// ***************************************
// * Author: AB Allen                    *
// * Company: 360eBusiness               *
// * Contant: info@360ebusiness.co.uk    *
// * URL: http://www.360ebusiness.co.uk/ *
// ***************************************


// used in quotation.html

function validatequote()
	{
	if (document.customer_quote.pick_up_from.value == "no pick up location specified")
		{
		alert('please enter a pick up location');
		return false;
		}
	else if (document.customer_quote.pick_up_date.value == "DD-MM-YYYY")
		{
		alert('please enter a pick up date');
		return false;
		}
	else if (document.customer_quote.pick_up_time.value == "")
		{
		alert('please enter a pick up time');
		return false;
		}
	else if (document.customer_quote.drop_off_at.value == "no drop off location specified")
		{
		alert('please enter a drop off location');
		return false;
		}
	else if (document.customer_quote.drop_off_date.value == "DD-MM-YYYY")
		{
		alert('please enter a drop off date');
		return false;
		}
	else if (document.customer_quote.drop_off_time.value == "")
		{
		alert('please enter a drop off time');
		return false;
		}
	else if (document.customer_quote.destination.value == "")
		{
		alert('please enter a destination');
		return false;
		}
	else if (document.customer_quote.vehicle_group.value == "no vehicle type")
		{
		alert('please enter the type or size of vehicle that you require');
		return false;
		}
	else if (document.customer_quote.first_name.value == "" || document.customer_quote.surname.value == "")
		{
		alert('please make sure your name has been clearly entered');
		return false;
		}
	else if (document.customer_quote.address.value == "")
		{
		alert('please enter your full home address');
		return false;
		}
	else if (document.customer_quote.daytime_tel.value == "" || document.customer_quote.evening_tel.value == "")
		{
		alert('please enter day and evening contact numbers');
		return false;
		}
	else if (document.customer_quote.country_of_residence.value == "")
		{
		alert('please enter your country of residence');
		return false;
		}
	else if (document.customer_quote.age.value == "no age")
		{
		alert('please enter your age');
		return false;
		}
	else if (document.customer_quote.preferred_method_of_payment.value == "no preferred method of payment")
		{
		alert('please enter your preferred method of payment');
		return false;
		}
	else if (document.customer_quote.preferred_method_of_contact.value == "no preferred method of contact")
		{
		alert('please enter your preferred method of contact');
		return false;
		}
	else if (document.customer_quote.email.value == "")
		{
		alert('please enter a contact email address');
		return false;
		}
	else if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.customer_quote.email.value))
		{
		alert('sorry, your email address is invalid.');
		return false;
		}
	else if (document.customer_quote.agree_terms.checked != true)
		{
		alert('please confirm that you understand and agree with our estimate terms');
		return false;
		}
	else
	return true;
	}
    
// used in submit_feedback.html

function validatefeedback()
    {
    if (document.customer_feedback.client_name.value == "")
        {
        alert('please make sure your name has been clearly entered');
        return false;
        }
    else if (document.customer_feedback.client_feedback.value == "")
        {
        alert('please enter a comment');
        return false;
        }
    else if (document.customer_feedback.client_email.value == "")
        {
        alert('please enter a contact email address');
        return false;
        } 
    else if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.customer_feedback.client_email.value))
        {
        alert('sorry, your email address is invalid.');
        return false;
        }
    else
    return true;
    }

// used in quotation.html

function modelesswin(url,mwidth,mheight)
	{
	if (document.all&&window.print) //if ie5
	eval('window.showModelessDialog(url,"","help:0;resizable:1;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
	else
	eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=0,scrollbars=1")')
	}
	
// Used in contact_us.html

function validatecontactmsg()
    {
    if (document.frmcontactmsg.txtcontactname.value == "")
        {
        alert('Please enter your name in full');
        return false;
        }
    else if (document.frmcontactmsg.txtcontactemail.value == "")
        {
        alert('Please enter your email address');
        return false;
        }
    else if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.frmcontactmsg.txtcontactemail.value))
        {
        alert('Sorry, your email address is invalid.');
        return false;
        }
    if (document.frmcontactmsg.txtcontactmessage.value == "")
        {
        alert('You have not entered a message');
        return false;
        }
    else
    return true;
    }
    
// Used in quickquote.php

function validateqquote()
    {
    if (document.qquote.vehicle_group.value == "None")
        {
        alert('Please select a vehicle type');
        return false;
        }
    else if (document.qquote.duration.value == "" || document.qquote.duration.value == "0")
        {
        alert('Please enter a rental duration in days');
        return false;
        }
    else
    return true;
    }
    
// Used in callback.php

function validatecback()
    {
    if (document.cback.name.value == "")
        {
        alert('Please enter a contact name');
        return false;
        }
    else if (document.cback.tel.value == "")
        {
        alert('Please enter a contact telephone number');
        return false;
        }
    else
    return true;
    }