// Contains form submission javascript
function validateEmailCollectionForm()
{	
    if (checkTitle(document.emailCollectionForm['TitleName'].options[document.emailCollectionForm['TitleName'].selectedIndex]) &&
        checkFirstName(document.emailCollectionForm.FirstName) &&
        checkSurname(document.emailCollectionForm.Surname, true) &&
        check2Email(document.emailCollectionForm.Email, document.emailCollectionForm.Email2) &&
        checkMobilePhone(document.emailCollectionForm.MobilePhone)) {
        	document.emailCollectionForm.submit();
    }
}

function validateContactusForm(pageTitle) { 
	
	if (pageTitle == "Outstanding Orders")
	{						
        if( checkFirstName(document.contactusform.forename) &&
            checkSurname(document.contactusform.surname) &&
            checkAccountNumber(document.contactusform.accountnumber) &&
            checkEnquiry(document.contactusform.enquiry) &&
            checkReplyType(document.contactusform.replyType, 
            			   document.contactusform.email ) )  {         
            document.contactusform.submit();
        }
     }
     
    if(pageTitle == "Received Orders") {
        
        if( checkFirstName(document.contactusform.forename) &&
            checkSurname(document.contactusform.surname) &&
            checkAccountNumber(document.contactusform.accountnumber) &&
            checkSingleItemNumber(document.contactusform.itemnumber1) &&
            checkEnquiry(document.contactusform.enquiry) &&
	        checkReplyType(document.contactusform.replyType, 
            			   document.contactusform.email) ) {
            document.contactusform.submit();
        }
    }
    else if(pageTitle == "Returned Goods") {
        if( checkFirstName(document.contactusform.forename) &&
            checkSurname(document.contactusform.surname)  &&
            checkAccountNumber(document.contactusform.accountnumber) &&
            checkEnquiry(document.contactusform.enquiry) &&
            checkItemNumber(document.contactusform.itemnumber1, document.contactusform.itemnumber2,
                            document.contactusform.itemnumber3, document.contactusform.itemnumber4,
                            document.contactusform.itemnumber5 ) &&
			checkReplyType(document.contactusform.replyType, 
            			   document.contactusform.email ) ) {
            document.contactusform.submit();
        }
    }
    else if(pageTitle == "Your Account") {
        if( checkFirstName(document.contactusform.forename) &&
            checkSurname(document.contactusform.surname) &&
            checkAccountNumber(document.contactusform.accountnumber) &&
            checkEnquiry(document.contactusform.enquiry) &&
            checkReplyType(document.contactusform.replyType, 
            			   document.contactusform.email) ) {
             document.contactusform.submit();
        }
    }
    else if(pageTitle == "Our Products") {
        if( checkEnquiry(document.contactusform.enquiry) &&
            checkSingleItemNumber(document.contactusform.itemnumber1) &&
            checkReplyType(document.contactusform.replyType, 
            			   document.contactusform.email) ) {
            document.contactusform.submit();
        }
    }
    else if(pageTitle == "Problems with our Website") {
        if( checkTimeDateOfError(document.contactusform.datetimeerror) &&
            checkEnquiry(document.contactusform.enquiry) &&
            checkReplyType(document.contactusform.replyType, 
            			   document.contactusform.email) ) {
            document.contactusform.submit();
         }
    }
    else if(pageTitle == "Comments on our Service") {
        if(checkComment(document.contactusform.comment) && 
           checkReplyType(document.contactusform.replyType, 
            			  document.contactusform.email)) {
           
           document.contactusform.submit();
        }
    }
    else if(pageTitle == "Our Policies") {
        if( checkEnquiry(document.contactusform.enquiry) &&
		    checkReplyType(document.contactusform.replyType, 
            			  document.contactusform.email)) {
            document.contactusform.submit();
        }
    }
    else if(pageTitle == "Other Enquiries") {
        if( checkEnquiry(document.contactusform.enquiry) &&
       		checkReplyType(document.contactusform.replyType, 
       					   document.contactusform.email ) ) {
       			document.contactusform.submit();
        }
    }
}