

//-----Place Order Form --------------//
function validateplaceorder()
	{

		//---------- FName  ----------
		if ( document.frmplaceorder.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.first_name,"Please enter the First Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.first_name))
   		 {if (!(PrintMesg(document.frmplaceorder.first_name,"Please enter First Name other than space.")))
    		{return false;}}
		 }

		//---------- LName  ----------
		if ( document.frmplaceorder.last_name.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.last_name,"Please enter the Last Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.last_name))
   		 {if (!(PrintMesg(document.frmplaceorder.last_name,"Please enter Last Name other than space.")))
    		{return false;}}
		 }

			//---------- business name  ----------
		if ( document.frmplaceorder.business_name.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.business_name,"Please enter the Business Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.business_name))
   		 {if (!(PrintMesg(document.frmplaceorder.business_name,"Please enter Business Name other than space.")))
    		{return false;}}
		 }


		 //---------- TelePhone  ----------
		if ( document.frmplaceorder.telephone.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.telephone,"Please enter Telephone Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.telephone))
   		 {if (!(PrintMesg(document.frmplaceorder.telephone,"Please Telephone Number other than space.")))
    		{return false;}}
		 }

			 //---------- Mobile  ----------
		if ( document.frmplaceorder.mobile.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.mobile,"Please enter Mobile Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.mobile))
   		 {if (!(PrintMesg(document.frmplaceorder.mobile,"Please Mobile Number other than space.")))
    		{return false;}}
		 }

				 //----------Address  ----------
		if ( document.frmplaceorder.address.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.address,"Please enter Address.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.address))
   		 {if (!(PrintMesg(document.frmplaceorder.address,"Please Address other than space.")))
    		{return false;}}
		 }

		

//---------- postcode  ----------
		if ( document.frmplaceorder.postcode.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.postcode,"Please enter your postcode.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.postcode))
   		 {if (!(PrintMesg(document.frmplaceorder.postcode,"Please enter your postcode other than space.")))
    		{return false;}}
		 }

 
		//--------e-mail
	mail = ""
	mail = document.frmplaceorder.submit_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmplaceorder.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.frmplaceorder.submit_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmplaceorder.submit_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}

