// JavaScript Functions
function init() {
	/* Netscape users, unless you have IE mode enabled on Netscape 8, 
	   this won't work unless you drag the scroll bar with your mouse,
	   no wheeling around sorry :(
	*/
	window.onscroll = ShowCoords;
}

function highLight(id)
{
	var a = 0;
	var divID = "";
	var hDiv;
	// Get All divs in the page
	var allDivs = document.getElementsByTagName("div");
	// Change all divs with a class name of faqdiv back to white
	for(a=0;a<allDivs.length;a++) {
		if (allDivs[a].className == "faqdiv") { 
			allDivs[a].style.backgroundColor = "#FFFFFF";
		}
	}
	hDiv = document.getElementById(id);
	hDiv.style.backgroundColor = "#FFFF99";
	return true;
}
	
function ShowCoords()
{
	var scrolled;
	var linkOffsetX;
	var wHeight;
	var pageHeight;
	var pageRoot;
	var topVal;
	var overlap;
	var footerTop;
	var top1;      // hold top value for topmost marker link
	var top2;      // hold top value for middle marker link
	var e = document.getElementById("topLink");	
	var e2 = document.getElementById("topLink2"); // Top most
	var e3 = document.getElementById("topLink3"); // Middle
	var w = document.getElementById("container");

if (navigator.appName == "Microsoft Internet Explorer") {
		if (document.documentElement && document.documentElement.scrollTop) {
			pageRoot = document.documentElement;
		} else {
			pageRoot = document.body;
		}
		scrolled = pageRoot.scrollTop;
	} else {
		pageRoot = document.body;
		scrolled = window.pageYOffset;
	}
	// Get the window size
	if (typeof(window.innerHeight) == 'number') {
		wHeight = window.innerHeight; // Most non-IE browsers
	} else {
		if (document.documentElement.clientHeight && document.documentElement.clientHeight > 0)
		{
			wHeight = document.documentElement.clientHeight; // IE browsers
		} else {
			wHeight = document.body.clientHeight; // Mostly IE for Mac
		}
	}
	// Get the page and window height values
	pageHeight = w.clientHeight;
	// Setup the top and middle floating links
	top1 = scrolled + 110;
	e2.style.top = top1 + 'px';
	
	if (scrolled + wHeight >= pageHeight) {
		// Get overlapped size
		overlap = (scrolled + wHeight) - pageHeight;
		// Get top of footer location
		footerTop = scrolled + (wHeight-overlap);
		// Set topVal
		topVal = footerTop - 200;
		// Adjust middle link
		top2 = scrolled + ((footerTop-scrolled) / 2);
		e3.style.top = top2 + 'px';
		// Set the div position
		e.style.top = topVal + 'px';
	} else {
		topVal = scrolled + (wHeight - 150);
		top2 = scrolled + ((wHeight+22) / 2);
		e.style.top = topVal + 'px';
		e3.style.top = top2 + 'px';
	}
	if (scrolled >= 1620  ) {
		e.style.visibility = "visible";
		e2.style.visibility = "visible";
		e3.style.visibility = "visible";
	} else {
		e.style.visibility = "hidden";
		e2.style.visibility = "hidden";
		e3.style.visibility = "hidden";
	}
}

function showSize() {
	var myWidth = 0, myHeight = 0;
	var scrolled = 0;
	var e = document.getElementById("topLink");
	if (navigator.appName == "Microsoft Internet Explorer") {
		if (document.documentElement && document.documentElement.scrollTop) {
			pageRoot = document.documentElement;
		} else {
			pageRoot = document.body;
		}
		scrolled = document.documentElement.scrollTop;
	} else {
		pageRoot = document.body;
		scrolled = window.pageYOffset;
  	}
	if( typeof( window.innerWidth ) == 'number' ) {
	  //Non-IE
	  myWidth = window.innerWidth;
	  myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	  //IE 6+ in 'standards compliant mode'
	  myWidth = document.documentElement.clientWidth;
	  myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	  //IE 4 compatible
	  myWidth = document.body.clientWidth;
	  myHeight = document.body.clientHeight;
	}
	alert( 'Width = ' + myWidth + ' Height = ' + myHeight + ' Scroll Height: ' + scrolled );
}
function PreloadImages()
{
	// var pl = 10;  Change 10 to whatever number of preloaded images is needed
	var pl = 8;
	var d=document;
	var a = 0;
	if (!d.PLImg) { d.PLImg = new Array(); }
	for(a=0;a<10;a++) {
		d.PLImg[a] = new Image;
	}
	// Preloaded image list
	d.PLImg[0].src='assets/faq_on.gif';
	d.PLImg[1].src='assets/note_on.gif';
	d.PLImg[2].src='assets/map_on.gif';
	d.PLImg[3].src='assets/dotmark.gif';
	d.PLImg[4].src='assets/tlcorner_htrans.gif';
	d.PLImg[5].src='assets/trcorner_htrans.gif';
	d.PLImg[6].src='assets/llcorner_htrans.gif';
	d.PLImg[7].src='assets/lrcorner_htrans.gif';
	// End preloaded image list
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
