//global event settings
var eventName = "wimb";
var siteURL = "www.wimbledon.org";
var infoImg = new Image();
//site variables
var playerID = "";
var sbOn = 1;
var ajaxRefresh = 300000;
var pageLoc = document.location.toString();
pageLoc = pageLoc.toLowerCase();
if(pageLoc.indexOf('http://www.wimbledon.org') != -1 && pageLoc.indexOf('http://wimbledon.org') != -1){
var sumScoresServer = "/";
} else {
var sumScoresServer = "http://2010.wimbledon.org/";
}
var sumScoresWait = 3000;
var sumScoreboardyear = 2010;
//*****************************/
// Jquery functions
//*****************************/
var keyvalue = "";
$(document).ready(function(){
if(document.all){$("#nav li").hoverClass("over");}
if(document.all){$(".videoItem").hoverClass("over");}
if(document.all){$("#galleryContainer ul li").hoverClass("over");}
var path = location.pathname.substring(0);
var page = location.href;
if(page.indexOf('live.wimbledon.org') != -1){path = "http://live.wimbledon.org"};
$('#nav a[@href$="' + path + '"]').addClass('active');
$('.subnav a[@href$="' + path + '"]').parents("ul").prev("ul li a").addClass('active');
//set ad key value for scores section
if(page.indexOf('/en_GB/scores/') != -1){keyvalue = "wmb.scores";}
if(page.indexOf('/en_GB/scores/index.html') != -1){keyvalue = "wmb.scores.mip";}
if(page.indexOf('/en_GB/scores/cmatch/') != -1){keyvalue = "wmb.scores.completed";}
if(page.indexOf('/en_GB/tracker/') != -1){keyvalue = "wmb.scores.slamtracker";}
if(page.indexOf('/en_GB/scores/schedule/') != -1){keyvalue = "wmb.scores.schedule";}
if(page.indexOf('/en_GB/widgets/index.html') != -1){keyvalue = "wmb.scores.widget";}
if(page.indexOf('/en_GB/scores/challenge/') != -1){keyvalue = "wmb.scores.pcs";}
if(page.indexOf('/en_GB/scores/weather/') != -1){keyvalue = "wmb.scores";}
//set ad key value for draws section
if(page.indexOf('/en_GB/scores/draws/') != -1){keyvalue = "wmb.draws";}
if(page.indexOf('/en_GB/scores/draws/ms/') != -1){keyvalue = "wmb.draws.gentssingles";}
if(page.indexOf('/en_GB/scores/draws/ws/') != -1){keyvalue = "wmb.draws.ladiessingles";}
if(page.indexOf('/en_GB/scores/draws/md/') != -1){keyvalue = "wmb.draws.gentsdoubles";}
if(page.indexOf('/en_GB/scores/draws/wd/') != -1){keyvalue = "wmb.draws.ladiesdoubles";}
if(page.indexOf('/en_GB/scores/draws/xd/') != -1){keyvalue = "wmb.draws.mixeddoubles";}
if(page.indexOf('/en_GB/scores/draws/bs/') != -1){keyvalue = "wmb.draws.juniors";}
if(page.indexOf('/en_GB/scores/draws/bd/') != -1){keyvalue = "wmb.draws.juniors";}
if(page.indexOf('/en_GB/scores/draws/gs/') != -1){keyvalue = "wmb.draws.juniors";}
if(page.indexOf('/en_GB/scores/draws/gd/') != -1){keyvalue = "wmb.draws.juniors";}
if(page.indexOf('/en_GB/scores/draws/od/') != -1){keyvalue = "wmb.draws.invitational";}
if(page.indexOf('/en_GB/scores/draws/qs/') != -1){keyvalue = "wmb.draws.qualifiers";}
if(page.indexOf('/en_GB/scores/draws/qd/') != -1){keyvalue = "wmb.draws.qualifiers";}
if(page.indexOf('/en_GB/scores/draws/us/') != -1){keyvalue = "wmb.draws.qualifiers";}
if(page.indexOf('/en_GB/scores/draws/ud/') != -1){keyvalue = "wmb.draws.qualifiers";}
if(page.indexOf('/en_GB/scores/draws/wc/') != -1){keyvalue = "wmb.draws.wheelchairs";}
if(page.indexOf('/en_GB/scores/draws/pdf.html') != -1){keyvalue = "wmb.draws";}
//set ad key value for players section
if(page.indexOf('/en_GB/players/') != -1){keyvalue = "wmb.players";}
if(page.indexOf('/en_GB/players/index.html') != -1){keyvalue = "wmb.players";}
if(page.indexOf('/en_GB/players/overview/') != -1){keyvalue = "wmb.players.profiles";}
if(page.indexOf('/en_GB/players/seeds.html') != -1){keyvalue = "wmb.players.seeded";}
if(page.indexOf('/en_GB/news/interviews/') != -1){keyvalue = "wmb.players.interviews";}
if(page.indexOf('/en_GB/players/competitor/') != -1){keyvalue = "wmb.players.competitors";}
if(page.indexOf('/en_GB/scores/extrastats/') != -1){keyvalue = "wmb.players.stats";}
//set ad key value for news section
if(page.indexOf('/en_GB/news/') != -1){keyvalue = "wmb.newsphotos";}
if(page.indexOf('/en_GB/news/index.html') != -1){keyvalue = "wmb.newsphotos";}
if(page.indexOf('/en_GB/news/articles/') != -1){keyvalue = "wmb.newsphotos.news";}
if(page.indexOf('/en_GB/news/photos/') != -1){keyvalue = "wmb.newsphotos.photos";}
if(page.indexOf('/en_GB/news/blogs/') != -1){keyvalue = "wmb.newsphotos.blogs";}
if(page.indexOf('/en_GB/news/juniors/') != -1){keyvalue = "wmb.newsphotos.juniors";}
if(page.indexOf('/en_GB/news/rss/') != -1){keyvalue = "wmb.newsphotos";}
//set ad key value for video/radio section
if(page.indexOf('/en_GB/interactive/radio/') != -1){keyvalue = "wmb.videoradio";}
if(page.indexOf('/en_GB/interactive/video/index.html') != -1){keyvalue = "wmb.videoradio.gallery";}
//load rounded boxes only if not a 3rd party page
if(typeof href_server == "undefined"){
DD_roundies.addRule(".round","10px",true);
DD_roundies.addRule(".innerround","6px",true);
DD_roundies.addRule(".followround","3px",true);
DD_roundies.addRule(".roundbutton","2px",true);
DD_roundies.addRule("#scheduleNavInnerBox","2px",true);
DD_roundies.addRule("#nutchSearchDiv .nextBtn","2px",true);
DD_roundies.addRule("#nutchSearchDiv .prevBtn","2px",true);
DD_roundies.addRule(".fmatchbutton","2px",true);
DD_roundies.addRule(".button","2px",true);
DD_roundies.addRule(".roundtop","10px 10px 0px 0px",true);
DD_roundies.addRule(".roundbottom","0px 0px 10px 10px",true);
DD_roundies.addRule(".fontSize","3px",true);
}
DD_roundies.addRule("#fmScoreboard li","10px",true);
$(".roundbutton").click(function(){
if( $(this).children("a").attr("href") != "" ){
location.href = $(this).children("a").attr("href");
}
if( $(".roundbutton a").attr("onclick") != "" ){
$(this).attr("onclick",$(this).children("a").attr("onclick") );
}
});
$(".wbutton").click(function(){
if( $(this).children("a").attr("href") != "" ){
location.href = $(this).children("a").attr("href");
}
if( $(".wbutton a").attr("onclick") != "" ){
$(this).attr("onclick",$(this).children("a").attr("onclick") );
}
});
$(".fmatchbutton").click(function(){
if( $(this).children("a").attr("href") != "" ){
location.href = $(this).children("a").attr("href");
}
if( $(".roundbutton a").attr("onclick") != "" ){
$(this).attr("onclick",$(this).children("a").attr("onclick") );
}
});
$("#videoCategories a").hover(
function(){ $(this).parent("div").addClass('galleryCatHover'); },
function(){ $(this).parent("div").removeClass('galleryCatHover'); }
);
$("#videoCategories a").click(function(){
$("#videoCategories a").each(function(){
$(this).parent("div").removeClass("galleryCatActive")
$(this).removeClass("selected");
});
$(this).parent("div").addClass("galleryCatActive");
$(this).addClass("selected");
});
$(".videoItem").hover(
function(){ $(this).addClass('over'); },
function(){ $(this).removeClass('over'); }
);
$(".videoItem").click(function(){
$(".videoItem").each(function(){ $(this).removeClass("selected"); });
$(this).addClass("selected");
});
});
//jquery code for top navigation
$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover(
function() { $(this).addClass(c);},
function() { $(this).removeClass(c);}
);
});
};
//*****************************/
// Change Font Size
//*****************************/
var size = .7;
var newsize = .7;
function getBig()
{
allbody = document.getElementsByTagName("body")
newsize = newsize + .1;
writeSessionCookie("wmfontsize",newsize);
for (i=0; i < allbody.length; i++)
{
if (newsize <= 1.1 ) {
allbody[i].style.fontSize = newsize+"em";
}
}
measureApp('Site Functions','Font','Increase');
}
function getSmall()
{
allbody = document.getElementsByTagName("body")
newsize = newsize - .1;
writeSessionCookie("wmfontsize",newsize);
for (i=0; i < allbody.length; i++)
{
if (newsize >= .1 ) {
allbody[i].style.fontSize = newsize+"em";
}
}
measureApp('Site Functions','Font','Decrease');
}
function getNormal()
{
deleteCookie("wmfontsize");
allbody = document.getElementsByTagName("body")
for (i=0; i < allbody.length; i++)
{
allbody[i].style.fontSize = size+"em";
}
newsize = size;
measureApp('Site Functions','Font','Normal');
}
// set the function to run on page load
addLoadEvent(function() {
if (getCookieValue("wmfontsize"))
{
newsize = getCookieValue("wmfontsize");
allbody = document.getElementsByTagName("body")
for (i=0; i < allbody.length; i++)
{
allbody[i].style.fontSize = newsize+"em";
}
}
});
//*****************************/
// launch SlamTracker
//*****************************/
var ttWindow = "";
var launchPage;
var ttWindowHeight;
function launchTT(lang,view,crt,syn,debug,test){
if (hasReqestedFlashVersion && NPRuntime){
if (view == "draw"){
ttWindowHeight = 572;
}
else{
ttWindowHeight = 572;
}
launchPage = "http://2010.wimbledon.org/en_GB/tracker/ttFrame.html?";
if (test) launchPage = "/en_GB/tracker/ttFrame.html?";
var d = new Date()
var t = d.getTime()
launchPage += "ts=" + t;
launchPage += (lang.length>1)?"&lang="+lang:"&lang=en_GB";
launchPage += (syn)?"&syn="+syn:"&syn=none";
launchPage += "&wh=" + ttWindowHeight;
launchPage += "&mode=" + view;
launchPage += "&ref=" + document.location.host + document.location.pathname;
launchPage += (debug.indexOf("debug")>-1)?"&db=true":"&db=false";
launchPage += (crt)?"&crt="+crt:"&crt=none";
//alert(launchPage);
if (ttWindow.closed || ttWindow==""){
ttWindow = window.open(launchPage,"ttWindow","width=850,height=" + ttWindowHeight + ",top=0,left=0,statusbar=0")
if (ttWindow.opener == null) ttWindow.opener=self;
}
ttWindow.focus();
}
else{
document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
//*****************************/
// launch visual match
//*****************************/
var vmWindow = "";
var vmLaunchPage;
var vmWindowHeight;
function launchVM(lang,match,debug){
if (hasReqestedFlashVersion && NPRuntime){
vmWindowHeight = 510;
launchPage = "/en_GB/momentum/vmMain.html?";
var d = new Date()
var t = d.getTime()
launchPage += "ts=" + t;
launchPage += (lang.length>1)?"&lang="+lang:"&lang=en_GB";
launchPage += "&wh=" + vmWindowHeight;
launchPage += "&match=" + match;
launchPage += "&ref=" + document.location.host + document.location.pathname;
launchPage += (debug.indexOf("debug")>-1)?"&db=true":"&db=false";
//alert(launchPage);
if (vmWindow.closed || vmWindow==""){
vmWindow = window.open(launchPage,"vmWindow","width=810,height=" + vmWindowHeight + ",top=0,left=0,statusbar=0")
if (vmWindow.opener == null) vmWindow.opener=self;
}
vmWindow.focus();
}
else{
document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
function launch(which,crt){
var loc = "";
var sbLang;
if (!which){
which = 'score';
}
loc = "/en_GB/scores/index.html";
sbLang = "en_GB";
// for wim quals:
if(crt){
crt = crt.toLowerCase();
}
//uncomment next line when slam tracker is ready
launchTT(sbLang,which,crt,'','','');
//document.location.href = loc;
}
//*****************************/
// launch standalone radio
//*****************************/
var radioWindow = "";
var radiolaunchPage;
function launchRadio(stream,debug){// where stream in("0","1","2") debug in(true,false)
var radioLaunchPage = "/en_GB/interactive/radio/radio.html?";
if (hasReqestedFlashVersion && NPRuntime){
var d = new Date()
var t = d.getTime()
radioLaunchPage += "ts=" + t;
radioLaunchPage += (debug && debug.indexOf("debug")>-1)?"&db=true":"&db=false";
radioLaunchPage += "&ref=" + document.location.host + document.location.pathname;
radioLaunchPage += "&lang=en_GB";// + lang;
radioLaunchPage += "&stream=" + stream;
if (radioWindow.closed || radioWindow==""){
//consoleWindow = window.open(consolelaunchPage,"consoleWindow","width=510,height=" + mcWindowHeight + ",top=50,left=50")
radioWindow = window.open(radioLaunchPage,"radioWindow","width=420,height=220,top=50,left=50");
if (radioWindow.opener == null) radioWindow.opener=self;
}
radioWindow.focus();
} else {
//user doesn't have flash9:
document.location.href = "/" + lang + "/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
//*****************************/
// measurement function for permalink, print popup
// @param lang - lang of app, "en_US", "fr_FR", etc...
// @param diffTag - unique measurement string
//*****************************/
function popupMeasure(poptype){
var page = "";
var refPage = document.location.href;
var randomnumber=Math.floor(Math.random()*9999999999);
var ck = "";
ck = getCookie("sauid");
refPage = refPage.substring(refPage.indexOf("/en_GB"),refPage.indexOf(".html"));
page = refPage + "_" + poptype + ".html";
var url= "http://stats.surfaid.ihost.com/rc/images/uc.GIF?1.20&events&"+eventName+"&http%3A//" + siteURL + page + "&" + refPage + "&&&" + ck + "&&&&&&" + randomnumber;
// alert(url);
infoImg.src = url;
}
//*****************************/
// new getScript allows you to specify caching
//*****************************/
$.getScript = function(url, callback, cache, async){
$.ajax({
type: "GET",
url: url,
success: callback,
dataType: "script",
cache: cache,
async: async
});
};