function enqValidate(enqform){

	var pass=true;
	var time_at_addr_pass=false;
	var total_time_at_addr=0;
	var failed_field_count=0;
	var checkbox_status = new Array();
	var highlight = new Array();
	if (document.images){
		for (i=0;i<enqform.length;i++){
			if(enqform.elements[i].name){
				var tempobj=enqform.elements[i];
				if (tempobj.name.substring(0,4)=="req_"){					
					if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="select-one")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
						pass=false;
						highlight.push('enq' +  tempobj.name.substring(4 , 150));
						failed_field_count ++;
						//break;
					}
					else if(tempobj.type == 'checkbox'){
						if(!tempobj.checked){
							pass=false;
							highlight.push('enq' +  tempobj.name.substring(4 , 150));
							failed_field_count ++;					
						}
					}
					else if(tempobj.type=="radio"){
						var varname = tempobj.name.substring(4 , 150);
						if(!checkbox_status[varname]){
							checkbox_status[varname] = new Array();
							checkbox_status[varname]['boxes'] = new Array();
						}
						checkbox_status[varname]['boxes'].push('enq' + varname + '_' + tempobj.value);
						if(!checkbox_status[varname]['status']){
							if(tempobj.checked){
								checkbox_status[varname]['status'] = true;
							}
							else{
								checkbox_status[varname]['status'] = false;
							}
						}
					}
				}
			}
		}
	}
	//Sort radio button pass status
	for (row in checkbox_status){
		if(!checkbox_status[row]['status']){
			pass=false;
			for(y=0;y<checkbox_status[row]['boxes'].length;y++){
				highlight.push(checkbox_status[row]['boxes'][y]);
				failed_field_count ++;
			}
		}
	}
	
	if (pass){

		return true;
	
	}
	
	else{
		alert("Please complete all of the required fields in the form!");
		for(i=0; i<highlight.length; i++){
			highlightField(document.getElementById(highlight[i]));
		}
		return false;
	}

}

function highlightField(jshighlight){
	jshighlight.style.background = '#FF9999';
	jshighlight.style.border = '#FF0000 2px solid';
	jshighlight.onfocus = unHighlightField;
}

function unHighlightField(mozevent){
	if(mozevent){
			var jsunhighlight = mozevent.target;
	}
	else if(event){
			var jsunhighlight = event.srcElement
	}
	if(jsunhighlight){
		jsunhighlight.style.background = '#FFFFFF';
		jsunhighlight.style.border = '#BCBCBC 1px solid';
	}
	return true;
}
