var lower_characters="abcdefghijklmnopqrstuvwxyz_";var upper_characters="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var number_val="0123456789";function checkEmail(F){var C=F.email.value;var A=F.confirmemail.value;var B="";if(C==""||A==""){B="Please enter your email address.\n"}var E=/^.+@.+\..{2,4}$/;if(!(E.test(C))||!(E.test(A))){B="Please enter a valid e-mail address in both fields.\n"}else{var D=/[\(\)\<\>\,\;\:\\\"\[\]]/;if(C.match(D)||A.match(D)){B="Email address contains some words which are not allowed.\n"}}if(C!=A){B+="Confirm email does not match.\n"}return B}function isValid(B,A){if(B==""){return false}for(i=0;i<B.length;i++){if(A.indexOf(B.charAt(i),0)==-1){return false}}return true}function checkUsername(A){var B="";if(A==""){return"Invalid username.\n"}if((A.length<4)||(A.length>14)){B+="You must have atleast 4 characters and a max of 14 characters in your username.\n"}else{if(!isValid(A,lower_characters+number_val+upper_characters)){B+="Username can also only contain alphanumeric characters and the underscore.\n"}}return B}function checkPassword(D){var C=D.password.value;var B=D.confirmpassword.value;var A="";if((C.length<4)||(C.length>15)||(B.length<4)||(B.length>15)){A+="Password should be (4-15) characters long\n"}if(C.length!=B.length){A+="Confirm password does not match.\n"}return A}function checkPassword2(C){var B=C.password.value;var A="";if((B=="")||(B.length<4)||(B.length>15)){A+="Password should be (4-15) characters long\n"}return A}function checkForm(B){var A="";A+=checkUsername(B.username.value);A+=checkPassword(B);A+=checkEmail(B);if(B.name.value==""){A+="Name is missing.\n"}if(!B.gender[0].checked&&!B.gender[1].checked){A+="You did not specify your gender.\n"}if(B.month.value==0){A+="Birth month is missing.\n"}if(B.day.value==0){A+="Birth day is missing.\n"}if(B.year.value==0){A+="Birth year is missing.\n"}if(B.country.value==0){A+="Select your country from drop down.\n"}if(B.notlisted.checked==false){if(B.phone_brand.value==0||B.mobile.value==0){A+="Select your phone from drop down.\n"}}if(!B.tos.checked){A+="You must agree with Terms and Conditions.\n"}if(B.user_code.value==""){A+="You did not enter the image code\n"}if(A!=""){alert(A);return false}B.Submit.disabled=true;B.Submit.value="Registering...";return true}function checkSettings(B){var A="";A+=checkPassword2(B);if(B.name.value==""){A+="Please enter your name.\n"}if(!B.gender[0].checked&&!B.gender[1].checked){A+="You did not specify your gender.\n"}if(B.month.value==0){A+="Birth month is missing.\n"}if(B.day.value==0){A+="Birth day is missing.\n"}if(B.year.value==0){A+="Birth year is missing.\n"}if(B.country.value==0){A+="Select your country from drop down.\n"}if(B.notlisted.checked==false){if(B.phone_brand.value==0||B.mobile.value==0){A+="Select your phone from drop down.\n"}}if(A!=""){alert(A);return false}B.Submit.disabled=true;B.Submit.value="Updating Settings...";return true}function SelectOptions(A,B){for(i=0;i<A.options.length;i++){if(B==A[i].value){A[i].selected=true}}}function updateCellPhone(){var A=document.register.phone_brand.value;if(A==0){document.register.mobile.options.length=1;document.register.mobile.options[0].value="0";document.register.mobile.options[0].text="Select model";document.register.mobile.disabled=true;return }caturl=url+"ajax/cellphone-handler.php?ck=cell&pcid="+escape(A);if(http){http.open("GET",caturl,true);http.onreadystatechange=handleCellPhoneResponse;http.send(null)}}function handleCellPhoneResponse(){if(http.readyState==4){if(http.responseText.indexOf("Invalid Data")==-1){var B=http.responseXML;document.register.mobile.options.length=0;document.register.mobile.options.length=B.getElementsByTagName("mobile").length+1;document.register.mobile.options[0].value="0";document.register.mobile.options[0].text="Choose model";for(i=0;i<B.getElementsByTagName("mobile").length;i++){var A=B.getElementsByTagName("mobile").item(i);document.register.mobile.options[i+1].value=A.getElementsByTagName("mobileid").item(0).firstChild.data;document.register.mobile.options[i+1].text=A.getElementsByTagName("mobilename").item(0).firstChild.data}document.register.mobile.disabled=false;return }else{document.register.mobile.options.length=1;document.register.mobile.options[0].value="0";document.register.mobile.options[0].text="No Mobile Found.."}}else{document.register.mobile.options.length=1;document.register.mobile.options[0].value="0";document.register.mobile.options[0].text="Loading..."}document.register.mobile.disabled=true}function changeSelection(){if(document.register.notlisted.checked==true){document.register.phone_brand.disabled=true;document.register.mobile.disabled=true}else{document.register.phone_brand.disabled=false;if(document.register.mobile.options.length<=1){document.register.mobile.disabled=true}else{document.register.mobile.disabled=false}}};