//load flash elements //EventUtil.addEvent(window, 'load', fLoadFlashElements , false); //load nav EventUtil.addEvent(window, 'load', fNavLoad , false); function f_contact_validate(my_array) { var myMediumSelect = document.getElementById('medium'); var myMediumSelectValue = fGetMultiSelectValue( myMediumSelect ); //get form object my_form = my_array['object']; if(my_form.elements.firstname.value==""){ alert("Please fill out the FIRST NAME field"); my_form.elements.firstname.focus(); return(false); }else if(my_form.elements.surname.value==""){ alert("Please fill out the FAMILY NAME field"); my_form.elements.surname.focus(); return(false); }else if(my_form.elements.phone.value=="" && my_form.elements.mobile.value==""){ alert("Please fill out the PHONE or MOBILE field"); my_form.elements.phone.focus(); return(false); }else if(my_form.elements.email.value==""){ alert("Please fill out the EMAIL field"); my_form.elements.email.focus(); return(false); }else if( f_formValidateEmail( my_form.elements.email.value ) != true ){ alert("Please insure your EMAIL field is in the correct format"); my_form.elements.email.focus(); return(false); }else if(my_form.elements.suburb.value==""){ alert("Please fill out the SUBURB field"); my_form.elements.suburb.focus(); return(false); }else if(my_form.elements.postcode.value==""){ alert("Please fill out the POSTCODE field"); my_form.elements.postcode.focus(); return(false); }else if( myMediumSelectValue[0] == ""){ alert("Please select an option to tell us how you found our company"); my_form.elements.medium.focus(); return(false); }else{ //document.location = "http://www.gumleafgutterguard.com/cgi-bin/FormMail.cgi?recipient=jasjc@jasjc.com" //my_form.submit(); return(true); } }//end function f_contact_validate(my_array) function f_installers_validate(my_array) { if(document.getElementById('name').value==""){ alert("Please fill out the YOUR NAME field"); document.getElementById('name').focus(); return(false); }else if(document.getElementById('phone').value==""){ alert("Please fill out the PHONE field"); document.getElementById('phone').focus(); return(false); }else if(document.getElementById('email').value==""){ alert("Please fill out the EMAIL field"); document.getElementById('email').focus(); return(false); }else if( f_formValidateEmail( document.getElementById('email').value ) != true ){ alert("Please insure your EMAIL field is in the correct format"); document.getElementById('email').focus(); return(false); }else if(document.getElementById('suburb').value==""){ alert("Please fill out the SUBURB field"); document.getElementById('suburb').focus(); return(false); }else if( document.getElementById('comments').value==""){ alert("Please leave a comment or question concerning your enquiry"); document.getElementById('comments').focus(); return(false); }else{ //document.location = "http://www.gumleafgutterguard.com/cgi-bin/FormMail.cgi?recipient=jasjc@jasjc.com" document.installercontact.submit(); return(true); } }//end function f_contact_validate(my_array) //handles validating an email address function f_formValidateEmail(pmEmail){ //get email address to validate var myEmail = pmEmail; //EMPTY EMAIL //check if email is empty if(myEmail==""){return('EMAIL field is required')}; //INVALID CHARACTERS //set invalid email character set var myInvalidCharSet = " /:,;"; //check for invalid chars in email for(i=0;i-1){return('EMAIL field entry does not appear to be in the right format')}; }//end for //PRESENCE AND POSITION OF @ SYMBOL //get position of first at symbol from second char of email var atPos = myEmail.indexOf("@",1); //check for at least one @ symbol later than second char if(atPos==-1){return('EMAIL field entry does not appear to be in the right format')}; //second @ symbol present after first @ symbol not valid if(myEmail.indexOf("@",atPos+1) != -1){return('EMAIL field entry does not appear to be in the right format')}; //PRESENCE AND POSITION OF PERIOD SYMBOL //get position of first period symbol from after first @ symbol var periodPos = myEmail.indexOf(".",(atPos+2)); //period required after @ symbol if(periodPos==-1){return('EMAIL field entry does not appear to be in the right format')}; //if not enough space for TLD (Top Level Domain) then send error if(periodPos+3>myEmail.length){return('EMAIL field entry does not appear to be in the right format')}; //email validates return(true); }//end function f_formValidateEmail function fGetMultiSelectValue(pmSelectElement) { var mySelectObj = pmSelectElement;//document.getElementById(mySelectId); if(!mySelectObj){ return( false ); }; var mySelectedArray = new Array(); for (var i = 0; i < mySelectObj.options.length; i++) { if (mySelectObj.options[i].selected){ mySelectedArray.push( mySelectObj.options[i].value ); };//end if };//end for return( mySelectedArray ); };//end function fGetMultiSelectValue //******************************************************************************************* //NAVIGATION //******************************************************************************************* gNavList = new Array({action:"about", childId:"navAboutSub", id:"navAbout"}, {action:"product", childId:"navProductSub", id:"navProduct"}); function fNavLoad() { //set document level handler for onmouseover event //allows operation of banner menu code //by default the menu hiding will occur while over a page element //document.onmouseover = f_NavMenuHide; EventUtil.addEvent(document, 'mouseover', f_NavMenuHide , false); /* //build list of menu open items var myMenuOpenList = gNavList; //set open menu events //iterate through id list for(var i=0; i