// JavaScript Document
function findPosX(obj){
	var curleft = 0;
	if(obj.offsetParent)
		while(1) 
		{
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj){
	var curtop = 0;
	if(obj.offsetParent)
		while(1)
		{
		  curtop += obj.offsetTop;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}

//Start of drop down script
var subMnus="";
var mnuTop=80;
var thedefaultsub="";
//This function is to show the subs in the parent dropdown
/*function showMenu(whichOne){
	hideAllMenu();
	if(whichOne!='')
		document.getElementById(whichOne).style.display='inline';
	idx,livar subleftoffset=findPosX(document.getElementById("mnuAboutUs"));
	var sublefts=new Array(3);
	sublefts[0]=subleftoffset;
	sublefts[1]=sublefts[0]+98;
	sublefts[2]=sublefts[1]+184;
	try{
		hideAllMenu();
		var dv=document.getElementById("subNav"+idx);
		//dv.style.left=sublefts[li];
		//dv.style.top=mnuTop;
		dv.style.visibility="visible";
	}
	catch(e){}
}*/
//This function is to hide the dropdown menu
/*function hideAllMenu(){
	document.getElementById('subNav').style.display='none';
	document.getElementById('subNav2').style.display='none';
	
	if(thedefaultsub!="")
		document.getElementById(thedefaultsub).style.display='inline';
	try{
		var ar=subMnus.split(',');
		for(i=0;i<ar.length;i++){
			var dv=document.getElementById("subNav"+ar[i]);
			dv.style.visibility="hidden";
		}
		if(thedefaultsub!="")
			document.getElementById(thedefaultsub).style.display='inline';
	}
	catch(e){}
}*/
//End of drop down script

//This function is to show the subs in the parent dropdown
function showMenu(idx){
	hideAllMenu(1);
	try{
		var dv=document.getElementById("subNav"+idx);
		dv.style.display="inline";
	}
	catch(e){}
}
//This function is to hide the dropdown menu
function hideAllMenu(showdef){
	try{
		var ar=subMnus.split(',');
		for(i=0;i<ar.length;i++){
			var dv=document.getElementById("subNav"+ar[i]);
			dv.style.display="none";
		}
		if(thedefaultsub!=""&&showdef!=1)
			document.getElementById(thedefaultsub).style.display='inline';
	}
	catch(e){}
}
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];}
}
//This function checks to see if the email is valid
function isValidEmail(thisEmail){
	var emailexp = /.*\@.*\..*/;
	if (!emailexp.test(thisEmail)) {
		return false;
	} 
	return true;
}
//This function will pop a new windows based on a url or file
function popUp(URL,width,height) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+width+",height="+height+"');");
}

//This function checks to make sure a check box has been marked
function cbxSelectionMade(cbx){
	var isGood=false;
	if(cbx.checked){
		isGood=true;
	}
	for(i=0;i<cbx.length && !isGood;i++){
		if(cbx[i].checked){
			isGood=true;
		}
	}
	return isGood;
}

//This Function checks to make sure a select box has been selected
function cboSelectionMade(cbo){
	var isGood=false;
	
	if(cbo.options[cbo.selectedIndex].value!="")
		isGood=true;
		
	return isGood;
}

//this function writes the swf for index
function writeSWF(divName){	
	var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="821" height="389" id="main" align="middle">';
	str+='<param name="allowScriptAccess" value="sameDomain" />';
	str+='<param name="allowFullScreen" value="false" />';
	str+='<param name="movie" value="flash/main.swf" />';
	str+='<param name="quality" value="high" />';
	str+='<param name="bgcolor" value="#ffffff" />';
	str+='<param name="menu" value="false" />';
	str+='<param name="wmode" value="opaque" />';
	str+='<embed src="flash/main.swf" quality="high" bgcolor="#ffffff" width="821" height="389" name="main" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="opaque" menu="false" />';
	str+='</object>';
	document.getElementById(divName).innerHTML=str;
}

//this function writes the swf for index
function writeMapSWF(){	
	var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="818" height="747" id="main" align="middle">';
	str+='<param name="allowScriptAccess" value="sameDomain" />';
	str+='<param name="allowFullScreen" value="false" />';
	str+='<param name="movie" value="flash/map.swf" />';
	str+='<param name="quality" value="high" />';
	str+='<param name="bgcolor" value="#ffffff" />';
	str+='<embed src="flash/map.swf" quality="high" bgcolor="#ffffff" width="818" height="747" name="main" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	str+='</object>';
	document.getElementById("tdMapSwf").innerHTML=str;
	document.getElementById("divMapBg").style.display="inline";
	document.getElementById("divMap").style.display="inline";	
	setDivHeight();
	scroll(0,0);
}


function closeMap(){
	document.getElementById("divMapBg").style.display="none";
	document.getElementById("divMap").style.display="none";	
}

function setDivHeight(){
	d=document.getElementById("divMapBg");
	if(document.all){
		d.style.height=document.body.offsetHeight;
	}
	else{
		d.style.height=window.innerHeight;
	}
	if(parseInt(d.style.height)<820)
		d.style.height=820;
}

function writeMapIMG(){	
	document.getElementById("divMapBg").style.display="inline";
	document.getElementById("divMapI").style.display="inline";	
	setDivHeightI();
}


function closeMapI(){
	document.getElementById("divMapBg").style.display="none";
	document.getElementById("divMapI").style.display="none";	
}

function setDivHeightI(){
	d=document.getElementById("divMapBg");
	if(document.all){
		d.style.height=document.body.offsetHeight;
	}
	else{
		d.style.height=window.innerHeight;
	}
	if(parseInt(d.style.height)<787)
		d.style.height=787;
}
