function addOption(b,e,d){var a=new Option(e,d);var c=b.options.length;b.options[c]=a}function deleteOption(a,b){if(a.options.length!=0){a.options[b]=null}}function handleSubmitInfo(a){return function(){var e=a.getNodeFind();var d=a.getSelectElementTarget();if(a.XmlHttp.readyState==2){d.options.length=0;addOption(d,"Loading...","")}if(a.XmlHttp.readyState==4){d.options.length=0;var c;addOption(d,"Loading...","");if(globalLanguage=="es"){addOption(d,"-- Seleccionar --","")}else{addOption(d,"-- Select --","")}for(var b=0;b<a.XmlHttp.responseXML.getElementsByTagName(e).length;b++){addOption(d,a.XmlHttp.responseXML.getElementsByTagName(e)[b].childNodes[0].nodeValue,a.XmlHttp.responseXML.getElementsByTagName(e)[b].getAttribute("id"))}deleteOption(d,0);for(var b=0;b<d.length;b++){if(d.options[b].value==a.getDefValue()){d.options.selectedIndex=b}}}}}function submitFrmAjax(d,b,c,a){submitFrmAjax(d,b,c,a,"")}function submitFrmAjax(f,b,e,a,d){var c=new SubmitFrmAjax();c.setNodeFind(e);c.setSelectElementTarget(a);c.setUserForm(f);c.setActionUrl(f.action);c.fEventHandle=b;c.FormSubmitToAjax();c.setDefValue(d);return}function changeCombo(a){document.frmCountry.lookup.value="regions|idCountryField:"+a.value;submitFrmAjax(document.frmCountry,handleSubmitInfo,"element",document.getElementsByName("argument_dataMap_currIdState")[0])}function changeComboUserDescription(a){document.frmCountry.lookup.value="regions|idCountryField:"+a.value;submitFrmAjax(document.frmCountry,handleSubmitInfo,"element",document.getElementsByName("argument_userInfo_state")[0])}function changeComboStateUserDescription(b,a){document.frmCountry.lookup.value="regions|idCountryField:"+b.value;submitFrmAjax(document.frmCountry,handleSubmitInfo,"element",document.getElementsByName("argument_userInfo_state")[0],a)}function changeComboCityUserDescription(b,a){document.frmCountry.lookup.value="cities|idCountryField:"+b.value1+";idRegionField:"+b.value;submitFrmAjax(document.frmCountry,handleSubmitInfo,"element",document.getElementsByName("argument_userInfo_city")[0],a)}function changeCombo1(a){document.frmCountry.lookup.value="cities|idCountryField:"+document.getElementsByName("argument_dataMap_currIdCountry")[0].value+";idRegionField:"+a.value;submitFrmAjax(document.frmCountry,handleSubmitInfo,"element",document.getElementsByName("argument_dataMap_currIdCity")[0])}function changeCombo1UserDescription(a){document.frmCountry.lookup.value="cities|idCountryField:"+document.getElementsByName("argument_userInfo_country")[0].value+";idRegionField:"+a.value;submitFrmAjax(document.frmCountry,handleSubmitInfo,"element",document.getElementsByName("argument_userInfo_city")[0])}function loadCombo(){document.frmCountry.lookup.value="countries";submitFrmAjax(document.frmCountry,handleSubmitInfo,"element",document.getElementsByName("argument_dataMap_currIdCountry")[0])}function fillDate(){document.getElementsByName("argument_dataMap_dateOfBirth")[0].value=document.getElementsByName("year")[0].value+"-"+document.getElementsByName("month")[0].value+"-"+document.getElementsByName("day")[0].value+" 00:00:00"}function validate(a){for(i=0;i<a.elements.length;i++){if(a.elements[i].type=="textarea"||a.elements[i].type=="password"){if(a.elements[i].value.length==0){alert(a.elements[i].title);return false}}if(a.elements[i].type=="select-one"){if(a.elements[i].selectedIndex==0){alert("Invalid Data");return false}}}}function doHeardOther(a){if(a[a.selectedIndex].getAttribute("isOther")=="true"){document.frmUserCreation.argument_dataMap_howHeardOther.disabled=false;document.frmUserCreation.argument_dataMap_howHeardOther.focus()}else{document.frmUserCreation.argument_dataMap_howHeardOther.disabled=true;document.frmUserCreation.argument_dataMap_howHeardOther.value=" "}}function ajaxInvoke(a){objHttpReq=ObjXmlHttp();objHttpReq.onreadystatechange=function(){if(objHttpReq.readyState==4){if(objHttpReq.status==200){var b=objHttpReq.responseXML;checkUniqueFields(b)}}else{}};objHttpReq.open("GET",a,true);objHttpReq.send(null)}function ajaxInvokeUrl(a){objHttpReq=ObjXmlHttp();objHttpReq.onreadystatechange=function(){if(objHttpReq.readyState==4){if(objHttpReq.status==200){var b=objHttpReq.responseXML;checkUniqueFieldUrl(b)}}else{}};objHttpReq.open("GET",a,true);objHttpReq.send(null)}function ajaxInvokeEmail(a){objHttpReq=ObjXmlHttp();objHttpReq.onreadystatechange=function(){if(objHttpReq.readyState==4){if(objHttpReq.status==200){var b=objHttpReq.responseXML;checkUniqueFieldEmail(b)}}else{}};objHttpReq.open("GET",a,true);objHttpReq.send(null)}function ajaxInvokeCaptcha(a){objHttpReq=ObjXmlHttp();objHttpReq.onreadystatechange=function(){if(objHttpReq.readyState==4){if(objHttpReq.status==200){var b=objHttpReq.responseXML;ajaxInvokeCaptchaResultXML(b)}}else{}};objHttpReq.open("GET",a,true);objHttpReq.send(null)}function setArguments(c,a){if(c==null){c=true}var b="";if(document.getElementById("argument_dataMap_email").value.length!=0){b+="&argument_fields=email|"+document.getElementById("argument_dataMap_email").value}if(c){if(document.getElementById("argument_dataMap_url").value.length!=0){b+="&argument_fields=url|"+document.getElementById("argument_dataMap_url").value}}if(a!=null){b+="&argument_fields=idUser|"+a}return b}function searchCities(c,e,b){var a=document.getElementById(c);e+="%";var d=document.getElementById(b);if(a.selectedIndex<=0){alert("You must select a state before searching for cities");return}selectedState=a.options[a.selectedIndex].value;lco=new loadComboObject("cities|idRegionField:"+selectedState+";cityName:"+escape(e),"",b,null,"cities","");lco.loadCombo()}function cleanCombo(f){var e=document.getElementById(f);var d=e.options.length;for(var b=0;b<d;b++){e.remove(0)}var c=((globalLanguage=="es")?"-- Seleccionar --":"-- Select --");var a=new Option(c,"");e.options[0]=a}function loadHowHeardCombo(a,e,h){if(!a){var c="/frontEnd/ElhoodCocoonGenerator.xml?invoke=nothing&lookup=howHeard&language="+h;ajaxCall(c,new Function('loadHowHeardCombo(arguments[0], "'+e+'","'+h+'");'),new Function('loadHowHeardCombo(null, "'+e+'","'+h+'");'));c=null}else{var b=getLookupFromXML(a,"howHeard");var d=b.firstChild;var g=document.getElementById("argument_dataMap_howHeard");var f=null;while(d){f=document.createElement("option");f.value=d.getAttribute("id");f.text=d.firstChild.nodeValue;f.setAttribute("isOther",d.getAttribute("id1"));f.setAttribute("isPromotion",d.getAttribute("id2"));if(e&&d.getAttribute("id2")=="true"){f.selected=true}if(e||d.getAttribute("id2")!="true"){g.options[g.options.length]=f}d=d.nextSibling}f=b=d=g=null}}function fillCanContact(){document.getElementById("argument_dataMap_weCanContact").value=(document.getElementById("weCanContact").checked);document.getElementById("argument_dataMap_partnersCanContact").value=(document.getElementById("partnersCanContact").checked)}function validEmail(a,b){var c=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(c.test(a)){return true}else{if(b!=true){alert(validEmailText)}if(document.getElementById("argument_dataMap_email").focus()){return false}}}function validUsernameFormat(b){var a=/^([a-zA-Z0-9_\-ñÑáéíóúÁÉÍÓÚüÜàèìòùÀÈÌÒÙ ])+$/;if(a.test(b)){return true}else{alert(validUsernameText);document.frmUserCreation.argument_dataMap_username.focus();document.frmUserCreation.argument_dataMap_username.select();return false}}function validArtistnameFormat(b){var a=/^([a-zA-Z0-9_\-ñÑáéíóúÁÉÍÓÚüÜàèìòùÀÈÌÒÙ ])+$/;if(a.test(b)){return true}else{alert(validArtistnameText);document.frmUserCreation.argument_dataMap_username.focus();document.frmUserCreation.argument_dataMap_username.select();return false}}function validUrlFormat(a){var b=/^([a-zA-Z0-9_\-])+$/;if(b.test(a)){return true}else{alert(validUrlFormatText);document.frmUserCreation.argument_dataMap_url.focus();document.frmUserCreation.argument_dataMap_url.select();return false}}function validPasswordFormat(a){var b=/^([a-zA-Z0-9])+$/;if(b.test(a)){return true}else{alert(validPasswordFormatText);document.frmUserCreation.argument_dataMap_password.focus();document.frmUserCreation.argument_dataMap_password.select();return false}}function verifyEmailDisponibility(){if(validEmail(document.getElementById("argument_dataMap_email").value)){if(document.getElementById("argument_dataMap_email").value!=""){var a="/frontEnd/validateUniqueFields.xhtml?xsl=none&invoke=validateUniqueFields&component=userMgr&argument_fields=email|"+document.getElementById("argument_dataMap_email").value+"&random="+Math.random();ajaxInvokeEmail(a)}}}function checkUniqueFieldValidEmail(b){var a=b.getElementsByTagName("result");for(i=0;i<a.length;i++){if(a[i].getAttribute("component")=="userMgr"&&a[i].getAttribute("action")=="validateUniqueFields"){if(a[i].childNodes[0].getAttribute("value")=="success"){alert(validEmailText);document.getElementById("argument_dataMap_email").select();document.getElementById("argument_dataMap_email").focus();return false}else{return true}}}}function checkUniqueFieldValidEmail(b){var a=b.getElementsByTagName("result");for(i=0;i<a.length;i++){if(a[i].getAttribute("component")=="userMgr"&&a[i].getAttribute("action")=="validateUniqueFields"){if(a[i].childNodes[0].getAttribute("value")=="success"){alert(validEmailText);document.getElementById("argument_dataMap_email").select();document.getElementById("argument_dataMap_email").focus();return false}else{return true}}}}function checkUniqueFieldValidEmailForgotpwd(b){var a=b.getElementsByTagName("result");for(i=0;i<a.length;i++){if(a[i].getAttribute("component")=="userMgr"&&a[i].getAttribute("action")=="validateUniqueFields"){if(a[i].childNodes[0].getAttribute("value")=="success"){alert(validEmailText);document.getElementById("argument_dataMap_email").select();document.getElementById("argument_dataMap_email").focus();return false}else{return true}}}}function checkUniqueFieldUrl(b){var a=b.getElementsByTagName("result");for(i=0;i<a.length;i++){if(a[i].getAttribute("component")=="userMgr"&&a[i].getAttribute("action")=="validateUniqueFields"){if(a[i].childNodes[0].getAttribute("value")=="success"){alert(urlAvailableText)}else{alert(urlDuplicatedText);document.frmUserCreation.argument_dataMap_url.focus();document.frmUserCreation.argument_dataMap_url.select()}}}}function checkUniqueFieldEmail(b){var a=b.getElementsByTagName("result");for(i=0;i<a.length;i++){if(a[i].getAttribute("component")=="userMgr"&&a[i].getAttribute("action")=="validateUniqueFields"){if(a[i].childNodes[0].getAttribute("value")=="success"){alert(emailAvailableText)}else{alert("Email "+fieldHasAlreadyBeenregisteredText);document.frmUserCreation.argument_dataMap_email.select();document.frmUserCreation.argument_dataMap_email.focus()}}}}function validateUrlName(){if(document.getElementById("argument_dataMap_url").value!=""){var a="/frontEnd/validateUniqueFields.xhtml?xsl=none&invoke=validateUniqueFields&component=userMgr&argument_fields=url|"+document.getElementById("argument_dataMap_url").value+"&random="+Math.random();ajaxInvokeUrl(a)}}function validDataUser(a){fillCanContact();fillDate();output=vf.validate(a);if(output){if(document.getElementById("argument_dataMap_currIdCity_custom_hidden").value.length==0){alert($("validCityText").value);return false}if(document.getElementById("argument_dataMap_password").value!=document.getElementById("passwordconfirm").value){output=false;document.getElementById("passwordconfirm").focus();document.getElementById("passwordconfirm").select();alert(yourPasswordConfirmationDoesNotMatchText)}try{var c=document.getElementById("month").value+"/"+document.getElementById("day").value+"/"+document.getElementById("year").value;if(!isDate(c)){output=false;alert(dateOfBirthNoValidText)}}catch(b){alert(b)}return output}else{return false}}function onSubmit(){if(validData(document.getElementById("frmUserCreation"))!=false&&validUsernameFormat(document.getElementById("argument_dataMap_username").value)&&validUrlFormat(document.getElementById("argument_dataMap_url").value)&&validPasswordFormat(document.getElementById("argument_dataMap_password").value)&&validEmail(document.getElementById("argument_dataMap_email").value)){var b=setArguments();var a="/frontEnd/validateUniqueFields.xhtml?xsl=none&invoke=validateUniqueFields&component=userMgr"+b+"&random="+Math.random();ajaxInvoke(a)}}function validData(a){output=vf.validate(a);if(output){if(document.getElementById("argument_dataMap_currIdCity_custom_hidden").value.length==0){alert(validCity);return false}output=document.getElementById("argument_dataMap_sex").checked;if(!output){output=document.getElementById("argument_dataMap_sex1").checked}if(!output){alert(vf.getShowText()+document.getElementById("argument_dataMap_sex").title);return output}if(output){try{var c=document.getElementById("month").value+"/"+document.getElementById("day").value+"/"+document.getElementById("year").value;if(!isDate(c)){output=false;alert(dateOfBirthNoValidText);return output}}catch(b){alert(b)}if((document.getElementById("day").selectedIndex==0)||(document.getElementById("month").selectedIndex==0)||(document.getElementById("year").selectedIndex==0)){alert(pleaseFillData);output=false;return output}}if(output){if(document.getElementById("verification").value.length==0){alert(pleasFillVerification);output=false;return output}}if(output){output=document.getElementById("accept").checked}if(!output){alert(vf.getShowText()+document.getElementById("accept").title);return output}if(output){if(document.getElementById("argument_dataMap_password").value!=document.getElementById("passwordconfirm").value){output=false;alert(passConfNotMatch);document.getElementById("passwordconfirm").focus();document.getElementById("passwordconfirm").select();return output}}if(output){if(document.getElementById("argument_dataMap_password").value.length<6){output=false;alert(passConfNotMatch);document.getElementById("passwordconfirm").focus();document.getElementById("passwordconfirm").select();return output}}}return output}function changeCaptchaImage(){lastRandomCaptcha=Math.random();document.getElementById("captchaImage").src="/captcha/captchaImage?random="+lastRandomCaptcha;document.getElementById("verification").value=""}function checkUniqueFields(b){var a=b.getElementsByTagName("result");for(i=0;i<a.length;i++){if(a[i].getAttribute("component")=="userMgr"&&a[i].getAttribute("action")=="validateUniqueFields"){if(a[i].childNodes[0].getAttribute("value")=="success"){var d="/captcha/captchaValidation?captchaResponse="+document.getElementById("verification").value+"&random="+lastRandomCaptcha;ajaxInvokeCaptcha(d)}else{var e=a[i].childNodes[0].getAttribute("value");var c=e.substring(e.indexOf(":")+1);if(trim(c)=="url"){alert(urlDuplicated);document.frmUserCreation.argument_dataMap_url.focus();document.frmUserCreation.argument_dataMap_url.select()}else{alert(c+fillAlreadyReg)}}}}}function ajaxInvokeCaptchaResultXML(b){var a=b.getElementsByTagName("result");if(a[0].firstChild.nodeValue=="success"){document.frmUserCreation.submit()}else{alert(wrongCaptcha);changeCaptchaImage()}}function valideUrlOnTxt(c,b){var a=jQuery("#"+c);if(validUrlFormat(jQuery(a).val())){jQuery.get("/data/other/folders.txt?",function(f){textResult=f.split(/\n/g);var d=0;for(var e=0;e<textResult.length;e++){if(textResult[e].toLowerCase()==(jQuery(a).val()).toLowerCase()){d+=d+1}}if(d!=0){alert(urlDuplicatedText);a.focus();a.select();return false}else{if(!b){validateUrlName()}else{secondValidation()}}})}}function valideUrlOnTxtArtist(c,b){var a=jQuery("#"+c);if(validUrlFormat(jQuery(a).val())){jQuery.get("/data/other/folders.txt?",function(f){textResult=f.split(/\n/g);var d=0;for(var e=0;e<textResult.length;e++){if(textResult[e].toLowerCase()==(jQuery(a).val()).toLowerCase()){d+=d+1}}if(d!=0){alert(urlDuplicatedText);a.focus();a.select();return false}else{if(!b){validateUrlName_Reg(jQuery(a).val())}else{onSubmit_Step1()}}})}};