var aDOM = 0, ieDOM = 0, nsDOM = 0; var stdDOM = document.getElementById;
if (stdDOM) aDOM = 1; else {ieDOM = document.all; if (ieDOM) aDOM = 1; else {
var nsDOM = ((navigator.appName.indexOf('Netscape') != -1)
&& (parseInt(navigator.appVersion) ==4)); if (nsDOM) aDOM = 1;}}
function findDOM(objectId, wS) {
if (stdDOM) return wS ? document.getElementById(objectId).style:
document.getElementById(objectId);
if (ieDOM) return wS ? document.all[objectId].style: document.all[objectId];
if (nsDOM) return document.layers[objectId];
}

function findLivePageWidth() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
function findAdWidth(objectID) {var obj = findDOM(objectID,0); if(obj.offsetWidth) return obj.offsetWidth; if (obj.clip) return obj.clip.width; return 220;}
var right = 1;
var countdown = 10;
var slideDelay = 0;
var objStyle = null;

function startAd(objectID) {
if (aDOM) {
 objStyle = findDOM(objectID,1);
 var rightBoundary = (findLivePageWidth()-50) - findAdWidth(objectID);
 rightBoundary -= rightBoundary % 2;
slideAd(50,rightBoundary,rightBoundary);
}
}

function slideAd(currentPos, finalPos,rightBoundary) {
if (currentPos != finalPos) {
if (currentPos > finalPos) currentPos -= 2; else currentPos += 2;
objStyle.left = currentPos;
}
else {
 countdown--;
 if (right) {finalPos = 50; currentPos = rightBoundary; right = 0;}
 else       {finalPos = rightBoundary; currentPos = 50; right = 1;}
}
if (countdown > 0)
 setTimeout('slideAd('+currentPos+','+finalPos+','+rightBoundary+')',slideDelay);
if (countdown == 0)
 objStyle.visibility = 'hidden';
return;
}
function hideAd(objectID) {
 objStyle = findDOM(objectID,1);
 objStyle.visibility = 'hidden';
}
function displayAd(adText,cd) {
document.write('<div id="mainAd" onmouseover="countdown = -1;" align="center"><a href="#" onmouseover="countdown = -1;" onclick="hideAd(\'mainAd\'); "><font color="blue" align="center"><b>Close</b></font></a><div align="center">\n'+adText+'<br>\n</div></div>');
countdown = cd;
startAd('mainAd');
}


var subwindow;
function opensubwindow()
{
	var urlName = "../Ad_Functions/MoreInfo.asp";
	
	if (subwindow==null)
	{
		subwindow=window.open(urlName,'swin', 'location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=yes,scrollbars=yes,height=600,width=550,top=0,left=0,screenX=0,screenY=0', false);
	}
	else
	{
		if (subwindow.closed!=true)
		{
		 		subwindow.focus(); subwindow.location.replace(urlName);
		 }
		else
		{
		 		subwindow=null;subwindow=window.open(urlName,'swin', 'location=no,toolbar=no,menubar=no,directories=no,status=no,resizable=yes,scrollbars=yes,height=400,width=550,top=0,left=0,screenX=0,screenY=0', false);
		}
	} 

}