var oas='http://65.200.204.201/RealMedia/ads/';
var RN = new String (Math.random());
var RNS = RN.substring (2, 11);

function checkCookie(ad)
{
	var allCookies = document.cookie;
	var temp = ad + ":"
	var pos = allCookies.indexOf(temp);
	var value = "0";
	
	if (pos != -1)
	{
		var start = pos + temp.length;
		var end = allCookies.indexOf(";", start);
		if (end == -1)
		{
			end = allCookies.length;
		}
		value = allCookies.substring(start, end);
		value = unescape(value);
		if (parseInt(value) >= 3)
		{
			return false;
		}
	}
		
	value = parseInt(value) + 1;
	temp = temp + escape(value);
	
	var today = new Date();
	var expiry_date = new Date(today.getTime() + 86400000);
	
	var newCookieVal = temp + "; expires=" + expiry_date.toGMTString();
	document.cookie = newCookieVal;
	
	allCookies = document.cookie;
	if (allCookies == "")
		return false;
	
	return value;
}

function DisplayAds(sitepage,position,cookie,ad)
{
	var oaspage= sitepage + '/1' + RNS + '@' + position;
	
	if ( (navigator.userAgent.indexOf("Win") != -1) && (navigator.userAgent.indexOf("MSIE") != -1) )
//	if ( navigator.userAgent.indexOf("MSIE") != -1 )
	{
		var bShowAd = (cookie) ? checkCookie(ad) : "true";
		if (bShowAd)
		{
			if (_version < 11) {
				document.write ('<A HREF="' + oas + 'click_nx.ads/'+ oaspage + '" TARGET="_top" ><IMG SRC="' + oas + 'adstream_nx.ads/' + oaspage + '" BORDER="0"></a>');
			} 
			else {
				document.write ('<SCRIPT LANGUAGE="JavaScript1.1" SRC="' + oas + 'adstream_jx.ads/' + oaspage + '">');
				document.write ('\<\!-- --\>');
				document.write ('\<\/SCRIPT\>');
				document.write ('\<\!-- --\>');
			}
		}
	}
}
