<!--
//-------------------------------------------------------------------------

function check_field(field_name, label){
var sfield_name = field_name.value;
var ifield_name = sfield_name.length;

if(ifield_name== 0) {
alert ("'" + label + "' is a required field.");
field_name.focus();
return 0;
}

var OK = false;
for(var i = 0;i<ifield_name;i++) if(sfield_name.charAt(i) != " ") {	OK = true;	break;	}  
if(OK == false) { alert("'" + label + "' field contains only whitespaces."); field_name.focus(); return 0; }
return 1;
}

//-------------------------------------------------------------------------

function check_textarea(field_name, label){
var sfield_name = field_name.value;
var ifield_name = sfield_name.length;

if(ifield_name== 0) {
alert ("'" + label + "' is a required field.");
field_name.focus();
return 0;
}

var OK = false;
for(var i = 0;i<ifield_name;i++) if(sfield_name.charAt(i) != " ") {	OK = true;	break;	}  
if(OK == false) { alert("'" + label + "' field contains only whitespaces."); field_name.focus(); return 0; }
if(ifield_name>5000){alert("Only 5000 characters are allowed for the "+label+" field"); field_name.focus(); return 0; }

return 1;
}

//-------------------------------------------------------------------------

function check_email(field_name, label){
var sfield_name = field_name.value;
var ifield_name = sfield_name.length;
var Amp = false;
var Period = false;
for(var i = 0;i<ifield_name;i++) if(sfield_name.charAt(i)=="@"){Amp = true; break;}
for(var i = 0;i<ifield_name;i++) if(sfield_name.charAt(i)=="."){Period = true; break;}
if(Amp == false || Period == false) {alert("Please enter a valid e-mail address");	field_name.focus();	return 0;}
return 1;
}

//-------------------------------------------------------------------------

function validate(){

if(check_field(document.form_quick_quote.name, "Name")==0) return;
if(check_field(document.form_quick_quote.email, "E-mail")==0) return;
if(check_email(document.form_quick_quote.email, "E-mail")==0) return;
if(check_field(document.form_quick_quote.phone, "Phone")==0) return;
if(check_field(document.form_quick_quote.comp, "Company")==0) return;
if(check_field(document.form_quick_quote.city, "City")==0) return;

if(!document.form_quick_quote.method[0].checked && !document.form_quick_quote.method[1].checked && !document.form_quick_quote.method[2].checked){alert("Please select your preffered method of communication."); document.form_quick_quote.method[0].focus(); return;}
if(document.form_quick_quote.type[0].checked==false && document.form_quick_quote.type[1].checked==false && document.form_quick_quote.type[2].checked==false && document.form_quick_quote.type[3].checked==false){alert("Plase select the type of project"); document.form_quick_quote.type[0].focus(); return;}

//radio 1 ------------------------------------------------------------------------------------------------------------------

if(document.form_quick_quote.type[0].checked){
if(check_field(document.form_quick_quote.sub_01_domain, "Domain name")==0) return;
if(document.form_quick_quote.sub_01_rfp[0].checked) if(check_field(document.form_quick_quote.rfp_upload_01, "Select document")==0) return;
if(check_textarea(document.form_quick_quote.sub_01_details, "Details")==0) return;
}

//radio 2 ------------------------------------------------------------------------------------------------------------------

if(document.form_quick_quote.type[1].checked){
if(document.form_quick_quote.sub_02_rfp[0].checked) if(check_field(document.form_quick_quote.rfp_upload_02, "Select document")==0) return;
if(check_textarea(document.form_quick_quote.sub_02_details, "Details")==0) return;
}

//radio 3 ------------------------------------------------------------------------------------------------------------------

if(document.form_quick_quote.type[2].checked){
if(document.form_quick_quote.sub_03_rfp[0].checked) if(check_field(document.form_quick_quote.rfp_upload_03, "Select document")==0) return;
if(check_textarea(document.form_quick_quote.sub_03_details, "Details")==0) return;
}

//radio 4 ------------------------------------------------------------------------------------------------------------------

if(document.form_quick_quote.type[3].checked){
if(document.form_quick_quote.sub_04_rfp[0].checked) if(check_field(document.form_quick_quote.rfp_upload_04, "Select document")==0) return;
if(check_textarea(document.form_quick_quote.sub_04_details, "Details")==0) return;
}
document.form_quick_quote.submit();
}

//-->