

function validatefaq()
{
	if (document.frmFaq.search.value == "")
	{
		alert("Enter text for search");
		document.frmFaq.search.focus();
		return false;
	}
	frmFaq.action="faqdetails.aspx?flag=2&search="+document.frmFaq.search.value;
	return true;
}

function ValidateContactUs()
{
 	var ErrMsg="";
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.Contactus2_txtEmail.value.match(emailPat);
	var ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	
	if(document.Form1.Contactus2_txtFname.value=="" )
	{
		alert("First name required\n");
		document.Form1.Contactus2_txtFname.focus();
		return false;
	}
	
	if(document.Form1.Contactus2_txtFname.value.charAt(0)==' ')
	{    alert("First name required"); 
		 document.Form1.Contactus2_txtFname.focus();
		 return false;
	 }
	
	if(document.Form1.Contactus2_txtEmail.value==""||document.Form1.Contactus2_txtEmail.value=="Enter your email.")
	{
	    alert("Email required");		
		document.Form1.Contactus2_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form1.Contactus2_txtEmail.focus();
		return false;
	}
	
	 if(document.Form1.Contactus2_txtComments.value==""||document.Form1.Contactus2_txtComments.value=="Enter your comments here")
	{
	    alert("Comments required");
		document.Form1.Contactus2_txtComments.focus();
		return false;		
	}
	
	if(document.Form1.Contactus2_txtComments.value.charAt(0)==' '||document.Form1.Contactus2_txtComments.value=="")
	{  
	    alert("No spaces allowed.");
	    document.Form1.Contactus2_txtComments.focus();
		return false;
    }
	if(document.Form1.Contactus2_txtComments.value.length > 250)
	 {
			alert("Please enter only 250 characters");
			document.Form1.Contactus2_txtComments.focus();
			return false; 
	 }
	 
	if(document.Form1.Contactus2_CodeNumberTextBox.value.charAt(0)==' '||document.Form1.Contactus2_CodeNumberTextBox.value=="")
	{
		alert("Verification code required");
		document.Form1.Contactus2_CodeNumberTextBox.focus();
		return false;
	}
	
	
	
	
	
	
	
	
	/*if(document.Form1.Contactus2_ddlCountry.selectedIndex==".::Please Select::.")
	{
		ErrMsg += "Country required\n";
	}*/
	
	if (ErrMsg=="")
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+ErrMsg);
		return false;
	}
}

function ValidateFaqDetails()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.TextBox2.value.match(emailPat);
	if(document.Form1.TextBox2.value=="")
	{
		alert("Email required");
		document.Form1.TextBox2.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form1.TextBox2.focus();
		return false;
	}
	if(document.Form1.txtArea.value=="")
	{
		alert("Question required");
		document.Form1.txtArea.focus();
		return false;
	}
	return true;
}

function ValidateProfile()
{
	
 	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form2.Profile1_txtEmail.value.match(emailPat);
	if(document.Form2.Profile1_txtFName.value=="")
	{  
		alert("First name required");
		document.Form2.Profile1_txtFName.focus();
		return false;
	}
	if(document.Form2.Profile1_txtFName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Profile1_txtFName.focus();
		return false;
	}
	if(document.Form2.Profile1_txtUserName.value=="")
	{
		alert("User name required");
		document.Form2.Profile1_txtUserName.focus();
		return false;
	}
	if(document.Form2.Profile1_txtUserName.value.charAt(0)==' ')
	{   alert("No spaces allowed.\n");
		document.Form2.Profile1_txtUserName.focus();
		return false; 
    }
	if(document.Form2.Profile1_txtPassword.value=="")
	{
		alert("Password required");
		document.Form2.Profile1_txtPassword.focus();
		return false;
	}
	if(document.Form2.Profile1_txtPassword.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n"); 
		document.Form2.Profile1_txtPassword.focus();
		return false;
	 }
	if(document.Form2.Profile1_txtEmail.value=="")
	{
		alert("Email required");
		document.Form2.Profile1_txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form2.Profile1_txtEmail.focus();
		return false;
	}
	
	if(document.Form2.Profile1_ddlCountry.value==".::Please Select::.")
	{
		alert("Country required");
		return false;
	}
	
	if(document.Form2.Profile1_txtAns.value=="")
	{
		alert("Answer required");
		document.Form2.Profile1_txtAns.focus();
		return false;
	}
	if(document.Form2.Profile1_txtAns.value.charAt(0)==' ')
	{    alert("No spaces allowed.\n");
	document.Form2.Profile1_txtAns.focus(); 
	return false;
	 }
	return true;
	}
	
function loopy() {
		loc = window.location.href
		sPos =loc.lastIndexOf("/")+1;
		if (sPos != -1) loc = loc.substring(0,sPos); // loose existing search
		window.location = loc+'logout.aspx';
	}

function popup(url)
{
	width = 450;
	height = 345;
	xx = window.screen.width;
	yy = window.screen.height;
	xx = (xx/2) - (width/2);
	yy = (yy/2) - (height);
	style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
	newwindow=window.open(url,'name',style);
	if (window.focus) {newwindow.focus()}
}

function HeaderEmailValidation()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray =document.newsletter.m_txtNewsLetter.value.match(emailPat);
	
	if ((document.newsletter.m_txtNewsLetter.value== "") || (document.newsletter.m_txtNewsLetter.value==" "))
	{
		alert("Enter Email address.");
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format.");
		document.newsletter.m_txtNewsLetter.value="";
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
}


