window._msie=/*@cc_on!@*/0;
if(window._msie) {
	document.write('<div id="fpoffers" class="fpold">');
} else {
	document.write('<div id="fpoffers" class="fpnew">');
}

function fpoffers() {
	var o=this;
	this.left=$('<div id="fpprev"></div>').bind('mouseover',function() {
		$(this).toggleClass('fpprevover',true);
		o.startprevscroll();
	}).bind('mouseout',function() {
		$(this).toggleClass('fpprevover',false);
		o.stopautoscroll();
	}).css('opacity','0.5');
	this.scroller=$('<div id="scroller"></div>');
	this.scrollele=$('<tr></tr>');
	this.scroller.append($('<table border="0" cellpadding="0" cellspacing="0"></table>').append(this.scrollele));
	this.right=$('<div id="fpnext"></div>').bind('mouseover',function() {
		$(this).toggleClass('fpnextover',true);
		o.startfastscroll();
	}).bind('mouseout',function() {
		$(this).toggleClass('fpnextover',false);
		o.stopautoscroll();
	}).css('opacity','0.5');
	this.container=$('#fpoffers').append(this.left)
		.append(this.scroller)
		.append(this.right)
		.bind('mouseover',function(e) {
			o.showui(e);
		}).bind('mouseout',function(e) {
			o.hideui(e);
		}).get(0);
	this.initelements(["paddingtontavern.html",14,"<h1>Paddington Tavern</h1><address>Brisbane</address><div>$10 credit for food or drink purchased</div>","ClaremontHotelMotel.html",104,"<h1>Claremont Hotel Motel</h1><address>Claremont Hobart</address><div>$10 credit for food or drinks purchased</div>","mtericahotel.html",15,"<h1>Mt Erica Hotel</h1><address>Prahran</address><div>$10 credit for food or drink purchased</div>","PaddingtonAleHouse.html",3,"<h1>Paddington Ale House</h1><address>Mt Hawthorn</address><div>$10 credit for food or drink purchased</div>","bayviewhotelwoywoy.html",1,"<h1>The Bayview Hotel</h1><address>Woy Woy</address><div>$10 credit for food or drinks purchased</div>","RisingSunHotel.html",0,"<h1>Rising Sun Hotel</h1><address>Bendigo</address><div>$10 credit for drinks or food purchased</div>","colmsliehotel.html",24,"<h1>Colmslie Hotel</h1><address>Morningside</address><div>$10 credit for food or drink purchased</div>","TheGrandBarandBrasserie.html",0,"<h1>The Grand Bar & Brasserie</h1><address>Bowral</address><div>$10 credit for food or drink purchased</div>","BoJanglesSaloon.html",0,"<h1>Bojangles Saloon</h1><address>Alice Springs</address><div>$10 credit for food or drinks purchased</div>","HelmBar.html",19,"<h1>Helm Bar</h1><address>Darling Harbour</address><div>$10 credit for food or drinks purchased</div>","ClaremontHotelMotel.html",104,"<h1>Claremont Hotel Motel</h1><address>Claremont Hobart</address><div>$10 credit for food or drink</div>","lordislestavern.html",17,"<h1>Lord of the Isles Tavern</h1><address>Geelong</address><div>$10 credit for food or drink purchased</div>","MerinoTavernCamden.html",16,"<h1>Merino Tavern</h1><address>Camden</address><div>$10 credit for food or drinks purchased</div>","CourtHouseHotel.html",26,"<h1>Court House Hotel</h1><address>Port Douglas</address><div>$10 credit for food or drinks purchased</div>","Taroona.html",111,"<h1>Taroona Lounge Bar</h1><address>Taroona</address><div>$10 credit for food or drinks purchased</div>","JamberooPub.html",0,"<h1>Jamberoo Pub</h1><address>Jamberoo</address><div>$10 credit for food or drinks purchased</div>","Northies.html",0,"<h1>Northies</h1><address>Cronulla</address><div>#10 credit for food or drinks purchased</div>","ArkabaHotel.html",45,"<h1>Arkaba Hotel Motel</h1><address>Fullarton</address><div>$10 for food or drink purchased.</div>","WicklowHotel.html",9,"<h1>Wicklow Hotel</h1><address>Armidale</address><div>$10 credit for food or drink purchased</div>","EppingHotel.html",86,"<h1>The Epping Hotel</h1><address>Epping</address><div>$10 credit for food or drinks purchased</div>","TheDockYard.html",27,"<h1>The Dockyard Bar</h1><address>Newcastle</address><div>$10 credit for food or drinks purchased</div>","TheCrestHotel.html",12,"<h1>The Crest Hotel</h1><address>Sylvania</address><div>$10 for food or drinks purchased</div>","goldenbarley.html",21,"<h1>Golden Barley Hotel</h1><address>Enmore</address><div>$10 credit for drinks from the Bar</div>","StanleyHotel.html",110,"<h1>Stanley Hotel</h1><address>Stanley</address><div>$10 credit for food or drinks purchased</div>","TannumSands.html",13,"<h1>Tannum Sands Hotel Motel</h1><address>Tannum Sands</address><div>$10 credit for food or drinks purchased</div>","TheSpottedCow.htm",8,"<h1>The Spotted Cow</h1><address>Toowoomba</address><div>$10 Hotel Voucher for food or drink purchased</div>","HiltonHotel.html",0,"<h1>Hilton Hotel</h1><address>Hilton</address><div>$10.00 credit for Food or Drinks purchased</div>","http://www.thebestpub.com.au/BombayBicycleClub.html",0,"<h1>Bombay Bicycle Club</h1><address>Ovingham</address><div>$10 credit for food or drinks purhased</div>","gladstone.html",11,"<h1>The Gladstone Hotel</h1><address>Dulwich Hill</address><div>$10 credit for food or drinks purchased</div>","CustomsHouseHotel.html",105,"<h1>Customs House Hotel</h1><address>Hobart</address><div>$10 credit for food or drinks purchased</div>","UnionNewtown.html",2,"<h1>Union Hotel</h1><address>Newtown</address><div>$10 credit for food or drinks purchased</div>"]);
	this.uihidden=true;
	this.startautoscroll();
}
fpoffers.prototype={
appendelement:function(pub,img,desc) {
	$('<td><div class="entry"><img src="/fpoffers.php?img='+img+'" width="83" height="112" alt=""/><div class="desc">'+desc+'</div><div class="link"><span>Click Here</span> for more.</div></div></td>').bind('click',function() {
		document.location.href=pub;
	}).appendTo(this.scrollele);
},
initelements:function(list){
	this.max=0;
	var x;
	if(list.length) {
		for(x=0,ct=list.length; x<ct; x+=3) {
			this.appendelement(list[x],list[x+1],list[x+2]);
			this.max+=249;
		}
	}
	var y=0;
	for(x=0;x<4;x++) {
		this.appendelement(list[y],list[y+1],list[y+2]);
		y+=3;
		if (y>=list.length-2) y=0;
	}
},
showui:function(e) {
	if(this.uihidden) {
		this.uihidden=false;
		$('div#fpprev,div#fpnext').stop(true).animate({
			'opacity':'1'
		},200)
	}
},
hideui:function(e) {
	if(e.relatedTarget!=this.container) {
		var ele=e.relatedTarget;
		while (ele && (ele=ele.offsetParent)) {
			if (ele == this.container) {
				return;
			}
		}
		this.startautoscroll();
		this.uihidden=true;
		$('div#fpprev,div#fpnext').stop(true,true).animate({
			'opacity':'0.5'
		},200)
	}
},
startautoscroll:function() {
	var o=this, start=new Date().getTime();
	start-=this.scroller.attr('scrollLeft')*30;
	clearTimeout(this.scrolltimeout);
	function tick() {
		var current = new Date().getTime()-start;
		var pos = Math.floor(current/30);
		o.scroller.attr('scrollLeft',pos);
		if(pos >= o.max) {
			start=new Date().getTime();
		}
		if(o.uihidden) {
			o.scrolltimeout=setTimeout(function() { tick(); },10)
		}
	}
	this.scrolltimeout=setTimeout(function() { tick(); },10)
},
stopautoscroll:function() {
	clearTimeout(this.scrolltimeout);
},
startfastscroll:function() {
	var o=this, start=new Date().getTime();
	start-=this.scroller.attr('scrollLeft')*10;
	function tick() {
		var current = new Date().getTime()-start;
		var pos = Math.floor(current/10);
		o.scroller.attr('scrollLeft',pos);
		if(pos >= o.max) {
			start=new Date().getTime();
		}
		if(!o.uihidden) {
			o.scrolltimeout=setTimeout(function() { tick(); },10)
		}
	}
	this.scrolltimeout=setTimeout(function() { tick(); },10)
},
startprevscroll:function() {
	var o=this, start=new Date().getTime();
	start+=this.scroller.attr('scrollLeft')*10;
	function tick() {
		var current = start - new Date().getTime();
		var pos = Math.floor(current/10);
		o.scroller.attr('scrollLeft',pos);
		if(pos <= 20) {
			start=new Date().getTime()+(o.max+pos)*10;
		}
		if(!o.uihidden) {
			o.scrolltimeout=setTimeout(function() { tick(); },10)
		}
	}
	this.scrolltimeout=setTimeout(function() { tick(); },10)
}
}
jQuery(function() {
	new fpoffers();
})

