sMsgRegCCAccNo="";sMsgRegEntFirstName="";sMsgRegEntLastName="";sMsgRegEntPhone="";sMsgRegEntAddress="";sMsgRegEntCity="";sMsgRegEntCounty="";sMsgRegEntPostCode="";sMsgRegEntSeqAnswer="";sMsgRegPrivacyCheck="";sMsgRegTCRulesCheck="";sMsgRegOver18Check="";sMsgAdvertSource="";var aUserMsg=new Array();var bUpdateCurrencyIfSelectedCountry=true;function FV_FormVal(oForm){var sTmp,oTmp,bOk=true,x;if(oForm.submitted)return false;oForm.alertuser=true;var oElems=oForm.elements;var nLen=oElems.length;for(var i=0;i<nLen;i++){oTmp=oElems[i];if(typeof(oTmp.valme)!="function")continue;bOk=oTmp.valme();if(!bOk)break}if(bOk){oForm.submitted=true}return bOk}function SetFocus(){if(document.registerform.elements[sErrorFieldSet])document.registerform.elements[sErrorFieldSet].focus()}function ToggleCorrespOpts(bChecked,sCorrespOptsId,oForm){var oCorrespCheckboxes=oForm.elements['sCorrespondenceOptions'];if(oCorrespCheckboxes){if(bChecked){xOn(sCorrespOptsId);if(oCorrespCheckboxes.length){for(var i=0;i<oCorrespCheckboxes.length;i++){if(SG_sSuggCorrespOpts.indexOf(';'+oCorrespCheckboxes[i].value+';')>=0)oCorrespCheckboxes[i].checked=true}}if(SG_sSuggCorrespOpts.indexOf(';'+oCorrespCheckboxes.value+';')>=0)oCorrespCheckboxes.checked=true}else{xOff(sCorrespOptsId);if(oCorrespCheckboxes.length){for(var i=0;i<oCorrespCheckboxes.length;i++)oCorrespCheckboxes[i].checked=false}oCorrespCheckboxes.checked=false}}}function FV_FieldVal(oField){var bOk=true;var sFldName=oField.name;if(sFldName=="")return;var oForm=oField.form;var sValue;var sType=sFldName.charAt(0).toLowerCase();switch(sType){case "s":switch(sFldName){case "sEmail":bOk=FV_IsEmail(oField.value);if(!bOk){if(oForm.alertuser){FV_ShowMessage(sMsgRegEntEmail);oForm.alertuser=false;oField.focus()}break}break;case "sUsername":sValue=oField.value;bOk=(sValue.length>=nMinLenUsername&&sValue.length<=nMaxLenUsername);if(!bOk){if(oForm.alertuser){FV_ShowMessage(SG_MsgLogEntUserLen);oForm.alertuser=false;oField.focus()}break}bOk=(SG_sInUserAllow==""||FV_StripCharsNotInBag(sValue,SG_sInUserAllow)==sValue);if(!bOk){if(oForm.alertuser){FV_ShowMessage(SG_MsgLogEntUserChars+"\n"+SG_sInUserAllow);oForm.alertuser=false;oField.focus()}}break;case "sPassword":sValue=oField.value;bOk=(sValue.length>=nMinLenPassword&&sValue.length<=nMaxLenPassword);if(!bOk){if(oForm.alertuser){FV_ShowMessage(SG_MsgLogEntPassLen);oForm.alertuser=false;oField.focus()}break}bOk=(SG_sInUserAllow==""||FV_StripCharsNotInBag(sValue,SG_sInUserAllow)==sValue);if(!bOk){if(oForm.alertuser){FV_ShowMessage(SG_MsgLogEntPassChars+"\n"+SG_sInUserAllow);oForm.alertuser=false;oField.focus()}}break;case "sPassword2":sValue=oField.value;sValueOriginal=oField.form.elements["sPassword"].value;bOk=(sValue==sValueOriginal);if(!bOk){if(oForm.alertuser){FV_ShowMessage(sMsgRegEntRetypePass);oForm.alertuser=false;oField.focus()}break}break;default:bOk=!FV_IsBlank(oField.value);if(!bOk){if(oForm.alertuser){if(aUserMsg[sFldName])FV_ShowMessage(aUserMsg[sFldName]);oForm.alertuser=false;if(oField.style.display!="none")oField.focus()}break}}break;case "n":switch(sFldName){case "nDobday":case "nDobmonth":case "nDobyear":var oDay=oForm.elements["nDobday"];var oMonth=oForm.elements["nDobmonth"];var oYear=oForm.elements["nDobyear"];var sDay=FV_Trim(oDay.value);var sMonth=FV_Trim(oMonth.value);var sYear=FV_Trim(oYear.value);if(sDay==""||sYear==""){if(oForm.alertuser){bOk=false;FV_ShowMessage(sMsgRegEntDoB);oForm.alertuser=false;(sDay=="")?oDay.focus():oYear.focus();break}else{bOk=false;break}}bOk=FV_IsValidDate(sYear,sMonth,sDay,1);if(!bOk){if(oForm.alertuser){FV_ShowMessage(sMsgRegEntDoB);oForm.alertuser=false;oField.focus()}break}var bToYoung=false;var dToday=new Date();var dYearDiff=dToday.getFullYear()-parseInt(sYear);var dMonthDiff=(dToday.getMonth()+1)-parseInt(sMonth);var dDayDiff=dToday.getDate()-parseInt(sDay);if(dYearDiff<18){bToYoung=true}else{if(dYearDiff==18){if(dMonthDiff<0){bToYoung=true}else{if(dMonthDiff==0){if(dDayDiff<0)bToYoung=true}}}}bOk=!bToYoung;if(!bOk){if(oForm.alertuser){FV_ShowMessage(sMsgRegEntTooYoung);oForm.alertuser=false;oField.focus()}break}break;case "nCCPIN":bOk=(FV_IsIntegerInRange(oField.value,0,9999)&&oField.value.length==4);if(!bOk){if(oForm.alertuser){FV_ShowMessage(sMsgRegCCPIN);oForm.alertuser=false;oField.focus()}break}break;default:bOk=(FV_IsFloat(oField.value)||FV_IsInteger(oField.value));if(!bOk){if(oForm.alertuser){if(aUserMsg[sFldName])FV_ShowMessage(aUserMsg[sFldName]);oForm.alertuser=false;oField.focus()}break}}break;case "b":if(oForm.alertuser){if(aUserMsg[sFldName]&&!oField.checked&&oField.type=="checkbox")FV_ShowMessage(aUserMsg[sFldName]);oForm.alertuser=false}break}return bOk}function SetCountrySpecifics(oSelect){var oForm=oSelect.form;if(!oForm.firstChild)return;var sCountry=oSelect.options[oSelect.selectedIndex].value;var oCounty=oForm.elements["sCounty"].parentNode.getElementsByTagName("label")[0];if(oCounty){switch(sCountry){case "GB":case "EN":case "WA":case "SQ":case "ND":case "UK":case "IE":oCounty.innerHTML=FS_I18N("County");break;case "US":case "UM":oCounty.innerHTML=FS_I18N("State");break;default:oCounty.innerHTML=FS_I18N("Province")}}var oCountyList=oForm.elements["sCountyList"];var oCountyE=oForm.elements["sCounty"];var oCountyDiv=oForm.elements["sCounty"].parentNode;if(oCountyList){oCountyE.value="";switch(sCountry){case "AU":case "CA":case "IE":case "ZA":case "US":FillCountyList(sCountry,oCountyList);oCountyE.style.display="none";oCountyList.style.display="inline";break;default:oCountyE.style.display="inline";oCountyList.style.display="none"}}if(oCounty){switch(sCountry){case "AU":case "CA":case "IE":case "ZA":case "US":oCounty.className+=" mandat";oCountyE.valme=function(){var oDiv=this.parentNode;if(this.type=="text")this.value=FV_Trim(this.value);bOk=FV_FieldVal(this);if(bOk)oDiv.className=oDiv.className.replace("badinput","");else if(oDiv.className.indexOf("badinput")==-1){oDiv.className+=" badinput"}return bOk};oCountyE.onblur=oCountyE.valme;if(oCountyList)oCountyList.onblur=oCountyE.onblur;break;default:oCounty.className=oCounty.className.replace(/mandat/,"");oCountyE.valme=null;oCountyE.onblur=null;oCountyDiv.className=oCountyDiv.className.replace("badinput","")}}var oPostCode=oForm.elements["sPostcode"].parentNode.getElementsByTagName("label")[0];if(oPostCode){switch(sCountry){case "US":case "UM":oPostCode.innerHTML=FS_I18N("ZIP code");break;default:oPostCode.innerHTML=FS_I18N("Post code")}}var oPostCodeDiv=oForm.elements["sPostcode"].parentNode;var oPostCodeE=oForm.elements["sPostcode"];if(oPostCode){var bPCIsMandatory=false;if(sListOfCountriesWithMandatoryPostCodeAsCSVString.length>0){var sTmpList=","+sListOfCountriesWithMandatoryPostCodeAsCSVString+",";var sTmpCountry=","+sCountry+",";if(sTmpList.indexOf(sTmpCountry)>-1){bPCIsMandatory=true}}if(bPCIsMandatory){oPostCode.className+=" mandat";oPostCodeE.valme=function(){var oDiv=this.parentNode;if(this.type=="text")this.value=FV_Trim(this.value);bOk=FV_FieldVal(this);if(bOk)oDiv.className=oDiv.className.replace("badinput","");else if(oDiv.className.indexOf("badinput")==-1){oDiv.className+=" badinput"}return bOk};oPostCodeE.onblur=oPostCodeE.valme}else{oPostCode.className=oPostCode.className.replace(/mandat/,"");oPostCodeE.valme=null;oPostCodeE.onblur=null;oPostCodeDiv.className=oPostCodeDiv.className.replace("badinput","")}}if(bUpdateCurrencyIfSelectedCountry){var oCurrency=oForm.elements["sCurrency"];if(oCurrency){switch(sCountry){case "GB":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="GBP"){oCurrency.selectedIndex=i;break}break;case "US":case "UM":case "AS":case "IO":case "TP":case "EC":case "SV":case "GU":case "HT":case "MH":case "FM":case "MP":case "PW":case "PA":case "PR":case "TC":case "VG":case "VI":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="USD"){oCurrency.selectedIndex=i;break}break;case "CA":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="CAD"){oCurrency.selectedIndex=i;break}break;case "AU":case "CX":case "CC":case "HM":case "KI":case "NR":case "NF":case "TV":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="AUD"){oCurrency.selectedIndex=i;break}break;case "DK":case "FO":case "GL":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="DKK"){oCurrency.selectedIndex=i;break}break;case "AT":case "AD":case "BE":case "FI":case "FR":case "GF":case "TF":case "DE":case "GR":case "GP":case "VA":case "IE":case "IT":case "LU":case "MQ":case "YT":case "MC":case "NL":case "PT":case "RE":case "PM":case "SM":case "ES":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="EUR"){oCurrency.selectedIndex=i;break}break;case "HK":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="HKD"){oCurrency.selectedIndex=i;break}break;case "JP":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="JPY"){oCurrency.selectedIndex=i;break}break;case "BV":case "NO":case "SJ":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="NOK"){oCurrency.selectedIndex=i;break}break;case "SG":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="SGD"){oCurrency.selectedIndex=i;break}break;case "ZA":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="ZAR"){oCurrency.selectedIndex=i;break}break;case "SE":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="SEK"){oCurrency.selectedIndex=i;break}break;case "CH":case "LI":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="CHF"){oCurrency.selectedIndex=i;break}break;case "TH":for(i=0;i<oCurrency.options.length;i++)if(oCurrency.options[i].value=="THB"){oCurrency.selectedIndex=i;break}break}if(typeof(OnCurrencyChange)!="undefined")OnCurrencyChange(oCurrency)}}else{bUpdateCurrencyIfSelectedCountry=true}}function CountyListOnChange(oCountyList){if(!oCountyList)return;var oForm=oCountyList.form;if(!oForm.firstChild)return;var sCounty=oCountyList.options[oCountyList.selectedIndex].value;var oCountyE=oForm.elements["sCounty"];if(oCountyE){oCountyE.value=sCounty}}function SetupOnLoad(){FV_SetupForm("registerform");var oForm=document.forms["registerform"];if(!oForm)return;var oCountry=oForm.elements["sCountry"];if(oCountry){oCountry.onchange=function(){SetCountrySpecifics(this)};SetCountrySpecifics(oCountry)}var oCountyList=oForm.elements["sCountyList"];if(oCountyList){oCountyList.onchange=function(){CountyListOnChange(this)}}var oGoRegCard=oForm.elements["xGoregcard"];if(oGoRegCard){oGoRegCard.onclick=function(){this.form.onsubmit=function(){return false};location.href="regcard.asp"}}var oGoDeposit=oForm.elements["xGodeposit"];if(oGoDeposit){oGoDeposit.onclick=function(){this.form.onsubmit=function(){return false};location.href="RegInstr.asp"}}var oPopupTandC=document.getElementById("tcpopup");if(oPopupTandC){oPopupTandC.onclick=function(){var sHref=this.href;SG_ShowWin(sHref+"?popup=true","TandC",640,500);return false}}oPopupOffers=document.getElementById("offerspopup");if(oPopupOffers){oPopupOffers.onclick=function(){var sHref=this.href;SG_ShowWin(sHref+"?popup=true","Offers",600,500);return false}}var oPopupRules=document.getElementById("rulespopup");if(oPopupRules){oPopupRules.onclick=function(){var sHref=this.href;SG_ShowWin(sHref+"?popup=true","Rules",770,500);return false}}var oPopupPrivacy=document.getElementById("privacypopup");if(oPopupPrivacy){oPopupPrivacy.onclick=function(){var sHref=this.href;SG_ShowWin(sHref+"?popup=true","Privacy",600,400);return false}}var oCurrency=oForm.elements["sCurrency"];if(oCurrency){oCurrency.onchange=function(){var sCurr=this.options[this.selectedIndex].value;var oCurrMsg=document.getElementById("CURR_message");if(sCurr&&oCurrMsg)switch(sCurr){case "GBP":case "EUR":case "CAD":case "USD":oCurrMsg.style.display="none";break;default:oCurrMsg.style.display="block"}}}var oCardnumber=oForm.elements["sAccountnumber"];if(oCardnumber){oCardnumber.onblur=function(){var sVal=FV_Trim(this.value);var oForm=this.form,oFld,aLabel,vTmp;var aTmp=("sAccountnumber|sIDMMSIType|sAccountowner|nMonthvalidto|nYearvalidto").split("|");if(sVal!=""){for(var i=0;i<aTmp.length;i++){oFld=oForm.elements[aTmp[i]];if(oFld){aLabel=oFld.parentNode.getElementsByTagName("label");if(aLabel)for(var j=0;j<aLabel.length;j++)if(aLabel[j].className.indexOf("mandat")==-1)aLabel[j].className+=" mandat"}}}else{for(var i=0;i<aTmp.length;i++){oFld=oForm.elements[aTmp[i]];if(oFld){aLabel=oFld.parentNode.getElementsByTagName("label");if(aLabel)for(var j=0;j<aLabel.length;j++)aLabel[j].className=aLabel[j].className.replace(/mandat/,"")}}}}}aUserMsg["sCCaccountno"]=sMsgRegCCAccNo;aUserMsg["sFirstname"]=sMsgRegEntFirstName;aUserMsg["sLastname"]=sMsgRegEntLastName;aUserMsg["sHomephone"]=sMsgRegEntPhone;aUserMsg["sMobilephone"]=sMsgRegEntPhone;aUserMsg["sAddress"]=sMsgRegEntAddress;aUserMsg["sCity"]=sMsgRegEntCity;aUserMsg["sCounty"]=sMsgRegEntCounty;aUserMsg["sPostcode"]=sMsgRegEntPostCode;aUserMsg["sSecurityanswer"]=sMsgRegEntSeqAnswer;aUserMsg["bTCRules"]=sMsgRegTCRulesCheck;aUserMsg["bPrivacy"]=sMsgRegPrivacyCheck;aUserMsg["bOver18"]=sMsgRegOver18Check;aUserMsg["sAdvertsource"]=sMsgAdvertSource}DomLoaded.load(SetupOnLoad);function PostCodeLookup(oForm){var oPostcode=oForm.elements["sPostcode"];if(!oPostcode||!oPCL)return;oPCL.form=oForm;var sPC=FV_Trim(oPostcode.value);if(sPC!="")oPCL.Load("/account/PostCodeLookup.asp?sPostcode="+sPC)}function PostCodeResult(sMsg,sAddress,sCity,sPostcode,sCounty){var oForm=oPCL.form;if(!oForm)return;var oMsgBox=document.getElementById("PCL_message");if(oMsgBox){oMsgBox.innerHTML=sMsg;if(sMsg=="")oMsgBox.style.display="none";else oMsgBox.style.display="block"}var oFld=oForm.elements["sAddress"];if(oFld){if(sAddress=="")oFld.value=sAddress;else oFld.value+=" "+sAddress}oFld=oForm.elements["sCity"];if(oFld)oFld.value=sCity;var oFld=oForm.elements["sPostcode"];if(oFld)oFld.value=sPostcode;oFld=oForm.elements["sCounty"];if(oFld)oFld.value=sCounty}function FillCountyList(sCountry,oCountyList){oCountyList.options.length=0;oCountyList.options[0]=new Option("","");switch(sCountry){case "AU":for(var i=0;i<AU.length;i++){oCountyList.options[i+1]=new Option(AU[i][1],AU[i][0])}break;case "CA":for(var i=0;i<CA.length;i++){oCountyList.options[i+1]=new Option(CA[i][1],CA[i][0])}break;case "IE":for(var i=0;i<IE.length;i++){oCountyList.options[i+1]=new Option(IE[i][1],IE[i][0])}break;case "ZA":for(var i=0;i<ZA.length;i++){oCountyList.options[i+1]=new Option(ZA[i][1],ZA[i][0])}break;case "US":for(var i=0;i<US.length;i++){oCountyList.options[i+1]=new Option(US[i][1],US[i][0])}break}}var AU=new Array(8);AU[0]=new Array("ACT","Australian Capital Territory");AU[1]=new Array("NSW","New South Wales");AU[2]=new Array("NT","Northern Territory");AU[3]=new Array("QLD","Queensland");AU[4]=new Array("SA","South Australia");AU[5]=new Array("TAS","Tasmania");AU[6]=new Array("VIC","Victoria");AU[7]=new Array("WA","Western Australia");var CA=new Array(13);CA[0]=new Array("AB","Alberta");CA[1]=new Array("BC","British Columbia");CA[2]=new Array("MB","Manitoba");CA[3]=new Array("NB","New Brunswick");CA[4]=new Array("NF","Newfoundland");CA[5]=new Array("NS","Nova Scotia");CA[6]=new Array("NT","Northwest Territories");CA[7]=new Array("NN","Nunavut");CA[8]=new Array("ON","Ontario");CA[9]=new Array("PE","Prince Edward Island");CA[10]=new Array("QC","Quebec");CA[11]=new Array("SK","Saskatchewan");CA[12]=new Array("YT","Yukon");var IE=new Array(26);IE[0]=new Array("CW","Carlow");IE[1]=new Array("CN","Cavan");IE[2]=new Array("CE","Clare");IE[3]=new Array("CK","Cork");IE[4]=new Array("DL","Donegal");IE[5]=new Array("DN","Dublin");IE[6]=new Array("GY","Galway");IE[7]=new Array("KY","Kerry");IE[8]=new Array("KE","Kildare");IE[9]=new Array("KK","Kilkenny");IE[10]=new Array("LM","Leitrim");IE[11]=new Array("LS","Leix");IE[12]=new Array("LK","Limerick");IE[13]=new Array("LD","Longford");IE[14]=new Array("LH","Louth");IE[15]=new Array("MO","Mayo");IE[16]=new Array("MH","Meath");IE[17]=new Array("MN","Monaghan");IE[18]=new Array("OY","Offaly");IE[19]=new Array("RN","Roscommon");IE[20]=new Array("SO","Sligo");IE[21]=new Array("TY","Tipperary");IE[22]=new Array("WD","Waterford");IE[23]=new Array("WH","Westmeath");IE[24]=new Array("WX","Wexford");IE[25]=new Array("WW","Wicklow");var ZA=new Array(9);ZA[0]=new Array("EC","Eastern Cape");ZA[1]=new Array("FS","Free State");ZA[2]=new Array("GG","Gauteng");ZA[3]=new Array("KN","KwaZulu-Natal");ZA[4]=new Array("MG","Mpumalamanga");ZA[5]=new Array("NO","Northern Cape");ZA[6]=new Array("NP","Northern Province");ZA[7]=new Array("NW","North West");ZA[8]=new Array("WC","Western Cape");var US=new Array(62);US[0]=new Array("AL","Alabama");US[1]=new Array("AK","Alaska");US[2]=new Array("AS","American Samoa");US[3]=new Array("AZ","Arizona");US[4]=new Array("AR","Arkansas");US[5]=new Array("AE","Armed Forces - Europe");US[6]=new Array("AP","Armed Forces - Pacific");US[7]=new Array("AA","Armed Forces - The Americas");US[8]=new Array("CA","California");US[9]=new Array("CO","Colorado");US[10]=new Array("CT","Connecticut");US[11]=new Array("DE","Delaware");US[12]=new Array("DC","District of Columbia");US[13]=new Array("FM","Federated States of Micronesia");US[14]=new Array("FL","Florida");US[15]=new Array("GA","Georgia");US[16]=new Array("GU","Guam");US[17]=new Array("HI","Hawaii");US[18]=new Array("ID","Idaho");US[19]=new Array("IL","Illinois");US[20]=new Array("IN","Indiana");US[21]=new Array("IA","Iowa");US[22]=new Array("KS","Kansas");US[23]=new Array("KY","Kentucky");US[24]=new Array("LA","Louisiana");US[25]=new Array("ME","Maine");US[26]=new Array("MH","Marshall Islands");US[27]=new Array("MD","Maryland");US[28]=new Array("MA","Massachusetts");US[29]=new Array("MI","Michigan");US[30]=new Array("MN","Minnesota");US[31]=new Array("MS","Mississippi");US[32]=new Array("MO","Missouri");US[33]=new Array("MT","Montana");US[34]=new Array("NE","Nebraska");US[35]=new Array("NV","Nevada");US[36]=new Array("NH","New Hampshire");US[37]=new Array("NJ","New Jersey");US[38]=new Array("NM","New Mexico");US[39]=new Array("NY","New York");US[40]=new Array("NC","North Carolina");US[41]=new Array("ND","North Dakota");US[42]=new Array("MP","Northern Mariana Islands");US[43]=new Array("OH","Ohio");US[44]=new Array("OK","Oklahoma");US[45]=new Array("OR","Oregon");US[46]=new Array("PW","Palau");US[47]=new Array("PA","Pennsylvania");US[48]=new Array("PR","Puerto Rico");US[49]=new Array("RI","Rhode Island");US[50]=new Array("SC","South Carolina");US[51]=new Array("SD","South Dakota");US[52]=new Array("TN","Tennessee");US[53]=new Array("TX","Texas");US[54]=new Array("UT","Utah");US[55]=new Array("VT","Vermont");US[56]=new Array("VI","Virgin Islands");US[57]=new Array("VA","Virginia");US[58]=new Array("WA","Washington");US[59]=new Array("WV","West Virginia");US[60]=new Array("WI","Wisconsin");US[61]=new Array("WY","Wyoming");