//---- Join Mailing List 
//---- Added by Jini [15-10-2008]
function validForm()
{
	//---------- First Name  ----------
		if ( document.frmjoin.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmjoin.first_name,"Please enter the First Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmjoin.first_name))
   		 {if (!(PrintMesg(document.frmjoin.first_name,"Please enter First Name other than space.")))
    		{return false;}}
		 }
	
	//---------- Last Name  ----------
		if ( document.frmjoin.last_name.value == ""  )
  		 {if (!(PrintMesg(document.frmjoin.last_name,"Please enter the Last Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmjoin.last_name))
   		 {if (!(PrintMesg(document.frmjoin.last_name,"Please enter Last Name other than space.")))
    		{return false;}}
		 }

	//----------  Phone  ----------	
	if ( document.frmjoin.phoneno.value == ""  )
 {if (!(PrintMesg(document.frmjoin.phoneno,"Please enter the Phone Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmjoin.phoneno))
   		 {if (!(PrintMesg(document.frmjoin.phoneno,"Please enter Phone Number other than space.")))
    		{return false;}}
		 }	

	//----------  Post Code  ----------	
	if ( document.frmenquiry.postcode.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.postcode,"Please enter your postcode.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.postcode))
   		 {if (!(PrintMesg(document.frmenquiry.postcode,"Please enter your postcode other than space.")))
    		{return false;}}
		 }	
	
	//----------  Mobile Phone  ----------	
	if (! document.frmjoin.mobileno.value == ""  )
  		 {if (isNaN(document.frmjoin.mobileno.value))
   			{
				alert("Please enter a number");
				document.frmjoin.mobileno.focus()
				return false;
		}}	
	


	//----------  Email  ----------
		
	mail = document.frmjoin.submit_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmjoin.submit_by,"Please enter Email address")))
    {return false;}}
 	else 
	{ 

  		 n = mail.indexOf("@")
   		if (n >= 0)
   		{ newstr = mail.substring(n)
	 	  n= newstr.indexOf(".")
	 	  if (n<0)
	    	{if (!(PrintMesg(document.frmjoin.submit_by,"Please Enter a valid E-mail Address")))
	    	{return false;}}
   		} 
   		else
    	{if (!(PrintMesg(document.frmjoin.submit_by,"Please Enter a valid E-mail Address")))
    	{return false;}}}	
	
	//---------- Post Code  ----------
		if ( document.frmjoin.postcode.value == ""  )
  		 {if (!(PrintMesg(document.frmjoin.postcode,"Please enter the Post Code.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmjoin.postcode))
   		 {if (!(PrintMesg(document.frmjoin.postcode,"Please enter Post Code other than space.")))
    		{return false;}}
		 }
		return true;
}
//------- Here ends

//-----General Enquiry Form --------------//
function validateBookNow()
{

		//---------- date  ----------
		if ( document.frmenquiry.date.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.date,"Please enter the required date.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.date))
   		 {if (!(PrintMesg(document.frmenquiry.date,"Please enter date other than space.")))
    		{return false;}}
		 }

		if ( document.frmenquiry.time.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.time,"Please enter the required time.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.time))
   		 {if (!(PrintMesg(document.frmenquiry.time,"Please enter time other than space.")))
    		{return false;}}
		 }

		if ( document.frmenquiry.nop.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.nop,"Please enter the no. of people.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.nop))
   		 {if (!(PrintMesg(document.frmenquiry.nop,"Please enter no. of people other than space.")))
    		{return false;}}

		if ( isNaN(document.frmenquiry.nop.value) )
  		 {if (!(PrintMesg(document.frmenquiry.nop,"Please enter a numeric value.")))
   			{return false;}}
   	      }

		//---------- Name  ----------
		if ( document.frmenquiry.name.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.name,"Please enter the Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.name))
   		 {if (!(PrintMesg(document.frmenquiry.name,"Please enter Name other than space.")))
    		{return false;}}
		 }


		 //---------- TelePhone  ----------
		if ( document.frmenquiry.cno.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.cno,"Please enter Telephone Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.cno))
   		 {if (!(PrintMesg(document.frmenquiry.cno,"Please Telephone Number other than space.")))
    		{return false;}}
		 }


		//--------e-mail
	mail = ""
	mail = document.frmenquiry.email.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmenquiry.email,"Please enter E-mail Address.")))
    {return false;}}
	 else { 
   	n = mail.indexOf("@")
   	if (n >= 0)
   	{ newstr = mail.substring(n)
	 n= newstr.indexOf(".")
	 if (n<0)
	    {if (!(PrintMesg(document.frmenquiry.email,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmenquiry.email,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}

	//---------- How did you hear about Botany Bay? 
	
		if ( document.frmenquiry.specify.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.specify,"Please enter 'How did you hear about Botany Bay?'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.specify))
   		 {if (!(PrintMesg(document.frmenquiry.specify,"Please enter 'How did you hear about Botany Bay?'")))
    		{return false;}}
		 }
	
		return true;
}
//==============================

function validateEnquiry()
	{

		//---------- FName  ----------
		if ( document.frmenquiry.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.first_name,"Please enter the First Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.first_name))
   		 {if (!(PrintMesg(document.frmenquiry.first_name,"Please enter First Name other than space.")))
    		{return false;}}
		 }

		//---------- LName  ----------
		if ( document.frmenquiry.last_name.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.last_name,"Please enter the Last Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.last_name))
   		 {if (!(PrintMesg(document.frmenquiry.last_name,"Please enter Last Name other than space.")))
    		{return false;}}
		 }

		 //---------- TelePhone  ----------
		if ( document.frmenquiry.phoneno.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.phoneno,"Please enter Telephone Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.phoneno))
   		 {if (!(PrintMesg(document.frmenquiry.phoneno,"Please Telephone Number other than space.")))
    		{return false;}}
		 }

		//---------- postcode  ----------
		if ( document.frmenquiry.postcode.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.postcode,"Please enter your postcode.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.postcode))
   		 {if (!(PrintMesg(document.frmenquiry.postcode,"Please enter your postcode other than space.")))
    		{return false;}}
		 }

		/*//---------- Req. date----------
		if ( document.frmenquiry.rdate.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.rdate,"Please enter the required Date.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.rdate))
   		 {if (!(PrintMesg(document.frmenquiry.rdate,"Please enter Date other than space.")))
    		{return false;}}
		 }
		//---------- no. of people ----------
		if ( document.frmenquiry.nopeople.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.nopeople,"Please enter No. of people.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.nopeople))
   		 {if (!(PrintMesg(document.frmenquiry.nopeople,"Please No. of people other than space.")))
    		{return false;}}

		if ( isNaN(document.frmenquiry.nopeople.value) )
  		 {if (!(PrintMesg(document.frmenquiry.nopeople,"Please enter a numeric value")))
   			{return false;}}

		 }*/



 
		//--------e-mail
	mail = ""
	mail = document.frmenquiry.submit_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmenquiry.submit_by,"Please enter E-mail Address.")))
    {return false;}}
	 else { 
   	n = mail.indexOf("@")
   	if (n >= 0)
   	{ newstr = mail.substring(n)
	 n= newstr.indexOf(".")
	 if (n<0)
	    {if (!(PrintMesg(document.frmenquiry.submit_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmenquiry.submit_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}

	//---------- Please specify your enquiry
	
		if ( document.frmenquiry.specify.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.specify,"Please enter 'Please specify your enquiry'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.specify))
   		 {if (!(PrintMesg(document.frmenquiry.specify,"Please enter 'Please enter 'Please specify your enquiry")))
    		{return false;}}
		 }

	//---------- How did you hear about Botany Bay? 
		if ( document.frmenquiry.hear.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.hear,"Please enter 'How did you hear about Joe’s Fresh Poultry?'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.hear))
   		 {if (!(PrintMesg(document.frmenquiry.hear,"Please enter 'How did you hear about Joe’s Fresh Poultry?'")))
    		{return false;}}
		 }

	
		return true;
	}




//prints messages
function PrintMesg(ctrlvar,mesg)
{ alert(mesg); ctrlvar.focus(); return false }

// function to check spaces
function SpaceChk(ctrlvar)
{
   chkstr     = ctrlvar.value
   stlength   = chkstr.length
   spacecount = 0
   if (stlength >0)  {
    for(i=0;i<=stlength;i++)
     if ( chkstr.charAt(i)==" ") { spacecount=spacecount+1  }
    if (stlength == spacecount) { return false }
   return true }
}

//---------------popup 04-06-2008

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=635,height=530,scrollbars=Yes');
return false;
}


//---------------


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;
}

function popvideo(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=435,height=370,scrollbars=No');
return false;
}

