
/* Contact Us Form ------------------ */
function validClientbook(clientbookForm) {
	
	 	
	if (clientbookForm.fullName.value == '') {
		alert("Please enter your Name");
		clientbookForm.fullName.focus();
		return false;
	}
	if (clientbookForm.fullName.value == 'Name'){
		alert("Please enter your Name");
		clientbookForm.fullName.focus();
		return false;
	}
	if (clientbookForm.emailAddr.value == '') {
		alert("Please enter your email address");
		clientbookForm.emailAddr.focus();
		return false;
	}
	if (clientbookForm.emailAddr.value == 'Email') {
		alert("Please enter your email address");
		clientbookForm.emailAddr.focus();
		return false;
	}
	
	if (!validEmail(clientbookForm.emailAddr.value)) {
		clientbookForm.emailAddr.focus();
		return false;
	}
	
	
		if (clientbookForm.country.value == 'Country') {
		alert("Please select your country");
		clientbookForm.country.focus();
		return false;
	}
		
	if (clientbookForm.message.value == 'Comments') {
		alert("Please enter your comments");
		clientbookForm.message.innerHTML='';
		clientbookForm.message.focus();
		return false;
	}
	
	 
	return true;
	
}

/* Contact Us Form ------------------ */
function validContact(contactForm) {
	
	 	
	if (contactForm.fullName.value == '') {
		alert("Please enter your Name");
		contactForm.fullName.focus();
		return false;
	}
	if (contactForm.fullName.value == 'Name'){
		alert("Please enter your Name");
		contactForm.fullName.focus();
		return false;
	}
	if (contactForm.emailAddr.value == '') {
		alert("Please enter your email address");
		contactForm.emailAddr.focus();
		return false;
	}
	if (contactForm.emailAddr.value == 'Email') {
		alert("Please enter your email address");
		contactForm.emailAddr.focus();
		return false;
	}
	
	if (!validEmail(contactForm.emailAddr.value)) {
		contactForm.emailAddr.focus();
		return false;
	}
	
	if (contactForm.telephone.value == '') {
		alert("Please enter your telephone");
		contactForm.telephone.focus();
		return false;
	}
	
	if (contactForm.telephone.value == 'Tel') {
		alert("Please enter your telephone");
		contactForm.telephone.focus();
		return false;
	}
	
		if (contactForm.country.value == 'Country') {
		alert("Please select your country");
		contactForm.country.focus();
		return false;
	}
	
	if (contactForm.comments.value == 'Comments') {
		alert("Please enter your comments");
		contactForm.comments.innerHTML='';
		contactForm.comments.focus();
		return false;
	}
	
	 
	return true;
	
}

 

 
 

// checks for valid telephone characters
function validNum(telno) {
	
	var pattern = "0123456789+-)(. ";
	var i = 0;
	
	do {
		var pos = 0;
		for ( var j = 0 ; j < pattern.length ; j++ )
			if ( telno.charAt(i) == pattern.charAt(j) )
				pos = 1;
		i++;
	}
	while ( pos == 1 && i < telno.length )
	
	if ( pos == 0 ) return false;
	
	return true;
}



// check email address pattern
function validEmail(addr) {
	
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	
	if ( !regex.test(addr) ) {
		alert("Invalid email address");
		return false;
	}
	
	return true;
}

// validation for Send to Friend
function val_send_to_friend(contactForm) {
	if (!validEmail(contactForm.addr.value)) {
		contactForm.addr.value = '';
		contactForm.addr.focus();
		return false;
	}
	return true;
}
 
 
