var stopEventBubbling=true;var wgtWidth=1012;var wgtHeight=675;var centeredLeftX=parseInt(((screenX-wgtWidth)/2),10);var centeredTopY=parseInt(((screenY-wgtHeight)/2),10);var baseSitePath="/";var offsetURL="";var defaultURL="gameclient.aspx";var clientURL="gameclient.aspx";var siteURL="home.aspx";var privacyURL="privacy.aspx";var accountURL="user/myaccount.aspx";var loginURL="home.aspx";var logoutURL="logout.aspx";var registerURL="register.aspx";var profileBaseURL="members/";var tourneyBaseURL="tournaments/";var tourneyEnterURL="tournaments/enter.aspx";var tourneyDetailURL="tournaments/details.aspx";var tourneyRulesURL="tournaments/rules.aspx";var tourneyPrizesURL="tournaments/prizes.aspx";var tourneyLeaderboardURL="tournaments/leaderboard.aspx";var tourneyCalendarPastURL="tournaments/calendar.aspx?show=past";var forgotPasswordURL="user/EmailForgottenPassword.aspx";var myMessagesURL="user/conversations/default.aspx";var proShopBasePath="proshop/";var playersHomeURL="players.aspx";var forumsBasePath="forums/";var newsBasePath="news/";var flashGameClientID="gameclient";var flashUberID="uberwidget";var gameClientWindow=null;var communitySiteWindow=null;var detectCookiesEnabled=false;var isNewPrivateMessages=false;var userCreditBalance=0;if(typeof(console)=="undefined"){var console={log:function(b){if(debug){var a=((b!==null)&&(b!=="")&&(typeof(b)!="undefined"))?b:"intentionally left blank?!";alert(b)}}}}var debug=(typeof(console)=="object")&&!true;function debugOut(a){if(debug){var b=((a!==null)&&(a!=="")&&(typeof(a)!="undefined"))?a:"intentionally left blank?!";console.log(b)}}function toggleDebugMode(a){debug=!debug;if(a){return handleEventCall(a)}}function getX(a){return document.getElementById(a)}function getUA(){var a=("browser" in BrowserDetect)?BrowserDetect.browser:"n.a.";a+="_Version_";a+=("version" in BrowserDetect)?BrowserDetect.version:"n.a.";return a}function friendAdd(a){if(getWindowName()!="site"){console.log("function call not in community site, hence no uber widget!")}else{if(getX(flashUberID)){try{getX(flashUberID).NeutronFriendAdd(a);debugOut("uber widget call to add: "+a)}catch(b){debugOut("your flash does not populate the NeutronFriendAdd() method to JS - error: "+b)}}else{debugOut("no flash object with ID: "+flashUberID)}}}function friendRemove(a){if(getWindowName()!="site"){debugOut("function call not in community site, hence no uber widget!")}else{if(getX(flashUberID)){try{getX(flashUberID).NeutronFriendRemove(a);debugOut("uber widget call to remove: "+a)}catch(b){debugOut("your flash does not populate the NeutronFriendAdd() method to JS - error: "+b)}}else{debugOut("no flash object with ID: "+flashUberID)}}}function getUserStates(a){if(getWindowName()!="site"){debugOut("function call not in community site, hence no uber widget!")}else{if(getX(flashUberID)){try{debugOut("uber widget call to gather states of: "+a);return getX(flashUberID).getUserStates(a)}catch(b){debugOut("your flash does not populate the getUserStates() method to JS - error: "+b)}}else{debugOut("no flash object with ID: "+flashUberID)}}}function getUsersFriendCount(){if(getWindowName()!="site"){debugOut("function call not in community site, hence no uber widget!")}else{if(getX(flashUberID)){try{debugOut("uber widget call to gather number of friends of current player.");return getX(flashUberID).getUsersFriendCount()}catch(a){debugOut("your flash does not populate the getUsersFriendCount() method to JS - error: "+a)}}else{debugOut("no flash object with ID: "+flashUberID)}}}var iFrameChannelID="iframeChannel"+Math.random();var jsCommID="JSComm";function sendJavaScriptEventToSiteShell(b){try{getX(jsCommID).sendJavaScriptEventToSiteShell(b)}catch(a){console.log("Could not send event to game: "+a)}}function onJavaScriptEventToSiteShellSent(a){}function onJavaScriptEventToSiteShellNotSent(inEventText){try{eval(inEventText)}catch(err){console.log("Could not resend event to game: "+err)}}function onJavaScriptEventFromSiteShell(inEventText){try{eval(inEventText)}catch(err){console.log("Could not execute event from siteshell: "+err)}}function sendJavaScriptEventToIFrame(a){getX(jsCommID).sendJavaScriptEventToIFrame(a)}function onJavaScriptEventFromIFrame(inEventText){try{eval(inEventText)}catch(err){console.log("Could not execute event from iframe: "+err)}}function sendJavaScriptEventToCommunitySite(inEventText,inbFirstOnly){try{if(getX(jsCommID)){eval(inEventText);return}getX(flashGameClientID).sendJavaScriptEventToCommunitySite(inEventText,inbFirstOnly)}catch(err){console.log("Could not resend event to site: "+err)}}function onJavaScriptEventToCommunitySiteSent(a){}function onJavaScriptEventToCommunitySiteNotSent(inEventText){try{eval(inEventText)}catch(err){console.log("Could not resend event to site: "+err)}}function onJavaScriptEventFromCommunitySite(inEventText){try{eval(inEventText)}catch(err){console.log("Could not execute event from site: "+err)}}function sendJavaScriptEventToIFrameParent(a){getX(jsCommID).sendJavaScriptEventToIFrameParent(a)}function onJavaScriptEventFromIFrameParent(inEventText){try{eval(inEventText)}catch(err){console.log("Could not execute event from parent: "+err)}}function onJavaScriptEventToIFrameParentSent(a){}function onJavaScriptEventToIFrameParentNotSent(a){console.log("onJavaScriptEventToIFrameParentNotSent: "+a)}function onJSCommTrace(a){}function onJavaScriptEventToIFrameSent(a){}function onJavaScriptEventToIFrameNotSent(a){console.log("onJavaScriptEventToIFrameNotSent: "+a)}function openGameClient(a){var b="http://"+document.location.host+baseSitePath+clientURL;openWindowAndLoadUrl(b,"client");if(a){return handleEventCall(a)}}function closeGameClient(){var a=false;if(getWindowName()=="client"){a=(getWindow("site")!==false)?getWindow("site").closeWindow("client"):false}else{if(getWindowName()=="site"){a=closeWindow("client")}else{a=false}}return a}function onCloseGameClient(b){if(getX(flashUberID)){try{getX(flashUberID).onGameClientClosed();debugOut("game client closed!")}catch(a){debugOut("your flash does not populate the onUnload() method to JS - error: "+a)}}else{debugOut("no flash object with ID: "+flashUberID)}if(b){return handleEventCall(b)}}function _setGameClientView(view,JSON){gameClientWindow=openWindow("client");if(typeof(gameClientWindow)=="undefined"){openWindowAndLoadUrl("","client")}else{if(gameClientWindow==false||gameClientWindow.location.toString().indexOf("about:blank",0)!=-1){debugOut("no game client present, opening new - view: "+view+", JSON: "+JSON);var tempClientURL=clientURL;var JSONVal=eval("("+JSON+")");if(JSONVal.Brand&&(JSONVal.Brand=="USGA")){tempClientURL+="?group=USGA&view="+escape(view)+"&JSON="+escape(JSON)}else{tempClientURL+="?view="+escape(view)+"&JSON="+escape(JSON)}var newURL="http://"+document.location.host+baseSitePath+tempClientURL;openWindowAndLoadUrl(newURL,"client")}else{if(gameClientWindow.getX(flashGameClientID)){try{gameClientWindow.getX(flashGameClientID).setView(view,JSON);gameClientWindow.focus();debugOut("game client set to view: "+view+", JSON: "+JSON)}catch(err){debugOut("your flash does not populate the setView() method to JS - error: "+err)}}else{debugOut("no flash object with ID: "+flashGameClientID)}}}}function _startEquipClubs(b){var c=((b=="")||(b==null)||(typeof(b)=="undefined"))?"":b;var a='{ "Brand" : "'+c+'" }';_setGameClientView("equipClubs",a)}function startEquipClubs(a){sendJavaScriptEventToSiteShell("_startEquipClubs('"+a+"')")}function _startSiteShellPage(a,c){var f=((c=="")||(c==null)||(typeof(c)=="undefined"))?"":c;var d={ClosestToTheHoleTournaments:"",StrokePlayTournaments:"",SelectACourse:"",Tutorials:"",Prizes:"",MainMenu:""};var b="MainMenu";if(a in d){b=a}var e='{ "Page" : "'+b+'", "Brand" : "'+f+'" }';_setGameClientView("setPage",e)}function startSiteShellPage(a,b){sendJavaScriptEventToSiteShell("_startSiteShellPage('"+a+"','"+b+"')")}function _startTourney(g,d,f,e,b){var c=((b=="")||(b==null)||(typeof(b)=="undefined"))?"":b;var a='{ "TournamentId" : "'+g+'", "GameType" : "'+d+'", "GameCourseId" : "'+f+'", "TournamentDefinitionUrl" : "'+e+'", "Brand" : "'+c+'" }';_setGameClientView("tourney",a)}function startTourney(e,b,d,c,a){sendJavaScriptEventToSiteShell("_startTourney('"+e+"','"+b+"','"+d+"','"+c+"','"+a+"')")}function _startGame(b,g,e,d,f,c){var h=((c=="")||(c==null)||(typeof(c)=="undefined"))?"":c;var i="front_9";if(f in {front_9:"",back_9:"",full_18:"",random_3:""}){i=f}var a='{ "GameMode" : "'+b+'", "GameCourseId" : "'+g+'", "Wind" : "'+e+'", "TeeID" : "'+d+'", "Holes" : "'+i+'", "Brand" : "'+h+'" }';_setGameClientView("game",a)}function startGame(f,e,c,d,b,a){sendJavaScriptEventToSiteShell("_startGame('"+f+"','"+e+"','"+c+"','"+d+"','"+b+"','"+a+"')")}function _startPracticeHole(e,f,c,d,b){var g=((b=="")||(b==null)||(typeof(b)=="undefined"))?"":b;var a='{ "HoleNum" : "'+e+'", "GameType" : "'+1+'", "GameMode" : "'+2+'", "Wind" : "'+c+'", "TeeID" : "'+d+'", "GameCourseId" : "'+f+'", "Brand" : "'+g+'" }';_setGameClientView("practiceHole",a)}function startPracticeHole(d,e,b,c,a){sendJavaScriptEventToSiteShell("_startPracticeHole('"+d+"','"+e+"','"+b+"','"+c+"','"+a+"')")}function _startReplay(c,b){var d=((b=="")||(b==null)||(typeof(b)=="undefined"))?"":b;var a='{ "GUID" : "'+c+'", "Brand" : "'+d+'" }';_setGameClientView("showReplay",a)}function startReplay(b,a){sendJavaScriptEventToSiteShell("_startReplay('"+b+"','"+a+"')")}function _inviteToPlay(b,c){var d=((c=="")||(c==null)||(typeof(c)=="undefined"))?"":c;var a='{ "UserID" : "'+b+'", "Brand" : "'+d+'" }';_setGameClientView("inviteToPlay",a)}function inviteToPlay(a,b){sendJavaScriptEventToSiteShell("_inviteToPlay('"+a+"','"+b+"')")}function _createAGroup(b){var c=((b=="")||(b==null)||(typeof(b)=="undefined"))?"":b;var a='{ "Brand" : "'+c+'" }';_setGameClientView("createAGroup",a)}function createAGroup(a){sendJavaScriptEventToSiteShell("_createAGroup('"+a+"')")}function _acceptInvite(b,c){var d=((c=="")||(c==null)||(typeof(c)=="undefined"))?"":c;var a='{ "invitationID" : "'+b+'", "Brand" : "'+d+'"}';setTimeout("_setGameClientView('acceptInvite', '"+a+"');",23)}function acceptInvite(a,b){sendJavaScriptEventToSiteShell("_acceptInvite('"+a+"','"+b+"')")}function handleLocalconnectionCleanUp(c){var a=(getWindowName()=="site")?flashUberID:flashGameClientID;if(getX(a)&&getX(a).onUnload){try{getX(a).onUnload();debugOut("flash unloaded!")}catch(b){debugOut("your flash does not populate the onUnload() method to JS - error: "+b)}}else{debugOut("no flash object with ID: "+a)}if(c){return handleEventCall(c)}}function _setCommunitySitePage(a){if(a.charAt(0)=="/"){openWindowAndLoadUrl(a,"site")}else{openWindowAndLoadUrl(baseSitePath+a,"site")}}function _openCommunitySite(){_setCommunitySitePage(siteURL)}function openCommunitySite(){sendJavaScriptEventToCommunitySite("_openCommunitySite()",true)}function _openPrivacyPolicy(){_setCommunitySitePage(privacyURL)}function openPrivacyPolicy(){sendJavaScriptEventToCommunitySite("_openPrivacyPolicy()",true)}function _openProfile(a){_setCommunitySitePage(profileBaseURL+encodeUsername(a)+"/default.aspx")}function openProfile(a){sendJavaScriptEventToCommunitySite("_openProfile('"+a+"')",true)}function showProfileTab(b){var c=$("div#profileWidgetTabs a:eq("+b+")");if(c){try{c.click()}catch(a){console.log("Could not open tab",b)}}}function _openProfileAppearance(a){showProfileTab(3);_setCommunitySitePage(profileBaseURL+encodeUsername(a)+"/default.aspx#tab=3")}function openProfileAppearance(a){sendJavaScriptEventToCommunitySite("_openProfileAppearance('"+a+"')",true)}function _openAccount(){_setCommunitySitePage(accountURL)}function openAccount(){sendJavaScriptEventToCommunitySite("_openAccount()",true)}function _openForgotPassword(){_setCommunitySitePage(forgotPasswordURL)}function openForgotPassword(){sendJavaScriptEventToCommunitySite("_openForgotPassword()",true)}function _openMyMessages(){_setCommunitySitePage(myMessagesURL)}function openMyMessages(){sendJavaScriptEventToCommunitySite("_openMyMessages()",true)}function hasNewPrivateMessages(){return isNewPrivateMessages}function getUserCreditBalance(){return userCreditBalance}function _openTourneyHome(){_setCommunitySitePage(tourneyBaseURL)}function openTourneyHome(){sendJavaScriptEventToCommunitySite("_openTourneyHome()",true)}function _openTourneyPayment(a){_setCommunitySitePage(tourneyEnterURL+"?id="+escape(a))}function openTourneyPayment(a){sendJavaScriptEventToCommunitySite("_openTourneyPayment('"+a+"')",true)}function _openTourneyDetails(a){_setCommunitySitePage(tourneyDetailURL+"?id="+escape(a))}function openTourneyDetails(a){sendJavaScriptEventToCommunitySite("_openTourneyDetails('"+a+"')",true)}function _openTourneyRules(a){_setCommunitySitePage(tourneyRulesURL+"?id="+escape(a))}function openTourneyRules(a){sendJavaScriptEventToCommunitySite("_openTourneyRules('"+a+"')",true)}function _openTourneyPrizes(a){_setCommunitySitePage(tourneyDetailURL+"?id="+escape(a))}function openTourneyPrizes(a){sendJavaScriptEventToCommunitySite("_openTourneyPrizes('"+a+"')",true)}function _openTourneyLeaderboard(a){_setCommunitySitePage(tourneyLeaderboardURL+"?id="+escape(a))}function openTourneyLeaderboard(a){sendJavaScriptEventToCommunitySite("_openTourneyLeaderboard('"+a+"')",true)}function _openTourneyCalendarPast(){_setCommunitySitePage(tourneyCalendarPastURL)}function openTourneyCalendarPast(){sendJavaScriptEventToCommunitySite("_openTourneyCalendarPast()",true)}function _openRegistration(a){var b=((a=="")||(a==null)||(typeof(a)=="undefined"))?"":"?gameID="+escape(a);_setCommunitySitePage(registerURL+b)}function openRegistration(a){sendJavaScriptEventToCommunitySite("_openRegistration('"+a+"')",true)}function openUSGARegistration(){window.open("http://usga.usopen.com/2009/virtualopen/signup")}function openUSGATutorials(){parent.location.href="http://usga.usopen.com/2009/virtualopen/tutorials/"}function openUSGAPrivacyPolicy(){window.open("http://www.usopen.com/en_US/info/privacy/index.html")}function _openPlayersHome(){_setCommunitySitePage(playersHomeURL)}function openPlayersHome(){sendJavaScriptEventToCommunitySite("_openPlayersHome()",true)}function _openForumsHome(){_setCommunitySitePage(forumsBasePath)}function openForumsHome(){sendJavaScriptEventToCommunitySite("_openForumsHome()",true)}function _openNewsHome(){_setCommunitySitePage(newsBasePath)}function openNewsHome(){sendJavaScriptEventToCommunitySite("_openNewsHome()",true)}function _openProShopHome(){_setCommunitySitePage(proShopBasePath)}function openProShopHome(){sendJavaScriptEventToCommunitySite("_openProShopHome()",true)}function _openProShopSellBack(){_setCommunitySitePage(proShopBasePath+"sellback.aspx")}function openProShopSellBack(){sendJavaScriptEventToCommunitySite("_openProShopSellBack()",true)}function _openProShopBrandPage(a){_setCommunitySitePage(proShopBasePath+"products.aspx?b="+a)}function openProShopBrandPage(a){sendJavaScriptEventToCommunitySite("_openProShopBrandPage('"+a+"')",true)}function _openProShopCategoryBrandPage(b,a){_setCommunitySitePage(proShopBasePath+"products.aspx?c="+b+"&b="+a)}function openProShopCategoryBrandPage(b,a){sendJavaScriptEventToCommunitySite("_openProShopCategoryBrandPage('"+b+"','"+a+"')",true)}function _openProShopCategoryPage(a){_setCommunitySitePage(proShopBasePath+"products.aspx?c="+a)}function openProShopCategoryPage(a){sendJavaScriptEventToCommunitySite("_openProShopCategoryPage('"+a+"')",true)}function _openProShopItemPage(a){_setCommunitySitePage(proShopBasePath+"products.aspx?i="+a)}function openProShopItemPage(a){sendJavaScriptEventToCommunitySite("_openProShopItemPage('"+a+"')",true)}function _causeLogIn(){_checkForCookie("loginCookieTest")}function causeLogIn(){sendJavaScriptEventToCommunitySite("_causeLogIn()",true)}function _causeLogOut(){_setCommunitySitePage(logoutURL)}function causeLogOut(){sendJavaScriptEventToCommunitySite("_causeLogOut()",true)}function loginCookieTest(a){if(a){_setCommunitySitePage(loginURL)}else{showCookiesNotice(false)}}function encodeUsername(c){var b="";var a=false;for(var d=0;d<c.length;d++){var e=c.substr(d,1);if(/[A-Za-z0-9]/.test(e)){b+=e;a=false}else{if(!a){b+="_"}else{b=b.substr(0,b.length-1)}b+=(c.charCodeAt(d)-0).toString(16)+"00";b+="_";a=true}}return(b)}function redirectUser(a){location.href=a}function unloadGarbage(){var a=((typeof(window.name)=="undefined")||(window.name=="")||(window.name==null))?"not defined":window.name;windowObjectReference=null;debugOut("unloaded garbage in: "+a)}function unloadWindow(){try{if((window.opener!==null)&&(typeof(window.opener.self)=="object")){if(window.opener.unloadGarbage){window.opener.unloadGarbage()}}}catch(a){debugOut("failed unloading from window.opener")}}function beforeUnload(){handleLocalconnectionCleanUp();if(getWindowName()=="client"){communitySite=getWindow("site");if(communitySite!==false){communitySite.onCloseGameClient()}}}addEvent(window,"beforeunload",beforeUnload);addEvent(window,"unload",unloadWindow);addEvent(window,"unload",_EventCache.flush);