var bUsernameTaken=false;var benefitsTimeout;var autoLoadFaces=true;var newFacesTimeout;function loadNewFaces(b){clearTimeout(newFacesTimeout);if(b!=true){autoLoadFaces=false}var c="deltafx.html?wci=component&type=new_faces";new Ajax.Request(c,{method:"get",onSuccess:function(d){var a=d.responseText;$("new_faces_placeholder").innerHTML=a;setTimeout("$('new_faces').innerHTML=$('new_faces_placeholder').innerHTML;",1000)}})}function aLoadNewFaces(a){if(a){return}loadNewFaces(true);if(autoLoadFaces==true){newFacesTimeout=setTimeout("aLoadNewFaces();",10000)}}function benefitsPrev(a){benefitsLoad(parseInt($("benefit_selected_index").value)-1)}function benefitsNext(a){if(!a||a==false){clearTimeout(benefitsTimeout);benefitsRotate(15000)}if(a==true){benefitsLoad(parseInt($("benefit_selected_index").value)+1,true)}else{benefitsLoad(parseInt($("benefit_selected_index").value)+1,false)}}function benefitsStop(){clearTimeout(benefitsTimeout)}function benefitsStart(){benefitsRotate(5000)}function benefitsRotate(a){benefitsTimeout=setTimeout("benefitsNext(true)",a)}function benefitsLoad(a,c,e){var d=$("benefit_selected_index");var f=$("benefits_main_img_div");var b=$("benefits_main_img");if(e==true){benefitsStop();benefitsRotate(15000)}if(a==d.value){return false}if(a>6){a=0}if(a<0){a=6}var g=new Image();g.onload=function(){$("benefits_main_img_div").appear({from:0.3,to:1,duration:0.5});$("benefit_selected_index").value=a;benefitsSelectIndex(a)};g.src="images/splash/BenefitPhoto_0"+a+".jpg";b.src=g.src;if(a==6){benefitsStop();hideDiv($("benefitsBtnLeft"));hideDiv($("benefitsBtnRight"));b.useMap="#restart_map";return}else{showDiv($("benefitsBtnLeft"));showDiv($("benefitsBtnRight"));b.style.cursor="normal;";b.onclick="";b.useMap="";if(c==true){benefitsRotate(5000)}}}function benefitsSelectIndex(a){for(var b=0;b<7;b++){if(b==a){$("benefits_navdot_"+b).src="images/splash/NavDotOn.gif"}else{$("benefits_navdot_"+b).src="images/splash/NavDotOff.gif"}}}function importDoPost(){showWait();$("contact_import_form").request({onComplete:function(b){var a=b.responseText;if(a.substring(0,2)=="OK"){location.href="/JoinAddContacts/?done=1"}else{showalert(a.substring(4));hideWait()}},onFailure:function(){hideWait();showalert("Sorry, there was an error processing your request.\n\nPlease try again later.")}})}function importDoSkip(){location.href="/JoinAddContacts/skip"}function selectAllContacts(a){$$(".contact_cbox").each(function(b){if(a==true){b.checked=true}else{b.checked=false}})}function saveNotes(){if(wordCount($("notes"))<30){showalert("Please ensure you add at least 30 words.<br><br>The better the description the higher your chances of success!",false,false,true,true);return false}document.userform.submit()}function updateWordCount(b,d){var a=wordCount(b);var c=charCount(b);if(c>0){$(d).innerHTML=a+" words, "+c+" chars";switch(true){case (a<30):$(d).style.color="red";break;case (a>=30&&a<100):$(d).style.color="orange";break;case (a>=100):$(d).style.color="green";break;default:$(d).style.color="black";break}}else{$(d).innerHTML="&nbsp;"}}function getAutoCompleteParamsRegZip(f,a){var c=f.id;var e=a.id;var d=e.split("_");c=c.substring(0,c.length-3);try{$(c).value=d[0]}catch(b){}if($("reg_country").value==""){$("reg_country").value=d[3]}else{if($("reg_country").value!=d[3]){if(confirm("The postcode/zip you have selected is related to a different country than you previously selected, would you like to change it?")==true){$("reg_country").value=d[3]}}}$("reg_town").value=d[1];$("reg_town_ac").value=d[2]}function checkRegForm(){var g="";var j="";var c;$("regform_submit").enabled=true;if(isFormSubmitted==true){return}var d=document.join_form.reg_username.value;d=d.strip();if(d==""){j="reg_username";g="<br>Please enter your username."+g}else{if(d.length<5){j="reg_username";g="<br>The username must be at least 5 characters long."+g}else{if(bUsernameTaken==true){checkUsernameHint();return false}}}if(d.length>20){j="reg_username";g="<br>The username cannot be more than 20 chars long."+g}if(document.join_form.reg_password.value.length==""){g="<br>Please enter a password."+g;j="passwrd1"}else{if(document.join_form.reg_password.value.length<5){g="<br>Please enter a password of at least 5 characters."+g;j="passwrd1"}}if(document.join_form.reg_password.value.length>30){g="<br>Password too long, maximum 30 characters."+g;j="passwrd1"}var i=document.join_form.reg_email.value;if(i.length<1){g="<br>Please enter your email address."+g;j="reg_email"}else{if(!isValidEmail(document.join_form.reg_email.value,"Registration",true)||document.join_form.reg_email.value.lastIndexOf("@")!=document.join_form.reg_email.value.indexOf("@")){g="<br>The email address you have entered is invalid."+g;j="reg_email"}}if($("reg_gender_male").checked){}else{if($("reg_gender_female").checked){}else{g="<br>Please select your gender."+g;j="reg_gender_male"}}var l=document.join_form.reg_birth_day.value;var e=document.join_form.reg_birth_year.value;var k=document.join_form.reg_birth_month.value;if(e<1){j="reg_birth_year";g="<br>Year of birth is invalid."+g}if(k<1){j="reg_birth_month";g="<br>Month of birth is invalid."+g}if(l<1){j="reg_birth_day";g="<br>Day of birth is invalid."+g}if(document.join_form.reg_postcode.value.length==0){if(document.join_form.reg_postcode_ac.value.length==0){j="reg_postcode";g="<br>Please enter your postal/zip code."+g}}if($("reg_town").value.length==0){if(document.join_form.reg_town_ac.value.length==0){j="reg_town_ac";g="<br>Please enter your town."+g}}if(document.join_form.reg_name){var h=document.join_form.last_name.value;h=h.strip();if(h==""){j="last_name";g="<br>Please enter your Surname."+g}else{if(h.length>50){j="last_name";g="<br>Surname is too long. Maximum length is 50 characters."+g}if(h.length<2){j="last_name";g="<br>Surname is too short. Minimum length is 2 characters."+g}}var f=document.join_form.first_name.value;f=f.strip();if(f==""){j="first_name";g="<br>Please enter your Firstname."+g}else{if(f.length>50){j="first_name";g="<br>Firstname is too long. Maximum length is 50 characters."+g}if(f.length<2){j="first_name";g="<br>Firstname is too short. Minimum length is 2 characters."+g}}}try{var b=new Date();document.join_form.tz_offset.value=-b.getTimezoneOffset()}catch(m){}if(g==""){if(document.join_form.reg_password.value.length>0){var a=badPwds.toString();if(a.search(document.join_form.reg_password.value)>0){g="<br>Your password is too simple. Please choose a stronger password.<br><br>A good password would contain numbers, Upper and Lower case letters and be longer than 6 characters."+g;j="reg_password"}}}if(g!=""){msg="<b>Ooops... We have detected a problem with the registration form.</b><br><br>";g=msg+g+"<br>";showalert(g,true,true,false,true,500);return false}else{if($("recaptcha_response_field")&&captchaShown==false&&bRequireRecaptcha==true){ShowCaptchaDiv();return false}if(bRequireRecaptcha==true&&checkRecaptcha()==false){return false}else{try{$("recaptcha_challenge_field_frm").value=$("recaptcha_challenge_field").value;$("recaptcha_response_field_frm").value=$("recaptcha_response_field").value;HideCaptcha()}catch(m){}isFormSubmitted=true;document.join_form.submit();return true}}}function requireRecaptcha(){var a="/deltafx.html?wci=JoinRequireCaptcha";var b="reg_email="+$("reg_email").value;if($("reg_email").value.length==0){bRequireRecaptcha=true;return}new Ajax.Request(a,{method:"post",parameters:b,onSuccess:function(d){var c=d.responseText;if(c=="NCAP"){bRequireRecaptcha=false}else{bRequireRecaptcha=true}},onFailure:function(){showalert("Sorry, there was an error processing your request.\n\nPlease try again later.")}});if($("captcha_error").value=="true"){showalert("The confirmation code you have entered is incorrect, please check the code carefully and try again");setTimeout("ShowCaptchaDiv();",3000)}}function setUsername(a){$("reg_username").value=a;bUsernameTaken=false;HideUsernameHintDiv();return checkRegForm()}function HideUsernameHintDiv(b){try{$("iBackGroundDiv2").parentNode.removeChild($("iBackGroundDiv2"));$("reg_username_hint_box").style.display="none";if(b==true){setTimeout(function(){$("reg_username").focus();$("reg_username").select()},500)}}catch(a){}return true}function showUsernameHintDiv(f,d,j){var i=document.createElement("div");i.id="iBackGroundDiv2";i.style.display="none";i.style.zIndex=9999;i.style.backgroundColor="#CCCCCC";i.style.opacity="0.60";i.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=60)";i.style.position="absolute";i.style.width="100%";i.style.height="100%";i.style.top=0;i.style.left=0;document.body.appendChild(i);Effect.Appear(i,{duration:1,from:0,to:0.6});var e=$("reg_username_hint_box");e.style.backgroundColor="transparent";e.style.zIndex=99999;e.style.position="fixed";e.style.margin="0 auto";var h=document.viewport.getScrollOffsets()["top"]+(getVisibleHeight()/2)-(e.getHeight()/2);var g=((document.viewport.getDimensions().width/2)-(e.getWidth()/2));e.style.top=parseInt(h);e.style.left=parseInt(g);Effect.Appear(e);if(f.length>0){$("reg_username_hint_box_1").innerHTML='<a href="javascript:void(0);" class="linkClaretMiddle" onClick="return setUsername(\''+f+"');\">"+f+"</a>"}if(d.length>0){$("reg_username_hint_box_2").innerHTML='<a href="javascript:void(0);" class="linkClaretMiddle" onClick="return setUsername(\''+d+"');\">"+d+"</a>"}if(j.length>0){$("reg_username_hint_box_3").innerHTML='<a href="javascript:void(0);" class="linkClaretMiddle" onClick="return setUsername(\''+j+"');\">"+j+"</a>"}}function createProfileCheckForm(){var d="";var b="";var c;var a="#FFC0C0";if(document.userform.nationality.value==""){$("nationality").style.background=a;b="nationality";d=d+"<br>Please select your nationality."}else{$("nationality").style.background=""}if(document.userform.ethnic_origin.value==""){$("ethnic_origin").style.background=a;b="ethnic_origin";d=d+"<br>Please select your ethnic origin."}else{$("ethnic_origin").style.background=""}if(document.userform.height.value==""){$("height").style.background=a;b="height";d=d+"<br>Please select your height."}else{$("height").style.background=""}if(document.userform.build.value==""){$("build").style.background=a;b="build";d=d+"<br>Please select your build."}else{$("build").style.background=""}if(document.userform.eyes.value==""){$("eyes").style.background=a;b="eyes";d=d+"<br>Please select your eye color."}else{$("eyes").style.background=""}if(document.userform.hair.value==""){$("hair").style.background=a;b="hair";d=d+"<br>Please select your hair color."}else{$("hair").style.background=""}if(document.userform.religion.value==""){$("religion").style.background=a;b="education";d=d+"<br>Please select your religion."}else{$("religion").style.background=""}if(document.userform.education.value==""){$("education").style.background=a;b="education";d=d+"<br>Please select your education."}else{$("education").style.background=""}if(document.userform.smoke.value==""){$("smoke").style.background=a;b="smoke";d=d+"<br>Please tell us if you smoke."}else{$("smoke").style.background=""}if(document.userform.drink.value==""){$("drink").style.background=a;b="drink";d=d+"<br>Please tell us if you drink."}else{$("drink").style.background=""}if(document.userform.drugs.value==""){$("drugs").style.background=a;b="drugs";d=d+"<br>Please tell us if you use drugs."}else{$("drugs").style.background=""}if(document.userform.occupation.value==""){$("occupation").style.background=a;b="occupation";d=d+"<br>Please select your occupation."}else{$("occupation").style.background=""}if(document.userform.income.value==""){$("income").style.background=a;b="income";d=d+"<br>Please select your income."}else{$("income").style.background=""}if(document.userform.orientation.value==""){$("orientation").style.background=a;b="orientation";d=d+"<br>Please specify your orientation."}else{$("orientation").style.background=""}if(document.userform.status.value==""){$("status").style.background=a;b="status";d=d+"<br>Please tell us your personal status."}else{$("status").style.background=""}if(document.userform.seeking.value==""){$("seeking").style.background=a;b="seeking";d=d+"<br>Please tell us which kind of relationship you are interested in."}else{$("seeking").style.background=""}if(d!=""){msg="Ooops... We have detected a problem with the form.<br>";d=msg+d+"<br>";showalert(d,true,true,false,true,500);return false}else{document.userform.submit();return true}}function setNewUsername(a){$("username").value=a;submitUsername()}function submitUsername(){$("username_form").request({onComplete:function(b){var a=b.responseText;if(a.substring(0,2)=="OK"){showalert("Username Saved!");location.href=a.substring(3)}else{showalert(a.substring(4))}}})}function createUsername(b){try{if(b.value.length==0){hideDiv("un_submit");hideDiv("un_div");return false}if(b.value.length<5&&b.value.length>0){$("un_div").innerHTML="Username must be at least 5 characters.";showDiv("un_div");hideDiv("un_submit");return false}if(b.value.length>20){$("un_div").innerHTML="Username cannot be more than 20 characters.";showDiv("un_div");hideDiv("un_submit");return false}var d=/^[a-zA-Z0-9][a-zA-Z0-9\-]{0,18}[a-zA-Z0-9]?$/;if(!d.test(b.value)){$("un_div").innerHTML="Username contains invalid characters.";showDiv("un_div");hideDiv("un_submit");return false}var c="/deltafx.html?wci=checkusername&n="+b.value;new Ajax.Request(c,{method:"get",onSuccess:function(f){var e=f.responseText;if(e=="TAKEN"){bUsernameTaken=true;$("un_div").innerHTML="Username is not available.";showDiv("un_div");hideDiv("un_submit")}else{bUsernameTaken=false;hideDiv("un_div");showDiv("un_submit")}},onFailure:function(){showalert("Sorry, there was an error processing your request.\n\nPlease try again later.")}})}catch(a){alert(a)}}function checkUsername(b){try{if(b.value.length==0){return false}if(b.value.length<5&&b.value.length>0){$("un_div").innerHTML="Username must be at least 5 characters.";showDiv("un_div");hideDiv("em_div");hideDiv("pw_div");return false}if(b.value.length>20){$("un_div").innerHTML="Username cannot be more than 20 characters.";showDiv("un_div");hideDiv("em_div");hideDiv("pw_div");return false}var d=/^[a-zA-Z0-9][a-zA-Z0-9\-]{3,18}[a-zA-Z0-9]$/;if(!d.test(b.value)){$("un_div").innerHTML="Username contains invalid characters.";showDiv("un_div");hideDiv("em_div");hideDiv("pw_div");return false}var c="/deltafx.html?wci=checkusername&n="+b.value;new Ajax.Request(c,{method:"get",onSuccess:function(f){var e=f.responseText;if(e=="TAKEN"){bUsernameTaken=true;hideDiv("un_div")}else{bUsernameTaken=false;hideDiv("un_div")}},onFailure:function(){showalert("Sorry, there was an error processing your request.\n\nPlease try again later.")}})}catch(a){alert(a)}}function checkUsernameHint(){var a="/deltafx.html?wci=GetUsernameHints";var b="reg_username="+$("reg_username").value+"&reg_birth_year="+$("reg_birth_year").value+"&reg_birth_month="+$("reg_birth_month").value+"&reg_birth_day="+$("reg_birth_day").value;new Ajax.Request(a,{method:"post",parameters:b,onSuccess:function(h){try{var g=h.responseXML.getElementsByTagName("name");var f=g[0].childNodes[0].nodeValue;var d=g[1].childNodes[0].nodeValue;var i=g[2].childNodes[0].nodeValue;showUsernameHintDiv(f,d,i)}catch(e){showalert(e)}},onFailure:function(){showalert("Sorry, there was an error processing your request.\n\nPlease try again later.")}})}function checkPwd(b){try{if(b.value.length==0){return false}if(b.value.length<5&&b.value.length>0){$("pw_div").innerHTML="Password too short";showDiv("pw_div");hideDiv("em_div");hideDiv("un_div");return false}if(b.value.length>30){$("pw_div").innerHTML="Password too long";showDiv("pw_div");return false}hideDiv("pw_div")}catch(a){}}function checkEmail(a){if(a.value.length==0){return false}if(!isValidEmail(document.join_form.reg_email.value,"Registration",true)||document.join_form.reg_email.value.lastIndexOf("@")!=document.join_form.reg_email.value.indexOf("@")){$("em_div").innerHTML="Invalid email";showDiv("em_div");hideDiv("pw_div");hideDiv("un_div");requireRecaptcha();return false}hideDiv("em_div")}function createFirstAndLastName(){var e;var d;var a;var c;d="";a="";e=$("reg_name").value;e=e.strip();e=e.stripRight();if(e.indexOf(" ")>0){c=e.split(" ");for(var b=0;b<c.length;b++){if(b!=c.length-1){if(c[b]!=" "&&c[b]!=""){if(d==""){d=c[b]}else{d=d+" "+c[b]}}}else{a=c[b]}}}else{d=e;a=""}$("first_name").value=d;$("last_name").value=a;guessGenderByForename(d);return}function guessGenderByForename(c){var b="/deltafx.html?wci=guessgender&n="+c;try{new Ajax.Request(b,{method:"get",onSuccess:function(e){var d=e.responseText;if(d=="M"){document.join_form.reg_gender[0].checked=true}if(d=="F"){document.join_form.reg_gender[1].checked=true}},onFailure:function(){showalert("Sorry, there was an error processing your request.\n\nPlease try again later.")}})}catch(a){}}function joinAddLocation(){if($("reg_postcode").value.length==0){$("reg_postcode").value=$("reg_postcode_ac").value}var b="reg_postcode="+$("reg_postcode").value+"&reg_town="+$("reg_town").value+"&reg_country="+$("reg_country")[$("reg_country").selectedIndex].value;var a="/website.html?wci=JoinAddLocation&wce=enter";new Ajax.Request(a,{method:"post",parameters:b,onSuccess:function(e){try{var d=e.responseText;if(d=="OK"){showalert("Thank you!<br><br>Your location has been updated.");setTimeout("location.href='/JoinCreateUsername';",1000)}else{showalert("Sorry, there has been an error updating your location.<br><br>A full report has been sent to our technical team who will review the problem.");setTimeout("location.href='/JoinCreateUsername';",1000)}}catch(c){showalert(c)}},onFailure:function(){showalert("Sorry, there was an error processing your request.\n\nPlease try again later.")}})};

