function validateElement(elementName, elementLabel){
	if (eval('document.quoteform.' + elementName + '.value') == "" || eval('document.quoteform.' + elementName + '.value') == elementLabel){
		alert('You must enter ' + elementLabel)
		eval('document.quoteform.' + elementName + '.focus()');
		checkResult = 'error';
	}else{
		checkResult = 'ok';
	}
}

function isEmail(address) {
    var pos = address.lastIndexOf("@");
    return pos > 0 && (address.lastIndexOf(".") > pos) && (address.length - pos > 4);
}

function validateQuote(){

	//debugger;
	

	validateElement('myname', 'your Name');
	if (checkResult == 'error'){
		return false
	}
	
		
	
	
	
	validateElement('howmany', 'How many people will be travelling');
	if (checkResult == 'error'){
		return false
	}

	validateElement('where', 'Where would you like to travel to');
	if (checkResult == 'error'){
		return false
	}
	
	validateElement('when', 'When would you like to travel');
	if (checkResult == 'error'){
		return false
	}
	
	validateElement('stay', 'How long would you like to stay for');
	if (checkResult == 'error'){
		return false
	}
	
	validateElement('accommodation', 'What kind of accommodation are you looking for');
	if (checkResult == 'error'){
		return false
	}
	
	validateElement('rounds', 'How many rounds would you like to play');
	if (checkResult == 'error'){
		return false
	}
	
	validateElement('hearlongmere', 'Where did you hear of us');
	if (checkResult == 'error'){
		return false
	}
	
	
	// ensure the two e-mail fields have been populated and that they match
	validateElement('myemail', 'your E-mail');
	if (checkResult == 'error'){
		return false
	}	
	
	validateElement('myemailconfirm', 'confirm your E-mail');
	if (checkResult == 'error'){
		return false
	}
	
	strEmail = document.quoteform.myemail.value;
	strEmailConfirm = document.quoteform.myemailconfirm.value;
	
	if (strEmail != strEmailConfirm) {
		alert('The email addresses you have entered do not match');
		return false
	}
	
	
	// finally is e-mail valid(ish)?
        if (!(isEmail(document.quoteform.myemail.value))){
        	alert('The e-mail address you have entered appears to be invalid.');
		document.quoteform.myemail.focus(); 
        	return false;
        }
        
	
	
	document.forms['quoteform'].submit();

}



