/*********************************************** * Freejavascriptkit.com * Visit http://www.freejavascriptkit.com for more free Javascripts source code ***********************************************/ /* * 07/09/10 * isInIFrame: checks to see if this tooltip.js is inside an iframe or not. returns true or false. * if we are not in iframe, window load this tooltip, otherwise, hide it. */ var isInIFrame = (window.location != window.parent.location) ? true : false; if(!isInIFrame){window.onload = init;} var xmlstr = new Array(); var xmlDoc = new Array(); var timer = new Array(); var tipobj; var _eveID; var offsetxpoint=-60; //Customize x offset of tooltip var offsetypoint=20; //Customize y offset of tooltip var ie=document.all; var ns6=document.getElementById && !document.all var enabletip=false; var wrapperTooltip; var className = "williamhill_sw"; var eventid_counter = []; var eventid_counter_limit = 10; var counter_eventNotFound = 10; var whEventID = new Array(); /*********************************************** * function hideddrivetip ***********************************************/ function ietruebody(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body; } /*********************************************** * function ddrivetip ***********************************************/ function ddrivetip(thetext, thecolor, thewidth){ if (ns6||ie){ if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"; tipobj.innerHTML= wrapperTooltip + thetext + ""; if(xmlDoc[_eveID].getElementsByTagName("IsLive")[0].childNodes[0].nodeValue == "True"){ (document.getElementById("tooltip_header")).src = "http://serve.williamhill.com/promoDisplay?promoId=1468881882"; } enabletip=true; return false; } } /*********************************************** * function positiontip ***********************************************/ function positiontip(e){ if (enabletip){ var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft; var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop; //Find out how close the mouse is to the corner of the window var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20; var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20; var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000; //if the horizontal distance isn't enough to accomodate the width of the context menu if (rightedge
Match stats
'; if (ie||ns6) tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "" document.onmousemove=positiontip; var _style = ".parameter{font-weight:bold;}"; addCss(_style); var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)"); var allElements = document.getElementsByTagName("div"); var element; //loop through all divs and looks for the div with className for (var i =0 ; i < allElements.length; i++) { element = allElements[i]; var elementClass = element.className; if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass)) { loadEventId(element); } } } var whobj = new Object(); /*********************************************** * function loadEventId ***********************************************/ function loadEventId(element){ //we excpect to find in the iframe name the parameters for the script e.g: whlp_67567567_whz_345345_ifz_456456 // whlp = guixml LP , whz = guixml zone , ifz = iframe zone var iframe_name =element.childNodes[0].name; var datatemp = iframe_name.split("_"); whobj[datatemp[0]] = datatemp[1]; whobj[datatemp[2]] = datatemp[3]; whobj[datatemp[4]] = datatemp[5]; var whz = whobj['whz']; var whp = whobj['whlp']; var zone = whobj['ifz']; // this link will load the event id it uses the "iframe_zone" parameter as the key of the object // e.g. whEventID['123'] = '123455'; var referrer_url =window.location.href; var filename = 'http://serve.williamhill.com/promoRedirect?member=OPREventIDFunc&zone='+whz+'&lp='+whp+'&iframe_zone='+zone+'&var2='+referrer_url; var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref); eventid_counter[zone] = eventid_counter_limit; setTimeout(function(){test4eventid(zone,element)},1000); } /*********************************************** * function test4eventid ***********************************************/ function test4eventid(zone,elem){ try{ if(typeof(whEventID[zone]) != 'undefined' && whEventID[zone] != '' ){ initPopup(whEventID[zone],elem); } else if(eventid_counter[zone]-- > 0){ setTimeout(function(){test4eventid(zone,elem)},1000); } } catch(e){eventid_counter[zone]--;} } /*********************************************** * function initPopup ***********************************************/ function initPopup(eveID,_element) { var filename = 'http://cachefeeds.sportwiser.com/EventTips.aspx?eventId='+eveID; var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref); if (typeof xmlstr[eveID] != 'undefined' && xmlstr[eveID] !="") { setDivOnBanner(eveID,_element) } else if(counter_eventNotFound-- > 0) { setTimeout(function(){initPopup(eveID,_element)},1000); } if(typeof timer[eveID] == 'undefined'){ // timer[eveID] = setTimeout(function(){initPopup(eveID,_element)},3000); } } /*********************************************** * function setDivOnBanner ***********************************************/ function setDivOnBanner(eveID,_element) { var myIFrame = _element.childNodes[0]; try { _element.style.width = myIFrame.width + "px"; _element.style.height = myIFrame.height + "px"; var myNewDiv = document.createElement("div"); myNewDiv.style.zIndex= "1000"; myNewDiv.style.width = myIFrame.width + "px"; myNewDiv.style.height = myIFrame.height + "px"; myNewDiv.style.position = "absolute"; myNewDiv.style.cursor = "pointer"; var _top = myIFrame.offsetParent.offsetTop; _top += myIFrame.offsetTop; var _left = myIFrame.offsetParent.offsetLeft; _left += myIFrame.offsetLeft; //myNewDiv.style.top = myIFrame.offsetParent.offsetTop + "px"; //myNewDiv.style.left = myIFrame.offsetParent.offsetLeft + "px"; //myNewDiv.style.top = _top+ "px"; //myNewDiv.style.left = _left+ "px"; //myNewDiv.style.top = "0px"; //myNewDiv.style.left = "0px"; var myLink = document.createElement("a"); //URL=http://serve.williamhill.com/promoRedirect?channel=DEFAULT&campaign=DEFAULT&member=Alonaradtest4&zone=1468875313&lp=908300452&var3=/en/nui/free-bet/%23http://sports.williamhill.com/bet/betting/e/1378635?lang=en //URL=http://serve.williamhill.com/promoRedirect?memebr=goodaff&campain=DEFUALT&channel=DEFUALT&zone=376845&lp=0&var3=/nui/free-bet/%23http://sports.williamhill.com/bet/betting/e/1378582 //myvar3 ="&var3=/" +gui.@lang+ "/nui/free-bet/%23"+ var3+"?lang=" +gui.@lang; myLink.href ='http://serve.williamhill.com/promoRedirect?'+clickinfo+'&zone='+whobj['whz']+'&lp=0&var3=/en/nui/free-bet/%23http://sports.williamhill.com/bet/betting/e/'+eveID+'?lang=en'; myLink.target ="_blank"; var myPixel = document.createElement("img"); myPixel.src = "http://cacheserve.williamhill.com/promoDisplay?promoId=603436489"; myPixel.width = myIFrame.width ; myPixel.height = myIFrame.height; myPixel.border = "0px"; myLink.appendChild(myPixel); myNewDiv.appendChild(myLink); _element.insertBefore(myNewDiv,myIFrame); _element.onmouseover = function(){RaiseSportWiserPopup(eveID)}; _element.onmouseout = function(){HideSportWiserPopup();}; } catch(e){} } /*********************************************** * function RaiseSportWiserPopup ***********************************************/ function RaiseSportWiserPopup(eveID) { _eveID = eveID; try { if (window.DOMParser) { parser=new DOMParser(); xmlDoc[eveID]=parser.parseFromString(xmlstr[eveID],"text/xml"); } else // Internet Explorer { xmlDoc[eveID]=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc[eveID].async="false"; xmlDoc[eveID].loadXML(xmlstr[eveID]); } } catch (e){} var txt =""; for(x=0;x< xmlDoc[_eveID].getElementsByTagName("Tip").length;x++) { if(x%2 == 0) bg = '#f5f5f5'; else bg = '#ffffff'; //txt += '
' + xmlDoc[_eveID].getElementsByTagName("Tip")[x].childNodes[0].nodeValue + "
"; txt += '
' + xmlDoc[_eveID].getElementsByTagName("Tip")[x].childNodes[0].nodeValue + "
"; } ddrivetip(txt,'#ffffff', 303); } /*********************************************** * function HideSportWiserPopup ***********************************************/ function HideSportWiserPopup(){ hideddrivetip(); } /*********************************************** * function loadXMLDoc ***********************************************/ function loadXMLDoc(theurl,onreadyfunc) { if (window.XMLHttpRequest) // code for IE7+, Firefox, Chrome, Opera, Safari { xmlhttp=new XMLHttpRequest(); } else // code for IE6, IE5 { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET",theurl,true); //make sure we define the "onreadystatechange" function before we make the HTTP call if(typeof(onreadyfunc) == 'function'){ xmlhttp.onreadystatechange = onreadyfunc; } xmlhttp.send(); return xmlhttp; } /*********************************************** * function addLoadEvent ***********************************************/ function addLoadEvent(fn) { var win = window, doc=document; var UNDEF = "undefined"; if (typeof win.addEventListener != UNDEF) { win.addEventListener("load", fn, false); } else if (typeof doc.addEventListener != UNDEF) { doc.addEventListener("load", fn, false); } else if (typeof win.attachEvent != UNDEF) { addListener(win, "onload", fn); } else if (typeof win.onload == "function") { var fnOld = win.onload; win.onload = function() { fnOld(); fn(); }; } else { win.onload = fn; } } function addListener(gtarget, eventType, fn) { gtarget.attachEvent(eventType, fn); }