
var m_bImgDownFlg=0; 
var xs_bv=0;
var xs_endpt=62;
var xs_ranonce=0;
var xs_pDivSeen=0;
var ua=navigator.userAgent.toLowerCase()
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_gecko = (agt.indexOf('gecko') != -1);
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_aol = (agt.indexOf("aol") != -1);
var is_opera = (agt.indexOf("opera") != -1);
var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var OpenedWin;

var xs_exp = new Date(); 
xs_exp.setTime(xs_exp.getTime()+(48*60*60*1000));

if ( (ua.indexOf("opera")==-1)&&((ua.indexOf("msie")!=-1)&&(ua.indexOf("windows")!=-1))||((ua.indexOf("msie 5")!=-1)&&(ua.indexOf("mac")!=-1)) ) 
{
	xs_bv=1
}

function xsGetCookieVal (offset) 
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function xsGetCookie (name) 
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) 
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return xsGetCookieVal (j);
	
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return null;
}

function xsSetCookie (name,value,expires,path,domain,secure) 
{
	document.cookie = name + "=" + escape (value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}


function xs_pdEx()
{
	var xs_ctest

//	var xs_popval = xsGetCookie('seenexp');
//	if ((xs_popval == null) || (xs_popval != "2")) 
//	{
//		xs_popval=2;
//		xsSetCookie('seenexp', xs_popval, xs_exp, "/");
//		xs_ctest = (xsGetCookie('seenexp')=="2");
//	}

//	if((xs_bv)&&(!xs_ranonce)&&(xs_ctest!=null))
	if((xs_bv)&&(!xs_ranonce))
	{
		xs_ranonce=1;
		setTimeout("xs_pdown();",1000);
	}
}

function xs_pdown()
{
	if(xs_endpt<240)
	{
		xsp_pDiv.style.borderBottomColor='#FFFFFF';
		xs_endpt+=10;
		xsp_pDiv.style.height=xs_endpt;
		setTimeout("xs_pdown();",10);
	}
	else
	{
		//Set the amount of time to show the ad...
		if (m_bImgDownFlg != 1)
		{
			m_bImgDownFlg = 1;
			setTimeout("xs_pup();",5000);
		}
	}
}
function xs_pup()
{
	m_bImgDownFlg = 0;
	if(xs_endpt>62)
	{
		xs_endpt-=10;
		xsp_pDiv.style.height=xs_endpt;
		setTimeout("xs_pup();",10);
	}
	else
	{
		xsp_pDiv.style.borderBottomColor='#FFFFFF';
	}
}

function PopWinA(url,name,options)
{
	var ContextWindow = window.open(url,name,options);
	ContextWindow.opener = this;
	ContextWindow.focus();
}

function openWin (URL, width, height) 
{
	OpenedWin = window.open(URL, "demo_window", "width="+width+",height="+height+",status=no,menubar=no,location=no,toolbar=no,directories=no,scrollbars=no");
	if (! is_aol) 
	{
		var NewX = (screen.availWidth/2)-(width/2);
		var NewY = (screen.availHeight/2)-(height/2);
		OpenedWin.moveTo(NewX, NewY);
		NewX = null;
	NewY = null;
	}
}

function launch (URL, width, height) 
{
	if (!URL || !width || !height) 
	{
		alert("Error");
	} 
	else if (width>screen.availWidth || height>screen.availHeight) 
	{
		var message;
		message = "Your screen resolution is too low to display the demo.\nClick 'OK' if you wish to continue anyway.\n";
		message += '\n Your screen resolution: '+screen.width+' x '+screen.height;
		message += ' | Viewable: '+screen.availWidth+' x '+screen.availHeight;
		message += '\n Required: '+width+' x '+height;
		if (confirm(message)) 
		{
			message = "If you can not find the close buttons, use your keyboard:\n";
			message += 'Windows: ALT+F4\n';
			message += 'Macintosh: CONTROL+W';
			alert(message);
			openWin(URL, width, height);
		}
	} 
	else 
	{
		openWin(URL, width, height);
	}
}

function displayLink(text)
{
	if ( is_major >= 4 && is_win && ( is_nav || is_ie || is_opera || is_gecko ) ) 
	{
		document.write(text);
	};
}
