﻿
if(typeof(Sys)=='undefined')throw new Error('ASP.NET Ajax client-side framework failed to load.');Type.registerNamespace("GFMedia.Ponged");var ajaxInProgress=false;var bodyJQ=$('body');GFMedia.Ponged.insertNewCssDiv=function GFMedia$Ponged$insertNewCssDiv(parentJQ,className){var divJQ=$(document.createElement("div"));divJQ.addClass(className).prependTo(parentJQ);return divJQ;}
GFMedia.Ponged.removeCssDiv=function GFMedia$Ponged$removeCssDiv(parentJQ,className){parentJQ.children("div."+className).remove();}
GFMedia.Ponged.insertNewCssSpan=function GFMedia$Ponged$insertNewCssSpan(parentJQ,className){var spanJQ=$(document.createElement("span"));spanJQ.addClass(className).prependTo(parentJQ);return spanJQ;}
GFMedia.Ponged.removeCssSpan=function GFMedia$Ponged$removeCssSpan(parentJQ,className){parentJQ.children("span."+className).remove();}
GFMedia.Ponged.removeContentSiblingStyling=function GFMedia$Ponged$removeContentSiblingStyling(id){var modContJQ=$("#"+id).parent();GFMedia.Ponged.removeCssDiv(modContJQ,"topleft");GFMedia.Ponged.removeCssDiv(modContJQ,"topright");GFMedia.Ponged.removeCssDiv(modContJQ,"bottomleft");GFMedia.Ponged.removeCssDiv(modContJQ,"bottomright");GFMedia.Ponged.removeCssDiv(modContJQ,"bottom");GFMedia.Ponged.removeCssDiv(modContJQ,"right");GFMedia.Ponged.removeCssDiv(modContJQ,"left");GFMedia.Ponged.removeCssDiv(modContJQ,"top");}
GFMedia.Ponged.removeModuleStyling=function GFMedia$Ponged$removeModuleStyling(id){GFMedia.Ponged.removeModuleStylingJQ($("#"+id));}
GFMedia.Ponged.removeModuleStylingJQ=function GFMedia$Ponged$removeModuleStylingJQ(modJQ){modJQ.removeClass("styled_module");GFMedia.Ponged.removeCssDiv(modJQ,"styles");var modContJQ=modJQ.children("div.contents");GFMedia.Ponged.removeCssDiv(modContJQ,"topleft");GFMedia.Ponged.removeCssDiv(modContJQ,"topright");GFMedia.Ponged.removeCssDiv(modContJQ,"bottomleft");GFMedia.Ponged.removeCssDiv(modContJQ,"bottomright");GFMedia.Ponged.removeCssDiv(modContJQ,"bottom");GFMedia.Ponged.removeCssDiv(modContJQ,"right");GFMedia.Ponged.removeCssDiv(modContJQ,"left");GFMedia.Ponged.removeCssDiv(modContJQ,"top");var modTtlJQ=modJQ.children("div.title");GFMedia.Ponged.removeCssDiv(modTtlJQ,"right");GFMedia.Ponged.removeCssDiv(modTtlJQ,"left");}
GFMedia.Ponged.addModuleStyling=function GFMedia$Ponged$addModuleStyling(id){GFMedia.Ponged.addModuleStylingJQ($("#"+id));}
GFMedia.Ponged.addModuleStylingJQ=function GFMedia$Ponged$addModuleStylingJQ(modJQ){if(modJQ.hasClass("flyout_module"))return;GFMedia.Ponged.removeModuleStylingJQ(modJQ);modJQ.addClass("styled_module");var width=modJQ.outerWidth()-6;var height=modJQ.outerHeight()-6;var rightTitleJQ;var hasTitle=false;var modTtlJQ=modJQ.children("div.title");if(modTtlJQ.length!==0&&!modTtlJQ.hasClass("unstyled_title")){hasTitle=true;rightTitleJQ=GFMedia.Ponged.insertNewCssDiv(modTtlJQ,"right");GFMedia.Ponged.insertNewCssDiv(modTtlJQ,"left");}
var widthJQs=[];var heightJQs=[];var rightJQs=[];var bottomJQs=[];var styleJQ=GFMedia.Ponged.insertNewCssDiv(modJQ,"styles");GFMedia.Ponged.insertNewCssDiv(styleJQ,"topleft");rightJQs[0]=GFMedia.Ponged.insertNewCssDiv(styleJQ,"topright");bottomJQs[0]=GFMedia.Ponged.insertNewCssDiv(styleJQ,"bottomleft");bottomJQs[1]=rightJQs[1]=GFMedia.Ponged.insertNewCssDiv(styleJQ,"bottomright");widthJQs[0]=GFMedia.Ponged.insertNewCssDiv(styleJQ,"top");rightJQs[2]=heightJQs[0]=GFMedia.Ponged.insertNewCssDiv(styleJQ,"right");heightJQs[1]=GFMedia.Ponged.insertNewCssDiv(styleJQ,"left");bottomJQs[2]=widthJQs[1]=GFMedia.Ponged.insertNewCssDiv(styleJQ,"bottom");var isFlat=modJQ.hasClass("flat_module");var c_heightJQs=[];var c_widthJQs=[];var c_rightJQs=[];var c_bottomJQs=[];if(!isFlat){var modContJQ=modJQ.children("div.contents");c_bottomJQs[0]=GFMedia.Ponged.insertNewCssDiv(modContJQ,"bottomleft");c_rightJQs[0]=c_bottomJQs[1]=GFMedia.Ponged.insertNewCssDiv(modContJQ,"bottomright");c_bottomJQs[2]=c_widthJQs[0]=GFMedia.Ponged.insertNewCssDiv(modContJQ,"bottom");c_rightJQs[1]=c_heightJQs[0]=GFMedia.Ponged.insertNewCssDiv(modContJQ,"right");c_heightJQs[1]=GFMedia.Ponged.insertNewCssDiv(modContJQ,"left");c_widthJQs[1]=GFMedia.Ponged.insertNewCssDiv(modContJQ,"top");}
jQuery.each(widthJQs,function(){this.width(width)});jQuery.each(heightJQs,function(){this.height(height)});var c_width;var c_height;if(!isFlat){c_width=width-2;c_height=height-(hasTitle?30:0);jQuery.each(c_widthJQs,function(){this.width(c_width)});jQuery.each(c_heightJQs,function(){this.height(c_height)});}
if($.browser.version==6.0){if(hasTitle)rightTitleJQ.css('left',width-2+'px');if(!isFlat){var c_top=c_height-1;jQuery.each(c_rightJQs,function(){this.css('left',c_width+'px')});jQuery.each(c_bottomJQs,function(){this.css('top',c_top+'px')});}
var left=width+3;var top=height+3;jQuery.each(rightJQs,function(){this.css('left',left+'px')});jQuery.each(bottomJQs,function(){this.css('top',top+'px')});}}
GFMedia.Ponged.removeTabStylingJQ=function GFMedia$Ponged$removeTabStylingJQ(tabJQ){tabJQ.removeClass("styled_tab_tool");GFMedia.Ponged.removeCssSpan(tabJQ,"top");GFMedia.Ponged.removeCssSpan(tabJQ,"topleft");GFMedia.Ponged.removeCssSpan(tabJQ,"topright");GFMedia.Ponged.removeCssSpan(tabJQ,"innerbottomright");GFMedia.Ponged.removeCssSpan(tabJQ,"innerbottomleft");GFMedia.Ponged.removeCssSpan(tabJQ,"right");GFMedia.Ponged.removeCssSpan(tabJQ,"left");}
GFMedia.Ponged.addTabStylingJQ=function GFMedia$Ponged$addTabStylingJQ(tabJQ){GFMedia.Ponged.removeTabStylingJQ(tabJQ);tabJQ.addClass("styled_tab_tool");var rightJQs=[];GFMedia.Ponged.insertNewCssSpan(tabJQ,"topleft");rightJQs[0]=GFMedia.Ponged.insertNewCssSpan(tabJQ,"topright");rightJQs[1]=GFMedia.Ponged.insertNewCssSpan(tabJQ,"innerbottomright");GFMedia.Ponged.insertNewCssSpan(tabJQ,"innerbottomleft");rightJQs[2]=GFMedia.Ponged.insertNewCssSpan(tabJQ,"right");var targetHeight=tabJQ.outerHeight()-6;jQuery.each({0:rightJQs[2],1:GFMedia.Ponged.insertNewCssSpan(tabJQ,"left")},function(){this.height(targetHeight)});var width=tabJQ.outerWidth()-4;GFMedia.Ponged.insertNewCssSpan(tabJQ,"top").width(width);var left=width+2;jQuery.each(rightJQs,function(){this.css('left',left);});}
GFMedia.Ponged.selectFlyoutTab=function GFMedia$Ponged$selectFlyoutTab(flyoutTabID,focusID){var flyoutTabJQ=$('#'+flyoutTabID);var inputJQ=flyoutTabJQ.children('input');if(inputJQ.val()=="1")return;inputJQ.val("1");bodyJQ.unbind(flyoutEventNamespace);bodyJQ.trigger('click.flyouts');var flyoutJQ=flyoutTabJQ.find('div.flyout_module');var tabJQ=flyoutTabJQ.children('a');var focusJQ=null;var focusIDSelector='#'+focusID;if(focusIDSelector!='#')focusJQ=$('#'+focusID);var flyoutEventNamespace='click.flyouts.'+flyoutTabID;if(!tabJQ.hasClass('selectedTab_tool'))tabJQ.addClass('selectedTab_tool');if(!tabJQ.parent().hasClass("selected_flyoutTab_tool"))tabJQ.parent().addClass("selected_flyoutTab_tool");bodyJQ.bind(flyoutEventNamespace,function(e){if(!ajaxInProgress&&inputJQ.val()=="1")tabJQ.click();});flyoutJQ.slideDown('fast',function(){if(focusJQ!=null)focusJQ.focus();if(modalBG!=null){var modalBGJQ=$('div#'+modalBG);if(modalBGJQ!=null)
modalBGJQ.bind(flyoutEventNamespace,GFMedia.stopEvent);}});};GFMedia.Ponged.deselectFlyoutTab=function GFMedia$Ponged$deselectFlyoutTab(flyoutTabID){var flyoutTabJQ=$('#'+flyoutTabID);var inputJQ=flyoutTabJQ.children('input');if(inputJQ.val()=="0")return;inputJQ.val("0");var tabJQ=flyoutTabJQ.children('a');var flyoutJQ=flyoutTabJQ.find('div.flyout_module');var flyoutEventNamespace='click.flyouts.'+flyoutTabID;if(modalBG!=null){var modalBGJQ=$('div#'+modalBG);if(modalBGJQ!=null)
modalBGJQ.unbind(flyoutEventNamespace);}
bodyJQ.unbind(flyoutEventNamespace);flyoutJQ.find('.resettable').each(function(){$(this).trigger('reset');});flyoutJQ.slideUp('fast',function(){if(inputJQ.val()!="0")return;if(tabJQ.hasClass('selectedTab_tool'))tabJQ.removeClass('selectedTab_tool');if(tabJQ.parent().hasClass("selected_flyoutTab_tool"))tabJQ.parent().removeClass("selected_flyoutTab_tool");});};GFMedia.Ponged.initFlyoutTab=function GFMedia$Ponged$initFlyoutTab(flyoutTabID,focusID){var ftJQ=$('#'+flyoutTabID);ftJQ.children('a').toggle(function(){GFMedia.Ponged.selectFlyoutTab(flyoutTabID,focusID);},function(){GFMedia.Ponged.deselectFlyoutTab(flyoutTabID);});ftJQ.find('div.flyout_module').click(GFMedia.stopEvent);}
GFMedia.Ponged.loadFlyoutTab=function GFMedia$Ponged$loadFlyoutTab(flyoutTabID){var ftJQ=$('#'+flyoutTabID);var tabJQ=ftJQ.children('a');if((ftJQ.children('input').val()=='1')&&(!tabJQ.hasClass('selectedTab_tool')))
tabJQ.click();}
GFMedia.stopEvent=function GFMedia$stopEvent(e){e.stopPropagation();};GFMedia.Ponged.reg_EnableDaysAndYears=function GFMedia$Ponged$reg_EnableDaysAndYears(monthSelectorId,daysSelectorId,yearsSelectorId){var selection=$('#'+monthSelectorId+" option:selected").val();var daysJQ=$('#'+daysSelectorId);switch(selection){case"02":daysJQ.find("option[value=30]").attr("disabled","disabled");daysJQ.find("option[value=31]").attr("disabled","disabled");break;case"04":case"06":case"09":case"11":daysJQ.find("option[value=30]").removeAttr("disabled");daysJQ.find("option[value=31]").attr("disabled","disabled");break;case"01":case"03":case"05":case"07":case"08":case"10":case"12":daysJQ.find("option[value=30]").removeAttr("disabled");daysJQ.find("option[value=31]").removeAttr("disabled");break;default:break;}
GFMedia.Ponged.reg_EnableYears(monthSelectorId,daysSelectorId,yearsSelectorId);}
GFMedia.Ponged.reg_EnableYears=function GFMedia$Ponged$reg_EnableYears(monthSelectorId,daysSelectorId,yearsSelectorId){var selectedDay=$('#'+daysSelectorId+" option:selected").val();var selectedMonth=$('#'+monthSelectorId+" option:selected").val();if(selectedDay=="X"||selectedDay=="X")return;var mustBeLeap=selectedDay=="29"&&selectedMonth=="02";$('#'+yearsSelectorId+' option').each(function(){var thisJQ=$(this);if(thisJQ.val()=="X")return;if((thisJQ.val()%4)!==0){if(mustBeLeap){thisJQ.attr("disabled","disabled");}
else{thisJQ.removeAttr("disabled");}}});}
GFMedia.Ponged.correctPosition=function GFMedia$Ponged$correctPosition(oElement,oPos,oWhich){while(oElement.offsetParent){oPos-=oElement['offset'+oWhich];oElement=oElement.offsetParent;}
oPos+=document.documentElement['scroll'+oWhich]?document.documentElement['scroll'+oWhich]:document.body['scroll'+oWhich];return oPos;}
GFMedia.Ponged.redirectToSearch=function GFMedia$Ponged$redirectToSearch(searchBoxID){location.href="/search/"+encodeURIComponent($('#'+searchBoxID).val())+"/1";return false;}
GFMedia.Ponged.updateFriendsTypeAheadResults=function GFMedia$Ponged$updateFriendsTypeAheadResults(typeAheadPanelID,keyCode){if((keyCode>=9&&keyCode<=45)&&keyCode!=32)return;var panelJQ=$('#'+typeAheadPanelID);var inputJQ=panelJQ.find('input[type=text]');var responseJQ=panelJQ.find('div.feedback');var messageJQ=responseJQ.children('span');var resultsJQ=responseJQ.find('ul');var inputText=inputJQ.val();if(inputText==""){responseJQ.hide().trigger('sizeChanged');return;}
GameFly.GFMedia.CasualGaming.Web.UI.Rpc.FriendsService.FindNamesBeginningWith(inputText,function GFMedia$Ponged$updateFriendsTypeAheadResults$callback(results){responseJQ.show();messageJQ.removeClass('error').hide();resultsJQ.hide();if(results.AuthenticationFailure){messageJQ.html("Your session has timed out. Please go <a href='/?ReturnUrl="+encodeURIComponent(window.location)+"'>Sign In</a>.").show();panelJQ.trigger('sizeChanged');return;}
if(results.Value.length==0){messageJQ.text("No such person to befriend.").addClass('error').css('display','block');}
else{resultsJQ.empty();jQuery.each(results.Value,function(index,resultData){var isPublic=resultData[1]=="public";var result=resultData[0];var resultJQ;if(isPublic)
resultJQ=$("<li><a href='/user/"+result+"' target='_blank'>"+result+"</a> <span onclick=\"GFMedia.Ponged.addFriendRequestClickHandler('"+result+"','"+typeAheadPanelID+"')\">add friend</span></li>");else
resultJQ=$("<li>"+result+" <span onclick=\"GFMedia.Ponged.addFriendRequestClickHandler('"+result+"','"+typeAheadPanelID+"')\">add friend</span></li>");resultsJQ.append(resultJQ);});resultsJQ.show();}
panelJQ.trigger('sizeChanged');});}
GFMedia.Ponged.addFriendRequestClickHandler=function GFMedia$Ponged$addFriendRequestClickHandler(targetUserName,typeAheadPanelID){var panelJQ=$('#'+typeAheadPanelID);var inputJQ=panelJQ.find('input[type=text]');var responseJQ=panelJQ.find('div.feedback');var messageJQ=responseJQ.children('span');var resultsJQ=responseJQ.find('ul');GameFly.GFMedia.CasualGaming.Web.UI.Rpc.FriendsService.SendFriendRequest(targetUserName,function(results){resultsJQ.empty().hide();if(results.AuthenticationFailure){messageJQ.html("Your session has timed out. Please go <a href='/?ReturnUrl="+encodeURIComponent(window.location)+"'>Sign In</a>.").show();panelJQ.trigger('sizeChanged');return;}
messageJQ.text("Friend request sent to "+targetUserName+'.').css('display','block');panelJQ.find('input[type=text]').val("").focus().blur();panelJQ.trigger('sizeChanged');});}
GFMedia.Ponged.resetTypeAheadPanelJQForm=function GFMedia$Ponged$resetTypeAheadPanelJQForm(typeAheadPanelJQ){typeAheadPanelJQ.find('div.feedback').hide().children('span').empty();typeAheadPanelJQ.find('input[type=text]').val("").focus().blur();}
GFMedia.Ponged.resetFindEmailForm=function GFMedia$Ponged$resetFindEmailForm(findEmailFormSelector){var formJQ=$(findEmailFormSelector);formJQ.find('input[type=text]').val("").focus().blur();formJQ.find('div.feedback').hide();}
GFMedia.Ponged.fixToolbar=function GFMedia$Ponged$fixToolbar(toolbarID){$('#'+toolbarID+' > div.contents').attr('style','height:24px;padding:0 2px 0 6px;overflow:visible;position:relative');}
GFMedia.Ponged.reportAbuse = function GFMedia$Ponged$reportAbuse(commentId){GFMedia.Ponged.openFeedbackModal('Report Abuse', commentId);}
GFMedia.Ponged.openFeedbackModal=function GFMedia$Ponged$openFeedbackModal(subject,args){var fbmpe=$find('fbmpe');var ddlFeedbackType=document.getElementById('ctl00_fb_ddlFeedbackType');if(subject!=undefined){for(i=0;i<ddlFeedbackType.options.length;i++){if(ddlFeedbackType.options[i].text==subject){ddlFeedbackType.selectedIndex=i;$(ddlFeedbackType).attr('disabled','disabled');}}}
else{ddlFeedbackType.selectedIndex=0;}
if(args)$('#feedbackArgs').val(args);else $('#feedbackArgs').val('');fbmpe.show();return false;}
GFMedia.Ponged.openEditProfileModal=function GFMedia$Ponged$openEditProfileModal(){$('#fuiframe').attr('src',$('#fuiframe').attr('src'));$find('mimpe').show();return false;}
GFMedia.Ponged.maxLength=function GFMedia$Ponged$maxLength(event,maxLen){var jObj=$(event.srcElement||event.target);var key=event.keyCode||event.charCode;var ok=[8,13,46,37,38,39,40];for(var i=0;i<ok.length;i++)
if(ok[i]==key)return;var val=jObj.val();if(val.length>maxLen-1)
jObj.val(val.substr(0,maxLen-1));}
GFMedia.Ponged.startCountDown=function GFMedia$Ponged$startCountDown(elementID){var countJQ=$('#'+elementID+' span.timePhrase span');handler=function(){var count=countJQ.text();if(count!=1){countJQ.text(count-1).trigger('sizeChanged');setTimeout(handler,1000);}
else countJQ.parent().text('');}
setTimeout(handler,1000);}
GFMedia.Ponged.applySifr=function GFMedia$Ponged$applySifr(sifrContainerID){if(typeof(sIFR)=="function"){sIFR.rollback("#"+sifrContainerID+" .sIFR-enable-transferE");sIFR.replaceElement(named({sSelector:"#"+sifrContainerID+" .sIFR-enable-transferE",sColor:"#FFFFFF",sFlashSrc:"/js/Transfer-EGauge.swf",sWmode:"transparent"}));};}
GFMedia.Ponged.startHeart=function GFMedia$Ponged$startHeart(beatInterval,lifeSpan,maxBeats){var beatCount=0;function beatHeart(){beatCount++;if(beatCount>maxBeats)return;$.get("/KeepAlive.ashx");setTimeout(beatHeart,beatInterval);}
setTimeout(beatHeart,beatInterval);}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
