function form_validation(flg){
	var hh = document.enquiry_frm;
	
	if(hh.name.value==""){
		alert("Please enter your name");
		hh.name.focus();
		return false;
	}
	
	if(hh.company.value==""){
		alert("Please enter Company name.");
		hh.company.focus();
		return false;
	}
	
	if(hh.address1.value==""){
		alert("Please enter your postal address.");
		hh.address1.focus();
		return false;
	}
	
	if(hh.event_address1.value==""){
		alert("Please enter the event address.");
		hh.event_address1.focus();
		return false;
	}
	
	if(hh.telephone.value==""){
		alert("Please enter your Telephone No.");
		hh.telephone.focus();
		return false;
	}
	
	if(hh.mobile.value==""){
		alert("Please enter your Mobile No.");
		hh.mobile.focus();
		return false;
	}
	
	
	if(hh.email.value==""){
		alert("Please enter your email.");
		hh.email.focus();
		return false;
	}
	
	
	if (echeck(hh.email.value)==false){
		//alert("Invalid email address");
		hh.email.focus();
		return false;
	}
	
	
	if(hh.find_us.value==""){
		alert("How Did You Find Us?");
		hh.find_us.focus();
		return false;
	}
		
		
	if(parseInt(flg)==1) {
		if(hh.castle_design.value==""){
			alert("Choose a Castle Design");
			hh.castle_design.focus();
			return false;
		} 
	}
	
		
	if(hh.start.value=="" || hh.start.value=="00:00"){
		alert("Please enter the start time.");
		hh.start.focus();
		return false;
	}
	
	
	if(hh.finish.value=="" || hh.finish.value=="00:00"){
		alert("Please enter the finish time.");
		hh.finish.focus();
		return false;
	}
	
	
	if(parseInt(flg)==1) {
		if(hh.surface.value==""){
			alert("Choose a the type of Surface.");
			hh.surface.focus();
			return false;
		} 
	}
	
	if(hh.comment.value==""){
		alert("Please enter comment");
		hh.comment.focus();
		return false;
	}
return true;
}
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function popimage(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=750,height=730,scrollbars=Yes');
return false;
}