// JavaScript Document

var ie  = document.all;
var ns6 = document.getElementById && !document.all;

//===========================================================================
// *** ietruebody ***		
//---------------------------------------------------------------------------
//      WRITTEN BY:  visit http://www.dynamicdrive.com/
//===========================================================================
function ietruebody(){
	return (document.compatMode && document.compatMode != "BackCompat" && !window.opera) ? document.documentElement : document.body;
}
//end ietruebody


function HideDiv(thisDiv) {
	var objDiv = document.getElementById(thisDiv);	
	objDiv.style.display = "none";
}

function CenterPopup(thisDiv){ 
	//get the main div		
	divobj = document.getElementById(thisDiv);
		
	//get the width of the image
	var divWidth = divobj.style.width;
		 
	//calculate the position of the layer
	vertpos = PageVertPos(divWidth);
	horzpos = PageHorzPos(divWidth);
		
	//set the position and width of the div object
    divobj.style.left = horzpos+"px";
	divobj.style.top  = vertpos+"px";
	
	divobj.style.visibility = "visible";		
    return false;
}


function PageVertPos(imgwd){
	var pgyoffset;
	var vertpos;
	var op = (window.opera && window.innerHeight);
		
	pgyoffset = ns6 ? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop); //used in Opera calculation
	vertpos = ns6 ? pageYOffset+250 : ietruebody().scrollTop+250;
	if (op){ //compensate for Opera toolbar
		vertpos = pgyoffset+(window.innerHeight/2)-(imgwd);
		vertpos = Math.max(pgyoffset, vertpos)+250;
	}
	return vertpos;
}
//end PageVertPos

function PageHorzPos(lr, imgwd){
	var horzpos;
	var edgeofpage;
	var ns6winwd;
	var iewinwd;
	var iescrollwd;
	
	//calculate each of these values once
	ns6winwd = window.innerWidth;
	iewinwd = ietruebody().clientWidth;
	iescrollwd = ietruebody().scrollLeft;		
	
	horzpos = ns6 ? pageXOffset+(ns6winwd/2)-(imgwd/2) : iescrollwd+(iewinwd/2)-(imgwd/2)
	
	return horzpos
}
//end PageHorzPos