function wopen(url, name, w, h) { w += 32; h += 96; wleft = (screen.width - w) / 2; wtop = (screen.height - h) / 2; var win = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no'); }
function wopenScroll(url, name, w, h) { w += 32; h += 96; wleft = (screen.width - w) / 2; wtop = (screen.height - h) / 2; var win = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=no'); }
function redirect(url) { window.location.href = url; }
function n(url) { navigateWithReferrer(url); }
function navigateWithReferrer(url) {var fakeLink = document.createElement("a");if (typeof (fakeLink.click) == 'undefined') {location.href = url;}else {fakeLink.href = url;document.body.appendChild(fakeLink);fakeLink.click();}}
function targetBlank(url) { blankWin = window.open(url, '_blank', 'menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');}

function targetBlankConditional(url) {
    var isNewWindow = false;
    var myURL = window.location.href.toLowerCase()

    if ((myURL.indexOf("/uk/") >= 0)
|| (myURL.indexOf("/australia/") >= 0)
|| (myURL.indexOf("/canada-casinos/") >= 0)
|| (myURL.indexOf("/netherlands/") >= 0)
|| (myURL.indexOf("/italy/") >= 0)
|| (myURL.indexOf("/spain/") >= 0)
|| (myURL.indexOf("/france/") >= 0)
|| (myURL.indexOf("/sweden/") >= 0)
|| (myURL.indexOf("/germany/") >= 0)
|| (myURL.indexOf("/finland/") >= 0)
|| (myURL.indexOf("/denmark/") >= 0)
|| (myURL.indexOf("/greece/") >= 0)
|| (myURL.indexOf("/japan/") >= 0)) isNewWindow = true;

    if (isNewWindow) { blankWin = window.open(url, '_blank', 'menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes'); } else { n(url); }
}

function fpo(obj) { obj.className = "fpm_on"; }
function fpt(obj) { obj.className = "fpm"; }
function on(obj) { obj.className = "nb"; }
function out(obj) { obj.className = "nbo"; }
function ctt(obj) { obj.className = "tab2"; }
function cto(obj) { obj.className = "tab1"; }
function tco(obj) { obj.className = "topcasinos_on"; }
function tce(obj) { obj.className = "topcasinos"; }
function cttl(obj) { obj.className = "tab2l"; }
function ctol(obj) { obj.className = "tab1l"; }

function doSearch() {
    var txtSearch = $("#txtSearch").val();
    if (txtSearch.length >= 3) {
        $("#divSearch").hide();
        $("#searchProgress").html('<strong>Searching LiveCasinoDirect</strong><br /><br />Just a moment please...');
        $("#searchProgress").show();
        n("/search/?q=" + encodeURIComponent(txtSearch)); return true;
    } else { alert("Please enter something into the search box"); return false; }
}

function nav(url) { redirect(url); }
function LiveHelp() { wopen('/livehelp/', 'Live_Help', 500, 650); }

function grboxinf(id, resourcetitle, bonus) { wopen("/group-box-info/" + id + "?KeepThis=true&bonustype=" + bonus + "&TB_iframe=true&height=430&width=785", "Bonus", 785, 390) }
function slotsinf(id, resourcetitle) { wopenScroll("/group-slots-info/" + id + "?KeepThis=true&TB_iframe=true&height=500&width=600", "NewSlots", 600, 500); }
function pgameinf(id, resourcetitle) { wopenScroll("/group-progressive-info/" + id + "?KeepThis=true&TB_iframe=true&height=500&width=600", "ProgressiveWin", 600, 500); }

function showDate() {
    var result = "";
    today = new Date;
    var monthName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    result = today.getDay() + " " + monthName[today.getMonth()] + " " + today.getYear();
    return result;
}

$(function () {
    $("#txtSearch").hover(function () { $(this).attr("title", "Press Enter to start a search on Live Casino Direct"); }, function () { $(this).attr("title", ""); });
    $("#txtSearch").keypress(function (e) { if (e.keyCode == 13) { doSearch();return false;   } });
    $("#txtDate").html(showDate());
    $("#searchlinks").html('<span style="color:#f3f3f3;font-size:11px;">Recommended search</span>');
});