// funcs.js version 2.2.1 supports iES.asp v2.2.1

// from ies.asp begin
function myHeight() {
    if (document.layers) 
	{
        return document.body.document.height - window.innerHeight;
	}
    else if (document.all)
        return 0; // cannot get current window size
    else
        return 200; // approx height (adjust as necessary)
}

function myScroll() {
    documentYposition += scrollAmount;
    window.scroll(0,documentYposition);
    if (document.layers) {
        if (documentYposition > documentLength || documentYposition == 0)
			return;
            scrollAmount *= -1;
    }
    else if (document.all) {
        if (document.body.scrollTop == lastScrollTop || document.body.scrollTop == 0)
            scrollAmount *= -1;
    }
	if (nCount < 10)
	{
		// 10 x 200 = 2000 (2 seconds)
		setTimeout('myScroll()',scrollInterval);
		nCount += 1;
	}
	else if (nCount < 13)
	{
		// 3 x 1000 = 3000 (3 seconds)
		setTimeout('myScroll()',scrollIntervalSlow);
		nCount += 1;
	}
}

function start() {
    documentLength = myHeight();
    myScroll();
}

var nCount = 0;
var documentLength;
var scrollAmount = 10000;         // scroll by 100 pixels each time
var scrollInterval = 2;			  // number of milliseconds between scrolls
var scrollIntervalSlow = 10;	  // number of milliseconds between scrolls
var documentYposition = 0;
var lastScrollTop = 0;         // workaround for IE

// from ies.asp end

function lw(t,n,w,h) 
{
	return open(t,n,"scrollbars=yes,location=no,resizable=yes,status=no,height="+h+",width="+w);
}

function lw2(t,n,w,h) 
{
	return open(t,n,"scrollbars=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,status=yes,height="+h+",width="+w);
}

function lw3(t,n,w,h,scrollbars,toolbar,menubar,location,resizable,status) 
{
    var ops = "scrollbars="+scrollbars+",toolbar="+toolbar+",menubar="+menubar+",location="+location+",resizable="+resizable+",status="+status+",height="+h+",width="+w;
	return open(t,n,ops);
}

function launch(n) 
{
	lw("",n,530,600)
}


var pmwin = 0;
function launchpm()
{
	if (navigator.appVersion.indexOf("3") == 0)	
		pmwin = lw("",'noHoldPM',500,500)	// 3.0 browsers
	else if (pmwin == 0 || pmwin.closed)
	{
		pmwin = lw("",'noHoldPM',window.screen.width-20,window.screen.height-60)
		pmwin.moveTo(0,0)
	}
	else
	{
		pmwin.focus();
		return false;
	}
	return true;
}

var wscale = .50, vscale=.75;

function GetScales()
{
	if (window.screen.width == 640)
	{
		wscale = .75
		vscale=.85
	}
	else if (window.screen.width == 800)
	{
		wscale = .65
		vscale=.80
	}
	else if (window.screen.width == 1024)
	{
		wscale = .60
		vscale=.75
	}
	else // any higher resolution
	{
		wscale = .55
		vscale=.70
	}
}

var kpwin = 0;
function launchkp()
{
    try {

	    GetScales()
	    // Knowledge Portal
        if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
        {
            kpwin = lw("",'noHold',500,window.screen.height*vscale)
	        if (kpwin != 0)
	        {
                kpwin.moveTo(10,10)
                kpwin.resizeTo(500,window.screen.height*vscale)
            }
        }	
	    else if (kpwin == 0 || kpwin.closed)
	    {
		    //kpwin = lw("",'noHold',window.screen.width*wscale,window.screen.height*vscale)
		    kpwin = lw("",'noHold',500,window.screen.height*vscale)
		    if (kpwin != 0 && !kpwin.closed)
			    kpwin.moveTo(10,10)
	    }
	    else
	    {
		    kpwin.focus()
		    return false;
	    }

    } catch (e) {}	

	return true;
}

function launchkpURL(url)
{
    try {

	    GetScales()
	    // Knowledge Portal
        if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
        {
            kpwin = lw(url,'noHold',500,window.screen.height*vscale)
	        if (kpwin != 0)
	        {
                kpwin.moveTo(10,10)
                kpwin.resizeTo(500,window.screen.height*vscale)
            }
        }	
        else if (kpwin == 0 || kpwin.closed)
	    {
		    kpwin = lw(url,'noHold',500,window.screen.height*vscale)
		    if (kpwin != 0 && !kpwin.closed)
			    kpwin.moveTo(300,100)
	    }
	    else
	    {
		    kpwin.focus()
		    return false;
	    }

    } catch (e) {}	

	return true;
}

