// Scrolling Ad Javascript
// copyright 3rd September 2004, by Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is used without any alteration

var aDOM = 0, ieDOM = 0, nsDOM = 0; var stdDOM = document.getElementById;
var right = 1;
var countdown = 100;
var slideDelay = 0;
var objStyle = null;

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 displayAd(adText,cd) 
{
	document.write('<div id="mainAd" onmouseover="countdown = -1;"><div align="center">\n'+adText+'<br>\n<\/div><\/div>');
	countdown = cd;
	startAd('mainAd');
}

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;
}



function startAd(objectID) 
{
	if (aDOM) 
	{
		objStyle = findDOM(objectID,1);
		var rightBoundary = findLivePageWidth() - findAdWidth(objectID);
		rightBoundary -= rightBoundary % 2;
		slideAd(0,rightBoundary/2,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 = 0; currentPos = rightBoundary; right = 0;}
	 else       {finalPos = rightBoundary; currentPos = 0; right = 1;}
	}
	if (countdown > 0)
	 setTimeout('slideAd('+currentPos+','+finalPos+','+rightBoundary+')',slideDelay);
	if (countdown == 0)
	 objStyle.visibility = 'hidden';
	return;
}
*/
function slideAd(currentPos, finalPos,rightBoundary) 
{
	if (currentPos <= finalPos) 
	{
		currentPos += 10;
		objStyle.left = currentPos;
		setTimeout('slideAd('+currentPos+','+finalPos+','+rightBoundary+')',slideDelay);
	}
	
	
	return;
}

function hideAd(objectID) 
{
	objStyle = findDOM(objectID,1);
	objStyle.visibility = 'hidden';
}


                  
