/*****************************************************************************
* OPEN THE TERMS OF USE WINDOW *
*****************************************************************************/
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
} 

/*****************************************************************************
* CHECK BUSINESS NAME *
*****************************************************************************/
function check_customer_info() {
var c_p_title = document.quote_customer.p_title;
var c_first_initial = document.quote_customer.first_initial;
var c_last_name = document.quote_customer.last_name;
var c_phone_number = document.quote_customer.phone_number;
var c_email = document.quote_customer.s_email;
var c_house_no = document.quote_customer.house_no;
var c_postcode = document.quote_customer.postcode;
if (c_p_title.value=="Select"){
alert("Please Select your Title")
return false
}
if ((c_first_initial.value==null)||(c_first_initial.value=="")){
alert("Please Enter your First Intial")
return false
}
if ((c_last_name.value==null)||(c_last_name.value=="")){
alert("Please Enter your Last Name")
return false
}
if ((c_phone_number.value==null)||(c_phone_number.value=="")){
alert("Please Enter your Phone Number")
return false
}
if ((c_email.value==null)||(c_email.value=="")){
alert("Please Enter your Email Address")
return false
}
if ((c_house_no.value==null)||(c_house_no.value=="")){
alert("Please Enter your House Number")
return false
}
if ((c_postcode.value==null)||(c_postcode.value=="")){
alert("Please Enter your Post Code")
return false
}
if (document.quote_customer.terms_and_conditions.checked == false) {
alert("You MUST Check the Accept Terms and Conditions")
return false
}
return true;
}

/*****************************************************************************
* EMAIL VERIFICATION *
*****************************************************************************/
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Please Enter your VALID email address")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Please Enter your VALID email address")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Please Enter your VALID email address")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("Please Enter your VALID email address")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Please Enter your VALID email address")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
alert("Please Enter your VALID email address")
return false
}
if (str.indexOf(" ")!=-1){
alert("Please Enter your VALID email address")
return false
}
return true
}
function ValidateEmail(){
var emailID=document.quote_customer.s_email;
// alert("the code is here");
// if ((emailID.value==null)||(emailID.value=="")){
// alert("Please Enter your VALID email address")
// emailID.focus()
// return false
// }
if (echeck(emailID.value)==false){
emailID.value=""
emailID.focus()
return false
}
return true
}

