document.write('<link rel="stylesheet" type="text/css" href="/a.init.css" />');

var adReloadAct=true;
var adReload=15;
var adBoxes=0;
var adWidths = new Array();
var adHeights = new Array();
var adCounts = new Array();
var adIsBoxes = new Array();

function createAdBox(box,count,width,height,isBox){
	if(!isBox) isBox = 0;
	document.write('<table cellspacing=0 cellpadding=0 border=0><tr><td><div class="aBoxParent" style="width:'+width+'px;height:'+height+'px;font-size:12px;"><div id="_aBox'+box+'"></div></div></td></tr></table>');
	window.addEvent('domready',function(){loadAd(box);});
	adWidths[box]=width;
	adHeights[box]=height;
	adCounts[box]=count;
	adIsBoxes[box]=isBox;
}

function loadAd(box){
	new Request.JSON({
		url:'/system/a.server.php',
		onComplete: function(f){
			$('_aBox'+box).innerHTML=f.html;
		}
	}).get({
		'fetch':1,
		'count':adCounts[box],
		'width':adWidths[box],
		'height':adHeights[box],
		'box':adIsBoxes[box],
		'xy':$time()+$random(10,1000)
	});
}


function reloadAds(){
	if(adReloadAct)	for(i=1;i<=adBoxes;i++) loadAd(i);
	window.setTimeout("reloadAds();",adReload*1000);
}
if(adReloadAct) window.setTimeout("reloadAds();",adReload*1000);
