var ads = [
	'Hurrah! <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">Capital Spreads</a> has upped its offer exclusively to FSB readers to a &pound;250 credit!<br>I love Capital Spreads because the spreads on the DAX/FTSE are very tight...<br>You can open an account online within the space of a minute (subject to approval)<br><a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">...so click here if you want to open your account.</a>',
	'Start spread betting at <a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">IG Index</a> for as low as 10p a pt...<br>Open a Limited Risk account (where you don\t risk more than your initial deposit) or<br>a <a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">Plus Account</a> to benefit from tightest spreads and full functionality<br>including one-click dealing for faster execution, DealThru Charts & trailing stops.<br><a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">Apply for an Account!</a>',
	'Hurrah! <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">Capital Spreads</a> has upped its offer exclusively to FSB readers to a &pound;250 credit!<br>with 1 pt FTSE and Dax Markets, 1pt EUR/USD, 2pts GBP/USD, 2pts Wall Street<br>you know that tighter spreads mean better value and greater opportunities to increase profits<br>If you know spread betting, you know that Capital Spreads is the right choice<br>You can create an account online within the space of a minute (subject to approval)<br><a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">...so click here if you want to open your account.</a>',
   '<a href="http://www.financial-spread-betting.com/ccount/click.php?id=39" target="_blank">Spread Co</a> an easy-to-use platform with a customisable trading screen and<br>competitive financing requirements (+2% longs, no financing charges for short trades).<br>Plus Spread Betting, CFDs and Forex Spot Trading products on a single platform!<br>Sign up for a <a href="http://www.financial-spread-betting.com/ccount/click.php?id=39" target="_blank">Spread Co</a> Account using <a href="http://www.financial-spread-betting.com/ccount/click.php?id=39" target="_blank">this link</a> and get up to &pound;200 in cash back!<br>(this is an exclusive offer for FSB readers and is superior to the offer from the Spread Co site)',
    '<a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">Capital Spreads</a> now not only offer 1 tick FTSE Spreads...<br>they are <u>now</u> also offering a range of small cap and AIM stocks <br> &amp; if you want to set up an account with them via me they offer you a &pound;250 bonus after 5 trades - and I\'d get &pound;20 too!  <br>I quite like these win win things <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">...so click here if you want to open your account.</a>',
		'Start spread betting at <a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">IG Index</a> for as low as 10 a pt...<br>Open a Limited Risk account (where you don\t risk more than your initial deposit) or<br>open a <a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">Plus Account</a> to benefit from tightest spreads and full functionality<br>including one-click dealing for faster execution, DealThru Charts & trailing stops.<br><a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">Apply for an Account!</a>',
	'<em>[cheeky mode]</em> If you were to decide to go ahead and use <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">Capital Spreads</a> as a spread betting company - they do have a refer a friend promotion that I\'d be happy to share with you if you wanna be my friend.  You only have to <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">click this link</a> ;-) <em>[/cheeky mode]</em>. Seriously though <img src="emoticons/icon_smile.gif" alt=""> I always feel that with promotions like these offering money, it\'s rude not to do so and if you do choose Capital Spreads you ought to let someone you know introduce you!',
     '<a href="http://www.financial-spread-betting.com/ccount/click.php?id=39" target="_blank">Spread Co</a> an easy-to-use platform with a customisable trading screen and<br>competitive financing requirements (+2% longs, no financing charges for short trades).<br>Plus Spread Betting, CFDs and Forex Spot Trading products on a single platform!<br>Sign up for a <a href="http://www.financial-spread-betting.com/ccount/click.php?id=39" target="_blank">Spread Co</a> Account using <a href="http://www.financial-spread-betting.com/ccount/click.php?id=39" target="_blank">this link</a> and get up to &pound;200 in cash back!<br>(this is an exclusive offer for FSB readers and is superior to the offer from the Spread Co site)',
	'Still use <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">Capital Spreads</a> for spread betting<br>I like the auto generated stop losses which help to maintain discipline...<br> and that\'s good for beginners I think <br> &amp; if you want to set up an account with them via me they offer you a &pound;250 bonus after 5 trades - and I\'d get &pound;20 too!  <br>I quite like these win win things <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">...so click here if you want to open your account.</a>',
'For spread betting on individual shares <a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">IG Index</a> is hard to beat...<br>they will quote any company with a market capitalisation as low as &pound;10 million<br>plus the trading platform is INSTANT and reliable with EXCELLENT PRO Charts.<br><a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">Apply for an Account</a>',
	'<a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">Capital Spreads</a> offers just 4 pips spreads on the Rolling Gold Daily<br>5 tick Brent Crude and 4 tick Rolling S&amp;P are amongst the best in the market...<br> &amp; if you want to set up an account with them via me they offer you a &pound;250 bonus after 5 trades - and I\'d get &pound;20 too!  <br>I quite like these win win things <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">...so click here if you want to open your account.</a>',
   'For currency trading <a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">IG Index</a> is hard to beat...<br>EUR/USD from just 1 pip, GBP/USD from just 2 pips...<br>Trade over 60 major and exotic currency pairs with very few requotes.<br>plus the trading platform is INSTANT and reliable with free professional charts.<br><a href="http://www.financial-spread-betting.com/ccount/click.php?id=14" title="IG Index" target="_blank">Apply for an Account</a>',
   'Remember that spread betting providers make money on margins and spreads<br> that\'s why it is important for you to shop around!<br><a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">Capital Spreads</a> for instance offer tight spreads and ultra-competitive margins<br> &amp; if you want to set up an account with them via me they offer you a &pound;250 bonus after 5 trades - and I\'d get &pound;20 too!  <br>I quite like these win win things <a href="http://www.financial-spread-betting.com/ccount/click.php?id=3" target="_blank">...so click here if you want to open your account.</a>'
];

var marginAds = {
	write: function() {
		var e = Number(this.checkCookie());
		e = isNaN(e)?0:e;
		document.write(ads[e]);
	},
	
	checkCookie : function() {
		var margin=this.getCookie('margin');
		if (margin >= ads.length - 1)
			this.setCookie('margin',0,365);
		else if (margin!=null && margin!="")
		  this.setCookie('margin',Number(margin)+1,365);
		else
			this.setCookie('margin',0,365);
			
		return this.getCookie('margin');
	},
	
	setCookie : function (c_name,value,expiredays) {
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+
		((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	},
	
	getCookie : function (c_name) {
		if (document.cookie.length>0) {
			c_start=document.cookie.indexOf(c_name + "=");
			if (c_start!=-1) {
				c_start=c_start + c_name.length+1;
				c_end=document.cookie.indexOf(";",c_start);
				if (c_end==-1)
					c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
			}
		}
		return "";
	}
}
