var rand=Math.floor(Math.random()*10000000);
pool_size='15';
agid='9955';
agid_key='41d366c2d3617400558397d8b7e13bae';
b_width='500px';
b_height='500px';

if (window.adtoll_count_impression==undefined) { adtoll_count_impression=0; } else { adtoll_count_impression=window.adtoll_count_impression; } 
if (window.adtoll_no_click==undefined) { adtoll_no_click=0; } else { adtoll_no_click=window.adtoll_no_click; }

prot = window.location.protocol;at_ads=new Array();
at_ads[0]=new Array();
var total_spons_links = 0;

function getCookie(NameOfCookie){
	var aCookie=document.cookie.split(" ");
	for (var i=0; i<aCookie.length; i++){
		var aCrumb=aCookie[i].split("=");
		if (NameOfCookie==aCrumb[0]){
			return unescape(aCrumb[1]);
		}
	}
	if (NameOfCookie!="AT_GEO") 
{		var get_temp=getCookie("AT_GEO");
		if ((get_temp==-1) || (get_temp=="undefined")){
			return -1;
		}else{ 
			return get_temp;
		} 
	} else { 
		return -1;
	}
}

function SetCookie(NameOfCookie, ValueOfCookie){
	date = new Date();
	date.setDate(date.getDate()+7);
	document.cookie = NameOfCookie + "=" + escape(ValueOfCookie) + " expires=" + date.toGMTString();
}

var targ_geo=getCookie("AT_GEO");
if (targ_geo==-1){
	var target_country='0';
}else{
	var target_country=targ_geo.substr(0,2);
}

at_ads[1]=new Array();
var total_ron_links = 0;

var total_links = 0;

at_ads[2]=new Array();
at_ads[2][0]=new Array();
at_ads[2][0][0]='0';
at_ads[2][0][1]='peel_away.jpg';
at_ads[2][0][2]='http://adclick.adtoll.com/defadclick.php?g=41d366c2d3617400558397d8b7e13bae%26at=y%26ref=4336%26c=%26dai=54';
at_ads[2][0][4]='0';
at_ads[2][0][5]='0';

var pub_default_ad = 'no';
var total_default_links = 1;

function randOrd(){
return (Math.round(Math.random())-0.5); }

function BuildPool () {
	pool_count = 0;
	spons_booking=0;
	while (pool_count < total_spons_links){
		pool_ads[pool_count]=spons_booking;
		pool_type[pool_count]='0';
		spons_booking++;
		pool_count++;
	}
	at_ads[1].sort(randOrd);
	x=0;
	while (pool_count < pool_size){
		if ((at_ads[1][x][4].indexOf(target_country) != -1) || (at_ads[1][x][4] == '0')){
			pool_ads[pool_count]=x;
			pool_type[pool_count]='1';
			pool_count++;
		}
		x++;
		if (total_ron_links<=x) break;
	}
	if (pool_count < pool_size) pool_size = pool_count;
}

	function sizeup987(){
		document.getElementById('atpacornerBig').style.top = '0px';
		document.getElementById('atpacornerSmall').style.top = '-1000px';
	}
	function sizedown987(){
		document.getElementById("atpacornerSmall").style.top = "0px";
		document.getElementById("atpacornerBig").style.top = "-1000px";
	}
function DisplayAds() {
	if (pool_size>0) {
		dis = Math.floor(Math.random()*pool_size);
		ad = pool_ads[dis];
		ad_type = pool_type[dis];
		if (adtoll_no_click == 1) { no_click='&c=y'; } else { no_click=''; } ;
	} else { 
		if (pub_default_ad=='no') {
			dis = Math.floor(Math.random()*total_default_links);
			ad = dis;
			ad_type = '2';
			no_click='';
		}
	}

	var randomnumber = Math.floor(Math.random()*14);
	var atpa = new Object();
	atpa.ad_url = at_ads[ad_type][ad][2]+no_click;
	atpa.small_path = prot+'//imgserve.adtoll.com/peel/cornersmall.swf';
	atpa.small_image = prot+'//imgserve.adtoll.com/peel/smallbutton_'+randomnumber+'.swf';
	atpa.big_path = prot+'//imgserve.adtoll.com/peel/cornerbig.swf';
	atpa.big_image = prot+'//imgserve.adtoll.com/ads/'+at_ads[ad_type][ad][1];
	atpa.small_width = '100';
	atpa.small_height = '100';
	atpa.small_params = 'ico=' + atpa.small_image;
	atpa.big_width = '650';
	atpa.big_height = '650';
	atpa.big_params = 'big=' + atpa.big_image + '&ad_url=' + atpa.ad_url;
	atpa.putObjects = function () {
		document.write('<div id="atpacornerSmall" style="position:absolute;width:'+ atpa.small_width +'px;height:'+ atpa.small_height +'px;z-index:9999;right:0px;top:0px;">');
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
		document.write(' id="atpacornerSmallObject" width="'+atpa.small_width+'" height="'+atpa.small_height+'">');
		document.write(' <param name="allowScriptAccess" value="always"> ');
		document.write(' <param name="movie" value="'+ atpa.small_path +'?'+ atpa.small_params +'">');
		document.write(' <param name="wmode" value="transparent">');
		document.write(' <param name="quality" value="high"> ');
		document.write(' <param name="FlashVars" value="'+atpa.small_params+'">');
		document.write('<embed src="'+ atpa.small_path + '?' + atpa.small_params +'" name="atpacornerSmallObject" wmode="transparent" quality="high" width="'+ atpa.small_width +'" height="'+ atpa.small_height +'" flashvars="'+ atpa.small_params +'" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
		document.write('</object></div></script>');
		document.write('<div id="atpacornerBig" style="position:absolute;width:'+ atpa.big_width +'px;height:'+ atpa.big_height +'px;z-index:9999;right:0px;top:0px;">');
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
		document.write(' id="atpacornerBigObject" width="'+ atpa.big_width +'" height="'+ atpa.big_height +'">');
		document.write(' <param name="allowScriptAccess" value="always"> ');
		document.write(' <param name="movie" value="'+ atpa.big_path +'?'+ atpa.big_params +'">');
		document.write(' <param name="wmode" value="transparent">');
		document.write(' <param name="quality" value="high"> ');
		document.write(' <param name="FlashVars" value="'+ atpa.big_params +'">');
		document.write('<embed src="'+ atpa.big_path + '?' + atpa.big_params +'" id="atpacornerBigEmbed" name="atpacornerBigObject" wmode="transparent" quality="high" width="'+ atpa.big_width +'" height="'+ atpa.big_height +'" flashvars="'+ atpa.big_params +'" swliveconnect="true" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
		document.write('</object></div>');
		setTimeout('document.getElementById("atpacornerBig").style.top = "-1000px";',1000);
	};
	atpa.putObjects();

	if (ad_type!='2') { bookings = at_ads[ad_type][ad][0]+':'+at_ads[ad_type][ad][5]; } else { bookings = 'n'; } 

	if (adtoll_count_impression == 0) {
		document.write('<img style="border:0px;" border=0 width=0 height=0 src='+prot+'//adserve.adtoll.com/stats.php?gk='+agid_key+'&g='+agid+'&a='+bookings+'&z='+rand+'>');

	}
}

if (total_links<pool_size) pool_size=total_links;
var pool_ads=new Array(pool_size);
var pool_type=new Array(pool_size);
BuildPool();
DisplayAds();

var get_true=getCookie("AT_GEO");



if (get_true==-1) {
document.write('<scri' + 'pt');
document.write(' src='+prot+'//geo.adtoll.com/geo.php>');
document.write(' </scri' + 'pt>');
}