﻿
Type.registerNamespace("PlainJoeStudios.Web");PlainJoeStudios.Web.PlainJoePage=function(args){this.Ctor(args);};PlainJoeStudios.Web.PlainJoePage.prototype={CookieName_LocalTime:"__PJSCOOKIE_LOCALTIMEZONE",ModelMessageTemplate:'<div class="jqPjsNoticeModal">'
+'<table><tr><td valign="top" style="width:24px;"><span class="ui-icon ui-icon-{{ icon }}"></span></td>'
+'<td><div style="float:left;text-align:justify;font-size:97%;" class="jqPjsNoticeModal_Message"></div></td></tr></table>'
+'</div>',ModelMessageWaitingTemplate:'<div class="jqPjsNoticeModal">'
+'<table><tr><td valign="top" style="width:24px;"><img src="/Images/ajax-loader_wheel_white_black.gif" alt="..." /></td>'
+'<td><div style="float:left;text-align:justify;font-size:97%;" class="jqPjsNoticeModal_Message"></div></td></tr></table>'
+'</div>',DIMMER_OPACITY:0.7,_Controls:new Object(),_Panes:new Object(),_PlainJoePageData:null,_Listeners_LoggedIn:null,_User:null,_FacebookUser:null,_nDisableAjaxButtonsStackSize:0,_DeferredCalls:null,_jqDimmer:null,Ctor:function(args){var This=this;this._PlainJoePageData=window.g_PlainJoePageData;this._Listeners_LoggedIn=[];this._User=this._PlainJoePageData["User"];var now=new Date();document.cookie=this.CookieName_LocalTime
+"="
+
((-(now.getTimezoneOffset()/60.0)).toString())
+";"
+"expires="+(new Date((new Date().getTime()+1000*60*60*24*365))).toString()+";"
+"path=/;";this._DeferredCalls=new PlainJoeStudios.Web.FunctionQueue();$(function(){This._DeferredCalls.Run();});},OnFormSubmit:function(){if(typeof(g_PageReadyForSubmit)==='undefined'||g_PageReadyForSubmit!==true){return false;}
window.setTimeout(function(){$('.jqDisableUntilFormReady').attr('disabled','disabled');return true;},1);return true;},GetUser:function(){return this._User;},GetUserFacebook:function(){return this._FacebookUser;},AttachLoggedInListener:function(func){if(typeof(func)!=="function"){throw new Error("func must be a function.");}
if(this._User==null){this._Listeners_LoggedIn.push(func);}
else{this._Listeners_LoggedIn.push(func);window.setTimeout(func,1);}},LogUserIn:function(userInfo){this._User=userInfo;for(var i=0;i<This._Listeners_LoggedIn.length;++i){This._Listeners_LoggedIn[i](This._UserDetails);}},LogUserInFromFacebook:function(fbUserInfo){this._FacebookUser=fbUserInfo;for(var i=0;i<this._Listeners_LoggedIn.length;++i){this._Listeners_LoggedIn[i](this._FacebookUser);}},ShowDimmer:function(jqModalContents,fnOnComplete){if(this._jqDimmer!==null){return;}
var iZIndex=101;var strStyle="width:100%; height:100%; position:fixed; z-index:"+iZIndex+"; background:#0a0a0a;";this._jqDimmer=$('<div style="'+strStyle+'"></div>');var jqBody=$("body");jqBody.append(this._jqDimmer);this._jqDimmer.hide();this._jqDimmer.fadeTo(600,this.DIMMER_OPACITY);if(jqModalContents){jqModalContents.appendTo(jqBody);jqModalContents.hide();jqModalContents.fadeIn(function(){if(fnOnComplete){fnOnComplete();}});this._jqDimmer.data("child",jqModalContents);}},HideDimmer:function(fnOnComplete){if(this._jqDimmer===null){return;}
var jqDimmer=this._jqDimmer;var jqChild=this._jqDimmer.data("child");if(jqChild){jqChild.fadeOut(function(){jqChild.remove();if(fnOnComplete){fnOnComplete();}});}
else{if(fnOnComplete){fnOnComplete();}}
jqDimmer.delay(50).fadeTo(600,0,function(){jqDimmer.remove();});this._jqDimmer=null;},ShowError:function(message,modal,container,icon){var This=this;if(!this._DeferredCalls.GetIsSynchronous()){this._DeferredCalls.Run(function(){This.ShowError(message,modal,container,icon);});return;}
var jqContainer=null;if(typeof(modal)==="undefined"){modal=true;}
if(modal){if(container==null){if(!icon){icon="alert";}
jqContainer=$(This.ModelMessageTemplate.replace("{{ icon }}",icon));}
else{jqContainer=$(container);}}
else{if(container==null){throw new Error("Cannot call method with modal=false & container=null.");}
jqContainer=$(container);}
jqContainer.hide();jqContainer.find(".jqPjsNoticeModal_Message").html(message);var jqExistingContainers=$(".jqPjsNoticeModal");jqExistingContainers.dialog("destroy");jqContainer.dialog({modal:true,title:"An error has occured",resizable:false,draggable:false,closeOnEscape:true,dialogClass:"pjsModal",closeOnEscape:true});var jqTheDialogParent=$(".pjsModal");jqTheDialogParent.css("position","fixed");jqTheDialogParent.css("top","300px");},ShowMessage:function(message,icon,fnOnClose,strTitle){var This=this;if(!this._DeferredCalls.GetIsSynchronous()){this._DeferredCalls.Run(function(){This.ShowMessage(message,icon,fnOnClose,strTitle);});return;}
if(!strTitle){strTitle="Hello";}
var jqContainer=null;if(!icon){icon="check";}
jqContainer=$(This.ModelMessageTemplate.replace("{{ icon }}",icon));jqContainer.hide();jqContainer.find(".jqPjsNoticeModal_Message").html(message);var jqExistingContainers=$(".jqPjsNoticeModal");jqExistingContainers.dialog("destroy");jqContainer.dialog({modal:true,title:strTitle,resizable:false,draggable:false,closeOnEscape:true,close:fnOnClose||function(){},dialogClass:"pjsModal",buttons:{"Ok":function(){jqContainer.dialog("destroy");if(typeof(fnOnClose)==="function"){fnOnClose();}}},closeOnEscape:true});var jqTheDialogParent=$(".pjsModal");jqTheDialogParent.css("position","fixed");jqTheDialogParent.css("top","300px");$(".ui-dialog-titlebar-close").hide();},ShowMessageWaiting:function(message,modal,container,icon,fnOnCancel){var This=this;if(!this._DeferredCalls.GetIsSynchronous()){this._DeferredCalls.Run(function(){This.ShowMessageWaiting(message,modal,container,icon,fnOnCancel);});return;}
var jqContainer=null;if(typeof(modal)==="undefined"){modal=true;}
if(modal){if(container==null){if(!icon){icon="flag";}
jqContainer=$(This.ModelMessageWaitingTemplate.replace("{{ icon }}",icon));}
else{jqContainer=$(container);}}
else{if(container==null){throw new Error("Cannot call method with modal=false & container=null.");}
jqContainer=$(container);}
jqContainer.hide();message=message.replace("{{Cancel}}",'<input type="button" value="Cancel" class="pjsBtnDialogCancel" />');jqContainer.find(".jqPjsNoticeModal_Message").html(message);var jqExistingContainers=$(".jqPjsNoticeModal");jqExistingContainers.dialog("destroy");jqContainer.dialog({modal:true,title:"Please Wait",resizable:false,draggable:false,closeOnEscape:false,dialogClass:"pjsModal"});$(".ui-dialog-titlebar-close").hide();var jqTheDialogParent=$(".pjsModal");jqTheDialogParent.css("position","fixed");jqTheDialogParent.css("top","300px");var jqBtnCancel=jqContainer.find("input.pjsBtnDialogCancel");if(jqBtnCancel.length>0){jqBtnCancel.click(function(){jqContainer.dialog("destroy");if(typeof(fnOnCancel)==="function"){fnOnCancel();}});}},HideMessage:function(){var jqExistingContainers=$(".jqPjsNoticeModal");jqExistingContainers.dialog("destroy");},SetUrlDeepLink:function(deepLink){if(deepLink.indexOf("#")==0){deepLink=deepLink.toString().substring(1);}
window.location.href="#"+deepLink;},GetUrlDeepLink:function(){var urlSplit=window.location.toString().split('#');if(urlSplit.length<2){return"";}
return urlSplit[1];},GetCookie:function(strName){var arr_strCookiesSplit=document.cookie.split(/&/);for(var i=0;i<arr_strCookiesSplit.length;++i){var strCookie=arr_strCookiesSplit[i];if(strCookie.indexOf(strName)!==0){continue;}
var arr_strNameValue=strCookie.split(/=/);return arr_strNameValue[1]||"";}
return null;},SetCookie:function(strName,strValue){document.cookie[strName]=strValue+";path=/;";},RegisterControl:function(id,instance){this._Controls[id]=instance;},GetControl:function(id){var instance=this._Controls[id];if(instance){return instance;}
return null;},RegisterPane:function(strPaneSetName,jqPane,iTabIndex,jqTab,strTabImageActive,strTabImageInactive,strTabClassActive,fnOnShow){var This=this;if(typeof(strPaneSetName)!=="string"||jqPane==null){throw new Error("Invalid argument(s).");}
var arr_oTheSet=this._Panes[strPaneSetName];if(arr_oTheSet==null){this._Panes[strPaneSetName]=arr_oTheSet=[];}
if(iTabIndex==null){iTabIndex=arr_oTheSet.length;}
var oThePane={"jqPane":jqPane};if(jqTab!=null){oThePane.jqTab=jqTab;oThePane.strTabImageActive=strTabImageActive;oThePane.strTabImageInactive=strTabImageInactive;jqTab.click(function(){This.ShowPane(strPaneSetName,iTabIndex);});}
if(typeof(fnOnShow)==="function"){oThePane.fnOnShow=fnOnShow;}
if(typeof(strTabClassActive)==="string"){oThePane.strTabClassActive=strTabClassActive;}
arr_oTheSet[iTabIndex]=oThePane;},ShowPane:function(strPaneSetName,whichPane){if(typeof(strPaneSetName)!=="string"){throw new Error("strPaneSetName must be set.");}
var arr_oTheSet=this._Panes[strPaneSetName];if(arr_oTheSet==null){throw new Error("unknown pane set");}
this.HidePanes(arr_oTheSet);var oPane=null;if(typeof(whichPane)==="number"){oPane=arr_oTheSet[whichPane];}
else if(typeof(whichPane.jquery)==="string"){for(var i=0;i<arr_oTheSet.length;++i){if(arr_oTheSet[i].jqPane[0]==whichPane[0]){oPane=arr_oTheSet[i];break;}}}
else if(typeof(whichPane.nodeName)==="string"){for(var i=0;i<arr_oTheSet.length;++i){if(arr_oTheSet[i].jqPane[0]==whichPane){oPane=arr_oTheSet[i];break;}}}
if(oPane.jqPane!=null){oPane.jqPane.show();}
if(oPane.jqTab!=null){var jqTab=oPane.jqTab.eq(0);if(jqTab[0].nodeName.toLowerCase()==="img"){jqTab.attr("src",oPane.strTabImageActive);}
else if(jqTab[0].nodeName.toLowerCase()==="div"){jqTab.css("background-image","url("+oPane.strTabImageActive+")");}
if(oPane.strTabClassActive!=null){jqTab.addClass(oPane.strTabClassActive);}}
if(oPane.fnOnShow!=null){oPane.fnOnShow();}},HidePanes:function(theSet){if(typeof(theSet)==="string"){theSet=this._Panes[theSet];}
if(theSet==null){return;}
for(var k in theSet){var oPane=theSet[k];if(oPane.jqPane!=null){oPane.jqPane.hide();}
if(oPane.jqTab!=null){var jqTab=oPane.jqTab.eq(0);if(jqTab[0].nodeName.toLowerCase()==="img"){jqTab.attr("src",oPane.strTabImageInactive);}
else if(jqTab[0].nodeName.toLowerCase()==="div"){jqTab.css("background-image","url("+oPane.strTabImageInactive+")");}
if(oPane.strTabClassActive!=null){oPane.jqTab.removeClass(oPane.strTabClassActive);}}}},GetJqueryObjectFromUnknownObjectType:function(obj,arrayIfObjIsIndex){for(var loop=0;loop<2;++loop){var D8ADK=(obj||0);if(obj==null){return $();}
if(typeof(obj)==="string"){return $("#"+obj);}
if(typeof(obj)==="number"){obj=arrayIfObjIsIndex[obj];continue;}
if(typeof(obj)==="object"){return $(obj);}}},OpenNewWindow:function(url,isPopup,strName,width,height){if(typeof(width)!=="number"){width=480;}
if(typeof(height)!=="number"){height=480;}
if(typeof(strName)!=="string"||strName==null||strName.length===0){strName="_blank";}
var options;if(isPopup){options="menubar=0,toolbar=0,resizable=1,directories=0,width="
+width
+",height="
+height
+",status=0,location=0,scrollbars=0,";}
else{options="menubar=1,resizable=1,location=1,status=1,scrollbars=1,";}
window.open(url,strName,options,false);},Redirect:function(url){window.location.href="/Handlers/Redirect.ashx?d="+encodeURI(url);},RedirectToSelf:function(){window.location.href="/Handlers/Redirect.ashx?d="+encodeURI(window.location.href.toString());},DisableAjaxButtons:function(){$(function(){$(".pjsDisableDuringAjax").attr('disabled','disabled');});++this._nDisableAjaxButtonsStackSize;},EnableAjaxButtons:function(forceEnable){if(this._nDisableAjaxButtonsStackSize<=1||forceEnable){$(function(){$(".pjsDisableDuringAjax").attr('disabled',null);});this._nDisableAjaxButtonsStackSize=0;}
else{--this._nDisableAjaxButtonsStackSize;}}};var g_PlainJoePage=new PlainJoeStudios.Web.PlainJoePage();var $PJP=g_PlainJoePage;