function HeaderLoginValidation()
{
	if(document.login.m_txtUserName.value==" ")
	{
		alert("Enter your username.");
		document.login.m_txtUserName.focus();
		return false;
	}
	
	if(document.login.m_txtPassword.value=="")
	{
		alert("Enter your password.");
		document.login.m_txtPassword.focus();
		return false;
	}
	return true;
}

function HeaderSearchValidation()
{
	if(document.Search.m_txtSearch.value==" ")
	{
		alert("Enter search text.");
		document.Search.m_txtSearch.focus();
		return false;
	}
}
function ValidationGuestBook()
{
	
	if(document.Form1.txtFname.value=="")
	{
		alert("Enter First Name.");
		document.Form1.txtFname.focus();
		return false;
	}
    var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray =document.Form1.txtEmail.value.match(emailPat);
	if(document.Form1.txtEmail.value=="")
	{
		alert("Enter Email address.");
		document.Form1.txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format.");
		document.Form1.txtEmail.value="";
		document.Form1.txtEmail.focus();
		return false;
	}
	if(document.Form1.txtComment.value=="")
	{
		alert("Enter Comment.");
		document.Form1.txtComment.focus();
		return false;
	}
	if(document.Form1.txtCode.value=="")
	{
		alert("Enter the verification code.");
		document.Form1.txtCode.focus();
		return false;
	}
	return true;
}
function OrderdetailsValidation()
{

	if(document.Form1.txtSurName.value=="")
	{
		alert("Surname Required.");
		document.Form1.txtSurName.focus();
		return false;
	}
	if(document.Form1.txtForeName.value=="")
	{
		alert("Forename Required.");
		document.Form1.txtForeName.focus();
		return false;
	}
	if(document.Form1.txtTel.value=="")
	{
		alert("Telephone Number Required.");
		document.Form1.txtTel.focus();
		return false;
	}
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray =document.Form1.txtEmail.value.match(emailPat);
	if(document.Form1.txtEmail.value=="")
	{
		alert("Email address Required.");
		document.Form1.txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format.");
		document.Form1.txtEmail.value="";
		document.Form1.txtEmail.focus();
		return false;
	}
	
	if(document.Form1.txtDay.value=="dd")
	{
		alert("Day Required.");
		document.Form1.txtDay.focus();
		return false;
	}
	if(document.Form1.txtDay.value.length < 2)
	{
		alert("Valid Format(dd) Required.");
		document.Form1.txtDay.focus();
		return false;
	}
	//additional validation
	if( parseInt(document.Form1.txtDay.value) < 1 || parseInt(document.Form1.txtDay.value) > 31)
	{
		alert("Valid Day Required.");
		document.Form1.txtDay.focus();
		return false;
	}
	
	if(document.Form1.txtMonth.value=="mm")
	{
		alert("Month Required.");
		document.Form1.txtMonth.focus();
		return false;
	}
	if(parseInt(document.Form1.txtMonth.value) < 1 || parseInt(document.Form1.txtMonth.value) > 12)
	{
		alert("Valid Month Required.");
		document.Form1.txtMonth.focus();
		return false;
	}
	if(document.Form1.txtMonth.value.length < 2)
	{
		alert("Valid Format(mm) Required.");
		document.Form1.txtMonth.focus();
		return false;
	}
	
	if(document.Form1.txtYear.value=="yyyy")
	{
		alert("Year Required.");
		document.Form1.txtYear.focus();
		return false;
	}
	if(document.Form1.txtYear.value.length < 4)
	{
		alert("Valid Format(yyyy) Required.");
		document.Form1.txtYear.focus();
		return false;
	}
	return true;

}
function clearFields()
{

document.Form1.txtSurName.value="";
document.Form1.txtForeName.value="";
document.Form1.txtTel.value="";
document.Form1.txtEmail.value=""
document.Form1.txtAddress.value=""
document.Form1.txtPost.value=""
document.Form1.txtCountry.value=""
document.Form1.txtDay.value="dd"
document.Form1.txtMonth.value="mm"
document.Form1.txtYear.value="yyyy"
document.Form1.txtInstructions.value="Your Menu Selection or special requirements, allergies, non-smoking etc."


return true;
}

function clearTipDay(field)
			{
				if(field.defaultValue == field.value)
				field.value = "";
			}

   function writeTipDay(field)
			{
				if(field.value == "")
				field.value = "dd";
			}	
	function clearTipMonth(field)
	{
		if(field.defaultValue == field.value)
		field.value = "";
	}

   function writeTipMonth(field)
			{
				if(field.value == "")
				field.value = "mm";
			}	
	function clearTipYear(field)
	{
		if(field.defaultValue == field.value)
		field.value = "";
	}

   function writeTipYear(field)
			{
				if(field.value == "")
				field.value = "yyyy";
			}	
function noChars(e)
				{
				var keynum
				var keychar
				var numcheck

				if(window.event) // IE
					{
					keynum = e.keyCode
					}
				else if(e.which) // Netscape/Firefox/Opera
					{
					keynum = e.which
					}
				keychar = String.fromCharCode(keynum)
				numcheck = /\d/
				return numcheck.test(keychar)
				}
function clearTip(field)
			{
				if(field.defaultValue == field.value)
				field.value = "";
			}

   function writeTip(field)
			{
				if(field.value == "")
				field.value = field.defaultValue;
			}					
