/********************************************************************
content shedding variabies
********************************************************************/
var shedAllGeos = false; //change to true if need to block all video links from all geos
/********************************************************************
variables for home page modules set to open or closed
********************************************************************/
var videoOpen;
var newsOpen;
/********************************************************************
variable for message refresh
********************************************************************/
var messageRefresh = 300000;
/********************************************************************
variabies for sublevel index page promos
********************************************************************/
var scores_promos = false;
var players_promos = false;
var guide_promos = true;
var news_promos = false;
var course_promos = false;
var history_promos = false;
var homeOpenCount = 0; //variable to count how many elements on the homepage are 'open'
var showBgImage; //variable to determing whether or not background image is being shown
var geoblock = "false";
var navigation_state = "nav_cookie";
function geoBlock(geo,geovalue){
if (geovalue)
geovalue = "true";
else{
geovalue = "false";
}
$.cookie("geo_cookie",geovalue);
if(geovalue == "true"){ $('#subPromo1').hide(); }
if(shedAllGeos){ $('#subPromo1').hide(); } //do this when shedding content
geoblock = geovalue;
}
function setNavCookie(state){
$.cookie(navigation_state,state);
}
$(function(){
/* get or set geoblock cookie */
if($.cookie("geo_cookie")){
geoblock = $.cookie("geo_cookie");
if(geoblock == "true"){ $('#subPromo1').hide(); }
if(shedAllGeos){ $('#subPromo1').hide(); } //do this when shedding content
} else {
var g = document.createElement("script");
g.src = "http://masters3.edgesuite.net/amencornerlive/geo/geocheck.js";
g.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(g);
}
});
$(document).ready(function(){
if (document.all){$("#nav li").hoverClass("over"); }
$("#navSubPlus").hide();
$("#scoreboardLargeHome").hide();
$("#infoLarge").hide();
if(videoOpen){
$("#videoSmall").hide();
$("#videoLarge").show();
setTimeout("initHomeVideo()",2000);
homeOpenCount++;
homeFadeOut();
} else {
$("#videoLarge").hide();
}
if(newsOpen){
$("#newsSmall").hide();
$("#newsLarge").show();
setTimeout("loadHeadlines()",2000);
homeOpenCount++;
homeFadeOut();
} else {
$("#newsLarge").hide();
}
if(qsParse.get("view")){
var page_set = qsParse.get("view");
if(page_set == "scoreboard"){
scoreboardExpand('external');
}
}
$("#background img").bind("contextmenu",function(e){
return false;
});
initBackground();
StartTimer();
if(document.all){$("#navPairings").hoverClass("over");}
if(document.all){$("#navPlayers").hoverClass("over");}
if(document.all){$("#navTournament").hoverClass("over"); }
if(document.all){$("#navVideo").hoverClass("over");}
if(document.all){$("#navNews").hoverClass("over");}
if(document.all){$("#navCourse").hoverClass("over");}
if(document.all){$("#navHistory").hoverClass("over");}
var path = location.pathname.substring(0);
var url = location.href;
if( (path.indexOf("/en_US/index.") != -1) || path == "/en_US/"){
/* set or get nav_cookie when index page loads */
if($.cookie(navigation_state)){
var nav_state = $.cookie(navigation_state);
if(nav_state == "cont"){
/* minimize nav when index page loads */
$("#navMinus").hide();
$("#nav").width("360px");
$("#navNews").hide();
$("#navCourse").hide();
$("#navHistory").hide();
} else {
$("#navPlus").hide();
}
} else {
setNavCookie("cont");
/* minimize nav when index page loads */
$("#navMinus").hide();
$("#nav").width("360px");
$("#navNews").hide();
$("#navCourse").hide();
$("#navHistory").hide();
}
}
if (path.indexOf('/players/') != -1){path = "/en_US/players/index.html";}
if (path.indexOf('/history/') != -1){path = "/en_US/history/index.html";}
if (path.indexOf('/stats/') != -1){path = "/en_US/scores/index.html";}
if (path.indexOf('/interviews/') != -1){path = "/en_US/news/index.html";}
if (path.indexOf('/articles/') != -1){path = "/en_US/news/index.html";}
$('#nav ul li ul').hide();
$('#navSub ul li ul').hide();
$('#nav a[@href$="' + path + '"]').addClass('active');
$('#nav a[@href$="' + path + '"]').parents("li").addClass('active');
$('#navSub a[@href$="' + path + '"]').addClass('active');
$('#navSub a[@href$="' + path + '"]').parents("li").addClass('active');
$('#navSub a[@href$="' + path + '"]').parents("ul").prev("ul li").addClass('active');
$('#navSub a[@href$="' + path + '"]').parents("ul").prev("ul li a").addClass('active');
$('#navPairings').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navPairings').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
$('#navTournament').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navTournament').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
$('#navHistory').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navHistory').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
$('#navNews').hover(function (){$('.middle703').css('z-index','-1');$('.middle703').css('position','relative'); },function (){$('.middle703').css('z-index','0');$('.middle703').css('position','relative'); });
$('#navNews').hover(function (){$('.middle346').css('z-index','-1');$('.middle346').css('position','relative'); },function (){$('.middle346').css('z-index','0');$('.middle346').css('position','relative'); });
}); /* end document.ready */
//jquery code for top navigation
$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover(
function() { $(this).addClass(c); },
function() { $(this).removeClass(c); }
);
});
};
/**********************************************************************
This function fades the background image out
**********************************************************************/
function homeFadeOut(){ /* $("#background img").fadeTo("normal", 0.20);*/ }
/**********************************************************************
This function brings the background image in
**********************************************************************/
function homeFadeIn(){ /*$("#background img").fadeTo("normal", 1);*/ }
/**********************************************************************
This function contracts the main nav on the home page
**********************************************************************/
$(function(){
$("#navMinus img").click(function(){
$("#nav").animate({width:"360px", height:"21px"}, 250);
$("#navNews").hide();
$("#navCourse").hide();
$("#navHistory").hide();
$("#navMinus").toggle();
$("#navPlus").toggle();
setNavCookie("cont");
measureApp('Home','Navigation','Hide');
});
});
/**********************************************************************
This function expands the main nav on the home page
**********************************************************************/
$(function(){
$("#navPlus img").click(function(){
$("#nav").animate({
width:"613px",
height:"21px"
}, 200, function(){
$("#navNews").show();
$("#navCourse").show();
$("#navHistory").show();
});
$("#navPlus").toggle();
$("#navMinus").toggle();
setNavCookie("exp");
measureApp('Home','Navigation','Show');
});
});
/**********************************************************************
This function contracts the main nav on sublevel pages
**********************************************************************/
$(function(){
$("#navSubMinus img").click(function(){
$("#navSub").animate({width:"360px", height:"21px"}, 250);
$("#navNews").hide();
$("#navCourse").hide();
$("#navHistory").hide();
$("#navSubMinus").toggle();
$("#navSubPlus").toggle();
setNavCookie("cont");
measureApp('Sublevel','Navigation','Hide');
});
});
/**********************************************************************
This function expands the main nav on sublevel pages
**********************************************************************/
$(function(){
$("#navSubPlus img").click(function(){
$("#navSub").animate({
width:"613px",
height:"21px"
}, 200, function(){
$("#navNews").show();
$("#navCourse").show();
$("#navHistory").show();
});
$("#navSubPlus").toggle();
$("#navSubMinus").toggle();
setNavCookie("exp");
measureApp('Home','Navigation','Show');
});
});
/**********************************************************************
This function expands the scoreboard div
**********************************************************************/
function scoreboardExpand(which){
$("#hmScoreboard").animate({
width:"525px",
height:"563px"
}, 650, function(){
checkVersions();//writeFlash();//put your code here, ed
});
homeOpenCount++;
homeFadeOut();
$("#scoreboardSmallHome").toggle();
$("#scoreboardLargeHome").toggle();
if(!which){ measureApp('Home','Leader Board','Large'); }
}
/**********************************************************************
This function contracts the scoreboard div
**********************************************************************/
var sb_launch = "false";
function scoreboardContract(launch){
if(launch){sb_launch = launch;}
$("#hmScoreboard").animate({width:"292px", height:"160px"}, 200);
homeOpenCount--;
if(homeOpenCount == 0){ homeFadeIn(); }
$("#scoreboardLargeHome").toggle();
$("#scoreboardSmallHome").toggle();
$("#leaderboardContainer").html('');
if(sb_launch == "false"){
measureApp('Home','Leader Board','Small');
}
}
/**********************************************************************
This function expands the video div
**********************************************************************/
function hmVideoExpand(){
$("#hmVideo").animate({
height:"290px"
}, 650, function(){
if(window.initHomeVideo){
initHomeVideo();
}
});
homeOpenCount++;
homeFadeOut();
$("#videoSmall").toggle();
$("#videoLarge").toggle();
measureApp('Home','Watch Live','Show');
}
/**********************************************************************
This function contracts the video div
**********************************************************************/
function hmVideoContract(){
if(window.stopHomeVideo){
stopHomeVideo();
}
$("#hmVideo").animate({height:"33px"}, 650);
homeOpenCount--;
if(homeOpenCount == 0){ homeFadeIn(); }
$("#videoLarge").toggle();
$("#videoSmall").toggle();
measureApp('Home','Watch Live','Hide');
}
/**********************************************************************
This function expands the news div
**********************************************************************/
function hmNewsExpand(){
$("#hmNews").animate({
width:456,
height:286
}, 650, function() {
loadHeadlines();
});
homeOpenCount++;
homeFadeOut();
$("#newsSmall").toggle();
$("#newsLarge").toggle();
measureApp('Home','Latest News','Show');
}
/**********************************************************************
This function contracts the news div
**********************************************************************/
function hmNewsContract(){
$("#hmNews").animate({width:456, height:33}, 650);
homeOpenCount--;
if(homeOpenCount == 0){ homeFadeIn(); }
$("#newsLarge").toggle();
$("#newsSmall").toggle();
measureApp('Home','Latest News','Hide');
}
/**********************************************************************
This function expands the info div
**********************************************************************/
$(function(){
$("#infoSmall").click(function(){
$(".hmInfo").animate({width:562, height:66}, 650);
$(".splashInfo").animate({width:562, height:66}, 650);
$("#infoSmall").hide();
$("#infoLarge").show();
$("#captionDiv").html(caption_text);
$("#captionDiv").append(" <a id='showBgLink' href='javascript:hideShowContent();'>Reveal background image</a>");
if(link_changed){ getLinkText(); }
measureApp('Site Functions','Background Info Box');
});
});
/**********************************************************************
This function contracts the info div
**********************************************************************/
function closeInfo(){
$(".hmInfo").animate({width:37, height:37}, 650);
$(".splashInfo").animate({width:37, height:37}, 650);
$("#infoLarge").hide();
$("#infoSmall").show();
}
/**********************************************************************
This function hides or shows all the page content to show or hide the
background image
**********************************************************************/
var showBg = false;
var link_changed = false;
function getLinkText(){
$("#showBgLink").html("Reveal content");
link_changed = true;
}
function hideShowContent(){
if(!showBg){
$("#content").fadeOut("slow");
$("#footerContentBar").fadeOut("slow");
$("#hmInfoButton").removeClass("hmInfo").addClass("splashInfo");
$("#hmInfoButton").parent("div").addClass("splashFooterContainer");
getLinkText();
showBg = true;
measureApp('Site Functions','Reveal Background Image');
} else if (showBg){
$("#content").fadeIn("slow");
$("#footerContentBar").fadeIn("slow");
closeInfo();
/*$("#infoLarge").hide(function(){
$("#infoSmall").fadeIn("slow");
});*/
$("#hmInfoButton").parent("div").removeClass("splashFooterContainer");
$("#hmInfoButton").removeClass("splashInfo").addClass("hmInfo");
showBg = false;
link_changed = false;
measureApp('Site Functions','Reveal Content');
}
}
/**********************************************************************
This function expands the statistics div on the scores index page
**********************************************************************/
function statisticsExpand(){
$("#scoresStatistics").animate({height:"213px"}, 650);
$("#scoresStatisticsSmall").toggle();
$("#scoresStatisticsLarge").toggle();
measureApp('Pairings and Stats','Statistics','Show');
}
/**********************************************************************
This function contracts the statistics div on the scores index page
**********************************************************************/
function statisticsContract(){
$("#scoresStatistics").animate({height:"32px"}, 650);
$("#scoresStatisticsLarge").toggle();
$("#scoresStatisticsSmall").toggle();
measureApp('Pairings and Stats','Statistics','Hide');
}
/**********************************************************************
This function expands the par 3 div on the scores index page
**********************************************************************/
function par3Expand(){
$("#scoresPar3").animate({height:"213px"}, 650);
$("#scoresPar3Small").toggle();
$("#scoresPar3Large").toggle();
measureApp('Pairings and Stats','Par 3','Show');
}
/**********************************************************************
This function contracts the par 3 div on the scores index page
**********************************************************************/
function par3Contract(){
$("#scoresPar3").animate({height:"32px"}, 650);
$("#scoresPar3Large").toggle();
$("#scoresPar3Small").toggle();
measureApp('Pairings and Stats','Par 3','Hide');
}
/**********************************************************************
This function expands the par 3 div on the scores index page
**********************************************************************/
function ticketsExpand(){
$("#infoTickets").animate({height:"213px"}, 650);
$("#infoTicketsSmall").toggle();
$("#infoTicketsLarge").toggle();
measureApp('Tournament Info','Tickets','Show');
}
/**********************************************************************
This function contracts the par 3 div on the scores index page
**********************************************************************/
function ticketsContract(){
$("#infoTickets").animate({height:"32px"}, 650);
$("#infoTicketsLarge").toggle();
$("#infoTicketsSmall").toggle();
measureApp('Tournament Info','Tickets','Hide');
}
/**********************************************************************
This function expands the par 3 div on the scores index page
**********************************************************************/
function tournamentExpand(){
$("#infoTournament").animate({height:"213px"}, 650);
$("#infoTournamentSmall").toggle();
$("#infoTournamentLarge").toggle();
measureApp('Tournament Info','At the Masters','Show');
}
/**********************************************************************
This function contracts the par 3 div on the scores index page
**********************************************************************/
function tournamentContract(){
$("#infoTournament").animate({height:"32px"}, 650);
$("#infoTournamentLarge").toggle();
$("#infoTournamentSmall").toggle();
measureApp('Tournament Info','At the Masters','Hide');
}
/**********************************************************************
This function expands the par 3 div on the scores index page
**********************************************************************/
function photosExpand(){
$("#newsPhotos").animate({height:"288px"}, 650);
$("#newsPhotosSmall").toggle();
$("#newsPhotosLarge").toggle();
measureApp('News and Media','Photos','Show');
}
/**********************************************************************
This function contracts the par 3 div on the scores index page
**********************************************************************/
function photosContract(){
$("#newsPhotos").animate({height:"32px"}, 650);
$("#newsPhotosLarge").toggle();
$("#newsPhotosSmall").toggle();
measureApp('News and Media','Photos','Hide');
}
/**********************************************************************
This function expands the par 3 div on the scores index page
**********************************************************************/
function videosExpand(){
$("#newsVideos").animate({height:"288px"}, 650);
$("#newsVideosSmall").toggle();
$("#newsVideosLarge").toggle();
measureApp('News and Media','Videos','Show');
}
/**********************************************************************
This function contracts the par 3 div on the scores index page
**********************************************************************/
function videosContract(){
$("#newsVideos").animate({height:"32px"}, 650);
$("#newsVideosLarge").toggle();
$("#newsVideosSmall").toggle();
measureApp('News and Media','Videos','Show');
}
/**********************************************************************
This function expands the qualifications div on the players index page
**********************************************************************/
function qualsExpand(){
$("#inviteesQualifications").animate({height:"286px"}, 650);
$("#qualificationsSmall").toggle();
$("#qualificationsLarge").toggle();
$('.quals-scroll-pane').jScrollPane({dragMinHeight:33, dragMaxHeight:33});
measureApp('Players','2010 Tournament Invitiees','Qualifications for Invitation and Past Champions Not Playing','Show');
}
/**********************************************************************
This function contracts the qualifications div on the players index page
**********************************************************************/
function qualsContract(){
$("#inviteesQualifications").animate({height:"33px"}, 650);
$("#qualificationsLarge").toggle();
$("#qualificationsSmall").toggle();
measureApp('Players','2010 Tournament Invitiees','Qualifications for Invitation and Past Champions Not Playing','Hide');
}
/**********************************************************************
This function expands the viewing instructions div on the 3D page
**********************************************************************/
function viewingExpand(){
$("#threeDViewing").animate({height:"214px"}, 650);
$("#threeDViewingSmall").toggle();
$("#threeDViewingLarge").toggle();
measureApp('3D','Viewing Instructions','Show');
}
/**********************************************************************
This function contracts the viewing requirements div on the 3D page
**********************************************************************/
function viewingContract(){
$("#threeDViewing").animate({height:"32px"}, 650);
$("#threeDViewingLarge").toggle();
$("#threeDViewingSmall").toggle();
measureApp('3D','Viewing Instructions','Hide');
}
/**********************************************************************
This function expands the requirements instructions div on the 3D page
**********************************************************************/
function systemExpand(){
$("#threeDSystem").animate({height:"378px"}, 650);
$("#threeDSystemSmall").toggle();
$("#threeDSystemLarge").toggle();
measureApp('3D','System Requirements','Show');
}
/**********************************************************************
This function contracts the requirements requirements div on the 3D page
**********************************************************************/
function systemContract(){
$("#threeDSystem").animate({height:"32px"}, 650);
$("#threeDSystemLarge").toggle();
$("#threeDSystemSmall").toggle();
measureApp('3D','System Requirements','Hide');
}
/**********************************************************************
These functions manipulate the background image when resizing the
browser window
**********************************************************************/
function initBackground() {
$(window).resize(backgroundResizeHandler);
$(window).trigger('resize');
};
var backgroundResizeHandler = function() {
// If the inital image isn't cached, it'll report 0 dimensions.
if ($('#background img').height() == 0 || $('#background img').width() == 0) {
setTimeout(function() { $(window).trigger('resize'); }, 100);
return;
}
if ($('#background').hasClass('horizontal')) {
if ($('#background img').height() < $('#background').height()) {
$('#background').addClass('vertical').removeClass('horizontal');
$('#background img').css('marginLeft', -1 * parseInt($('#background img').width() / 2));
}
} else {
if ($('#background img').width() < $('#background').width()) {
$('#background').addClass('horizontal').removeClass('vertical');
$('#background img').css('marginLeft', 0);
}
}
};
/**********************************************************************
functions for sponsor logo rotation
**********************************************************************/
var x = 15;
var y = 1;
function StartTimer() {
$('#sponMenu2').hide();
$('#sponMenu3').hide();
random_num = (Math.round((Math.random()*1)+1));
if (random_num == 1) {
$('#sponMenu2').toggle();
setTimeout("switchSponsers()" , 15000);
}
else {
$('#sponMenu3').toggle();
setTimeout("switchSponsers()" , 15000);
}
}
function switchSponsers(){
$('#sponMenu2').toggle();
$('#sponMenu3').toggle();
setTimeout("switchSponsers()", 15000);
}
/**********************************************************************
functions for sponsor logo rotation
**********************************************************************/
var lbWindow = "";
function launchLB(syn,debug,alt){
var lbLaunchPage = "/en_US/realtime/lb.html?";
if (hasReqestedFlashVersion && NPRuntime){
var d = new Date()
var t = d.getTime()
lbLaunchPage += "ts=" + t;
lbLaunchPage += (syn)?"&syn="+syn:"&syn=";
lbLaunchPage += (debug && debug.indexOf("debug")>-1)?"&db=true":"&db=false";
lbLaunchPage += "&ref=" + document.location.host + document.location.pathname;
lbLaunchPage += (alt)?"&alt="+alt:"&alt=";
if (lbWindow.closed || lbWindow==""){
lbWindow = window.open(lbLaunchPage,"vcWindow","width=525,height=623,top=0,left=0")
if (lbWindow.opener == null) lbWindow.opener=self;
}
lbWindow.focus();
} else {
//user doesn't have flash9:
document.location.href = "/en_US/flashupgrade.html?fl=" + hasReqestedFlashVersion + "&br=" + NPRuntime + "&sh=true";
}
}
/**********************************************************************
Function to launch standalone radio
**********************************************************************/
var radioWindow = "";
var radiolaunchPage;
function launchRadio(stream,debug){// where stream in("0","1","2") debug in(true,false) - stream not needed for USO.
var radioLaunchPage = "/en_US/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_US";// + lang;
radioLaunchPage += "&stream=0";// + stream;
if (radioWindow.closed || radioWindow==""){
radioWindow = window.open(radioLaunchPage,"radioWindow","width=420,height=195,top=50,left=50,resizable=no,location=no");
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";
document.location.href = "/en_US/flashupgrade.html?fl=" + hasReqestedFlashVersionALC + "&br=" + NPRuntime;
}
}
/**********************************************************************
This function launches the live video console
**********************************************************************/
var alWindow = "";
function launchALC(video_ref,syn,debug,alt){
var alLaunchPage = "/en_US/console/console.html?";
if (hasReqestedFlashVersionALC && NPRuntime){
var d = new Date()
var t = d.getTime()
alLaunchPage += "ts=" + t;
if ((video_ref == '1516')
|| (video_ref == 'dr')
|| (video_ref == 'fg')
|| (video_ref == 'ac')
|| (video_ref == 'p3')
|| (video_ref == 'ir')
|| (video_ref == 'me')) {
alLaunchPage += '&video=' + video_ref;
}
else{
alLaunchPage += '&video=';
}
alLaunchPage += (syn)?"&syn="+syn:"&syn=";
alLaunchPage += (debug)?"&db=true":"&db=false";
alLaunchPage += "&ref=" + document.location.host + document.location.pathname;
alLaunchPage += (alt)?"&alt="+alt:"&alt=";
if (alWindow.closed || alWindow==""){
alWindow = window.open(alLaunchPage,"alWindow","width=960,height=540,top=0,left=0,resizable=no,location=no")
if (alWindow.opener == null) alWindow.opener=self;
}
alWindow.focus();
} else {
//user doesn't have flash9:
document.location.href = "http://2010.masters.com/en_US/flashupgrade.html?fl=" + hasReqestedFlashVersionALC + "&br=" + NPRuntime;
}
}

