var email_regex=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;var postal_regex=/^([ABCEGHJKLMNPRSTVXY]\d[A-Z] ?\d[A-Z]\d)$/i;var zip_regex=/^([0-9]{5}(-[0-9]{4})?)$/i;var ukpostal_regex=/^[A-Z]{1,2}[0-9R][0-9A-Z]? [0-9][A-Z-[CIKMOV]]{2}$/i;var europostal_regex=/^[A-Z][A-Z]?\-[0-9]{4,5}$/i
function newuser_submit(oSubmitForm){if(oSubmitForm.sError.value){alert(oSubmitForm.sError.value);return false;}else if(oSubmitForm.sUUsername.value==''){alert("Please enter your username (6 characters or more).");oSubmitForm.sUUsername.focus();return false;}else if(oSubmitForm.sUUsername.value.length<6){alert("Your username is too short. It needs to be 6 characters or more. (ex. numb123)");oSubmitForm.sUUsername.focus();return false;}else if(oSubmitForm.sUPassword.value==''){alert("Please enter a 6-character password.");oSubmitForm.sUPassword.focus();return false;}else if(oSubmitForm.sUPassword.value.length<6){alert("Please enter a longer password (6 or more characters). This is for your security.");oSubmitForm.sUPassword.focus();return false;}else if(oSubmitForm.sUPassword.value!=oSubmitForm.sUPassword2.value){alert("Your 2 password entries do not match, please retry typing it in both");oSubmitForm.sUPassword.focus();return false;}else if(oSubmitForm.sUEmail.value==''||oSubmitForm.sUEmail.value.indexOf('@')<2){alert("Please enter an email address: we send a verification email to it. See our privacy policy, we do not spam.");oSubmitForm.sUEmail.focus();return false;}else if(oSubmitForm.sCaptchaResult.value==''){alert("Please enter the characters of the captcha-image you see. \n"
+"You should see a check-mark next to the box when you have the correct characters typed.");return false;}else if(!oSubmitForm.nAgree.checked){alert("Please review our terms of service and click on the 'Agree' checkbox. Then you are ready to submit it!");return false;}else{var nTime=new Date();oSubmitForm.sUTimezone.value=nTime.toUTCString();oSubmitForm.submit();oSubmitForm.SB.value='Wait...';oSubmitForm.SB.disabled=true;};};function username_check_result(nResult,sResponse){if(nResult!=-1){$("#sUUsername").css({backgroundColor:'#C1FFC1'});$("#usernamecheck").html('OK');}else{$("#sUUsername").css({backgroundColor:'#E9967A'});$("#usernamecheck").html('Already taken. Try another.');$("#sError").val('This username is already used. Please try another one.');}};function email_check_result(nResult,sResponse){if(nResult!=-1){$("#sUEmail").css({backgroundColor:'#C1FFC1'});}else{$("#sUEmail").css({backgroundColor:'#E9967A'});$("#emailcheck").html('Already used for another account.');$("#sError").val('Email address already taken. Please use another one.');}};function geo_locate(nLocationOnly){var sUZip=$('#idZip').val();var sULocation=escape($('#idLocation').val());var sUCountry=escape($('#idCountry').getLabel());if(nLocationOnly==1){if(sULocation==''){alert('You need to give your CITY please.');$('#idLocation')[0].focus();}else{AJAX('op=geo_locate&sType=_location&sUZip='+sUZip+'&sULocation='+sULocation+'&sUCountry='+sUCountry,'geo_locate_result');};}else if(sUZip.length>4){$('#idZipInfo').hide();if(postal_regex.test(sUZip)){AJAX('op=geo_locate&sType=CA&sUZip='+sUZip+'&sULocation='+sULocation+'&sUCountry='+sUCountry,'geo_locate_result');}else if(zip_regex.test(sUZip)){AJAX('op=geo_locate&sType=US&sUZip='+sUZip+'&sULocation='+sULocation+'&sUCountry='+sUCountry,'geo_locate_result');}else if(ukpostal_regex.test(sUZip)){AJAX('op=geo_locate&sType=GB&sUZip='+sUZip+'&sULocation='+sULocation+'&sUCountry='+sUCountry,'geo_locate_result');}else if(europostal_regex.test(sUZip)){AJAX('op=geo_locate&sType=EU&sUZip='+sUZip+'&sULocation='+sULocation+'&sUCountry='+sUCountry,'geo_locate_result');}else{$('#idZipInfo').show();};}else{$('#idZip').css({backgroundColor:'#FFFFFF'});};};function geo_locate_result(nResult,sResponse){try{if(nResult!=-1&&sResponse.indexOf('|')>0&&GBrowserIsCompatible()){var aResponse=sResponse.split('|');var nLat=parseFloat(aResponse[0]);var nLong=parseFloat(aResponse[1]);var nSens=parseInt(aResponse[2]);$('#idGeoLat').val(nLat);$('#idGeoLong').val(nLong);$('#idGeoSens').val(nSens);var map=new GMap2(document.getElementById('idMap'),{size:new GSize(150,150)});if(nSens==1)
map.setCenter(new GLatLng(nLat,nLong),15);else
map.setCenter(new GLatLng(nLat,nLong),9);$('#idMap').css('visibility','visible');$('#idZip').css({backgroundColor:'#C1FFC1'});}}catch(e){};};function geo_guess_result(nResult,sResponse){if(nResult!=-1&&sResponse!=''){var aResponse=sResponse.split(',');$('#idLocation').val(aResponse[0]);if(aResponse[1]!='')
$('#idCountry').val(aResponse[1]);else
$('#idLocation').val(aResponse[0]+', '+aResponse[2]);$('#idGreeting').html(''+aResponse[0]+', '+aResponse[2]+' member!');geo_locate(1);};};window.onunload='GUnload()';$(document).ready(function(){$('#sUEmail').keyup(function(){var sUEmail=$("#sUEmail").val();$("#sUEmail").css({backgroundColor:'#FFFFFF'});$("#emailcheck").html('');$("#sError").val('');if(sUEmail.length>6&&sUEmail.indexOf('@')>2&&email_regex.test(sUEmail))
AJAX('op=check_email&sUEmail='+sUEmail,'email_check_result');})
$('#idZip').keyup(function(){geo_locate(0);})
$('#sUUsername').alphanumeric('.').keyup(function(event){var sUUsername=$("#sUUsername").val();$("#sError").val('');if(sUUsername.length<6){$("#usernamecheck").html('Min 6 characters.');$("#sUUsername").css({backgroundColor:'#FFFFFF'});}else{AJAX('op=check_username&sUUsername='+sUUsername,'username_check_result');}});AJAX('op=geo_iplocate&sGeoKey='+sGeoKey,'geo_guess_result');});