﻿$(document).ready(function() {
ApplyTopNavMenuBg();
ApplyTopNavMapping();

$().newsTicker({newsList: ".introtext", startDelay: 5, tickerRate: 15,loopDelay: 3000, placeHolder1: " *"});

window.setTimeout("StartTicketShow();", 100);

$('#dollareye').flash({src: '/images/flash/dollareye.swf', width: 93,  height: 45, wmode:'transparent'});

ReplaceUIelements();

InjectTopAds();

$(window).resize(function() { $("body").removeClass("fix1").addClass("fix2");});

});

function InjectTopAds() { 

$.get("/controls/header-ads.aspx", function(data) {$("#adblockstop").html(data); });

}

function ReplaceUIelements() { 

$("td[@mytype=review]").each(function() {if ($(this).find("a").html() != null) { $(this).find("a").html('<img src="/images/chat_24.png" alt="Click here for Bonus Review" border="0" />');} });

}

function StartTicketShow() { $("#introholder").css("display", "block"); }

jQuery.preloadImages = function() {for(var i = 0; i<arguments.length; i++){jQuery("<img>").attr("src", arguments[i]); }}

function ApplyTopNavMenuBg() { 

if (location.pathname.toLowerCase().indexOf("casino") == 1) { 
$("#tabshometop").css("background", "url(/images/tabs-tophome-casino.gif) no-repeat top");
//click on td: restrict to only casino and casino bonus type pages
RegisterTDOnclick();
}
else if (location.pathname == "/") { 
$("#tabshometop").css("background", "url(/images/tabs-tophome.gif) no-repeat top");

//bind articles list click event
$(".articlesList p").each(function() { var myurl = $(this).find("a").attr("href"); $(this).find("img").bind("click", function() { n(myurl); }); });
RegisterTDOnclick();

} else if (location.pathname.toLowerCase().indexOf("partners") == 1) {  
$("#tabshometop").css("background", "url(/images/tabs-tophome-partners.gif) no-repeat top");
} else if (location.pathname.toLowerCase().indexOf("poker") == 1) {  
$("#tabshometop").css("background", "url(/images/tabs-tophome-poker.gif) no-repeat top");
RegisterTDOnclick();
} else if (location.pathname.toLowerCase().indexOf("bingo") == 1) {  
$("#tabshometop").css("background", "url(/images/tabs-tophome-bingo.gif) no-repeat top");
RegisterTDOnclick();
}

}

function RegisterTDOnclick(){
if (location.pathname.split('/').length < 5) {$("tr[@dr]").each(function() {var reviewPageURL = $(this).find("td[@mytype=review]").find("a").attr("href");$(this).find("td").bind("click",function() { n(reviewPageURL);return false; }); }); }
 }

function ApplyTopNavMapping(){
$("#tabshometop ul").replaceWith('<div style="margin:0;padding:0;width:994px;height:50px;text-align:right"><img border="0" src="/images/transparent-top-menu.gif" usemap="#Map"><map name="Map" id="Map"><area shape="rect" coords="234,5,358,52" href="/casino/" title="Casino Bonuses" /><area shape="rect" coords="381,9,462,50" href="/poker/" title="Poker Bonuses" /><area shape="rect" coords="501,8,587,50" href="/bingo/" title="Bingo Bonuses" /><area shape="rect" coords="850,10,956,49" href="/" alt="Home Page" /><area shape="rect" coords="663,10,799,50" href="/partners/" alt="Advertise with us" /></map></div>');
 }
 
function redirect(url) { window.location = url; }
function n(url) { redirect(url); }