function form_validation(){if(ValidateForm("frm")==true){document.frm.submit()}else{}}function listPop(arrayName,selected,noValueText,keepWhiteSpace){var array=eval(arrayName);if(array==null){alert("Error: listPop() Could not find array '"+arrayName+"'.");return }if(selected==null){selected=""}else{if(keepWhiteSpace==null){selected=selected.replace(/\s*/g,"")}}selected=selected.split(",");if((noValueText!=null)&&(noValueText.length>0)){document.write('<option value=""');if(selected.length==0){document.write(" selected")}document.write(">"+noValueText+"</option>")}for(var i=0;i<array.length;i=i+2){document.write('<option class="formSelect" value="'+array[i]+'"');var listItem=array[i].replace(/^\s*/g,"");for(var j=0;j<selected.length;j++){if(listItem==selected[j]){document.write(" selected")}}document.write(">"+array[i+1]+"</option>")}}function IndexChange(A){if(location.pathname.indexOf("index.aspx")==-1){location="index.aspx?sg="+A}else{location=location.pathname+"?sg="+A}}var sstr="";function selectKeyDown(C){var D,B;var A=false;if(event.keyCode==13){C.blur;return }D=unescape("%"+event.keyCode.toString(16));sstr=sstr+D;for(B=0;B<C.length;B++){if(C.options[B].text.slice(0,sstr.length).toLowerCase()==sstr){C.selectedIndex=B;A=true;break}}if(!A){sstr="";C.value=sstr}}function getQueryString(){var B=document.location.href;var A="";if(B.indexOf("?")!=-1){A=B.substr(B.indexOf("?"))}return A}function getQueryMsg(){var B=document.location.href;var A="";if(B.indexOf("=")!=-1){A=B.substr(B.indexOf("="));A=A.slice(1)}return A}function getQueryStringValue(C){var B=document.location.href;var A="";var D="&";if(B.indexOf("?"+C+"=")!=-1){D="?"}if(B.indexOf(D+C+"=")!=-1){A=B.substr(B.indexOf(D+C+"=")+1);if(A.indexOf("&")!=-1){A=A.substr(0,A.indexOf("&"))}A=A.substr(A.indexOf("=")+1)}return unescape(A)}function isDigit(A){if(A=="."||A==":"||A==","||A==" "){return true}return((A>="0")&&(A<="9"))}function IsNumeric(A){if(A.length==1&&A=="-"){return false}for(i=0;i<A.length;i++){var B=A.charAt(i);if(!isDigit(B)){return false}}return true}function IsInteger(A){if(A!=parseInt(A)){return false}return true}function FocusField(f){f.focus();if(eval(f.type=="text")){f.select()}}function addFormToQueryString(formName){var fields=eval("document."+formName+".elements");var qs=getQueryString();for(var i=0;i<fields.length;i++){var currField=fields[i];if(qs.length==0){qs=qs+"?"}else{qs=qs+"&"}if(currField.value!=""){qs=qs+currField.name+"="+currField.value}}return qs}function ValidateForm(formName){document[formName].Submit.disabled=true;var fields=eval("document."+formName+".elements");for(var i=0;i<fields.length;i++){var currField=fields[i];var desc="";desc=currField.getAttribute("desc");if(desc==""){desc=currField.name}var isMandatory=currField.getAttribute("isMandatory");var isCheckBox=currField.getAttribute("isCheckBox");var isLinkedWith=currField.getAttribute("isLinkedWith");var customError=currField.getAttribute("customError");var minChars=currField.getAttribute("minChars");var isNumeric=currField.getAttribute("isNumeric");var isInternationalPhoneNo=currField.getAttribute("isInternationalPhoneNo");var isEqualTo=currField.getAttribute("isEqualTo");var isDate=currField.getAttribute("isDate");var isEmail=currField.getAttribute("isEmail");if(isMandatory){if(isMandatory=="yes"){if(isCheckBox){if(currField.checked==false){alert("You must "+desc);FocusField(currField);document[formName].Submit.disabled=false;return false}}if(currField.value.replace(" ","")==""){alert("You need to enter a valid value for "+desc);FocusField(currField);document[formName].Submit.disabled=false;return false}}}if(isLinkedWith){if(eval(isLinkedWith)==0){if(customError){alert(customError)}else{alert(desc+" must be completed with a valid value")}FocusField(currField);document[formName].Submit.disabled=false;return false}}if(currField.value.replace(" ","")!=""||(isCheckBox&&currField.checked==true)){if(minChars){if(currField.value.length<minChars){alert("The value for "+desc+" must contain at least "+minChars+" characters.");FocusField(currField);document[formName].Submit.disabled=false;return false}}if(isNumeric){if(isNumeric=="yes"){if(!IsNumeric(currField.value)){alert("The value for "+desc+" must be numeric");FocusField(currField);document[formName].Submit.disabled=false;return false}}}if(isInternationalPhoneNo){if(isInternationalPhoneNo=="yes"){if(checkInternationalPhone(currField.value)==false&&currField.value!=""){alert(desc+" can only contain numbers and symbols '()- ' and must have at least "+minDigitsInIPhoneNumber+" digits.");FocusField(currField);document[formName].Submit.disabled=false;return false}}}if(isEqualTo){if(currField.value!=fields[isEqualTo].value){alert(desc+" must match");FocusField(currField);document[formName].Submit.disabled=false;return false}}if(isDate){if(isDate=="yes"){if(!validateDate(currField.value)){alert(desc+" must be a valid date in dd/mm/yyyy format");FocusField(currField);document[formName].Submit.disabled=false;return false}}}if(isEmail){if(isEmail=="yes"){if(!IsEmail(currField.value)){alert(desc+" must be a valid email address");FocusField(currField);document[formName].Submit.disabled=false;return false}}}}}document[formName].submit()}var digits="0123456789";var phoneNumberDelimiters="()- ";var validWorldPhoneChars=phoneNumberDelimiters+"+";var minDigitsInIPhoneNumber=10;function isInteger(B){var A;for(A=0;A<B.length;A++){var C=B.charAt(A);if(((C<"0")||(C>"9"))){return false}}return true}function IsEmail(A){var C="^[._A-z0-9-]+@[.A-z0-9-]+[.]{1}[A-z]{2,4}$";var B=new RegExp(C);return B.test(A)}function stripCharsInBag(C,D){var B;var A="";for(B=0;B<C.length;B++){var E=C.charAt(B);if(D.indexOf(E)==-1){A+=E}}return A}function checkInternationalPhone(A){s=stripCharsInBag(A,validWorldPhoneChars);return(isInteger(s)&&s.length>=minDigitsInIPhoneNumber)}function validateDate(C){var D,A,E,B;B=C.split("/");D=B[0];A=B[1];E=B[2];if(!(A>=1&&A<=12)){return false}if(!(E>=1900)){return false}if(A==1||A==3||A==5||A==7||A==8||A==10||A==12){if(!(D>=1&&D<=31)){return false}}else{if(A==2){if(D==29&&(!((E%4)==0))){return false}if(!(D>=1&&D<=29)){return false}else{return true}}else{if(!(D>=1&&D<=30)){return false}}}return true}function checkDateDistance(){today=new Date();var B=new Date(document.frm.year_dob.value,document.frm.month_dob.value-1,document.frm.day_dob.value);var A=1000*60*60*24;if(Math.ceil((today.getTime()-B.getTime())/(A))>=(365*18)){return true}else{return false}}function validatePassword(C,B){var A;if(C!="SIM"){A=new RegExp(/^.*(?=.{6,20})(?=.*\d)(?=.*[a-zA-Z]).*$/)}else{A=new RegExp(/^[a-zA-Z]{6,20}$/)}if(A.test(B)){return true}else{return false}}function formatNumber(D,B){if(isNaN(D)){D=0}if(D==""){D=0}var H=new String(D);var E=H.split(".");var F=parseFloat(E[0]);var A="";if(E.length>1){var G=new String(E[1]);G=String(parseFloat(E[1])/Math.pow(10,(G.length-B)));G=String(F+Math.round(parseFloat(G))/Math.pow(10,B));var C=G.indexOf(".");if(C==-1){G+=".";C=G.indexOf(".")}while(G.length<=C+B){G+="0"}A=G}else{var C;var G=new String(F);G+=".";C=G.indexOf(".");while(G.length<=C+B){G+="0"}A=G}return A}function hideObject(A){document.getElementById(A).style.display="none"}function showObject(A){document.getElementById(A).style.display="block"}function changeDate(B){var A=document.getElementById(B);A.selectedIndex=A.length-1}function resizeWindow(C){if(is_ie!=false){var A=""+C;var B=new Array("applicationform.html","applicationform1.html","applicationform2.html","applicationform3.html","applicationform4.html","applicationform5.html","applicationform6.html","applicationform7.html");var E=document.getElementById("text");for(var D=0;D<B.length;D++){if(A.indexOf(B[D])!=-1){document.getElementById("menuDIV").style.height="550px";E.style.height="550px";break}else{document.getElementById("menuDIV").style.height="100%";E.style.height="380px"}}}}var popup;function simplePopup(B,C,A){if(popup){popup.close()}popup=window.open(B,"popup","width="+C+",height="+A+", location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no");return popup}function simplePopupScroll(B,C,A){if(popup){popup.close()}popup=window.open(B,"popup","width="+C+",height="+A+",scrollbars=yes")}function roundto(A,B){return Math.round(A*Math.pow(10,B))/Math.pow(10,B)}function includeDynamicScript(A){var B=document.createElement("script");B.id="rs";B.setAttribute("type","text/javascript");B.setAttribute("src",A);var C=document.getElementsByTagName("head")[0];C.appendChild(B)}function openDesigner(A){myWindow=window.open(A,"designer","toolbar=no")}function getElementsByClassName(H,I,G){var B=new RegExp("(^|\\\\s)"+H+"(\\\\s|$)");var I=I||"*";var G=G||document;var A=(I=="*"&&G.all)?G.all:G.getElementsByTagName(I);var D=[];var F;var C=A.length;for(var E=0;E<C;E++){F=A[E];if(B.test(F.className)){D.push(F)}}return D}function getFormFieldValue(B){if(B.type){return B.value}else{for(var A=0;A<B.length;A++){if(B[A].checked){return B[A].value}}}}function setFormFieldValue(C,B){if(C.type){C.value=B}else{for(var A=0;A<C.length;A++){if(C[A].value==B){C[A].checked=true;return }}}};