function Validator(f)
{
		f = document.form;
		if(f.Email.value.length <4){
				warncheck(f.Email," Email  more than 4 Character","1")
		}else if(!check_email(f.Email.value)){
				warncheck(f.Email,"  Email ","1")
		}else if(Trim(f.Guestname.value)){
				warninput(f.Guestname," FirstName ","1")
		}else if(Trim(f.Surname.value)){
				warninput(f.Surname," LastName ","1")
		}else if(Trim(f.BirthDay.value)){
				Warnselbox(f.BirthDay," BirthDay ","1")
		}else if(Trim(f.BirthMonth.value)){
				Warnselbox(f.BirthMonth," BirthMonth ","1")
		}else if(Trim(f.BirthYear.value)){
				Warnselbox(f.BirthYear," BirthYeary ","1")
		}else if(Trim(f.Tel.value)){
				warninput(f.Tel," Tel ","1")					
		}else if(Trim(f.Address.value)){
				warninput(f.Address," Address ","1")
		}else if(Trim(f.Checkin_Date.value)){
    		alert("Please Select Depart Date !!!");
			f.Checkin_Date.focus();
		}
		else if(Trim(f.Checkin_Month.value)){
    		alert("Please Select Depart Month !!!");
			f.Checkin_Month.focus();
		}
		else if(Trim(f.Checkin_Year.value)){
    		alert("Please Select Depart Year !!!");
			f.Checkin_Year.focus();
		}
		else if(Trim(f.Checkout_Date.value)){
    		alert("Please Select Arrive Date !!!");
			f.Checkout_Date.focus();
		}
		else if(Trim(f.Checkout_Month.value)){
    		alert("Please Select Arrive Month !!!");
			f.Checkout_Month.focus();
		}
		else if(Trim(f.Checkout_Year.value)){
    		alert("Please Select Arrive Year !!!");
			f.Checkout_Year.focus();
		}
		else if(f.numberseat.value == 0)
		{
    		alert("Please Select num of attendance !!!");
			f.numberseat.focus();
		}

		else
		{
		if(chk_during("Checkin_Date","Checkin_Month","Checkin_Year","Checkout_Date","Checkout_Month","Checkout_Year"))
					{
						 if(f.numberseat.value != "")
		{
			var submit=false;
			count = 0
			var numtotal = eval(document.all.numberseat.value)
			for(k=1;k<=eval(document.all.numberseat.value);k++)
				{
					if  (eval("f.res_name"+k+".value")  ==  "")
					{
						if  (eval("f.res_name"+k+".value") == "")
						{
						alert("Please Insert Name  "+k+"")
						eval("f.res_name"+k+".focus()")
						submit = true
						return 0
						}
					}
					else
					{
					submit=false
					}
					if (submit == false)
					{
					count = (eval(count)+1)
						if (eval(count) == eval(numtotal))
						{
						if (!Trim(f.Checkin_Date.value))
						{
								con = confirm(" Confirm Reserving")
								if(con)
								{
								f.submit()
								}
						}
						} 
					}}}}}}

	function chk_during(dbegin,mbegin,ybegin,dlast,mlast,ylast)
	{
			var f  = document.all;
			str_dbegin 	= eval("f."+dbegin+".value");
			str_mbegin	= eval("f."+mbegin+".value");
			str_ybegin	= eval("f."+ybegin+".value");
			str_dlast		= eval("f."+dlast+".value");
			str_mlast		= eval("f."+mlast+".value");
			str_ylast		= eval("f."+ylast+".value");
			if (str_ylast < str_ybegin)
			{
				alert(" Please Check During Time check- In and check -out again ")
				eval("f."+ylast+".focus()");
				return false;
			}
			else if(str_ylast <= str_ybegin && str_mlast < str_mbegin)
			{
				alert(" Please Check During Time check- In and check -out again ")
				eval("f."+mlast+".focus()");
				return false;
			}
			else if(str_ylast <= str_ybegin && str_mlast <= str_mbegin &&  str_dlast < str_dbegin )
			{
				alert(" Please Check During Time check- In and check -out again ")
				eval("f."+dlast+".focus()");
				return false;
			}
			else
			{
				return true;
			}
	}

	
  
  function ShwRow()
  {
  		var f = document.form;
		var numtotal = f.numtotal.value;
		var numroom = f.Room.value;
				for ( j=1;j<=eval(numtotal);j++)
					{
					eval("document.all.Row"+j+".style.display ='none' ") 
					 }
					for ( i=1;i<=eval(numroom);i++)
					{
					eval("document.all.Row"+i+".style.display ='' ") 
					 }
	}
