var nn6=document.getElementById&&!document.all;
function showLoading(component, width, height)
{
if(!isShowingScreenSeparator())	showScreenSeparator();
showDiv("loader");
document.getElementById("loader").style.width=width+"px";
document.getElementById("loader").style.height=height+"px";
//alert(component+"\n"+document.getElementById("loaderContent").innerHTML);
document.getElementById("loaderContent").innerHTML=component;
centerPage("loader");
}
function cancelLoading()
{
hideDiv("loader");
}
function showScreenSeparator()
{
var browser=navigator.appName;
//document.body.style.overflow="hidden";
//document.getElementsByTagName('HTML')[0].style.overflow="hidden";

	document.getElementById("screenSeparator").style.left="0px";
	document.getElementById("screenSeparator").style.top="0px";
	document.getElementById("screenSeparator").style.width=(getPageSizeWithScroll()[0])+"px";
	document.getElementById("screenSeparator").style.height=(getPageSizeWithScroll()[1])+"px";
	document.getElementById("screenSeparator").style.display="";
	//initToOpaque("screenSeparator");
if(browser=="Microsoft Internet Explorer")
	{
		createIFrame();
	}
	changeOpac(80, 'screenSeparator')
	//currentOpac('screenSeparator', 60, 500);

//document.getElementById("floating_header").innerHTML="<font color=\"#444444\" size=\"3\"><b>"+header_one+"</b></font><br>"+header_two;
}
function isShowingScreenSeparator()
	{
	if(document.getElementById("screenSeparator").style.display=="none") return false;
	else return true;
	}
function showPage(url)
{
if(!isShowingScreenSeparator()) showScreenSeparator();
//alert("ShowPage URL: "+url);
getURL(url);
}

function getURL(url,lable_text,send_var)
{
//alert("GetUrl URL: "+url);
	if(lable_text==null)
		lable_text = "Loading";
	if(send_var==null)
		send_var = "";

hideDiv("floating_window");
showLoading('test','450','240');
showLoading('<embed src="/swf/loading.swf" flashvars="loading_text='+escape(lable_text)+'" wmode="transparent" width="450" height="240" type="application/x-shockwave-flash"></embed>','450','240');
var request=null;
request=createRequest();
request.open("POST",url,true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.setRequestHeader("Content-length", send_var.length);
request.setRequestHeader("Connection", "close");
request.onreadystatechange=function()
									{
							//		alert(request.readyState);
									if(request.readyState==4)
										{
									//	alert(request.responseText);
										var strVal=request.responseText;
										if(strVal.substr(0,5)=="link:")
											{
											hideDiv('floating_window');
											cancelLoading();
										 	cancelScreenSeparator();
											window.location=strVal.substr(5);
											return;
											}
										else if(strVal.substr(0,5)=="exit:")
											{
											//alert("Exit Call");
											//cancelLoading();
											cancelScreenSeparator();
											return;
											}
										else if(strVal.substr(0,7)=="script:")
											{
											//showDiv('floating_window');
											cancelScreenSeparator();
											cancelLoading();
											//alert(strVal.substr(7));
											eval(strVal.substr(7));
											//cancelScreenSeparator();
											return;
											}
										else
											{
											showDiv('floating_window');
											document.getElementById("floating_content").innerHTML=strVal;
											}
										cancelLoading();
										if(!isShowingScreenSeparator()) showScreenSeparator();
										showDiv('floating_window');
										centerPage('floating_window');
										window.onscroll=function() {
										setTimeout("centerPageWithEase('floating_window');",500);
										};
										}
									};
request.send(send_var);
}



function createIFrame()
	{
	zxcIF=document.createElement('IFRAME');
	zxcIF.style.position="absolute";
	//zxcIF.style.visibility='hidden';
	//zxcIF.style.display='none';
	zxcIF.id="screenSeparatorIE";
	zxcIF.style.zIndex="2000";
	zxcIF.style.left="0px";
	zxcIF.style.top="0px";
	zxcIF.style.width=(getPageSizeWithScroll()[0])+"px";
	zxcIF.style.height=(getPageSizeWithScroll()[1])+"px";
	zxcIF.style.filter="alpha(opacity=00)";
	document.getElementsByTagName('BODY')[0].appendChild(zxcIF);
	}
function cancelPage()
	{
	cancelScreenSeparator();
	hideDiv('floating_window');
	document.getElementById('floating_content').innerHTML="";
	}
function cancelScreenSeparator()
	{	
		document.body.style.overflow="";
		document.getElementsByTagName('HTML')[0].style.overflow="";
		changeOpac(0, 'screenSeparator')
		//currentOpac('screenSeparator', 0, 500);
		//changeToTransparent("screenSeparator",80,0);
		if(!nn6)
			{
			try {
			objDel=document.getElementById("screenSeparatorIE");
			objDel.parentNode.removeChild(objDel);
				}
			catch(e)
				{
				}
			}
		//document.getElementById("floating_window").style.display="none";
	}
	
	
	
function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	if(opacity==0) object.display="none";
	else object.display="";
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 0;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}
	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}
//changeOpac(0, 'screenSeparator');