function createCookie(name,value,days) {
    if (days) {
         var date = new Date();
         date.setTime(date.getTime()+(days*24*60*60*1000));
	     var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
		 document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ')
			c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0)
			return c.substring(nameEQ.length,c.length);
	}
	return null;
}

cookieValue = readCookie('adcounter');

if(cookieValue == '') {
	cookieValue = 1;
	createCookie('adcounter',cookieValue,1);
} else {
	cookieValue = parseInt(cookieValue) + 1;
	createCookie('adcounter',cookieValue,1);
}

	var countryCode = geoip_country_code();

	if(cookieValue < 4 && (countryCode == 'US' || countryCode == 'GB' || countryCode == 'AU' || countryCode == 'CA')) {
	document.write('\
	<SCRIPT language=\'JavaScript1.1\' SRC="http://ad.doubleclick.net/adj/N6103.553605.WITHLUV.COM/B5804939.3;sz=728x90;ord=[timestamp]?">\
	</SCRIPT>\
	<NOSCRIPT>\
	<A HREF="http://ad.doubleclick.net/jump/N6103.553605.WITHLUV.COM/B5804939.3;sz=728x90;ord=[timestamp]?">\
	<IMG SRC="http://ad.doubleclick.net/ad/N6103.553605.WITHLUV.COM/B5804939.3;sz=728x90;ord=[timestamp]?" BORDER=0 WIDTH=728 HEIGHT=90 ALT="Advertisement"></A>\
	</NOSCRIPT>\
	\
	')
	} else {
	document.write('\
		<script type="text/javascript"> \
		 microsoft_adunitid="29400";\
		 microsoft_adunit_width="728"; \
		 microsoft_adunit_height="90";\
		 microsoft_adunit_legacy="false"; \
		 </script> \
		 <script type="text/javascript" src="http://adsyndication.msn.com/delivery/getads.js" ></script>\
	')
	}

