/* to get leaderboard to disappear for now, set display to none in leaderboard_left.ssi and commented out part of doScoreboardControl function */
/* 4/20/11 RLL commented out getPanel, Leaderboard Panel and news Panel functions to completely turn off the panels */
var reelExpanded = false;
var newsExpanded = false;
var scoreboardExpanded = false;
var scoreboardBig = false;
var newsBig = false;
var preTournament = false;
var postTournament = true;
var bgvideoWritten = false;
var overlayOpen = false;
var contentOverlayOpen = false;
var noFlashText = "<div style=\"float:left; width:100%; margin-top:25%; text-align:center;\" class=\"noflashtext\"><a href=\"/en_US/flashupgrade.html?fl=false\">Flash 10 is necessary<br/>to view this content.<br/>Upgrade here.</a></div>";
/********************************************************************
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 reelOpen;
var newsOpen;
var scoresOpen;
/********************************************************************
variables for user initiated panel interactions
********************************************************************/
var uiReelOpen = false;
var uiNewsOpen = false;
var uiNewsSizeBig = false;
var uiScoresOpen = true;
var uiScoresSizeBig = false;
var uiLiveReelClosed = false;
/********************************************************************
variable for message refresh
********************************************************************/
var messageRefresh = 300000;
var rightNewsRefresh = 300000;
/********************************************************************
variabies for sublevel index page promos
********************************************************************/
var scores_promos = true;
var players_promos = true;
var guide_promos = true;
var news_promos = true;
var course_promos = true;
var history_promos = true;
var showBgImage; //variable to determine whether or not background image is being shown
var geoblock = "false";
function geoBlock(geo,geovalue){
if (geovalue)
geovalue = "true";
else{
geovalue = "false";
}
$.cookie("geo_cookie",geovalue,{ path: '/' });
if(shedAllGeos){ $('#subPromo1').hide(); } //do this when shedding content
geoblock = geovalue;
}
/********************************************************************
get or set geoblock cookie
********************************************************************/
$(function(){
if($.cookie("geo_cookie")){
geoblock = $.cookie("geo_cookie");
} 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);
}
});
/********************************************************************
get or set panel cookie
********************************************************************/
function setPanels(which){
if(which == "news"){
if(newsExpanded){ uiNewsOpen = true; }
else { uiNewsOpen = false; }
if($.cookie("newspanel")){ $.cookie("newspanel",null); }
$.cookie("newspanel",uiNewsOpen+'|'+newsBig,{ path: '/' });
}
if(which == "scores"){
if(scoreboardExpanded){ uiScoresOpen = true; }
else { uiScoresOpen = false; }
if($.cookie("scorespanel")){ $.cookie("scorespanel",null); }
$.cookie("scorespanel",uiScoresOpen+'|'+scoreboardBig,{ path: '/' });
}
if(which == "reel"){
if(reelExpanded){ uiReelOpen = true; }
else { uiReelOpen = false; }
if($.cookie("reelpanel")){ $.cookie("reelpanel",null); }
$.cookie("reelpanel",uiReelOpen,{ path: '/' });
if(livevideo && !reelExpanded){
uiLiveReelClosed = true;
if($.cookie("livereel")){ $.cookie("livereel",null); }
$.cookie("livereel",uiLiveReelClosed,{ path: '/' });
}
}
}
function getPanels(){
/*if($.cookie("newspanel")){
var tmp = $.cookie("newspanel");
if(tmp){
tmp = tmp.split('|');
uiNewsOpen = tmp[0];
uiNewsSizeBig = tmp[1];
doNewsControl('uicookie');
}
}
if($.cookie("scorespanel")){
var tmp = $.cookie("scorespanel");
if(tmp){
tmp = tmp.split('|');
uiScoresOpen = tmp[0];
uiScoresSizeBig = tmp[1];
doScoreBoardControl('uicookie');
}
}*/
if($.cookie("reelpanel")){
uiReelOpen = $.cookie("reelpanel");
if(uiReelOpen){ doReelControl('uicookie'); }
}
}
function getLiveReel(){
if($.cookie("livereel")){
uiLiveReelClosed = $.cookie("livereel");
if(!uiLiveReelClosed){doReelControl();}
reelExpanded = true;
} else {
if(!uiLiveReelClosed){doReelControl();}
reelExpanded = true;
}
}
function getLeaderboardPanel(){
/*if(!$.cookie("firsttime")){
$.cookie("firsttime","false",{ path: '/' });
doScoreBoardControl();
setPanels('scores');
}*/
}
$(document).ready(function(){
if( $("h1").html() != null ) {
var pagetitle = $("h1").html().replace('&amp;','&');
document.title="2011 Masters Tournament - " + pagetitle;
} else {
document.title="2011 Masters Tournament";
}
if(section != "popout" && section != "welcome"){
//check to see if panels should be open
getPanels();
setTimeout(function(){
var deferred = jQuery.Deferred(function(){ getRelatedContent(); });
deferred.done(function(){
initReel();
if(livevideo && geoblock == "false"){
getLiveReel();
}
getLeaderboardPanel();
});
deferred.resolve(); //not sure why this has to be here, but it breaks if it's not
},100);
//setTimeout('getRelatedContent()',100);
$('a.photooverlay').children('img').bind("contextmenu",function(e){ return false; });
$('#background img').bind("contextmenu",function(e){ return false; });
}
loadNewsContent();
var path = location.pathname.substring(0);
var url = location.href;
//if (path.indexOf('/players/') != -1){path = "/en_US/players/index.html";}
//if (path.indexOf('/players/') != -1){path = "/en_US/players/invitees_2011.html";}
if (path.indexOf('/stats/') != -1){path = "/en_US/scores/stats/index.html";}
if (path.indexOf('/articles/') != -1){path = "/en_US/news/articles/index.html";}
if (path.indexOf('/photos/') != -1){path = "/en_US/news/photos/index.html";}
if (path.indexOf('/discover/timeline.html') != -1){path = "/en_US/discover/timeline.html";}
$('#navbar .elements ul li').each(function(){
if($(this).attr('id') == section){
$(this).children('a').addClass('selected');
}
});
$('#subnavbar ul li a[href$="' + path + '"]').addClass('selected');
//font replacement
Cufon.replace('.breuertext', {hover:'true', fontFamily:'Breuer'});
Cufon.replace('.breuertext2', {fontFamily: 'Breuer'});
Cufon.replace('.breuerbold', {fontFamily: 'Breuer Bold'});
Cufon.replace('#nutchContainer .button', {fontFamily: 'Breuer Bold'});
Cufon.replace('#nutchContainer .tabsSearch .middle', {fontFamily: 'Breuer'});
Cufon.replace('#nutchContainer .sortContainer .label', {fontFamily: 'Breuer'});
Cufon.replace('#nutchContainer .paginationContainer .pager', {fontFamily: 'Breuer'});
if (document.all){$("#nav li").hoverClass("over"); }
initBackground();
StartTimer();
setupiPadPageScroll();
}); /* 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 closes the flashdetect box
**********************************************************************/
function closeFlashContent(){
$('#flashcontent').hide();
clipComplete();
}
/**********************************************************************
This function checks to see if cookie exists and passes param for
playing the intro video
**********************************************************************/
function play_intro(cookie_name){
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
if ( results )
return true;
else
return false
}
/**********************************************************************
This function toggles the state of the leaderboard drawer
**********************************************************************/
function doScoreBoardControl(which){
/*if(which && which == 'uicookie'){
if(uiScoresOpen == 'true'){
scoreboardExpanded = true;
if(uiScoresSizeBig == 'true'){
$('#scoresLeftMiddle').addClass('expanded');
$('#scoresLeftContent').addClass('expanded');
$('#scoreboardList').addClass('expanded');
$('#scoresLeftContent').children('#expandButton').html('<a onclick="changeLBSize();"><img src="/images/misc/show_less.gif" width="65" height="18" border="0" alt="Show Less"/></a>');
scoreboardBig = true;
}
getFeaturedPlayers(); //call this function to get data and load panel when opened
$('#scoresLeftContainer').css('left','0px');
$('#scoresControlOpen').hide();
} else if(uiScoresOpen == 'false') {
scoreboardExpanded = false;
$('#scoresLeftContainer').css('left','-282px');
$('#scoresControlOpen').show();
loopTimer(); //call this function to clear refresh when panel is closed
}
} else {
if(scoreboardExpanded){
scoreboardExpanded = false;
$('#scoresLeftContainer').animate({left:-282},1000,function(){
$('#scoresControlOpen').show();
});
loopTimer(); //call this function to clear refresh when tab is closed
}else{
scoreboardExpanded = true;
$('#scoresLeftContainer').animate({left:0},1000,function(){
getFeaturedPlayers(); //call this function to get data and load panel when opened
});
$('#scoresControlOpen').hide();
}
}
if(which && which == 'scores'){
setPanels('scores');
if(scoreboardExpanded){ panelMeasure('scores','open'); }
else { panelMeasure('scores','close'); }
}*/
}
function changeLBPage(){
measureApp('Leaderboard','Slideout','Expand');
if(browser.isIPad || browser.isIPhone){
document.location.href = "/en_US/scores/index.tablet.html";
} else {
document.location.href = "/en_US/scores/index.html";
}
}
/**********************************************************************
This function toggles the height of the leaderboard drawer
**********************************************************************/
function changeLBSize(){
if(scoreboardBig){
scoreboardBig = false;
$('#scoresLeftMiddle').animate({height: '189'}, 1000);
$('#scoresLeftContent').animate({height: '189'}, 1000);
$('#scoreboardList').animate({height: '114'}, 1000);
$('#scoresLeftContent').children('#expandButton').html('<a onclick="changeLBSize();"><img src="/images/misc/show_more.gif" width="65" height="18" border="0" alt="Show More"/></a>');
$('#scoresLeftMiddle').removeClass('expanded');
$('#scoresLeftContent').removeClass('expanded');
$('#scoreboardList').removeClass('expanded');
panelMeasure('scores','Show Less');
} else {
scoreboardBig = true;
$('#scoresLeftMiddle').animate({height: '339'}, 1000);
$('#scoresLeftContent').animate({height: '339'}, 1000);
$('#scoreboardList').animate({height: '266'}, 1000);
$('#scoresLeftContent').children('#expandButton').html('<a onclick="changeLBSize();"><img src="/images/misc/show_less.gif" width="65" height="18" border="0" alt="Show Less"/></a>');
$('#scoresLeftMiddle').addClass('expanded');
$('#scoresLeftContent').addClass('expanded');
$('#scoreboardList').addClass('expanded');
panelMeasure('scores','Show More');
}
setPanels('scores');
}
/**********************************************************************
This function load/refreshes the content in the latest news drawer
and latest news popout
**********************************************************************/
function loadNewsContent(){
/*if(newsBig || uiNewsSizeBig == 'true'){
$('#rightNewsUpdates.expanded').load(news_right_updates,function(){ Cufon.replace('#newsRightUpdates .breuertext', {hover:'true', fontFamily:'Breuer'}); });
$('#rightNewsArticles.expanded').load('/en_US/includes/news_right_articles.ssi',function(){ Cufon.replace('#newsRightArticles .breuertext', {hover:'true', fontFamily:'Breuer'}); });
} else {
$('#rightNewsUpdates').load(news_right_updates,function(){ Cufon.replace('#newsRightUpdates .breuertext', {hover:'true', fontFamily:'Breuer'}); });
$('#rightNewsArticles').load('/en_US/includes/news_right_articles.ssi',function(){ Cufon.replace('#newsRightArticles .breuertext', {hover:'true', fontFamily:'Breuer'}); });
}
if(newsExpanded){
setTimeout('loadNewsContent()',rightNewsRefresh);
}*/
}
function loadNewsPopContent(){
$('#newspopupdates').load(newspop_live_updates,function(){ Cufon.replace('#newspopupdates .breuertext', {hover:'true', fontFamily:'Breuer'}); });
$('#newspoparticles').load('/en_US/includes/newspop_articles.ssi',function(){ Cufon.replace('#newspoparticles .breuertext', {hover:'true', fontFamily:'Breuer'}); });
setTimeout('loadNewsPopContent()',rightNewsRefresh);
}
/**********************************************************************
This function toggles the state of the latest news drawer
**********************************************************************/
function doNewsControl(which){
/*if(which && which == 'uicookie'){
if(uiNewsOpen == 'true'){
newsExpanded = true;
if(uiNewsSizeBig == 'true'){
$('#newsRightMiddle').addClass('expanded');
$('#rightNewsUpdates').addClass('expanded');
$('#rightNewsArticles').addClass('expanded');
$('#newsRightContent').children('#expandButton').html('<a onclick="changeNewsSize();"><img src="/images/misc/show_less.gif" width="65" height="18" border="0" alt="Show Less"/></a>');
newsBig = true;
}
loadNewsContent();
$('#newsRightContainer').css('right','0px');
$('#newsControlOpen').hide();
} else if(uiNewsOpen == 'false') {
newsExpanded = false;
$('#newsRightContainer').css('right','-282px');
$('#newsControlOpen').show();
}
} else {
if(newsExpanded){
newsExpanded = false;
$('#newsRightContainer').animate({right:-282},1000,function(){
$('#newsControlOpen').show();
});
}else{
newsExpanded = true;
$('#newsRightContainer').animate({right:0},1000,function(){
loadNewsContent();
});
$('#newsControlOpen').hide();
}
}
if(which && which == 'news'){
setPanels('news');
if(newsExpanded){ panelMeasure('news','open'); }
else { panelMeasure('news','close'); }
}*/
}
/**********************************************************************
This function toggles the height of the news drawer
**********************************************************************/
function changeNewsSize(){
if(newsBig){
newsBig = false;
$('#newsRightMiddle').animate({height: '189'}, 1000);
$('#rightNewsUpdates').animate({height: '88'}, 1000);
$('#rightNewsArticles').animate({height: '84'}, 1000);
$('#newsRightContent').children('#expandButton').html('<a onclick="changeNewsSize();"><img src="/images/misc/show_more.gif" width="65" height="18" border="0" alt="Show More"/></a>');
$('#newsRightMiddle').removeClass('expanded');
$('#rightNewsUpdates').removeClass('expanded');
$('#rightNewsArticles').removeClass('expanded');
panelMeasure('news','Show Less');
} else {
newsBig = true;
$('#newsRightMiddle').animate({height: '339'}, 1000);
$('#rightNewsUpdates').animate({height: '164'}, 1000);
$('#rightNewsArticles').animate({height: '150'}, 1000);
$('#newsRightContent').children('#expandButton').html('<a onclick="changeNewsSize();"><img src="/images/misc/show_less.gif" width="65" height="18" border="0" alt="Show Less"/></a>');
$('#newsRightMiddle').addClass('expanded');
$('#rightNewsUpdates').addClass('expanded');
$('#rightNewsArticles').addClass('expanded');
panelMeasure('news','Show More');
}
setPanels('news');
}
/**********************************************************************
This function is called to measure actions from the panels
**********************************************************************/
function panelMeasure(which,action,description){
var which_panel;
if(which == 'news'){ which_panel = "Latest News Panel"; }
if(which == 'scores'){ which_panel = "Leaderboard Panel"; }
if(which == 'reel'){ which_panel = "Video Reel"; }
if(description){
measureApp(which_panel, action, description);
} else {
measureApp(which_panel, action);
}
}
/**********************************************************************
These functions is called when a clip is started, it hides the play
box and closes all panels
**********************************************************************/
function clipStart(){
$('#articleTitle').hide();
$('#videoTitle').hide();
$('#videoReplay').hide();
//$('#overlayReplay').hide();
if(overlayOpen){
if(reelExpanded){ doReelControl(); }
} else {
if(reelExpanded){ doReelControl(); }
if(newsExpanded){ doNewsControl(); }
if(scoreboardExpanded){ doScoreBoardControl(); }
}
}
/**********************************************************************
This function is called when a user clicks the popout button for the
small scoreboard or small news panels
**********************************************************************/
function openPopout(which){
if(which=="news"){
window.open("http://2011.masters.com/en_US/news/newspop.html","newsPop","width=257,height=423,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no");
//loadNewsPopContent();
panelMeasure('news','open popout');
}
if(which=="scores"){
window.open("http://2011.masters.com/en_US/scores/scorespop.html","scoresPop","width=298,height=416,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no");
panelMeasure('scores','open popout');
}
}
/**********************************************************************
This function is called when a user clicks an image to see the large
image in the overlay
**********************************************************************/
//measure video reel selections
function measureRelatedPhoto(photourl){
measureApp('Background Video','Video Reel','play',vidurl);
}
function openOverlayPhoto(image,width,height,capcred){
$('#fade').show();
$('#light').show();
$('#otherPlayer').hide();
$('#overlayPhotoContent').show();
$('#overlayPhoto').show();
$('#overlayPhoto').css('width',width+'px');
$('#overlayPhoto .image').html('<img src="'+image+'" width="'+width+'" height="'+height+'" border="0" alt=""/>');
if(capcred){
var tmp = capcred.split('|');
$('#overlayPhoto .caption').html(tmp[0]);
$('#overlayPhoto .credit').html(tmp[1]);
}
$('#overlayPhoto .image').bind("contextmenu",function(e){ return false; });
}
function closeOverlayPhoto(){
$('#overlayPhotoContent .image').html('');
$('#overlayPhotoContent .caption').html('');
$('#overlayPhotoContent .credit').html('');
$('#overlayPhotoContent').hide();
$('#overlayPhoto').hide();
$('#overlayHtmlContentWrapper').html('');
$('#overlayHtml').hide();
//$('#overlayPhotoContent .close').hide();
$('#fade').hide();
$('#light').hide();
overlayOpen = false;
}
/**********************************************************************
This function is called when a user clicks a more link in the history
timeline and it should show the content in a light box
**********************************************************************/
function openContentOverlay(urlToContent){
if(!contentOverlayOpen){
$('#fade').show();
$('#light').show();
$('#otherPlayer').hide();
$('#overlayPhoto').hide();
$('#overlayHtml').show();
} else {
$('#overlayHtml #overlayHtmlContentWrapper').html('');
}
$('#overlayHtml #overlayHtmlContentWrapper').load(urlToContent, function(){
$('#pagecontent.overlay .scroll-pane').jScrollPane({showArrows: true});
Cufon.replace('#pagecontent.overlay .breuerbold', {fontFamily:'Breuer'});
});
contentOverlayOpen = true;
}
function closeContentOverlay(){
$('#overlayHtml #overlayHtmlContentArea').html('');
$('#overlayHtml').hide();
$('#fade').hide();
$('#light').hide();
contentOverlayOpen = false;
overlayOpen = false;
}
/**********************************************************************
These functions manipulate the background image when resizing the
browser window
**********************************************************************/
function initBackground() {
$(window).resize(backgroundResizeHandler);
$(window).trigger('resize');
};
var backgroundResizeHandler = function() {
// add the background if it does not exists (typically this is only for the home page)
if(browser.isIPad || browser.isIPhone) {
if($('#background').length == 0 && latestImageFile != "") {
//alert("no background found " + $('#background').length + "<");
// create background div
var bg = document.createElement("div");
bg.setAttribute("id","background");
bg.setAttribute("class", "vertical");
// create image
var bgImg = document.createElement("img");
bgImg.setAttribute("src", latestImageFile);
bg.appendChild(bgImg);
document.body.insertBefore(bg, document.getElementById("footer"));
}
}
// 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;
}
// ipad
var landscape = false;
if(browser.isIPad || browser.isIPhone) {
landscape = (window.orientation % 180) ? true : false;
if (!$('#background').addClass('vertical')) {
$('#background').addClass('vertical').removeClass('horizontal');
}
$('#background').removeClass('horizontal');
$('#background img').css('marginLeft', -1 * parseInt($('#background img').width() / 2));
}
// everything else
else {
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 to set gallery cookie then go to gallery page
**********************************************************************/
function loadPhotoGallery(path){
setGallery(path);
document.location.href = "/en_US/news/photos/gallery.html";
}
/**********************************************************************
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()" , 30000);
}
else {
$('#sponMenu3').toggle();
setTimeout("switchSponsers()" , 30000);
}
}
function switchSponsers(){
$('#sponMenu2').toggle();
$('#sponMenu3').toggle();
setTimeout("switchSponsers()", 30000);
}
/**********************************************************************
change font size
**********************************************************************/
var size = 1;
var newsize = 1;
function getLarger(){
newsize = size + .1;
var article_text = changeableContent();
if (article_text != null){
$(article_text).css('font-size',newsize+'em');
}
$('.fontSizeChange').attr("src","/images/misc/font-size-change-m.gif")
measureApp('fontlarger');
}
function getLargest(){
newsize = size + .3;
var article_text = changeableContent();
if (article_text != null){
$(article_text).css('font-size',newsize+'em');
}
$('.fontSizeChange').attr("src","/images/misc/font-size-change-l.gif")
measureApp('fontlargest');
}
function getNormal(){
var article_text = changeableContent();
if (article_text != null){
$(article_text).css('font-size',size+'em');
}
$('.fontSizeChange').attr("src","/images/misc/font-size-change.gif")
measureApp('fontnormal');
}
function changeableContent(){
// get the article element
theArticle = $('.articleText');
if(theArticle){ return theArticle;}
else { return null; }
}
/**********************************************************************
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=298,height=104,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 == 'fg1')
|| (video_ref == 'fg2')
|| (video_ref == 'ac')
|| (video_ref == 'p3')
|| (video_ref == 'ir')
|| (video_ref == 'mid')) {
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();
if(!newsExpanded){
doNewsControl('');
if(!newsBig){
changeNewsSize();
}
}
if(reelExpanded){ doReelControl(); }
} else {
//user doesn't have flash9:
document.location.href = "http://2011.masters.com/en_US/flashupgrade.html?fl=" + hasReqestedFlashVersionALC + "&br=" + NPRuntime;
}
}
/**********************************************************************
This function sets up page scrolling on iPads and iPhones keeping
the header and footer fixed.
**********************************************************************/
function setupiPadPageScroll() {
var path = location.pathname.substring(0);
var url = location.href;
// if browser is iOS AND
// 		user is not on home
//		user is not on scores
//		page does not contain gallery photos
//		user is not on highlights page
if((browser.isIPad || browser.isIPhone) && section != "home" && section != "scores" && section != 'welcome' &&
typeof(photos) == "undefined" && (path.indexOf('/discover/mobile.html') == -1) &&
(path.indexOf('/discover/timeline.html') == -1) &&
(path.indexOf('/discover/timeline.ipad.html') == -1)) {
// stop the window from scrolling
document.body.addEventListener("touchmove", touchMove, false);
// Create a new YUI instance and populate it with the required modules.
YUI().use('scrollview', function (Y) {
// get the initial height of the window
var initialHeight = (Y.DOM.winHeight());
// ScrollView is available and ready for use.
var scrollView = new Y.ScrollView({
id:"pageScrollContainer",
srcNode:"#pagecontainer",
height:initialHeight
});
// render the scrollview
scrollView.render();
// adjust the height of the scrollview when the device orientation changes
Y.on("orientationchange", function (e) {
var orientation = (Y.config.win.orientation % 180) ? "landscape" : "portrait",
prevOrientation = (orientation == "portrait") ? "landscape" : "portrait";
scrollView.set("height", (Y.DOM.winHeight() + 29));
Y.one("body").replaceClass(prevOrientation, orientation);
});
});
}
// on home page no scroll
else if((browser.isIPad || browser.isIPhone) && section == "home") {
$("#background_video").hide();
}
/*
// on gallery page no scroll
if((browser.isIPad || browser.isIPhone) && typeof(photos) != "undefined") {
//alert("p");
//$("#pagecontainer").css("-webkit-transform", "translate3d(0px, -142px, 0px)");
setTimeout(function() {
$("#pagecontainer").removeAttr("style");
}, 500);
}
*/
}
function touchMove(event) {
event.preventDefault();
}

