ipsxR.TimerOff = function()
{
	clearTimeout(ipsxR.RAtid);
}

ipsxR.TimerOn = function()
{
	ipsxR.RAtid = setTimeout("ipsxR.RotateAd()", ipsxR.Dur);
}

ipsxR.RotateAd = function()
{
	if ( ipsxR.NumOfRota < ipsxR.LimitOfRota )
	{
	   ipsxR.NumOfRota++;
	   ipsxR.LoadAd();
	   ipsxR.AW = 0;
	   ipsxR.DisplayAd();
	   ipsxR.RAtid = setTimeout("ipsxR.RotateAd()", ipsxR.Dur);
	}
}

ipsxR.DisplayAd = function()
{
	if( typeof(ipsxRAd.CLICKURL) != "undefined"){
		clearTimeout(ipsxR.AWtid);
		ipsxR.DisplayTextBanner();
		return;
	}else{
		if ( ipsxR.AW > 2 )
		   return;
		ipsxR.AW++;
		ipsxR.AWtid = setTimeout("ipsxR.DisplayAd()", 100);
	}
}

ipsxR.DisplayTextBanner = function()
{
	var h = '<a target="' + ipsxR.ATarget + '" href="' + ipsxRAd.CLICKURL + '">';
	h += '<img src=' + ipsxRAd.ADIMAGE + ' border=0' + ' alt=' + ipsxRAd.ALTTEXT + '></img>' + '</a>';
	ipsxR.BannerArea.innerHTML = h;
	ipsxRAd = {};
}

ipsxR.LoadAd = function()
{
	var s = document.createElement('script');
	var rnd = Math.round(Math.random() * 100000000);
	var n = (ipsxR.NumOfRota > 10)?9999:ipsxR.NumOfRota;
	s.src = ipsxR.Server + '/jserver/acc_random=' + rnd + ipsxR.Tag + '/NUM=' + n;
	document.body.appendChild(s);
}

if (window.addEventListener) {
  window.addEventListener("load",ipsxR.RotateAd,false);
} else if (window.attachEvent) {
  window.attachEvent("onload",ipsxR.RotateAd);
} else  {
  window.onload = ipsxR.RotateAd;
}
