var sparksPopup='<script src="http://rts.sparkstudios.com/Publishers/f45ced016c.js?random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></script>';
var GunggoPopup='<script type="text/javascript">var cache_buster=Math.random((new Date()).getMilliseconds())*100000000000000000;document.write(unescape(\'%3Cscript type=\"text/javascript\" src="http://max.gunggo.com/show_ad.ashx?type=pop&sid=3255&cid=4081&cm=1&fc=1&hr=0.5&cb=\'+cache_buster+\'\"%3E%3C/scr\'+\'ipt%3E\'));</script>'
var SitePopup='<script src="/Advertisements/ad.aspx?position=Popup" language="JavaScript" type="text/javascript"></script>';
function GetCookie(name){
	try{
		var rx=new RegExp(name+"=([^;]+)","i");
		return document.cookie.match(rx)[1];
	}catch(ex){return ""}
};

var ActivePopup='';

try{
	var expire = new Date( new Date().getTime() + (600000) );	
	if(GetCookie("pcount")==''){
		document.cookie = "pcount=" +escape('1') + "; path=/ ;expires=" + expire.toGMTString();
		ActivePopup=GetCookie("sevenpop")==''?SitePopup:GunggoPopup;
	}else if(parseInt(GetCookie("pcount"))<=6){
		document.cookie = "pcount=" +escape((parseInt(GetCookie("pcount"))+1).toString()) + "; path=/ ;expires=" + expire.toGMTString();
		if(parseInt(GetCookie("pcount")) % 2 ==0)
			ActivePopup=GunggoPopup;
		else
			ActivePopup = GetCookie("sevenpop")==''?SitePopup:sparksPopup;
			
	}
	//if(document.referrer==null || document.referrer.match(/google|yahoo|bing/i)==null)	
	document.write(ActivePopup);

}catch(ex){document.write(sparksPopup);}

