
function serveAd(adType)
{
	var myAd = "";	
	var rn = 0;	

	switch(adType)
	{
		case 0: // 300x300 300x250 or 250x250, with text, landing
			if(ccountry=="US")
			{				
				myAd = makeImg(1, "http://www.thepokies.com/images/play-pokies.jpg") + makeTxt(1); // Oasis				
			}
			else if(ccountry=="AU")
			{				
				myAd = makeImg(27, "http://www.referback.com/media/FS_67901.GIF") + makeTxt(27); // Jackpotcity				
			}
			else 
			{
				myAd = makeImg(1, "http://www.thepokies.com/images/play-pokies.jpg") + makeTxt(1); // Oasis
			}
			break;
		case 1: // 200x200, 200x400
			if(ccountry=="AU")
			{
				rn = makeRnd(0, 1);
				if(rn==0) myAd = makeImg(25, "http://www.wagershare.com/affiliate_media/Banners/b6304.gif"); // SpinPalace
				else myAd = makeImg(26, "http://r1.lvnsystem.net/at?action=asset_req&imgonly=1&track=THEPOKIES2011&asset_id=4256"); // Betway
			}
			else
			{
			
			}			
			break;
		case 2: // 468
			if(ccountry=="AU")
			{
				myAd = makeImg(27, "http://www.referback.com/media/JackpotCity_AUD_468x60_2.gif"); // SpinPalace
			}
			else
			{
			
			}			
			break;			
		case 3: // 125x125
			if(ccountry=="AU")
			{
				myAd = makeImg(27, "http://www.referback.com/media/JackpotCity_AUD_125x125_1.gif"); 
			}
			else
			{
			
			}			
			break;			
		case 4: // 728x90
			if(ccountry=="AU")
			{
				myAd = makeImg(27, "http://www.referback.com/media/jpc-aus-728x90.gif"); // JackpotCity
			}
			else
			{
			
			}			
			break;						
		default:
			break;
	}

	if(myAd.length) document.write(myAd);
}

function makeImg(sID, sImg)
{
	str = '<a href="http://www.thepokies.com/goto/click.php?id=' + sID +'" title="Play pokies"><img src="' + sImg + '" class="topimg" alt="Play pokies for money" border="0" /></a>';
	return(str);
}

function makeTxt(sID)
{
	str = '<br /><img src="http://www.thepokies.com/images/arrow.gif" width="14" height="13" /> <strong><a href="http://www.thepokies.com/goto/click.php?id=' + sID + '" title="Play pokies to win: highest returns, top bonuses.">Play pokies for money</a></strong>'
	return(str);
}

function makeRnd(minVal, maxVal)
{
	return Math.round(minVal+(Math.random()*(maxVal-minVal)));
}

function servePageAd() // 300x250
{
// Default: Slots Oasis
	strHead = "Play at Slots Oasis";
	strText = "Why?<br />Fantastic gaming experience with state-of-the-art games. 400% bonus up to $4,000. Review every wager you ever placed!";
	strVisit  = "24";
	strInstant = "1";
	strDownload = "12";
	strBanner = "http://a.c-planet.net/b/4266.gif";
	
	if(ccountry=="AU")
	{
		rn = makeRnd(0, 1);
		// rn = 1;
		
		switch(rn)
		{
		case 0:
			strHead = "Play at Betway";
			strText = "Why?<br />State-of-the-art games with <a href='http://www.thepokies.com/exclusive-pokies-deals/'><strong>4 deposit bonuses</strong></a> (exclusive to ThePokies.com) - more than anywhere else!";
			strVisit  = "26";
			strInstant = "27";
			strDownload = "28";
			strBanner = "http://r1.lvnsystem.net/at?action=asset_req&imgonly=1&track=THEPOKIES2011&asset_id=4258";			
			break;
		case 1:
			strHead = "Play Pokies at SpinPalace";
			strText = "Why?<br />The biggest selection of 320 fantastic pokies games and equally fantastic bonus of AU$1,000!";
			strVisit  = "25";
			strInstant = "25";
			strDownload = "8";
			strBanner = "http://www.wagershare.com/affiliate_media/Banners/b6379.gif";				
			break;
		case 2:
		default:
			break;		
		}
	}
	
// Template to draw the ad	
	var myAd = '<table width="100%" border="0" cellspacing="0" cellpadding="4"><tr>' +
    '<td width="304" valign="top"><a href="http://www.thepokies.com/goto/click.php?id=' + strVisit + '"><img src="' + strBanner + '" width="300" height="250" border="0"/></a></td>' +
    '<td valign="top"><h2>' + strHead + '</h2>' +
     '<p>' + strText + '<br />&nbsp;<br />' +
      '( <strong>Play for Fun</strong> or <strong>Play for Money</strong>, your choice )</p>' +
      '<table width="100%" border="0" cellspacing="0" cellpadding="4"><tr>' +
      '<td><a href="http://www.thepokies.com/goto/click.php?id=' + strVisit + '"><img src="http://www.thepokies.com/images/visit.gif" width="120" height="24" border="0" /></a></td></tr><tr>' +
      '<td><a href="http://www.thepokies.com/goto/click.php?id=' + strInstant + '"><img src="http://www.thepokies.com/images/play-pokies-instantly.gif" width="120" height="24" border="0" /></a></td></tr><tr>' +
       '<td><a href="http://www.thepokies.com/goto/click.php?id=' + strDownload + '"><img src="http://www.thepokies.com/images/download-pokies.gif" width="120" height="24" border="0" /></a></td>' +
       '</tr></table></td></tr></table>';

	document.write(myAd);
}

function aDownloadPokies()
{
	var sURL = "http://www.thepokies.com/goto/click.php?id=28"; // JackpotCity
	
	if(ccountry=="US") sURL = "http://www.thepokies.com/goto/click.php?id=12"; // Slots Oasis
	
	document.write('<a href="' + sURL + '" title="Download 300+ pokies games: play just for fun or for real money. Download and install in seconds, have fun for hours!">');
}

function flagBar()
{
	if(ccountry!="US") document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="560" height="30" id="flags_560x30" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="http://www.referback.com/media/flags_560x30.swf" /> <param name="FlashVars" value="faid=aff113844" /><param name="quality" value="high" /> <param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.referback.com/media/flags_560x30.swf" quality="high" FlashVars="faid= aff113844" wmode="transparent" bgcolor="#ffffff" width="560" height="30" name="flags_560x30" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" /></object>');
}
