(function($){var _cbStr=(typeof _cbVarStr!=="undefined")?_cbVarStr:"b1002";var CONST_ThirdPartyConfig={recaptcha:{url:"/ajax/authentication/recaptcha.jsp",elmId:"recaptcha_div",id:"6LcspgwAAAAAAPIfJ3yUt1aUl_Thr8TQfQmR1oRP",settings:{theme:"clean"}},disqus:{widget:"DQIntegrationService",cookie:{name:"p_DQS",expires:14},hash:{empty:"e30=",expires:60}},idms:{cookie:{name:"p_IDMS",expires:14},hash:{empty:"e30=",expires:"5"},callback:{login:"FOX_IDMS_auth_logged_in",logout:"FOX_IDMS_auth_logged_in"}}};var AuthService=window.AuthService=function(initVars){this.validationUrl="/authentication/registration/validate/";this.getRegistrationDataUrl="/authentication/registration/get";this.loginSubmitUrl="/authentication/login/submit";this.logoutSubmitUrl="/authentication/logout/submit";this.requestLogoutUrl="/authentication/logout/submit";this.refreshAuthUrl="/authentication/login/refresh?"+_cbStr+"=t";this.forgottenPasswordSubmitUrl="/authentication/forgotten_password/submit";this.registrationSubmitUrl="/authentication/registration/submit";this.ajaxRetrieveHtmlUrl="/ajax/authentication/includes.jsp";this.newsAlertSubscriptionUrl="/portal/newsalertsubscribe";this.defaultDomain="foxnews.com";var i;for(i in initVars){this[i]=initVars[i];}};AuthService.prototype={init:function(config){var i,as=this;for(i in config){this[i]=config[i];}if(window.FOX_isMnt&&FOX_isMnt()){$("#account, #authentication").hide();}this.thirdPartyAPI.root=this;this.thirdPartyAPI.init();},createObjFromJSON:function(jsonString){if(typeof jsonString==="string"){if(($.trim(jsonString)).length>0){return eval("("+unescape(jsonString).replace(/\s+/g," ")+")");}}return false;},isLoggedIn:function(){return($.cookie("p_UN")&&$.cookie("p_UN")!=="")?true:false;},isThirdParty:function(){return($.cookie("p_Thirdparty"))?true:false;},getDisplayName:function(){var as=this;function pipeCheck(str){var separator="|id:",idx=str.lastIndexOf(separator);if(idx<1){return str;}return str.substr(0,idx);}if(as.isLoggedIn()){var displayName=false;if(typeof $.cookie("p_DN")==="string"){var dn=$.cookie("p_DN");if(dn.length>0){dn=pipeCheck(dn);displayName=dn.replace(/\+/g," ").replace(/\"/g,"");}}return(displayName)?displayName:as.getUsername();}return"";},getUsername:function(){if(this.isLoggedIn()){return $.cookie("p_UN");}},getUserEmail:function(){return(this.isLoggedIn())?$.cookie("p_EM"):"";},getUserLocation:function(){return(this.isLoggedIn())?$.cookie("p_UL"):"";},getOverlayHtml:function(overlayView,origDomain,callbackFn){callbackFn=callbackFn||false;var as=this;if(!origDomain){origDomain=as.defaultDomain;}$.ajax({type:"GET",async:false,url:as.ajaxRetrieveHtmlUrl,data:({view:overlayView,authDomain:origDomain,cb:_cbStr}),success:function(data,textStatus){$("body").append(data);if(typeof callbackFn==="function"){callbackFn();}}});},closeOverlay:function(elementId){var as=this,elm=$("#"+elementId);elm.find("input[type*=text], input[type*=password]").val("");elm.find("input:checkbox:checked").attr("checked","");elm.find("input[type*=text]").removeClass("error");as.overlay.hide(elm);},providerOverlay:function(authDomain,callbackFn){var as=this;if(!as.isLoggedIn()){if($("#login-provider").size()===0){as.getOverlayHtml("login-provider",authDomain,callbackFn);}as.initProviderOverlay();as.overlay.show("#login-provider");$("#user-login-form-overlay").find("input[name*=username]").focus();return false;}return true;},initProviderOverlay:function(){var as=this;var login_validation_options={onkeyup:false,errorPlacement:function(error,element){},invalidHandler:function(form,validator){var elm=$(this);elm.find("input[type*=submit]").attr("disabled","disabled");var errors=validator.numberOfInvalids();if(errors){elm.find(".error-box-login").html("User name and password are required.").show();}else{elm.find(".error-box-login").hide();}elm.find("input[type*=submit]").removeAttr("disabled");},submitHandler:function(form){var elm=$(form);elm.find("input[type*=submit]").attr("disabled","disabled");elm.find(".error-box-login").hide();as.login(elm);return false;}};$("#user-login-form-overlay").validate(login_validation_options);$(".thirdparty a img").hover(function(){var thirdPartyTooltip=$(this).parent().parent().siblings(0);thirdPartyTooltip.find(".icon-desc-bg p").html($(this).attr("alt"));thirdPartyTooltip.addClass($(this).attr("name")).css("visibility","visible");},function(){var thirdPartyTooltip=$(this).parent().parent().siblings(0);thirdPartyTooltip.find(".icon-desc-bg p").html("");thirdPartyTooltip.removeClass($(this).attr("name")).css("visibility","hidden");});var reset_password_validation_options={onkeyup:false,errorPlacement:function(error,element){},invalidHandler:function(form,validator){var elm=$(this);elm.find("input[type*=submit]").attr("disabled","disabled");var errors=validator.numberOfInvalids();if(errors){elm.find(".error-box-login").html("The email address you entered is invalid.").show();}else{elm.find(".error-box-login").hide();}elm.find("input[type*=submit]").removeAttr("disabled");},submitHandler:function(form){var elm=$(form);elm.find("input[type*=submit]").attr("disabled","disabled");elm.find(".error-box-login").hide();as.forgotPassword(elm);return false;}};$("#reset-password .user-email-reset-form").validate(reset_password_validation_options);$("#forgot-password-overlay").click(function(){$("#reset-password.reset").toggle();});},registrationOverlay:function(obj,authDomain,callbackFn){var as=this;if(!as.isLoggedIn()){if($("#registration-overlay").length===0){as.getOverlayHtml("registration-overlay",authDomain,callbackFn);}increaseRefresh();$("#reg_user_name").removeAttr("readonly");$("#reg_user_name").next(".validate").next(".validate").children(".sprites").show();as.initRegistrationOverlay();as.overlay.show("#registration-overlay");return false;}return true;},initRegistrationOverlay:function(){var as=this;var registration_validation_options={submitHandler:function(form){as.register($(form));return false;},errorElement:"p",errorPlacement:function(err,elm){var errMsg=err.text(),id=elm.attr("id");if(elm.data("_errMsg")===errMsg){return false;}elm.data("_errMsg",errMsg);var parent=elm.parent(),marker=parent.find("> .validate:first .sprites"),msgAlert=parent.find("> .error-tip p.err-msg"),errMsg=err.text(),reqTxt=parent.find("> .req-text");var css={valid:"check",invalid:"red-exclamation"};reqTxt.hide();var noMsg="reg_birth_year";var noMarker="reg_zip_code|reg_location";if(msgAlert.size()===0&&noMsg.indexOf(id)===-1){var validate=parent.find("> .validate:first");if(id==="agreement"){validate=elm;}msgAlert=$('<div class="error-tip"><span class="form-note"><p class="err-msg"></p></span></div>').insertAfter(validate);msgAlert=parent.find("> .error-tip p.err-msg");if(id==="agreement"){parent.find("> .error-tip").css({position:"absolute",width:"220px",right:"0",top:"0"});}}msgAlert.css("padding-top","0px");if(errMsg.length===0){if(noMarker.indexOf(id)===-1){marker.removeClass(css.invalid).addClass(css.valid);}msgAlert.html("&nbsp;");}else{if(noMarker.indexOf(id)===-1){marker.removeClass(css.valid).addClass(css.invalid);}msgAlert.html(errMsg);}if(marker.is(":hidden")&&noMarker.indexOf(id)===-1){marker.css("display","block");}},success:function(){},rules:{propID_username:{required:true,minlength:5,maxlength:15,validChars:true,remote:{url:as.validationUrl,type:"post"}},propID_email:{required:true,email:true,maxlength:250,strictEmail:true,remote:{url:as.validationUrl,type:"post"}},propID_pass1:{required:true,noSpaces:true,minlength:5,maxlength:12},propID_pass2:{required:true,noSpaces:true,minlength:5,maxlength:12,equalTo:"#reg_password"},propID_country:{required:true},propID_zip:{digits:true,maxlength:5,minlength:5,zipRequired:true,zipCheck:true,remote:{url:as.validationUrl,type:"post"}},propID_birthyear:{required:true,min:1900,isMaxYear:true},propID_terms:{required:true}},messages:{propID_username:{required:"Please enter a username",minlength:"Your username must consist of at least 5 characters",maxlength:"Your username is too long",validChars:"please supply valid characters only.",remote:"This username is already in use."},propID_email:{required:"Please enter an email address.",email:"Your email address must be valid.",maxlength:"Your email address is too long.",remote:"A user is already registered with this email."},propID_pass1:{required:"Please enter a password.",minlength:"Your password must be at least 5 characters.",maxlength:"Your password is too long."},propID_pass2:{required:"Please confirm your password.",equalTo:"Your passwords do not match."},propID_terms:{required:"In order to join Fox News community you must agree to our terms and conditions. Please review and check the box to join."},propID_country:{required:"Please select your country of residence."},propID_zip:{digits:"Please enter a valid zip code.",maxlength:"A valid zip code is five digits.",minlength:"A valid zip code is five digits.",required:"Please enter a zip code.",remote:"Please enter a valid United States zip code."},propID_birthyear:{required:"Please select your birth year."}}};as.instantiateValidators();$("#registration").validate(registration_validation_options);as.showRecaptcha();},initOpxLogin:function(){var as=this;var reset_password_validation_options={onkeyup:false,errorPlacement:function(error,element){},invalidHandler:function(form,validator){var elm=$(this);elm.find("input[type*=submit]").attr("disabled","disabled");var errors=validator.numberOfInvalids();if(errors){var message="The email address you entered is invalid.";elm.find(".error-box-login").html(message).show();}else{elm.find(".error-box-login").hide();}elm.find("input[type*=submit]").removeAttr("disabled");},submitHandler:function(form){var elm=$(form);elm.find("input[type*=submit]").attr("disabled","disabled");elm.find(".error-box-login").hide();as.forgotPassword(elm);return false;}};$("#reset-password .user-email-reset-form").validate(reset_password_validation_options);},initEditProfile:function(){var as=this;var edit_profile_validation_options={debug:false,submitHandler:function(form){if($("#reg_email").val()===""&&$("#reg_email2").val()===""){$("#reg_email").val($("#reg_curemail").val());$("#reg_email2").val($("#reg_curemail").val());}form.submit();return false;},errorElement:"p",errorPlacement:function(error,element){var elm=$(element),elem_pos=elm.position(),error_message=$(error[0]).html(),error_name=elm.attr("id").replace("reg","err");error_html=[];error_html.push('<div class="regoverlay_container error-tip" id="'+error_name+'">');error_html.push('<div class="overlaytip_top"></div><div class="form-note"><img src="/static/all/img/alert-yellow.gif" alt="" />');error_html.push('<p class="err-msg">'+error_message+'</p></div><div class="overlaytip_btm"></div></div>');error_html.join("");$("div.regoverlay_container.error-tip").hide();var errorElm=$("div#"+error_name);if(errorElm.size()>0){if(error_message!==""){errorElm.find("p.err-msg").html(error_message).show();}}else{elm.after(error_html);errorElm.hide();}errorElm.css({top:(elem_pos.top-80)+"px",left:(elem_pos.left+50)+"px"});errorElm.next(".validate > .sprites").removeClass("check").addClass("red-exclamation").show();},success:function(label){var errDiv=$("div#"+$(label).attr("htmlfor").replace("reg","err"));errDiv.hide();errDiv.next(".validate > .sprites").removeClass("red-exclamation").addClass("check");},rules:{propID_email:{required:false,email:true,maxlength:250,strictEmail:true},propID_email2:{equalTo:"#reg_email"},propID_pass1:{noSpaces:true,minlength:5,maxlength:12},propID_pass2:{noSpaces:true,minlength:5,maxlength:12,equalTo:"#reg_password"},propID_country:{required:true},propID_zip:{digits:true,maxlength:5,minlength:5,zipRequired:true,zipCheck:true},propID_gender:{required:true},propID_birthyear:{required:true,min:1900,isMaxYear:true}},messages:{propID_email:{required:"Please enter an email address.",email:"Your email address must be valid.",maxlength:"Your email address is too long.",remote:"A user is already registered with this email."},propID_email2:{required:"Please confirm your email address.",equalTo:"Please double check your email. They do not match."},propID_pass1:{required:"Please enter a password.",minlength:"Your password must be at least 5 characters.",maxlength:"Your password is too long."},propID_pass2:{required:"Please confirm your password.",equalTo:"Your passwords do not match."},propID_country:{required:"Please select your country of residence."},propID_zip:{digits:"Please enter a valid zip code.",maxlength:"A valid zip code is five digits.",minlength:"A valid zip code is five digits.",required:"Please enter a zip code."},propID_gender:{required:"Please submit your gender."},propID_birthyear:{required:"Please select your birth year."}}};as.instantiateValidators();$("#reg_profile").validate(edit_profile_validation_options);},forgotPasswordOverlay:function(obj){var as=this;if(!as.isLoggedIn()){if($("#forgot-password-overlay").size()===0){as.getOverlayHtml("forgot-password-overlay");}var offset=$(obj).offset();var leftPos=offset.left-$("#forgot-password-overlay").width();as.overlay.show("#forgot-password-overlay");return false;}return true;},login:function(formObj){formObj=$(formObj);var as=this,user=formObj.find("input[name*=username]").val(),pass=formObj.find("input[name*=password]").val(),rememberMe=(formObj.find("input[name*=rememberMe]:checked").size()>0)?true:false,numOfDays=(rememberMe)?365:0;$.ajax({type:"POST",url:as.loginSubmitUrl,data:({username:user,password:pass,authDomain:as.domain,rememberMe:rememberMe}),dataType:"text",success:function(data,textStatus){var loginResponse=as.createObjFromJSON(data);if(!loginResponse){showToConsole("[authSrv.login] No data returned from request.",true);return false;}if(loginResponse.authentication.status==="ok"){as.onSuccessLogin();as.thirdPartyAPI.disqus.login(loginResponse);as.thirdPartyAPI.idms.login(loginResponse);as.closeOverlay("login-provider");if(as.domain==="foxnews.com"&&window.location.pathname.indexOf("/community/user/")>-1){window.location.reload();}}else{formObj.find("input[type*=submit]").removeAttr("disabled");formObj.find(".login-error").html("We are sorry, please try again.").show();}},error:function(XMLHttpRequest,textStatus,errorThrown){formObj.find("input[type*=submit]").removeAttr("disabled");formObj.find(".login-error").html("We are sorry, please try again later.").show();}});},logout:function(origDomain){var as=this;origDomain=origDomain||as.defaultDomain;$.ajax({type:"POST",url:as.logoutSubmitUrl,data:({authDomain:origDomain}),success:function(data,textStatus){if(data){var authObj=as.createObjFromJSON(data);if(!authObj){showToConsole("[authSrv.logout] No data returned from request.",true);return false;}if(authObj.authentication.status==="ok"){as.thirdPartyAPI.disqus.logout(authObj,function(){as.thirdPartyAPI.idms.logout(authObj,function(){if(window.location.pathname.indexOf("/community/user/profile")>-1){window.location.href="http://www.foxnews.com/index.html";}else{window.location.reload();}});});}}},error:function(XMLHttpRequest,textStatus,errorThrown){}});},requestLogOut:function(config){config=config||{};var as=this;$.ajax({type:"GET",url:as.requestLogoutUrl,success:function(data){var authObj=as.createObjFromJSON(data);if(!authObj){showToConsole("[authSrv.requestLoginInfo] No data returned from request.",true);return false;}if(typeof config.callback==="function"){config.callback(authObj);}}});},requestLoginInfo:function(config){config=config||{};var as=this;$.ajax({type:"POST",url:as.refreshAuthUrl,success:function(data){var authObj=as.createObjFromJSON(data);if(!authObj){showToConsole("[authSrv.requestLoginInfo] No data returned from request.",true);return false;}if(typeof config.callback==="function"){config.callback(authObj);}}});},forgotPassword:function(formObj){formObj=$(formObj);var as=this,email=formObj.find("input[name*=emailResetField]").val();$.ajax({type:"POST",url:as.forgottenPasswordSubmitUrl,data:({email:email}),dataType:"text",success:function(data,textStatus){var forgotPasswordResponse=as.createObjFromJSON(data);if(!forgotPasswordResponse){showToConsole("[authSrv.forgotPassword] No data returned from request.",true);return false;}if(forgotPasswordResponse.authentication.status==="ok"){formObj.find(".error-box-login").hide();formObj.find(".reset-input-container").hide();formObj.find(".confirm-box-login").html("A reset link has been sent to the email provided.").show();}else{formObj.find("input[type*=submit]").removeAttr("disabled");formObj.find(".error-box-login").html("The email address you entered is invalid").show();}},error:function(XMLHttpRequest,textStatus,errorThrown){formObj.find("input[type*=submit]").removeAttr("disabled");formObj.find(".error-box-login").html("We're sorry your password cannot be reset at this time. Please try again later.").show();}});},register:function(formObj){var as=this,privacy=(formObj.find("#reg_location_confirm:checked").size()>0)?"hide":"",challenge=as.thirdPartyAPI.recaptcha.getChallenge(),response=as.thirdPartyAPI.recaptcha.getResponse();var slids=[];if(formObj.find("#fnbreaking:checked").size()>0){slids.push("C2F278094FACCEA62391025B7A52D8EB");}if(formObj.find("#fbbreaking:checked").size()>0){slids.push("5C84B893BD6D939E84FAE1A8E6E9525A");}if(slids.length>0){$.ajax({type:"GET",url:as.newsAlertSubscriptionUrl,data:({slids:slids.join(","),email:$("#reg_email").val()}),dataType:"text"});}$.ajax({type:"POST",url:as.registrationSubmitUrl,data:{authDomain:as.domain,realm:"realm1",username:formObj.find("#reg_user_name").val(),password:formObj.find("#reg_password").val(),email:formObj.find("#reg_email").val(),zip:formObj.find("#reg_zip_code").val(),country:formObj.find("#reg_country").val(),location_privacy:privacy,birth_year:formObj.find("#reg_birth_year").val(),recaptcha_challenge_field:challenge,recaptcha_response_field:response},dataType:"text",success:function(data,textStatus){var registrationResponse=as.createObjFromJSON(data);if(!registrationResponse){showToConsole("[authSrv.register] No data returned from request.",true);return false;}if(registrationResponse.authentication.status==="ok"){$("#registration-error").hide();$("#registration-overlay").hide();as.getOverlayHtml("registration-thankyou-overlay");decreaseRefresh();authentication_service.onSuccessLogin();as.thirdPartyAPI.disqus.login(registrationResponse);as.thirdPartyAPI.idms.login(registrationResponse);as.overlay.show("#registration-thankyou-overlay");$.scrollTo("#registration-thankyou-overlay");$("#clickToClose").focus();}else{var errorMsg=registrationResponse.authentication.message;as.showRecaptcha();$("#registration-error").html("We are sorry, we could not complete your registration. Please fix the error and try again. <br/> *"+errorMsg).show();$.scrollTo("#registration-error");}},error:function(XMLHttpRequest,message,errorThrown){as.showRecaptcha();$("#registration-error").html("We are sorry, we could not complete your registration. Please try again. <br> *"+message).show();$.scrollTo("#registration-error");}});},overlay:{init:function(action,target){target=$((target||"#registration-overlay"));var as=this;$(action).each(function(){$(action).unbind("click").click(function(){as.show(target);});});},show:function(target){target=$(target);var as=this;if(typeof increaseRefresh!=="undefined"){increaseRefresh();}target.find(".validate a.sprites").unbind("click");if($(".overlay-layer").size()===0){$("body").prepend('<div class="overlay-layer"></div>');}$(".overlay-layer").show();target.each(function(){var elm=$(this);elm.show().fixedBox();if($(window).height()<elm.height()){var scrollTop=$(document).scrollTop();var overlayTop=(target.css("top")).replace(/[a-z]/g,"");var abs=Math.abs(overlayTop)+scrollTop;elm.css({top:abs+"px",position:"absolute"});}elm.find(".field input").removeClass("error").attr("value","");elm.find(".validate a.sprites,.error-tip").hide();var usr=elm.find("#reg_user_name"),usrParent=usr.parent(),pwd=elm.find("#reg_password"),pwdParent=pwd.parent();if(usrParent.find("span.req-text").size()===0){usr.after('<span class="req-text req-user">5-15 characters, cannot be changed</span>');usrParent.focus(function(){elm.find(".req-user").remove();});}if(pwdParent.find("span.req-text").size()===0){pwd.after('<span class="req-text req-password">5-12 characters, no space, case-insensitive</span>');pwdParent.focus(function(){elm.find(".req-password").remove();});}});var close=target.find(".close").parent(),signUpReg=$(".sign_up_registration");close.unbind("click").removeAttr("onclick").click(function(){as.hide(target);return false;});target.find(".buttons input[type='reset']").click(function(){as.hide(target);return false;});signUpReg.click(function(){$(".overlay-layer").show();});},hide:function(target){if(typeof decreaseRefresh!=="undefined"){decreaseRefresh();}$(".overlay-layer").hide();$(target).hide();}},instantiateValidators:function(){var as=this;$.validator.addMethod("validChars",function(value){var i,result=true,iChars="!@#$%^&*()+=-[]\\';,./{}|\":<>?";for(i=0;i<value.length;i++){if(iChars.indexOf(value.charAt(i))!==-1){return false;}}return result;},"Please supply valid characters only.");$.validator.addMethod("strictEmail",function(value){return(value.match(/^([a-zA-Z0-9_.\-\+])+@([a-zA-Z0-9_.\-])+\.([a-zA-Z])+([a-zA-Z])+/)!==null)||(value==="");},"Please supply valid email characters only.");$.validator.addMethod("noSpaces",function(value){var result=true,strArr=[];if(typeof value==="string"&&value.split(" ").length>1){return false;}return result;},"Please remove the blank spaces.");$.validator.addMethod("validCharsName",function(value){var i,resultName=true,iChars='!@#$%^&*()\\+=[];,./{}|":<>?',iCharshp="-",iCharsap="'",counterhp=0,counterap=0;for(i=0;i<value.length;i++){if(iChars.indexOf(value.charAt(i))!==-1){return false;}if(iCharshp.indexOf(value.charAt(i))!==-1){counterhp=counterhp+1;}if(iCharsap.indexOf(value.charAt(i))!==-1){counterap=counterap+1;}}if(counterhp>1){return false;}if(counterap>1){return false;}return resultName;},"Please supply valid characters only.");$.validator.addMethod("isMaxYear",function(value){var result=true,d=new Date(),curr_year=d.getFullYear();if($("#reg_birth_year").val()>(curr_year-13)){return false;}return result;},"You must be at least 13 years old to register for this site.");$.validator.addMethod("zipRequired",function(value){var result=true;country=$("#reg_country").val();if(country==="United States"&&value===""){return false;}return result;},"Zip Code is required.");$.validator.addMethod("zipCheck",function(value){var result=true,regLocation=$("#reg_location");if($("#reg_country").val()==="United States"){regLocation.show();$.ajax({type:"GET",url:as.getRegistrationDataUrl,async:false,data:({zip:$("#reg_zip_code").val()}),dataType:"text",success:function(data,textStatus){if(data){var stateObj=as.createObjFromJSON(data);if(!stateObj){showToConsole("[authSrv.validator] No data returned from request.",true);return false;}var state=stateObj.state_for_zip;regLocation.val((state!=="")?state:"");result=false;}else{regLocation.val("");result=false;}},error:function(XMLHttpRequest,textStatus,errorThrown){regLocation.val("");}});result=(regLocation.val()!=="")?true:false;}else{regLocation.hide();}return result;},"Please enter a valid United States zip code.");},showRecaptcha:function(){var as=this;as.thirdPartyAPI.recaptcha.create();}};AuthService.prototype.thirdPartyAPI={init:function(){this.disqus.root=this.recaptcha.root=this.idms.root=this.root;this.disqus.set();this.idms.set();},recaptcha:{set:function(fn){var RC=this,root=this.root,cfg=CONST_ThirdPartyConfig.recaptcha;if(typeof Recaptcha!=="undefined"){if(typeof fn==="function"){fn();}}else{window.Recaptcha_Create_Instance=function(){$.loadAttempt({maxAttempts:30,timeout:500,callback:{check:function(){return(typeof Recaptcha!=="undefined")?true:false;},success:function(){if(typeof fn==="function"){fn();}},timedOut:function(){showToConsole("[authSrv.recaptcha] Recaptcha load attempt timed out.");}}});};(function(){var e=document.createElement("script");e.src=document.location.protocol+"//"+document.location.hostname+cfg.url;e.type="text/javascript";e.async=true;(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(e);}());}},create:function(){var RC=this,cfg=CONST_ThirdPartyConfig.recaptcha,recaptcha_id=cfg.id,divId=cfg.elmId,settings=cfg.settings;RC.set(function(){Recaptcha.create(recaptcha_id,divId,settings);});},getChallenge:function(){if(typeof Recaptcha!=="undefined"){return Recaptcha.get_challenge();}return false;},getResponse:function(){if(typeof Recaptcha!=="undefined"){return Recaptcha.get_response();}return false;}},disqus:{set:function(){var root=this.root,DQ=this;$(document).ready(function(){DQ.validateHash(function(hash){DQ.integrate({token:hash,usr:DQ.cookie("get","p_UN")});});});},validateHash:function(fn){var DQ=this,root=this.root,cookieVal=this.cookie("get"),cfg=CONST_ThirdPartyConfig.disqus;if(cookieVal){unescape(cookieVal);}function trigger(){var data={dqs:cookieVal};root.requestLoginInfo({data:data,callback:function(obj){if(!obj){showToConsole("[api.disqus] Refresh service returned no hash value.");return false;}try{var hash=obj.authentication.dqs;DQ.cookie("set",hash);if(typeof fn==="function"){fn(hash);showToConsole("[api.disqus] Hash Refresh Initiated");}}catch(err){showToConsole("[api.disqus] Refresh service: "+err);}}});}function loggedOutCookie(){root.requestLogOut({callback:function(obj){if(!obj){showToConsole("[api.disqus] logout hash service returned no value.");return false;}try{var hash=obj.authentication.dqs;DQ.cookie("set",hash);fn(hash);}catch(err){showToConsole("[api.disqus] Refresh service: "+err);return false;}}});}function hasExpired(hasExpiredFn){var cDate=new Date(),curr={time:cDate,epoch:Math.round(cDate.getTime()/1000),expire:new Date(cDate.getTime()+(cfg.hash.expires*60*1000))};curr.expireEpoch=Math.round(curr.expire/1000);function getLoggedOut(){return"new";}if(!cookieVal){return getLoggedOut();}var arr=cookieVal.split(" "),hash=arr[0],timestamp=arr[2];if(typeof timestamp==="undefined"){return getLoggedOut();}if(isNaN(timestamp)){return getLoggedOut();}if(!root.isLoggedIn()&&hash!==cfg.hash.empty){return getLoggedOut();}timestamp=parseInt(timestamp,10);var tDate=new Date(timestamp*1000),ts={time:new Date(tDate),epoch:timestamp,expire:new Date(tDate.getTime()+(cfg.hash.expires*60*1000))};ts.expireEpoch=Math.round(ts.expire/1000);if(curr.epoch>=ts.expireEpoch){if(arr[0]!==cfg.hash.empty){return"yes";}}return"no";}switch(hasExpired()){case"new":loggedOutCookie();break;case"no":fn(cookieVal);break;case"yes":showToConsole("[api.disqus] Hash Expired");trigger();break;}},login:function(data,fn){data=data||false;fn=fn||false;if(!data){return false;}if(typeof data!=="object"){return false;}var DQ=this;if(data.authentication.dqs){showToConsole("[api.disqus] Logging In");DQ.cookie("set",data.authentication.dqs);DQ.integrate({token:data.authentication.dqs,usr:DQ.cookie("get","p_UN")});}if(typeof fn==="function"){fn();}},logout:function(data,fn){data=data||false;fn=fn||false;if(!data){return false;}if(typeof data!=="object"){return false;}var DQ=this;if(data.authentication.dqs){showToConsole("[api.disqus] Logging Out");DQ.cookie("set",data.authentication.dqs);DQ.integrate({token:data.authentication.dqs,usr:DQ.cookie("get","p_UN")});}if(typeof fn==="function"){fn();}},integrate:function(config){config=config||{};var cfg=CONST_ThirdPartyConfig.disqus;function trigger(){$.loadAttempt({maxAttempts:60,timeout:500,callback:{check:function(){return((fox&&fox.widgets&&typeof fox.widgets[cfg.widget]==="function")||(typeof window["FOX_"+cfg.widget]==="function"))?true:false;},success:function(){if(fox&&fox.widgets&&typeof fox.widgets[cfg.widget]==="function"){showToConsole("[api.disqus] Integrating ");fox.widgets[cfg.widget](config);}else{if(typeof window["FOX_"+cfg.widget]==="function"){showToConsole("[api.disqus] Integrating ");window["FOX_"+cfg.widget](config);}}}}});}$(document).ready(function(){trigger();});},cookie:function(type,data){data=data||false;var cfg=CONST_ThirdPartyConfig.disqus,cName=cfg.cookie.name,root=this.root,host="*."+root.domain,exp=new Date();exp.setTime(exp.getTime()+(cfg.cookie.expires*24*60*60*1000));var options={path:"/",host:host,expires:exp,domain:root.domain};switch(type){case"set":if(data){$.cookie(cName,data,options);}break;case"remove":$.cookie(cName,null);break;case"get":cName=(data)?data:cName;return($.cookie(cName))?$.cookie(cName):false;}}},idms:{set:function(){var ID=this,root=this.root;$(document).ready(function(){ID.validateHash(function(hash){ID.integrate({token:hash,usr:ID.cookie("get","p_UN")});});});},integrate:function(config){config=config||{};var cfg=CONST_ThirdPartyConfig.idms,fnName=cfg.callback.login;if(typeof window[fnName]==="function"){window[fnName](config);}},validateHash:function(fn){var ID=this,root=this.root,cookieVal=this.cookie("get"),cfg=CONST_ThirdPartyConfig.idms;function loggedOutCookie(){ID.cookie("remove");fn(false);}function hasExpired(hasExpiredFn){function getLoggedOut(){return"new";}if(!cookieVal){return getLoggedOut();}var arr=cookieVal.split(" "),hash=arr[0];if(!root.isLoggedIn()&&hash!==cfg.hash.empty){return getLoggedOut();}return"no";}switch(hasExpired()){case"new":loggedOutCookie();break;case"no":fn(cookieVal);break;}},login:function(data,fn){data=data||false;fn=fn||false;if(!data){return false;}if(typeof data!=="object"){return false;}var ID=this;if(data.authentication.idms){showToConsole("[api.idms] Logging In");ID.cookie("set",data.authentication.idms);ID.integrate({token:data.authentication.idms,usr:ID.cookie("get","p_UN")});}else{showToConsole("[api.idms] No IDMS authentication found.");}if(typeof fn==="function"){fn();}},logout:function(data,fn){var ID=this,cfg=CONST_ThirdPartyConfig.idms,fnName=cfg.callback.logout;ID.cookie("remove-full");if(typeof window[fnName]==="function"){window[fnName](cfg);}if(typeof fn==="function"){fn();}},cookie:function(type,data){data=data||false;var cfg=CONST_ThirdPartyConfig.idms,cName=cfg.cookie.name,root=this.root,host=root.domain,exp=new Date();exp.setTime(exp.getTime()+(cfg.cookie.expires*24*60*60*1000));var options={path:"/",expires:exp,domain:host};switch(type){case"set":if(data){$.cookie(cName,data,options);}break;case"remove":options={path:"/",domain:host};$.cookie(cName,null,options);break;case"remove-full":options={path:"/",domain:host};$.cookie(cName,null,options);$.cookie(cName,"BLAH");$.cookie(cName,null);break;case"get":cName=(data)?data:cName;var val=($.cookie(cName))?$.cookie(cName):false;return val;}}}};var auth_service=window.auth_service=new AuthService();var disablezip=window.disablezip=function(value){var zip=$("#reg_zip_code"),loc=$("#reg_location");if(value==="United States"){zip.removeAttr("readonly").css("background","#fff");zip.next(".validate").children(".sprites").hide();loc.val("");}else{zip.attr("readonly",true).css("background","#ddd").val("");loc.val(value);}};var formatField=window.formatField=function(id,value){var elm=$("#"+id);switch(id){case"reg_first_name":elm.val(value.join(""));break;case"reg_last_name":elm.val(value.join(""));break;default:elm.val(value.toLowerCase().replace(/\s+/gi,""));}};var formatTrim=window.formatTrim=function(id,value){$("#"+id).val(value.replace(/\s+/gi,""));};var isNumberKey=window.isNumberKey=function(evt){var charCode=(evt.which)?evt.which:evt.keyCode;return(charCode>31&&(charCode<48||charCode>57))?false:true;};var increaseRefresh=window.increaseRefresh=function(){if(typeof ew_disableRefresh==="function"){ew_disableRefresh();}else{$("meta[name='refresh'],meta[http-equiv='refresh']").each(function(){var item=$(this),refresh=item.attr("content"),orig=(typeof item.attr("content")!=="undefined")?refresh:false;item.data("RefreshOrig",orig);item.attr("content","7200");});}};var decreaseRefresh=window.decreaseRefresh=function(){if(typeof ew_disableRefresh==="function"){ew_enableRefresh();}else{$("meta[name='refresh'],meta[http-equiv='refresh']").each(function(){var item=$(this),orig=item.data("RefreshOrig");if(orig){item.attr("content",orig);}});}};function showToConsole(str,force){force=force||false;var search=(window.location.search).substr(1);if(search.length>0){var x,pairs=search.split("&"),valuePair={};for(x=0;x<pairs.length;x++){var split=pairs[x].split("=");valuePair[split[0]]=split[1];}if(valuePair.stc==="y"||force){if(typeof window.console==="object"){console.log(str);}}}}(function(){function d(c){return typeof c==="function"?!0:!1;}var f=function(){var c,b=arguments;if(b.length===0){return !1;}var a={attempt:0,timeout:500};if(b.length===1&&typeof b[0]==="object"){for(c in b[0]){a[c]=b[0][c];}if(a.callback){c=a.callback;}else{return !1;}if(!c.check||!c.success){return !1;}else{a._check=c.check,a._success=c.success;}if(c.timedOut){a._timeout=c.timedOut;}}else{if(!isNaN(b[0])&&!isNaN(b[1])&&d(b[2])&&d(b[3])){a.attempt=b[0];a.timeout=b[1];a._check=b[2];a._success=b[3];if(b[4]){a._timeout=b[4];}if(b[5]){a._abort=b[5];}}else{if(d(b[0])&&d(b[1])){a._check=b[0];a._success=b[1];if(b[2]){a._timeout=b[2];}if(b[3]){a._abort=b[3];}}else{return !1;}}}if(!d(a._check)||!d(a._success)){return !1;}if(!d(a._timeout)){a._timeout=function(){};}if(isNaN(a.timeout)){return !1;}else{a.timeout=parseInt(a.timeout,10);}if(isNaN(a.attempt)){return !1;}else{a.attempt=parseInt(a.attempt,10);}var e=!1,g=!1;if(a.attempt&&a.timeout){var f=function(){g?clearTimeout(e):a._check()?(a._success(),clearTimeout(e)):a.attempt>0?e=setTimeout(function(){f();},a.timeout):a._timeout();a.attempt--;};f();}else{e=setInterval(function(){g?clearInterval(e):a._check()&&(a._success(),clearInterval(e));},a.timeout);}return{abort:function(){g=!0;}};};if(typeof jQuery!=="undefined"&&jQuery.extend&&!jQuery.loadAttempt){jQuery.extend({loadAttempt:f});}else{if(!window.loadAttempt){window.loadAttempt=f;}}})();}(jQuery));
/*Fri Feb 03 14:16:40 EST 2012*/

