// JavaScript Document
/*//---------------------------------------------*/
/*// Name: SITENAME - Default Scripts			 */
/*// Language: JavaScript						 */
/*//---------------------------------------------*/

/*/////////////////////////////////////////////////
//				Floater Code Block				 //
/////////////////////////////////////////////////*/

// Timer ID - to avoid vanishing table if people start entering information
var floatTimerID;

/*//---------------------------------------------*/
/*// Name: getElemPos(id)						 */
/*// Desc: Gets position of an element			 */
/*//---------------------------------------------*/

function getElemPos(id) {
	var dimReg = /([0-9\.]+)px/;
	var elem = document.getElementById(id);
	var top, left;
	if (elem.currentStyle) {
		top = dimReg.exec(elem.currentStyle["top"])[1];
		left = dimReg.exec(elem.currentStyle["left"])[1];
	} else {
		top = dimReg.exec(document.defaultView.getComputedStyle(elem,null).getPropertyValue("top"))[1];
		left = dimReg.exec(document.defaultView.getComputedStyle(elem,null).getPropertyValue("left"))[1];
	}
	top = Number(top);
	left = Number(left);
	return {top:top, left:left};
}

/*//---------------------------------------------*/
/*// Name: getWinDim()							 */
/*// Desc: Gets current window dimensions		 */
/*//---------------------------------------------*/

function getWinDim() {
	var width, height;
	if (typeof(window.innerWidth) == 'number') {
		width = window.innerWidth;
		height = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if (document.body && ( document.body.clientWidth || document.body.clientHeight )) {
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	width = Number(width);
	height = Number(height);
	return {width:width, height:height};
}

/*//---------------------------------------------*/
/*// Name: getElemDim(id)						 */
/*// Desc: Gets current element dimensions		 */
/*//---------------------------------------------*/

function getElemDim(id) {
	var dimReg = /([0-9\.]+)px/;
	var elem = document.getElementById(id);
	var width, height;
	if (elem.currentStyle) {
		if (dimReg.exec(elem.currentStyle["height"]) == null)
			height = 400;
		else
			height = dimReg.exec(elem.currentStyle["height"])[1];
		width = dimReg.exec(elem.currentStyle["width"])[1];
	} else {
		if (dimReg.exec(document.defaultView.getComputedStyle(elem,null).getPropertyValue("height")) == null)
			height = 400;
		else
			height = dimReg.exec(document.defaultView.getComputedStyle(elem,null).getPropertyValue("height"))[1];
		width = dimReg.exec(document.defaultView.getComputedStyle(elem,null).getPropertyValue("width"))[1];
	}
	width = Number(width);
	height = Number(height);
	return {width:width, height:height};
}

/*//---------------------------------------------*/
/*// Name: centerElem(id)						 */
/*// Desc: Centers a movable element within		 */
/*//	   the given window space		 		 */
/*//---------------------------------------------*/

function centerElem(id) {
	var dim = getElemDim(id);
	var win = getWinDim(id);
	var newTop, newLeft;
	newTop = (win.height-dim.height)/2;
	newLeft = (win.width-dim.width)/2;
	document.getElementById(id).style.top = newTop+"px";
	document.getElementById(id).style.left = newLeft+"px";
}

/*//---------------------------------------------*/
/*// Name: floatPos(id)							 */
/*// Desc: centers and prepares to hide float	 */
/*//---------------------------------------------*/

function floatPos(id, banner) {
	if (document.getElementById(id)) {
		centerElem(id);
		floatHide(id, banner);
		if (document.getElementById("babelFish"))
			document.getElementById("babelFish").style.display = 'none';
		floatShow(id);
		floatTimerID = setTimeout("floatHide(\""+id+"\",\""+banner+"\")",10000);
	}
}

/*//---------------------------------------------*/
/*// Name: floatHide(id)						 */
/*// Desc: Hides an element, adds image			 */
/*//---------------------------------------------*/

function floatHide(id,banner) {
	document.getElementById(id).style.display = 'none';
	if (document.getElementById("babelFish"))
		document.getElementById("babelFish").style.display = 'block';
}

/*//---------------------------------------------*/
/*// Name: floatShow(id)						 */
/*// Desc: Displays an element					 */
/*//---------------------------------------------*/

function floatShow(id) {
	centerElem(id);
	document.getElementById(id).style.display = 'block';
}

/*/////////////////////////////////////////////////
//			  End Floater Code Block			 //
/////////////////////////////////////////////////*/

/*//---------------------------------------------*/
/*// Name: InitializeSite()						 */
/*// Desc: Entry Point for Onload Event			 */
/*//---------------------------------------------*/

function InitializeSite()
{
	if ( window.location.href.match( /^https:/i ) )
		siteRoot = secureSiteRoot;
}

/*//---------------------------------------------*/
/*// Declare/Define Global Variables			 */
/*//---------------------------------------------*/

var secureSiteRoot = "https://clients3.bannerview.com/~PLANNAME";