function launchkpCustom(h,w, scrollbars,toolbar,menubar,location,resizable,status)
{
    try {
	    // Knowledge Portal
       if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
        {
            kpwin = lw3("",'noHold',w,h, scrollbars,toolbar,menubar,location,resizable,status)
	        if (kpwin != 0)
	        {
                kpwin.moveTo(10,10)
                kpwin.resizeTo(500,window.screen.height*vscale)
            }
        }	
        if (kpwin == 0 || kpwin.closed)
	    {
		    kpwin = lw3("",'noHold',w,h, scrollbars,toolbar,menubar,location,resizable,status)
		    if (kpwin != 0 && !kpwin.closed)
			    kpwin.moveTo(10,10)
	    }
	    else
	    {
		    kpwin.focus()
		    return false;
	    }
    } catch (e) {}
	return true;
}

var debugwin = 0;
function launchdebug()
{
	GetScales()
	// Debug Window
    if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
		debugwin = lw("frames_debug2.asp",'noHoldDebug',500,window.screen.height*vscale)
        if (debugwin != 0)
        {
            debugwin.moveTo(10,10)
            debugwin.resizeTo(500,window.screen.height*vscale)
        }
    }	
	else if (debugwin == 0 || debugwin.closed)
	{
		debugwin = lw("frames_debug2.asp",'noHoldDebug',500,window.screen.height*vscale)
		debugwin.moveTo(10,10)
	}
	else
	{
		debugwin.focus()
		return false;
	}
	return true;
}

function closedebug()
{
	if (debugwin && !debugwin.closed)
		debugwin.close();
}
var testwin = 0;
function launchtest()
{
	// Test Window
	GetScales()
	// Debug Window
    if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
		testwin = lw("frames_test.asp",'noHoldDebug',500,window.screen.height*vscale)
        if (debugwin != 0)
        {
            testwin.moveTo(10,10)
            testwin.resizeTo(500,window.screen.height*vscale)
        }
    }	
    else if (testwin == 0 || testwin.closed)
	{
		testwin = lw("frames_test.asp",'noHoldTest',500,window.screen.height*vscale)
		testwin.moveTo(10,10)
	}
	else
	{
		testwin.focus()
		return false;
	}
	return true;
}

function closetest()
{
	if (testwin && !testwin.closed)
		testwin.close();
}

var escwin = 0;
function launchesc(w,h)
{
try {
    GetScales()

	// Escalate Window
   if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
		if (w==0 || h==0)
	    {
			escwin = lw("",'noHoldEscalate',500,window.screen.height*vscale)
            escwin.moveTo(0,0)
            escwin.resizeTo(500,window.screen.height*vscale)
        }
		else
		{
			escwin = lw("",'noHoldEscalate',window.screen.width*(w/100),window.screen.height*(h/100))
            escwin.moveTo(0,0)
            escwin.resizeTo(500,window.screen.width*(w/100),window.screen.height*(h/100))
        }
    }	
	else if (escwin == 0 || escwin.closed)
	{
		if (w==0 || h==0)
			escwin = lw("",'noHoldEscalate',500,window.screen.height*vscale)
		else
			escwin = lw("",'noHoldEscalate',window.screen.width*(w/100),window.screen.height*(h/100))

		if (escwin != 0 && !escwin.closed)
		{
			if (w<=90  && h<=90)
				escwin.moveTo(40,40)
			else
				escwin.moveTo(0,0)
		}
	}
	else
	{
		escwin.focus();
		return false;
	}

}catch (e) {}	

	return true;
}

var fbwin = 0;
function launchfb(w,h)
{
try {
	GetScales()
 	// Feeback Window
    if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
		if (w==0 || h==0)
	    {
			fbwin = lw("",'feedback',500,window.screen.height*vscale)
            fbwin.moveTo(0,0)
            fbwin.resizeTo(500,window.screen.height*vscale)
        }
		else
		{
			fbwin = lw("",'feedback',window.screen.width*(w/100),window.screen.height*(h/100))
            fbwin.moveTo(0,0)
            fbwin.resizeTo(500,window.screen.width*(w/100),window.screen.height*(h/100))
        }
    }	
    else if (fbwin == 0 || fbwin.closed)
	{
		if (w==0 || h==0)
		{
			fbwin = lw("",'feedback',500,window.screen.height*vscale)
		}
		else
			fbwin = lw("",'feedback',window.screen.width*(w/100),window.screen.height*(h/100))

		if (fbwin != 0 && !fbwin.closed)
		{
			if (w<=90  && h<=90)
				fbwin.moveTo(40,40)
			else
				fbwin.moveTo(0,0)
		}
	}
	else
	{
		fbwin.focus();
		return false;
	}

}catch (e) {}	

	return true;
}

