var currTeamName="";jQuery(document).ready(function(){$("#message_modal").jqm({toTop:true});$("#entry_modal").jqm({toTop:true});$("#scorecard_modal").jqm({toTop:true})});function chalEntryClose(){$("#entry_modal").jqmHide();$("#crHeader").show();$("#crHeaderConf").hide()}function scorecardClose(){$("#scorecard_modal").jqmHide();liveScorecardTeam=-1;clearTimeout(scorecardTmout)}function enterChal(a,b){$("#crHeader").show();$("#crHeaderConf").hide();$("#forentry_chalid").val(a);$("#forentry_teamid").val(b);$("#dialogwaitmsg").html("Loading ...");$("#dialogwait").dialog("open");$.ajax({type:"POST",data:$("#chal_entry_form").serialize(),url:"/chalentry/detail/"+Math.round(Math.random()),success:function(c){$("#dialogwait").dialog("close");$("#entryModContent").html(c);$("#entry_modal").jqmShow()}})}function leaveChal(a,c,b,d){$("#entryModContent").html("<h1>Leave Challenge</h1><p>Are you sure that you wish to remove team `"+d+"` from the Challenge "+b+'?</p><p>If you unregister from this challenge you will be refunded your entire registration fee.</p><br /><a class="challRegConfirm" href="javascript:leaveChalReal('+a+", "+c+');">Confirm</a><a class="challRegCancel" href="javascript:chalEntryClose();">Cancel</a><br />');$("#entry_modal").jqmShow()}function leaveChalReal(a,b){$("#forentry_chalid").val(a);$("#forentry_teamid").val(b);chalEntryClose();$("#dialogwaitmsg").html("Processing Request to Leave Challenge, please wait ...");$("#dialogwait").dialog("open");$.ajax({type:"POST",data:$("#chal_entry_form").serialize(),url:"/leavechallenge/detail/"+Math.round(Math.random()),success:function(c){$("#dialogwait").dialog("close");if(c!=""){relocate("/play")}else{$("#message_disp").html("(An error occurred while processing your request)")}}})}function enterWithNewTeam(a){$("#entry_modal").jqmHide();$("#dialogwaitmsg").html("Creating New Team for Challenge ...");$("#dialogwait").dialog("open");$.ajax({type:"POST",data:$("#chal_entry_form").serialize(),url:"/procchalentry/detail/"+Math.round(Math.random()),success:function(b){if(b!=""){relocate("/editnewfantasyteam/detail/"+b)}else{$("#dialogwait").dialog("close");$("#entryModContent").html("(An error occurred while processing your request)");$("#entry_modal").jqmShow()}}})}function enterWithExistingTeamConfirm(a){$("#entryDispHolder").hide();$("#confirmEntry").show();$("#crHeader").hide();$("#crHeaderConf").show();$("#teamNameToConfirm").html($("select#entry_team_sel option:selected").attr("id"))}function enterWithExistingTeam(a){var b=$("#entry_team_sel").val();$("#forentry_teamid").val(b);$("#forentry_chalid").val(a);$("#entry_modal").jqmHide();$("#dialogwaitmsg").html("Adding Team To Challenge ...");$("#dialogwait").dialog("open");$.ajax({type:"POST",data:$("#chal_entry_form").serialize(),url:"/procchalentry/detail/"+Math.round(Math.random()),success:function(c){if(c==""){relocate("/challengelobby/detail/"+a)}else{$("#dialogwait").dialog("close");$("#entryModContent").html("(An error occurred while processing your request) "+c);$("#entry_modal").jqmShow()}}})}function showLiveScorecardReinvoke(){showLiveScorecard(liveScorecardTeam,true)}function showLiveScorecard(b,a){if(b>0){if(a){$("#scorecard_modal").jqmHide()}var c=((a)?"Updating Scorecard ...":"Loading Scorecard ...");$("#dialogwaitmsg").html(c);$("#dialogwait").dialog("open");$("#simple_update_val").val(b);$.ajax({type:"POST",data:$("form#simple_update").serialize(),url:"/showlivescorecard/detail/"+Math.round(Math.random()),success:function(d){if(d!=""){$("#dialogwait").dialog("close");$("#scorecardModContent").html(d);$("#scorecard_modal").jqmShow();$(".tippedscore").tooltip();if(nflScorecardsLive){liveScorecardTeam=b;scorecardTmout=setTimeout("showLiveScorecardReinvoke();",dfltUpdateRate)}setAnchorsStay()}else{$("#scorecard_modal").html("(An error occurred while processing your request) "+d)}}})}}function showPrevScorecard(a){var b="Loading Scorecard ...";$("#dialogwaitmsg").html(b);$("#dialogwait").dialog("open");$("#simple_update_val").val(a);$.ajax({type:"POST",data:$("form#simple_update").serialize(),url:"/showprevscorecard/detail/"+Math.round(Math.random()),success:function(c){if(c!=""){$("#dialogwait").dialog("close");$("#scorecardModContent").html(c);$("#scorecard_modal").jqmShow();$(".tippedscore").tooltip();setAnchorsStay()}else{$("#scorecard_modal").html("(An error occurred while processing your request) "+c)}}})};