// JScript source code
function isValidEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return true;
	}
	else {
		return false;
	}
}

function checkcallback(){
	var ftxt = '';

	if (document.contactform.Name.value==''||document.contactform.Name.value=='Name'){
		ftxt += '\n- Please enter your Name.';
	}
	
	if (document.contactform.Telephone_Number.value==''||document.contactform.Telephone_Number.value=='Telephone number'){
		ftxt += '\n- Please enter your Telephone Number.';
	}
	
	if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else {
		return true;
	}
}

function checkenquiryform(){
    var ftxt = '';
    
    if (document.enquiryform.Name.value==''||document.enquiryform.Name.value=='Name'){
		ftxt += '\n- Please enter your Name.';
	}
	
	if (isValidEmail(document.enquiryform.Email.value)==false){
		ftxt += '\n- Please enter your Email Address.';
	}
	
	if (document.enquiryform.Telephone.value==''||document.enquiryform.Telephone.value=='Telephone'){
		ftxt += '\n- Please enter your Telephone Number.';
	}
	
	if (document.enquiryform.Company.value==''||document.enquiryform.Company.value=='Company'){
		ftxt += '\n- Please enter your Company Name.';
	}
	
	if (document.enquiryform.Service.value==''){
		ftxt += '\n- Please select a Service.';
	}
    
    if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else {
		return true;
	}
}

function checkbrochureform(){
    var ftxt = '';
    
    if (document.brochureform.Name.value==''||document.brochureform.Name.value=='Name'){
		ftxt += '\n- Please enter your Name.';
	}
	
	if (document.brochureform.Company.value==''||document.brochureform.Company.value=='Company'){
		ftxt += '\n- Please enter your Company Name.';
	}
	
	if (document.brochureform.Telephone_Number.value==''||document.brochureform.Telephone_Number.value=='Telephone number'){
		ftxt += '\n- Please enter your Telephone Number.';
	}
	
	if (isValidEmail(document.brochureform.Email.value)==false){
		ftxt += '\n- Please enter your Email Address.';
	}
	
	if (document.brochureform.InterestedIn.value==''){
		ftxt += '\n- Please select what you\'re interested in.';
	}
	
	if (document.brochureform.Newsletter.value==''){
		ftxt += '\n- Please select if you would like to sign-up to our newsletter.';
	}
    
    if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else {
		return true;
	}
}


function clearemailfield(fieldVal){
	if (isValidEmail(fieldVal)==false){
		document.newsletterform.email.value='';
	}
}

function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}

function mainmenu(){
	$(" #navlist ul ").css({display: "none"}); // Opera Fix
	$(" #navlist li").hover(function(){
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(100);
			},function(){
			$(this).find('ul:first').css({visibility: "hidden"});
			});
	}

 $(document).ready(function(){					
	mainmenu()
});



