/*Banner changer- created by Daniel (webmaster@topslots.co.uk)
*Basically this stores all the banners in an array. One is chosen at random to show first, 
*the number for this is stored in cookie so that each time that user then goes to the site the next banner is shown
*should still partly work if cookies disabled- as will just show a random banner to start with and then be random each time
*
*Jackpot city used twice to make it more likely to be shown
*/
function f_banner(){
	banner_ads = new Array();
	banner_ads.push('<a href="http://www.jackpotcity.com/rfb_sa106__s||aff87943__b||sa106&amp;a=affad136"><img src="http://www.ClickedyClick.com/ads/jpc/sa106.gif" height="60" width="468" border="0" alt="Home of the Biggest Jackpots!" /></a>');

	banner_ads.push('<a href="http://www.gamingclub.co.uk/rfb_sa119__s||aff87943__b||sa11&amp;a=affad153"><img src="http://www.ClickedyClick.com/ads/gcc/sa119.gif" height="60" width="468" border="0" alt="Gaming Club - More Winners, More Often"/></a>');

	banner_ads.push('<a href="http://www.jackpotcitycasino.co.uk/Index.ASP?s=aff87943&amp;b=sa225&amp;a=affad136"><img src="http://www.ClickedyClick.com/ads/jpc/sa225.gif" height="60" width="468" border="0" alt="Home of the Biggest Jackpots!"/></a>');


	banner_ads.push('<a href="http://www.luckydevils.co.uk" target="_blank"><img src="images/ad_devil_sequence.gif" alt="lucky devils" width="470" height="62" border="0"></a>');

	//banner_ads.push('<a title="Online Games at Getminted.com - Win up to £25,000" href="http://www.getmintedxtra.co.uk/partners/aff_0166.html"><img src="http://www.barbaryonline.com/getminted/banners/blueslots_468x60.gif" width="468" height="60" border="0" alt="Online Games at Getminted.com - Win up to £25,000"></a>');

    banner_ads.push('<a href="http://www.fortuneaffiliates.com/tagservlet/tagservlet?btag=ad_52933"><img src="http://gateway.fortunelounge.com/copy/fr/banners/tr_fr_468_60.gif" border="0"></a>');
	banner_ads.push('<a href="http://www.fortune-affiliates.com/tagservlet/tagservlet?btag=ad_105745"><img src="http://gateway.fortunelounge.com/copy/rv/banners/rv_junglejim_b468x60.gif" border="0"></a>')
         

//Add extra banners here
	/*Simply paste the banner code from referback etc into a new banner_ads.push('<code here>') 
	* (remember single quotes) and it will be included in the list of banners shown on the site! */

/******************************************************
//OLD CODE- this was used to simply return a random banner,
//now instead use cookies to show them a different banner each time they visit page (scroll through banners)

//pick random banner from array
var random_number=Math.floor(Math.random()*banner_ads.length);
document.write(banner_ads[random_number]); //return banner to page
*********************************************************************/

var name_of_cookie = "topslots_banners";
var banner_num = 0; //banner to show (get from cookie or from random if no cookie)
if(document.cookie) {
	//cookie found so get value
	var index = document.cookie.indexOf(name_of_cookie);
	//need to find start and end pos as could be 1 digit number or 2 (or later store something else??)
	var start_of_value = (document.cookie.indexOf("=", index) + 1);
	var end_of_value = document.cookie.indexOf(";", index);
	if (end_of_value  == -1) { // closing ; not found - shouldnt really happen but just incase
		end_of_value = document.cookie.length;
	}
	
	//get value of last banner and add 1 to it
	banner_num = eval(document.cookie.substring(start_of_value , end_of_value )) +1;	
	if (banner_num >= banner_ads.length) {
	//loop back round to start
		banner_num =0;
	}
	
} else {
	
	//pick a banner at random to start with (this also means if cookies disabled will be random each time)
	banner_num = Math.floor(Math.random()*banner_ads.length);
	
}
//update / create cookie and store banner number
document.cookie = name_of_cookie + "="+ banner_num;
//DAN- add expire date for cookie later

document.write(banner_ads[banner_num]); //return code for banner to page

}