//---------- Please specify your order
	
		if ( document.frmplaceorder.specify.value == ""  )
  		 {if (!(PrintMesg(document.frmplaceorder.specify,"Please enter 'Please specify your order'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmplaceorder.specify))
   		 {if (!(PrintMesg(document.frmplaceorder.specify,"Please enter 'Please specify your order'")))
    		{return false;}}
		 }

	

	
	
		return true;
	}


//-----Custom Order Form --------------//

function validatecustomorder()
	{

		//---------- FName  ----------
		if ( document.frmcustomorder.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmcustomorder.first_name,"Please enter the First Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmcustomorder.first_name))
   		 {if (!(PrintMesg(document.frmcustomorder.first_name,"Please enter First Name other than space.")))
    		{return false;}}
		 }

		//---------- LName  ----------
		if ( document.frmcustomorder.last_name.value == ""  )
  		 {if (!(PrintMesg(document.frmcustomorder.last_name,"Please enter the Last Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmcustomorder.last_name))
   		 {if (!(PrintMesg(document.frmcustomorder.last_name,"Please enter Last Name other than space.")))
    		{return false;}}
		 }

			

		 //---------- TelePhone  ----------
		if ( document.frmcustomorder.telephone.value == ""  )
  		 {if (!(PrintMesg(document.frmcustomorder.telephone,"Please enter Telephone Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmcustomorder.telephone))
   		 {if (!(PrintMesg(document.frmcustomorder.telephone,"Please Telephone Number other than space.")))
    		{return false;}}
		 }



				

		

	//---------- postcode  ----------
		if ( document.frmcustomorder.postcode.value == ""  )
  		 {if (!(PrintMesg(document.frmcustomorder.postcode,"Please enter your postcode.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmcustomorder.postcode))
   		 {if (!(PrintMesg(document.frmcustomorder.postcode,"Please enter your postcode other than space.")))
    		{return false;}}
		 }

 	//--------e-mail
	mail = ""
	mail = document.frmcustomorder.submitco_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmcustomorder.submitco_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.frmcustomorder.submitco_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmcustomorder.submitco_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}

	//---------- Order Requirements
	
		if ( document.frmcustomorder.order_required.value == ""  )
  		 {if (!(PrintMesg(document.frmcustomorder.order_required,"Please enter 'Please specify order requirements'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmcustomorder.order_required))
   		 {if (!(PrintMesg(document.frmcustomorder.order_required,"Please enter 'Please specify order requirements'")))
    		{return false;}}
		 }

	


//---------- How did you hear about YCC Poultry
	
		if ( document.frmcustomorder.hear_yccpoultry == ""  )
  		 {if (!(PrintMesg(document.frmcustomorder.hear_yccpoultry,"Please enter 'How did you hear about YCC Poultry?'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmcustomorder.hear_yccpoultry))
   		 {if (!(PrintMesg(document.frmcustomorder.hear_yccpoultry,"How did you hear about YCC Poultry?'")))
    		{return false;}}
		 }

	
	
		return true;
	}


//-----General Enquiry Form --------------//

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;}}
		 }

			//---------- business name  ----------
		if ( document.frmenquiry.business_name.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.business_name,"Please enter the Business Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.business_name))
   		 {if (!(PrintMesg(document.frmenquiry.business_name,"Please enter Business Name other than space.")))
    		{return false;}}
		 }


		 //---------- TelePhone  ----------
		if ( document.frmenquiry.telephone.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.telephone,"Please enter Telephone Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.telephone))
   		 {if (!(PrintMesg(document.frmenquiry.telephone,"Please Telephone Number other than space.")))
    		{return false;}}
		 }

			 //---------- Mobile  ----------
		if ( document.frmenquiry.mobile.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.mobile,"Please enter Mobile Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.mobile))
   		 {if (!(PrintMesg(document.frmenquiry.mobile,"Please Mobile 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;}}
		 }

 
		//--------e-mail
	mail = ""
	mail = document.frmenquiry.submitenq_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmenquiry.submitenq_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.submitenq_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmenquiry.submitenq_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}

	//---------- How did you hear about YCC Poultry? 
	
		if ( document.frmenquiry.hear_ycc.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.hear_ycc,"Please enter 'How did you hear about YCC Poultry?'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.hear_ycc))
   		 {if (!(PrintMesg(document.frmenquiry.hear_ycc,"Please enter 'How did you hear about YCC Poultry?'")))
    		{return false;}}
		 }

	

	//---------- Please specify your enquiry
	
		if ( document.frmenquiry.specify_enquiry.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiry.specify_enquiry,"Please enter 'Please specify your enquiry'")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiry.specify_enquiry))
   		 {if (!(PrintMesg(document.frmenquiry.specify_enquiry,"Please enter 'Please enter 'Please specify your enquiry")))
    		{return false;}}
		 }
	
		return true;
	}


//-----Account Application/ Become a customer --------------//
function validateaccountappl()
	{

		//---------- FName  ----------
		if ( document.frmaccountappl.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.first_name,"Please enter the First Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.first_name))
   		 {if (!(PrintMesg(document.frmaccountappl.first_name,"Please enter First Name other than space.")))
    		{return false;}}
		 }

		//---------- LName  ----------
		if ( document.frmaccountappl.last_name.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.last_name,"Please enter the Last Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.last_name))
   		 {if (!(PrintMesg(document.frmaccountappl.last_name,"Please enter Last Name other than space.")))
    		{return false;}}
		 }

			//---------- business name  ----------
		if ( document.frmaccountappl.business_name.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.business_name,"Please enter the Business Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.business_name))
   		 {if (!(PrintMesg(document.frmaccountappl.business_name,"Please enter Business Name other than space.")))
    		{return false;}}
		 }


		 //---------- TelePhone  ----------
		if ( document.frmaccountappl.telephone.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.telephone,"Please enter Telephone Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.telephone))
   		 {if (!(PrintMesg(document.frmaccountappl.telephone,"Please Telephone Number other than space.")))
    		{return false;}}
		 }

			 //---------- Mobile  ----------
		if ( document.frmaccountappl.mobile.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.mobile,"Please enter Mobile Number.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.mobile))
   		 {if (!(PrintMesg(document.frmaccountappl.mobile,"Please Mobile Number other than space.")))
    		{return false;}}
		 }
	 	

	//---------- postcode  ----------
		if ( document.frmaccountappl.postcode.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.postcode,"Please enter your postcode.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.postcode))
   		 {if (!(PrintMesg(document.frmaccountappl.postcode,"Please enter your postcode other than space.")))
    		{return false;}}
		 }

 
		//--------e-mail
	mail = ""
	mail = document.frmaccountappl.submitac_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmaccountappl.submitac_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.frmaccountappl.submitac_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmaccountappl.submitac_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}


	//---------- A.B.N  ----------
		if ( document.frmaccountappl.abn.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.abn,"Please enter your A.B.N.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.abn))
   		 {if (!(PrintMesg(document.frmaccountappl.abn,"Please enter your A.B.N other than space.")))
    		{return false;}}
		 }

//---------- How did you hear about YCC Poultry? 
	
		if ( document.frmaccountappl.hear_ycc.value == ""  )
  		 {if (!(PrintMesg(document.frmaccountappl.hear_ycc,"Please enter 'How did you hear about YCC Poultry? '")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmaccountappl.hear_ycc))
   		 {if (!(PrintMesg(document.frmaccountappl.hear_ycc,"Please enter 'How did you hear about YCC 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;
}


//---------------


