// $Id: index_base.js,v 1.1.2.18 2008-10-13 10:23:31 mcarey Exp $ self.window.name = "index_html"; var win_golden_guineas = null; var win_account_balance = null; function add_to_url (url,extra) { if (url.indexOf("?") == -1) { return url + "?" + extra; } else { return url + "&" + extra; } } function go_help (url,width,height,link_target) { go_url("/sb3_portal/it/" + url,width,height,"Y" ,"Help","Y","Y","N",link_target); } function go_bet (url,new_win,tab,width,height,resize,scroll,menu,link_target) { if (typeof link_target == "undefined") { link_target = ""; } link_target = link_target.toLowerCase(); if (link_target == "_blank" || link_target == "_media" || link_target == "_parent" || link_target == "_search" || link_target == "_self" || link_target == "_top" || link_target == "") { // Do nothing. } else { link_target=""; } url = encode_url(url); if (tab!="" && tab != "home") { url = "?action=lb_go_home&id=" + tab + "&retURL_g=" + url + "&w_id=" + w_id; } else { url = "?action=lb_go_home&retURL_g=" + url + "&w_id=" + w_id; } if (new_win=="Y") { // When opening a new window target should be _BLANK always link_target = "_blank"; if (resize == "Y") { resize = "yes"; } else { resize = "no"; } if (scroll == "N") { scroll = "no"; } else { scroll = "yes"; } if (menu == "Y") { var menutxt = "menubar=yes,toolbar=yes,status=yes,location=yes"; } else { var menutxt = "menubar=no,toolbar=no,status=no,location=no"; } if (width == "") { width = window.screen.availWidth; } if (height == "") { height = window.screen.availHeight - 140; } dimensions = ",width=" + width + ",height=" + height; var newWindow = window.open(url, link_target, "scrollbars=" + scroll + ",resizable=" + resize + "," + menutxt + dimensions); newWindow.focus(); } else { if (link_target) { var newWindow = window.open(url, link_target); newWindow.focus(); } else { document.getElementById('mainLadbrokes').src=url; } } } function go_new_window (url,width,height,name,resize,scroll,menu,status,location,toolbar,directories,copyhistory) { if (resize == "N") { resize = "no"; } else { resize = "yes"; } if (scroll == "N") { scroll = "no"; } else { scroll = "yes"; } if (menu == "Y") { menu = "yes"; } else { menu = "no"; } if (width != "" && height != "") { dimensions = ",width=" + width + ",height=" + height; } else { dimensions = ""; } if (name == "") { name == "helpwin"; } if (status == "Y") { status = ",status=yes"; } else if (status == "N") { status = ",status=no"; } else { status = ""; } if (location =="Y") { location = ",location=yes"; } else { location = ",location=no"; } if (toolbar =="Y") { toolbar = ",toolbar=yes"; } else { toolbar = ",toolbar=no"; } if (directories =="Y") { directories = ",directories=yes"; } else { directories = ",directories=no"; } if (copyhistory =="Y") { copyhistory = ",copyhistory=yes"; } else { copyhistory = ",copyhistory=no"; } var newWindow = window.open(url, name, "scrollbars=" + scroll + ",resizable=" + resize + ",menubar=" + menu + dimensions + status + location + toolbar + directories + copyhistory); newWindow.focus(); return newWindow; } function go_url (url,width,height,new_win,name,resize,scroll,menu,status,location,toolbar,directories,copyhistory,link_target) { if (typeof link_target == "undefined") { link_target = ""; } link_target = link_target.toLowerCase(); if (link_target == "_blank" || link_target == "_media" || link_target == "_parent" || link_target == "_search" || link_target == "_self" || link_target == "_top" || link_target == "") { // Do nothing. } else { link_target=""; } url = add_to_url(url, "w_id=" + w_id); if (new_win=="Y") { go_new_window(url,width,height,name,resize,scroll,menu,status,location,toolbar,directories,copyhistory); } else { if (link_target) { var newWindow = window.open(url, link_target); newWindow.focus(); } else { document.getElementById('mainLadbrokes').src=url; } } } function getBSObj(obj) { var objRef; if(document.all) { objRef = eval("document.all." + obj); } if(document.getElementById) { objRef = document.getElementById(obj); } return objRef; } function setUpMain() { if (betslip_mode == 1) { window.scrollbars.visible=false; var cookie = getCookie("BETSLIP"); if (cookie != null){ var pos = getCookieValue("BETSLIP","pos"); if (pos != null) { var positions = pos.split("~"); var pos_x = positions[0]; var pos_y = positions[1]; getBSObj('ladbrokes_betslip').style.left = pos_x; getBSObj('ladbrokes_betslip').style.top = pos_y; } else { getBSObj('ladbrokes_betslip').style.left=window.innerWidth-340; } } else { getBSObj('ladbrokes_betslip').style.left=window.innerWidth-340; } } else if (betslip_mode == 2) { } } function getScrollbars() { if (navigator.appName.indexOf('Microsoft')==-1) { window.scrollbars.visible=true; } } function getCookie(NameOfCookie) { if (document.cookie.length > 0) { begin = document.cookie.indexOf(NameOfCookie+"="); if (begin != -1) { begin += NameOfCookie.length+1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)); } } return null; } function setCookie(NameOfCookie, value, expiredays) { var bind_domain_level_cookies = " LIL_Login Region FLAGS AFF_ID CAMP SESS_TIMEOUT" var domain = "" if (bind_domain_level_cookies.indexOf(NameOfCookie) != -1) { var domain = "ladbrokes.it" } var ExpireDate = new Date (); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); if (domain != "") { document.cookie = NameOfCookie + "=" + value + "; domain="+ domain + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); } else { document.cookie = NameOfCookie + "=" + value + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); } } function getCookieValue(cookieName, valueName, defaul) { var cookie = getCookie(cookieName); if (cookie != null){ var cookie = cookie.split("|"); for(var i = 0; i < cookie.length; i+=2) { if (cookie[i] == valueName) { return cookie[i+1]; } } } return defaul; } function setCookieValue(cookieName, name, value) { var cookie = getCookie(cookieName); if (cookie != null) { var cookieStr = cookie.split("|"); for(var i = 0; i < cookieStr.length; i+=2) { if (cookieStr[i] == name) { cookieStr[i+1] = value; var str = ""; for (var j = 0; j < cookieStr.length - 1; j++) { str = str + cookieStr[j] + "|"; } str = str + cookieStr[cookieStr.length - 1]; setCookie(cookieName, str); return; } } cookie = cookie + "|" + name + "|" + value; setCookie(cookieName, cookie); } else { setCookie(cookieName, name + "|" + value); } } function html_to_unicode(str) { return str.replace(/&#([0-9]+);/g,function(str,f1){s="";for(i=0;i<4;i++){d=f1%16;eval("s=\""+(d>9?"\\10"+String(d-9):String(d))+s+"\"");f1=(f1-d)/16};eval("s=\"\\u"+s+"\"");return s}); } function encode_url (u) { var url = "" + u; var l = url.length; var i; var ret = ""; var c; for (i = 0; i < l; i++) { c = url.charAt(i); if (c == '&') { ret = ret + '~'; } else { if (c == ':') { ret = ret + '^'; } else { ret = ret + c; } } } return ret; } function maxSlip() { var cookie = getCookie("BETSLIP"); if (cookie == null){ setCookie("BETSLIP", "show|1"); } else { setCookieValue("BETSLIP","show",1); } if(top.bs && !top.bs.closed) { top.bs.focus(); } else { top.bs = window.open("/lbr_sports_italia?action=bs_view_selections","ladbrokes_betslipWindow","width=243,height=250,status=yes,resizable=no",true); } } function popUnder() { pop_under = window.open("/lbr_portal_italia?action=go_popunder","popunder","height=328,width=470"); pop_under.blur(); pop_under.opener.focus(); } function isFloatingSlip() { if (betslip_mode == 2) { if (screen.width < 1024 || screen.height < 768) { return false; } else { return true; } } else { return false; } } function set_betslip_lock(locked) { setCookieValue("BETSLIP","locked",locked); } function get_betslip_lock() { return getCookieValue("BETSLIP", "locked", 0); } function reload_betslip(go_url) { if (top.isFloatingSlip()) { if (get_betslip_lock() != 0) { alert("BS_LOCKED"); return; } var iframe = top.ladbrokes_betslip; iframe.location.replace(go_url); } else { if (top.bs && !top.bs.closed) { top.bs.focus(); top.bs.location.replace(go_url); } else { top.maxSlip(); top.bs.focus(); top.bs.location.replace(go_url); } } }