var URL_ACCOUNT_SETTING="/ajax/accountSetting";var URL_GENERATE_TXN="/ajax/generateTxn";var URL_UPDATE_PHONE_NUMBER="/ajax/updatePhoneNumber";var URL_UPDATE_FB_CONNECT="/ajax/updateFBConnect";var URL_SUBSCRIBE="/ajax/subscribeMailing";var URL_DOWNGRADE_PLUS="/ajax/downgradePlus";var URL_DOWNGRADE_COMMERCIAL="/ajax/downgradeCommercial";function displayFeedbackWithScrollTop(A){displayFeedback(A);window.scroll(0,0)}function accountSetting(B){var A=$(B);$("accDescriptionUTF8").value=encodeURI($("accDescription").value);if(A.username.value.replace(/^\s*(.*)\s*$/,"$1")==""){displayFeedbackWithScrollTop("1"+GT.gettext("Your display name must not be empty"));return }if((A.newpass.value==""&&A.confpass.value=="")||(A.currpass.value!=""&&A.newpass.value==A.confpass.value)){if(A.newpass.value!=""&&A.newpass.value.length<4){displayFeedbackWithScrollTop("1"+GT.gettext("Your new password must be greater than 3 characters"));return }}else{if(A.currpass.value==""&&A.newpass.value==A.confpass.value){displayFeedbackWithScrollTop("1"+GT.gettext("You must enter your current password"));return }else{displayFeedbackWithScrollTop("1"+GT.gettext("Make sure your confirmation password matches your new password"));return }}new Ajax.Request(URL_ACCOUNT_SETTING,{method:"post",parameters:A.serialize(),onSuccess:function(D){var C=D.responseText;parseResponse(C);A.enable();if(responseArray.code=="0"){if(typeof responseArray.json.url!="undefined"){window.location=responseArray.json.url}else{displayFeedbackWithScrollTop("0"+GT.gettext("Your changes have been saved"))}}else{if(typeof responseArray.json.url!="undefined"){window.location=responseArray.json.url}else{displayFeedbackWithScrollTop(responseArray.code+responseArray.json.error)}}},onFailure:function(){displayFeedbackWithScrollTop("1"+GT.gettext("Error contacting the server"));A.enable()}});A.disable()}var phone_num="";function updatePhoneNumber(B){var A=$(B);phone_num=A.phonenum.value;if(A.phonenum.value==""||A.phonenum.value.replace(/^\s*(.*)\s*$/,"$1")==""){document.getElementById("updateErr").innerHTML=GT.gettext("Your phone number must not be empty");return }new Ajax.Request(URL_UPDATE_PHONE_NUMBER,{method:"post",parameters:A.serialize(),onSuccess:function(D){var C=D.responseText;parseResponse(C);A.enable();if(responseArray.code=="0"){if(typeof responseArray.json.url!="undefined"){window.location=responseArray.json.url}else{displayFeedbackWithScrollTop("0"+GT.gettext("Your phone number has been saved"));hideUpdatePhone()}}else{if(typeof responseArray.json.url!="undefined"){window.location=responseArray.json.url}else{displayFeedbackWithScrollTop(responseArray.code+responseArray.json.error)}}$("phonenumdiv").innerHTML='<INPUT style="font-size:18px;padding:3px;width:300px;" maxLength="255" name="phonenum" id="phonenum" value="'+phone_num+'">'},onFailure:function(){displayFeedbackWithScrollTop("1"+GT.gettext("Error contacting the server"));A.enable()}});A.disable()}var txnnum="";function generateTxn(B,A){grayOut(true,"BuyBucksPaypalOverlay");$("sel_frm_id").innerHTML=B;new Ajax.Request(URL_GENERATE_TXN,{method:"post",parameters:"pkg_name="+B+"&txnnum="+$("txnnum").innerHTML,onSuccess:function(D){var C=D.responseText;parseResponse(C);if(typeof responseArray.json.url!="undefined"){window.location=responseArray.json.url}else{generateTxnComplete(responseArray.json.txnnum,B,A)}resetResponse()},onFailure:function(){displayFeedback("1"+GT.gettext("Error contacting the server"));grayOut(false,"BuyBucksPaypalOverlay")}})}function generateTxnComplete(A,C,B){$("txnnum").innerHTML=A;$(C+"_invoice").value=A;$("packageName").innerHTML=B;$("generatingTxn").style.display="none";$("transferring").style.display="block";$(C).submit()}function gotoPayPal(){var A=$("sel_frm_id").innerHTML;$("transfer").style.display="none";$("transferring").style.display="block";$(A).submit()}function subscribeMailing(A,B,C){if(typeof A!="undefined"&&typeof B!="undefined"&&typeof C!="undefined"){var D=null;if(C=="subscribe"){D=GT.gettext("Are you sure you want to subscribe to our mailing list?")}else{D=GT.gettext("Are you sure you want to unsubscribe from our mailing list?")}if(confirm(D)){pageTracker._trackPageview("/pageTracker/ajax/subscribe/"+A);new Ajax.Request(URL_SUBSCRIBE,{method:"post",parameters:"user_id="+A+"&email="+B+"&type="+C,onSuccess:function(F){var E=F.responseText;parseResponse(E);if(typeof responseArray.json.url!="undefined"){window.location=responseArray.json.url}else{window.location=location.href}},onFailure:function(){displayFeedback("1"+GT.gettext("Error contacting the server"))}})}}}function downgradePlus(){var B=$("expiry_date").innerHTML;var A=GT.strargs(GT.gettext("Your account will be downgraded starting %1"),['<span style="font-size:16px;font-weight:bold;">'+B+"</span>"]);showProcessing(GT.gettext("Downgrade Account to Basic"),'<div style="width:600px;padding:30px 50px;font-size:16px;" id="downgrade_plus_overlay"><div style="width:600px;float:left;padding-bottom:30px;text-align:center">'+A+'<br/><br/><span class="plus_warn">'+GT.gettext("Be aware that from this date onwards you will lose access to GoPlus+ features as well as to assets you have uploaded as part of your GoPlus+ account.")+'</span></div><div class="info_row" style="width:600px;height:40px;"><div style="overflow: hidden; height: 40px; width: 600px;float:left;"><div class="centeredentity"><ul class="centeredentity_ul"><li class="centeredentity_ul_li"><a href="javascript:doDowngradePlus();" class="sitebtn" style="color:#666;"><div onmouseout="javascript:buttonOut(this.id);" onmouseover="javascript:buttonOver(this.id, -40);" style="overflow: hidden; height: 40px; cursor: pointer; float: left;" id="pwd_confirm_btn"><ol style="margin: 0px; padding: 0px;"><li style="margin: 0pt; float: left; display: block; height: 80px;" id="pwd_confirm_btnleft"><img height="80" width="10" onload="javascript:iePngFix(this, 10, 80);" src="/static/go/img/buttons/lightgray/btn_lightgray_80_left.png?v=626"></li><li style="padding: 5px 5px 0px; background: transparent url(/static/go/img/buttons/lightgray/btn_lightgray_80_mid.gif?v=626) repeat-x scroll 0pt 0pt; float: left; display: block; height: 80px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 160px; text-align: center;" id="pwd_confirm_btncenterinactive"><span style="color: white; font-size: 16px; line-height: 26px; vertical-align: top; font-weight: normal;">'+GT.gettext("Downgrade to Basic")+'</span></li><li style="padding: 5px 5px 0px; background: transparent url(/static/go/img/buttons/lightgray/btn_lightgray_80_mid.gif?v=626) repeat-x scroll 0pt -40px; float: left; display: none; height: 80px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 160px; text-align: center;" id="pwd_confirm_btncenteractive"><span style="color: white; font-size: 16px; line-height: 26px; vertical-align: top; font-weight: normal;">'+GT.gettext("Downgrade to Basic")+'</span></li><li style="margin: 0pt; float: left; display: block; height: 80px;" id="pwd_confirm_btnright"><img height="80" width="10" onload="javascript:iePngFix(this, 10, 80);" src="/static/go/img/buttons/lightgray/btn_lightgray_80_right.png?v=626"></li></ol></div></a><div style="padding:9px 5px 0; width:190px;overflow: hidden; height: 40px; float: left; text-align:right"><a href="javascript:hideProcessing();">'+GT.gettext("Keep GoPlus+ Account")+'</a></div></li></ul></div></div></div></div><div style="width=100%;padding:100px 0;font-size:16px;text-align:center;display:none;" id="processing_div">'+GT.gettext("Processing downgrade request, please wait ...")+"</div>")}function doDowngradePlus(){$("downgrade_plus_overlay").style.display="none";$("processing_div").style.display="block";new Ajax.Request(URL_DOWNGRADE_PLUS,{method:"post",onSuccess:function(B){var A=B.responseText;parseResponse(A);if(typeof responseArray.json.url!="undefined"){if(window.location.href==responseArray.json.url){window.location.reload()}else{window.location=responseArray.json.url}}else{if(responseArray.code!="0"){displayFeedback("1"+responseArray.json.error);hideProcessing()}}resetResponse()},onFailure:function(){displayFeedback("1Error contacting the server")}})}function downgradeCommercial(){var B=$("commercial_expiry_date").innerHTML;var A=GT.strargs(GT.gettext("Your account will be downgraded starting %1"),['<span style="font-size:16px;font-weight:bold;">'+B+"</span>"]);showProcessing(GT.gettext("Discontinue Business Subscription"),'<div style="width:600px;padding:30px 50px;font-size:16px;" id="downgrade_commercial_overlay"><div style="width:600px;float:left;padding-bottom:30px;text-align:center">'+A+'<br/><br/><span class="plus_warn">'+GT.gettext("Once your business account expires, you will lose all commercial rights. <strong>As a result, all videos you have uploaded to third party sites must be taken down.</strong> Embed codes and links shared on websites used to promote your business must also be removed. <strong>Any further commercial use of videos created on GoAnimate on any site is a violation of our agreement, subject to penalties under the law.</strong>")+'</span></div><div class="info_row" style="float:left;width:600px;height:40px;text-align:center"><a class="biz-button dim" href="javascript:;" onclick="doDowngradeCommercial()">'+GT.gettext("Discontinue Business Subscription")+'</a><a href="javascript:hideProcessing();">'+GT.gettext("Keep Business Account")+'</a></div></div><div style="width=100%;padding:100px 0;font-size:16px;text-align:center;display:none;" id="processing_div">'+GT.gettext("Processing downgrade request, please wait ...")+"</div>")}function doDowngradeCommercial(){$("downgrade_commercial_overlay").style.display="none";$("processing_div").style.display="block";new Ajax.Request(URL_DOWNGRADE_COMMERCIAL,{method:"post",onSuccess:function(B){var A=B.responseText;parseResponse(A);if(typeof responseArray.json.url!="undefined"){if(window.location.href==responseArray.json.url){window.location.reload()}else{window.location=responseArray.json.url}}else{if(responseArray.code!="0"){displayFeedback("1"+responseArray.json.error);hideProcessing()}}resetResponse()},onFailure:function(){displayFeedback("1Error contacting the server")}})};
