// JavaScript Document
var _floaters = new Array();
var _floatInt = null;
var allWrap = null;
function _getRealX(who) {
	// Returns the true X (from left 0) of an object.
	// The parameter can be either reference of an ID of the object
	var obj = (typeof who == "string")?document.getElementById(who):who;
	var res = 0;
	var t = who;
	while (1 == 1) {
		if (typeof t.offsetLeft != "undefined") res += t.offsetLeft;
		t = t.offsetParent;
		if (t == document.body) return res;
	}
}

function _getRealY(who) {
	// Returns the true Y (from top 0) of an object.
	// The parameter can be either reference of an ID of the object
	var obj = (typeof who == "string")?document.getElementById(who):who;
	var res = 0;
	var t = who;
	while (1 == 1) {
		if (typeof t.offsetTop != "undefined") res += t.offsetTop;
		t = t.offsetParent;
		if (t == document.body) return res;
	}
}



	function chngetext(smart, num)
	{
		for( var i=1; i<7; i++)
		{
			var t=document.getElementById("smart"+smart+"Label"+i);
			if(i==num)
			{
				t.style.display="block";
			}else{
				t.style.display="none";
			  }
			}
	   }
	 

function chackSmart(who)
{
	var logId = document.getElementById("step3");
	var popupIn = document.getElementById ("loginSmart");
	var popupOut = document.getElementById ("logoutSmart");
	if (logId.style.display=="block")
	{
		popupIn.style.top = (_getRealY(who) + 15) + "px";
		var newx = _getRealX(who);
		if (window.navigator.appName.toLowerCase().indexOf("explorer")>-1) newx -= 50;
		popupIn.style.left = (newx) + "px";
	}
	else{
		popupOut.style.top = (_getRealY(who) + 15) + "px";
		var newx = _getRealX(who);
		if (window.navigator.appName.toLowerCase().indexOf("explorer")>-1) newx -= 50;
		popupOut.style.left = (newx) + "px";
		}
}


	function closePopup(poid)
	{
	 	var popForm = document.getElementById(poid);
		popForm.style.top = "-5000px";
		popForm.style.left = "10px";
	}
	
	
	
	function smartBanner (show, hide, hide2)
{
	var hideText = document.getElementById(hide);
	var hideText2 = document.getElementById(hide2);
	var showText = document.getElementById (show);
	hideText.style.display="none";
	hideText2.style.display="none";
	showText.style.display="block";
}

/* Floating banner handler */

function regFloatBanner(fid) {
	var fb = document.getElementById(fid);
	if (fb == null) return false;
	_floaters.push(document.getElementById(fid));
	fb.style.top = "-510px";
	fb.style.left = (fb.getAttribute("side") == "left")?"0px":((document.body.clientWidth-110) + "px");
	_floatInt = window.setInterval(DoFloat,50);
}

function DoFloat() {
	if (allWrap == null) return false;
	for (var i=0;i<_floaters.length;i++) {
		var thisf = _floaters[i];
		// Check if banner is visible
		var leftcorner = _getRealX(allWrap);
		var targetPoint = document.body.scrollTop + document.body.clientHeight - thisf.offsetHeight;
/*		var rightcorner = leftcorner + allWrap.offsetWidth;
		var leftmargin = leftcorner;
		var rightmargin = document.body.clientWidth - rightcorner;
		var myside = thisf.getAttribute("side");
		var isVisible = false;
		if (myside == "left" && leftmargin > thisf.offsetWidth) isVisible = true; else
		if (myside == "right" && rightmargin > thisf.offsetWidth) isVisible = true;
		if (isVisible == true) {*/
			// Display banner
		var diff = targetPoint - thisf.offsetTop;
		thisf.style.top = (thisf.offsetTop + ((diff < 0)?Math.floor(diff):Math.ceil(diff))) + "px";
		thisf.style.left = leftcorner + "px";
/*		} else {
			thisf.style.top = "-510px";
			thisf.style.left = "0px";
		}*/
	}
}

function showBanner()
{
	var playerBan = document.getElementById("floatBannerLeft");
	playerBan.style.display="block";
}