<!--
/*
	
	APDirect specific client side scripts
	
*/


/* ------------------------------------------------------------------------------------------------------------
	Make sure we're not in a frame - cad
------------------------------------------------------------------------------------------------------------ */

	if (self != top) top.location.href = location.href;

/* ------------------------------------------------------------------------------------------------------------
	Check browser type
------------------------------------------------------------------------------------------------------------ */

var ie = 0;
var ns = 0;

if (navigator.appName.indexOf("Netscape") != -1)
	ns=1;
else if (navigator.appName.indexOf("Microsoft") != -1)
	ie=1;

/* ------------------------------------------------------------------------------------------------------------
	Opens a window, used for decline page
------------------------------------------------------------------------------------------------------------ */
function openWindow(url,name,width,height) {
	if (ie) {
		features = "titlebar=no,scrollbars=yes,width=" + width + ",height=" + height + ";";
		objWin = window.open(url,name,features,'');
	}
	if (ns) {
		features = "titlebar=no,scrollbars=yes,width=" + width + ",height=" + height + ";";
		objWin = window.open(url,name,features,'');
	}
	return objWin;
}

function newWindow(url,name,width,height,extras) {
	if (ie) {
		if(extras.length > 0)
			features = extras + ",width=" + width + ",height=" + height + ";";
		else
			features = "titlebar=no,scrollbars=yes,width=" + width + ",height=" + height + ";";
		objWin = window.open(url,name,features,'');
	}
	if (ns) {
		if(extras.length > 0)
			features = extras + ",width=" + width + ",height=" + height + ";";
		else
			features = "titlebar=no,scrollbars=yes,width=" + width + ",height=" + height + ";";
		objWin = window.open(url,name,features,'');
	}
	return objWin;
}

/* ------------------------------------------------------------------------------------------------------------
	Set a language preference localeid
------------------------------------------------------------------------------------------------------------ */
function setLanguagePref(localeid) {
	document.cookie = 'APPLOCALEID=' + localeid;
	top.location = window.location;
	return false;
}

/* ------------------------------------------------------------------------------------------------------------
	This page should be included in the asp or html file that you
	want to call help from.  The way you use this function for help is:
	  
	openhelp(help topic string, height of new window, width of new window)
	   
	It will open a new window and display the file helpsystem.asp with the
	help loaded out of an XML file.
------------------------------------------------------------------------------------------------------------ */

var Help

function openhelp(helpon, height, width){
	var features;
	features = "titlebar=no,scrollbars=1,screenX=" + (screen.width - (width+20)) + ",screenY=10,width=" + width + ",height=" + height;
	if (!Help || Help.closed) {
		Help = window.open("/apdirect/help.aspx?help="+helpon,"Help",features);
	}
	else{
		Help.focus();
	}
	if(ie)
		return;
	else
		return false;
}

function ChangeColor(strColor) 
	{
		if (navigator.appName.toUpperCase() != "NETSCAPE")
			event.srcElement.style.color = strColor;
	}	

/* ------------------------------------------------------------------------------------------------------------
	The following function required for the new and improved scroller on Netscape 4.x:
		initOnResize()
		initOnLoad()
		initScroller()
		scrollit()
------------------------------------------------------------------------------------------------------------ */


	function initOnResize(){
		window.location.reload()
	}

	function initOnLoad(){
		if (document.layers){
			setTimeout("window.onresize=initOnResize",450);
			initScroller();
		}
	}

	function initScroller(){
		alert('Contents: '+document.scrollerContents);
		document.scroller_lyr1.document.scroller_lyr2.document.write('<nobr>' + document.scrollerContents + '</nobr>');
		document.scroller_lyr1.document.scroller_lyr2.document.close();
		thelength=document.scroller_lyr1.document.scroller_lyr2.document.width;
		scrollit();
	}

	function scrollit(){
		if (document.scroller_lyr1.document.scroller_lyr2.left>=thelength*(-1)){
			document.scroller_lyr1.document.scroller_lyr2.left-=document.scrollerSpeed;
			setTimeout("scrollit()",100);
		}else{
			document.scroller_lyr1.document.scroller_lyr2.left=document.scrollerWidth;
			scrollit();
		}
	}




//-->