var cookieStr = document.cookie; var cookieKeys = new Array(); var cookieVals = new Array(); var cookiesParsed = false; function clean (str) { str = str.replace(/^\s+/,''); str = str.replace(/\s+$/,''); return str; } function parseCookies() { var cookieSets = cookieStr.split(";"); for (i=0; i < cookieSets.length; i++) { var cookiePairs = cookieSets[i].split("="); if (cookiePairs.length > 1) { cookiePairs[0] = cookiePairs[0].replace(/\+/g,' '); cookiePairs[0] = unescape(cookiePairs[0]); cookieKeys.push(clean(cookiePairs[0])); cookiePairs[1] = cookiePairs[1].replace(/\+/g,' '); cookiePairs[1] = unescape(cookiePairs[1]); cookieVals.push(clean(cookiePairs[1])); //alert(cookiePairs[0] + ' = ' + cookiePairs[1]); } } } function cookieVal (key) { if (!cookiesParsed) { parseCookies(); cookiesParsed = true; } for (i=0; i < cookieKeys.length; i++) { if (key == cookieKeys[i]) { return cookieVals[i]; } } return null; } function setCookie (ckey,cval,timegmt) { if (!timegmt) { var exp = new Date(); exp.setTime = (exp.getTime() + (1000 * 60 * 60)) timegmt = exp.toGMTString(); } document.cookie = ckey + "=" + escape(cval) + "; path=/;"; //document.cookie = ckey + "=" + escape(cval) + "; expires=" + timegmt + "; path=/;"; //alert("Added: " + ckey + "=" + escape(cval) + "; expires=" + timegmt + "; path=/;"); cookieKeys.push(ckey); cookieVals.push(cval); } function openWindow(l,w,h,t) { if (!w) { w = screen.width*.70; } if (!h) { h = screen.height*.80; } t = t ? ',toolbar' : ''; var wdo = window.open(l,'DMTCWindow','width='+w+',height='+h+',left=20,top=50,scrollbars,resizable'+t); wdo.focus(); } function link(url, parent) { if (parent) { setTimeout("parent.location.href = '"+ url +"';", 200); } else { setTimeout("location.href = '"+ url +"';", 200); } window.status = url; return; } function toggleNav (k) { var o = null; o = document.getElementById('div_'+k); if (!o) return; if ((cookieVal(k) && o.style.display == '') || o.style.display == 'none') { o.style.display = 'block'; setTimeout("document.images['img_"+k+"'].src = '/images/arrow_on.gif';",100); setCookie(k,'true'); } else { o.style.display = 'none'; setTimeout("document.images['img_"+k+"'].src = '/images/arrow_off.gif';",100); setCookie(k,''); } return; } function nothing() { return; } var DMB = null; function DelMarBets(pg) { if (DMB && !DMB.closed) DMB.close(); var w = 900; var h = 600; var top = Math.floor((screen.height / 2) - (h/2) - 50); if (top < 0) top = 0; var left = Math.floor((screen.width / 2) - (w / 2)); if (left < 0) left = 0; var url = 'https://delmarbetsecure.xb-online.com'; if (pg == 'reg') url = 'https://delmarbetsecure.xpressbet.com/signup/signup2a.aspx'; if (pg == 'forgot') url = 'https://delmarbetsecure.xpressbet.com/forgotpassword.aspx'; if (pg == 'reactivate') url = 'https://delmarbetsecure.xpressbet.com/reopen_acct.aspx'; DMB = window.open(url,'DelMarBets','resizable,scrollbars,width='+ w +',height='+ h +',top=' + top + ',left=' + left); DMB.focus(); } function countDown() { var box = document.forms['countDown'].text; var str = ""; var days = hours = mins = seconds = 0; var diff = timeDiff; timeDiff--; if (diff <= 0) { box.value = "Racing is underway!"; return; } days = parseInt(diff / 86400); diff -= days * 86400; str += days + " day" + (days == 1 ? '' : 's') + ', '; hours = parseInt(diff / 3600); diff -= hours * 3600; str += pad(hours,1,0) + ':'; mins = parseInt(diff / 60); diff -= mins * 60; str += pad(mins,2,0) + ':'; str += pad(parseInt(diff),2,0); box.value = str; setTimeout('countDown()',1000); } function pad(str,len,pd) { str += ""; while (str.length < len) str = "" + pd + str; return str; } var amt = 10; var spd = 50; var hangtime = 8000; var running = true; function rotate(num) { var last = num - 1; if (last <= 0) last = headlines; if (num > numHeaderBlocks) num = 1; if (running) fade(last,num,0,1); else fade(last,num,100,1); running = true; } function fade(last,id,opac,up) { // If starting out, show cover layer if (up && !opac) { if (document.all) document.all['headerCover'].style.display = 'block'; else if (document.getElementById) document.getElementById('headerCover').style.display = 'block'; } // If we've hit the top, set to go back down if (up && opac > 100) { // Hide old one if (document.all) document.all['headerBlock'+last].style.display = 'none'; else if (document.getElementById) document.getElementById('headerBlock'+last).style.display = 'none'; // Show the new one if (document.all) document.all['headerBlock'+id].style.display = 'block'; else if (document.getElementById) document.getElementById('headerBlock'+id).style.display = 'block'; setTimeout('fade('+last+','+id+',90,0)',spd); return; } // If we're done, rotate again in x seconds if (opac < 0) { if (document.all) document.all['headerCover'].style.display = 'none'; else if (document.getElementById) document.getElementById('headerCover').style.display = 'none'; setTimeout('rotate('+(id+1)+')',hangtime); return; } // Set opacity of cover if (document.all) document.all['headerCover'].filters.alpha.opacity = opac; else if (document.getElementById) document.getElementById('headerCover').style.MozOpacity = opac/100; if (up) opac += amt; else opac -= amt; setTimeout('fade('+last+','+id+','+opac+','+up+')',spd); } function fade2(id,next,opac) { if (!up && opac == 100) { // Just Starting // Show this headline, and make cover re-appear in x seconds if (document.all) document.all['headerBlock'+id].style.display = 'block'; else if (document.getElementById) document.getElementById('headerBlock'+id).style.display = 'block'; setTimeout('fade('+id+',0,1)',hangtime); } if (up && opac >= 100) { // Just Ended if (document.all) document.all['headerBlock'+id].style.display = 'none'; else if (document.getElementById) document.getElementById('headerBlock'+id).style.display = 'none'; rotate((id+1)); return; } // Too high, gotta quit if (up && opac > 100) return; // Set opacity if (document.all) document.all['headerCover'].filters.alpha.opacity = opac; else if (document.getElementById) document.getElementById('headerCover').style.MozOpacity = opac/100; }