var artwin = 0;
function launcham(percent_width, percent_height)
{
try {

	GetScales()
	// Article Viewer Window
    if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
		if (percent_width==0  || percent_height==0)
		{
			artwin = lw("",'nhArticle',500,window.screen.height*vscale)
			artwin.moveTo(window.screen.width*.42,20)
			artwin.resizeTo(500,window.screen.height*vscale)
		}
		else
		{
			artwin = lw("",'nhArticle',window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))
			if (percent_width<=90  && percent_height<=90)
				artwin.moveTo(window.screen.width*((90-percent_width)/100),window.screen.height*((90-percent_height)/100))
			else
				artwin.moveTo(0,0)
			artwin.resizeTo(width*((90-percent_width)/100),window.screen.height*((90-percent_height)/100))
		}
	}	
	else if (artwin == 0 || artwin.closed)
	{
		if (percent_width==0  || percent_height==0)
		{
			artwin = lw("",'nhArticle',500,window.screen.height*vscale)
			artwin.moveTo(window.screen.width*.42,20)
		}
		else
		{
			artwin = lw("",'nhArticle',window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))
			if (percent_width<=90  && percent_height<=90)
				artwin.moveTo(window.screen.width*((90-percent_width)/100),window.screen.height*((90-percent_height)/100))
			else
				artwin.moveTo(0,0)
		}
	}
	else
	{
		artwin.focus();
		//return false;
	}

}catch (e) {}	

	return true;
}

function closeam()
{
	if (artwin && !artwin.closed)
		artwin.close();
}

var amswin = 0;
function launchams()
{
try {

	GetScales()
	// Article Search Window
    if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
        amswin = lw("",'noHoldAms',500,window.screen.height*vscale)
        if (amswin != 0)
        {
            amswin.moveTo(40,140)
            amswin.resizeTo(500,window.screen.height*vscale)
        }
    }		
    else if (amswin == 0 || amswin.closed)
	{
		amswin = lw("",'noHoldAms',500,window.screen.height*vscale)
		amswin.moveTo(40,140)
	}
	else
	{
		amswin.focus()
		return false;
	}


}catch (e) {}	

	return true;
}

function closeams()
{
	if (amswin && !amswin.closed)
		amswin.close();
}

var routewin = 0;
function launchRoute(percent_width, percent_height)
{
try {

	GetScales()
	// Route Window
    if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
		if (percent_width==0  || percent_height==0)
		{
			routewin = lw("",'nhRoute',500,window.screen.height*vscale)
			routewin.moveTo(40,40)
		    routewin.resizeTo(500,window.screen.height*vscale)
		}
		else
	    {
			routewin = lw("",'nhRoute',window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))

		    if (percent_width<=90  && percent_height<=90)
			    routewin.moveTo(40,40)
            else
			    routewin.moveTo(0,0)
		    routewin.resizeTo(window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))
		 }
	}	
	else if (routewin == 0 || routewin.closed)
	{
		if (percent_width==0  || percent_height==0)
			routewin = lw("",'nhRoute',500,window.screen.height*vscale)
		else
			routewin = lw("",'nhRoute',window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))

		if (percent_width<=90  && percent_height<=90)
			routewin.moveTo(40,40)
		else
			routewin.moveTo(0,0)
	}
	else
	{
		routewin.focus();
		return false;
	}

}catch (e) {}	

	return true;
}

function launchWebRoute(percent_width, percent_height)
{
try {

	GetScales()
	// Route Window
    if (navigator.appVersion.indexOf("Safari") >= 0)            //Safari
    {
		if (percent_width==0  || percent_height==0)
		{
			routewin = lw2("",'nhRoute',500,window.screen.height*vscale)
			routewin.moveTo(40,40)
		    routewin.resizeTo(500,window.screen.height*vscale)
		}
		else
	    {
			routewin = lw2("",'nhRoute',window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))

		    if (percent_width<=90  && percent_height<=90)
			    routewin.moveTo(40,40)
            else
			    routewin.moveTo(0,0)
		    routewin.resizeTo(window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))
		 }
	}
	else if (routewin == 0 || routewin.closed)
	{
		if (percent_width==0  || percent_height==0)
			routewin = lw2("",'nhRoute',500,window.screen.height*vscale)
		else
			routewin = lw2("",'nhRoute',window.screen.width*(percent_width/100),window.screen.height*(percent_height/100))

		if (percent_width<=90  && percent_height<=90)
			routewin.moveTo(40,40)
		else
			routewin.moveTo(0,0)
	}
	else
	{
		routewin.focus();
		return false;
	}

}catch (e) {}	

	return true;
}

function closeRoute()
{
	if (routewin && !routewin.closed)
		routewin.close();
}

//ProgressBar
var pBar=0;
function launchProgressBar(url)
{	
	pBar=open(url,"nhProgress","scrollbars=no,resizable=yes,status=no,height=20,width=380");
}
function closeProgressBar()
{
	if (pBar && !pBar.closed)
		pBar.close();
}
