var error=""; var fields=new Array("input_5", "input_6", "input_7", "input_8"); var errorMessages=new Array(); errorMessages["input_5"]="Name is required!\n"; errorMessages["input_5_ERROR"]=false; errorMessages["input_6"]="E-mail is required!\n"; errorMessages["input_6_ERROR"]=false; errorMessages["input_7"]="Phone number: is required!\n"; errorMessages["input_7_ERROR"]=false; errorMessages["input_8"]="Your message: is required!\n"; errorMessages["input_8_ERROR"]=false; function formsubmit(){ checkErrors(); if(error==""){ with(document.forms.pageform){ submit(); form_submit.value="Sending in progress..."; form_submit.disabled=true; } } else { showErrors(fields,errorMessages); alert(form_format_alert_text(error+"Thank you!")); } } function checkErrors(){ error=""; with(document.forms.pageform){ miez='input_5'; if(eval(miez+'.value==""')){error+=errorMessages[miez]; errorMessages[miez+"_ERROR"]=true; } else errorMessages[miez+"_ERROR"]=false; miez='input_6'; if(eval(miez+'.value==""')){error+=errorMessages[miez]; errorMessages[miez+"_ERROR"]=true; } else errorMessages[miez+"_ERROR"]=false; if(errorMessages[miez+"_ERROR"]==false){ if(!eval('ic_common_isemail('+miez+'.value)')){error+=errorMessages[miez]; errorMessages[miez+"_ERROR"]=true; } else errorMessages[miez+"_ERROR"]=false; } miez='input_7'; if(eval(miez+'.value==""')){error+=errorMessages[miez]; errorMessages[miez+"_ERROR"]=true; } else errorMessages[miez+"_ERROR"]=false; miez='input_8'; if(eval(miez+'.value==""')){error+=errorMessages[miez]; errorMessages[miez+"_ERROR"]=true; } else errorMessages[miez+"_ERROR"]=false; } }