// JavaScript Document
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];}
}

function getActiveLink(varPage, varLinkTitle, cssClass){
	var thisPage = this.location.href;
	var thisHost = this.location.protocol + "//" + this.location.host + "/";
	var newLink = "/" + thisPage.replace(thisHost, "");

	if (varPage==newLink){
		nav_class = cssClass;
		
	}else{
		nav_class = "";
	}
	document.write('<a href="' + varPage + '" class="' + nav_class + '">'+ varLinkTitle + '</a>');
	//alert(varPage);
	//alert(newLink);
	//alert('<a href="' + varPage + '" class="' + nav_class + '">'+ varLinkTitle + '</a>');
}

function clearForm(txtValue, id) {
	varText = document.getElementById(id).value;
	//alert(id);
	if ( varText== txtValue){
		document.getElementById(id).value = "";
	}
	if ( varText== ""){
		document.getElementById(id).value = txtValue;
	}
}
function openModal(id, content_id){
	if (window.innerHeight && window.scrollMaxY) {
		// Firefox         
		yWithScroll = window.innerHeight + window.scrollMaxY;         
		xWithScroll = window.innerWidth + window.scrollMaxX;     
		} else if (document.body.scrollHeight > document.body.offsetHeight){ 
		// all but Explorer Mac         
		yWithScroll = document.body.scrollHeight;         
		xWithScroll = document.body.scrollWidth;     
		} else { 
		// works in Explorer 6 Strict, Mozilla (not FF) and Safari         
		yWithScroll = document.body.offsetHeight;         
		xWithScroll = document.body.offsetWidth;       
	} 
	
	screenHeight =document.documentElement.clientHeight;
	//alert(yWithScroll);
	document.getElementById(content_id).style.display='block';
	document.getElementById('fade').style.height = yWithScroll + "px";
	document.getElementById('light').style.display='block';
	document.getElementById('fade').style.display='block';
	}
	

  
function getScreenCenterY() {   
	var y = 0;   
 	y = getScrollOffset()+(getInnerHeight()/2);   
	return(y);   
}   
  
function getScreenCenterX() {   
	return(document.body.clientWidth/2);   
}   
  
function getInnerHeight() {   
	var y;   
	if (self.innerHeight) // all except Explorer   
	{   
		y = self.innerHeight;   
	}   
	else if (document.documentElement && document.documentElement.clientHeight)   
	// Explorer 6 Strict Mode   
	{   
y = document.documentElement.clientHeight;   
}   
else if (document.body) // other Explorers   
{   
y = document.body.clientHeight;   
}   
return(y);   
}   
  
function getScrollOffset() {   
var y;   
if (self.pageYOffset) // all except Explorer   
{   
y = self.pageYOffset;   
}   
else if (document.documentElement && document.documentElement.scrollTop)   
// Explorer 6 Strict   
{   
y = document.documentElement.scrollTop;   
}   
else if (document.body) // all other Explorers   
{   
y = document.body.scrollTop;   
}   
return(y);   
}  
