<!-- Hide from old browsers--

function QuoteFormIsOk(form)
	{r = false
	if(!IsEmpty(form.Operator.value, 'the name of the tour operator'))
	   {if(!IsEmpty(form.Resort.value, 'resort'))
	      {if(NameIsOk(form.SendersName.value))
	         {if(ContactNosAreOk(form))
	           {if(EMailIsOk(form.EmailAddress.value))
		       {if(PartyIsOk(form, true))
		          {if(DateIsOk(form.DepartureDate.value, 'the departure date (dd/mm/yy)'))
		                {if(IsANumber(form.Duration.value, 'the duration'))
			           {if(PriceIsOk(form.QuotedPrice.value, 'the TOTAL price you have been quoted')) r=true
				   }
				}
			  }
		       }
		    }
		 }
	      }
	    }
	return r
	}


function EnquiryFormIsOk(form)
	{r = false
	if(NameIsOk(form.SendersName.value))
	   {if(ContactNosAreOk(form))
	      {if(EMailIsOk(form.EMailAddress.value))
		{if(PartyIsOk(form, false))
		  {if(DateIsOk(form.DepartDateMin.value, 'your earliest possible departure date (dd/mm/yy)'))
		     {if(DateIsOk(form.DepartDateMax.value, 'your latest possible departure date (dd/mm/yy)'))
		         {if(IsANumber(form.DurationMin.value, 'the minimum required duration'))
		            {if(IsANumber(form.DurationMax.value, 'the maximum required duration'))
		              {if(PriceIsOk(form.Budget.value, 'your maximum budget')) r=true
			      }
		            }
			 }
		     }
		  }
	        }
	      }
	    }
	return r
	}


function NameIsOk(SourceStr)
	{rn=true

	if(IsEmpty(SourceStr, 'your name')) rn=false
		
	else if(!ContentIsValid(SourceStr, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-.'", 'your name')) rn=false

	else if(SourceStr.length < 6)
		{alert('Please enter more characters of your name')
		rn=false
		}

	return rn
	}


function PartyIsOk(SourceForm, AgesRequired)
	{rn=true

	if(IsEmpty(SourceForm.NoAdults.value, 'the number of adults')) rn=false

	else if(!ContentIsValid (SourceForm.NoAdults.value, '0123456789', 'the number of adults')) rn=false

	else if(IsEmpty(SourceForm.NoChildren, "the number of children or '0'")) rn=false

	else if(!ContentIsValid(SourceForm.NoChildren.value, '0123456789', "the number of children or '0'")) rn=false

	else if(IsEmpty(SourceForm.NoInfants.value, "the number of infants or '0'")) rn=false

	else if(!ContentIsValid(SourceForm.NoInfants.value, '0123456789', "the number of infants or '0'")) rn=false

	else if((SourceForm.NoAdults.value < 1) && (SourceForm.NoChildren.value < 1) && (SourceForm.NoInfants.value < 1))
		{alert('You cannot have 0 adults,  0 chldren and 0 infants')
		rn=false
		}

	else if(AgesRequired)
		{if((SourceForm.NoChildren.value > 0) && (SourceForm.ChildrenAges.value==""))
			{alert("Please enter children's ages")
			rn=false
			}
		}
	return rn
	}


function PriceIsOk(SourceStr, MessageStr)
	{rtn=true

	if (IsEmpty(SourceStr, MessageStr)) rtn=false

	else if(!ContentIsValid(SourceStr, '0123456789 £$.', MessageStr)) rtn=false

	return rtn
	}


function ContactNosAreOk(SourceForm)
	{rn = false
	if ((SourceForm.DayTelephone.value=="") && (SourceForm.EveningTelephone.value=="") && (SourceForm.FaxNumber.value==""))
		{alert('Please enter a telephone or fax number (including dialling code)')
		}
	else if(TelNoIsOk(SourceForm.DayTelephone.value, 'your daytime telephone' ))
		{if(TelNoIsOk(SourceForm.EveningTelephone.value, 'your evening telephone'))
			{if(TelNoIsOk(SourceForm.FaxNumber.value, 'your fax')) rn=true
			}
		}
	return rn
	}


function TelNoIsOk(SourceStr, MessageStr)
	{rtn=true
	if(SourceStr!="")
		{if(SourceStr.length < 10)
			{alert('Please ensure that your ' + MessageStr + ' number is correct (including dialling code)')
			rtn=false
			}
		else if(!ContentIsValid(SourceStr, '() 1234567890-', 'your ' + MessageStr + ' number (including dialling code)')) rtn=false
		}

	return rtn
	}


function DateIsOk(SourceStr, MessageStr)
	{rn=true

	if(IsEmpty(SourceStr, MessageStr)) rn=false

	else if((SourceStr.length < 6)||(SourceStr.length >8))
		{alert('Please ensure that ' + MessageStr + ' is correct')
		rn=false
		}
	else if(!ContentIsValid(SourceStr, '1234567890-/.', MessageStr)) rn=false

	return rn
	}


function EMailIsOk(SauceStr)
	{re=true
	if (IsEmpty(SauceStr, 'your email address')) re=false

	else if(SauceStr.length < 8)
		{alert('Please ensure that your email address is correct')
		re=false
		}
	else if(!AtIsOK(SauceStr))
		{re=false
		}
	else if(!DotIsOK(SauceStr))
		{re=false
		}
	else if(!ContentIsValid(SauceStr, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.@", 'your email address'))
		{re=false
		}
	return re
	}


function IsEmpty(SourceStr, MessageStr)
	{rtn=false
	if (SourceStr=="")
		{alert('Please enter ' + MessageStr)
		rtn=true
		}
	return rtn
	}


function ContentIsValid(SourceStr, AllowedStr, MessageStr)
	{rtn=true
	for (var i = 0; i < SourceStr.length; i++)
		{ch = SourceStr.substring(i, i + 1)
		if(AllowedStr.indexOf (ch)==-1)
			{alert('Please ensure that ' + MessageStr + ' is correct')
			rtn=false
			break
			}
		}
	return rtn
	}


function IsANumber(SourceStr, MessageStr)
	{rtn=true
	if (IsEmpty(SourceStr, MessageStr)) rtn=false

	else if (!ContentIsValid(SourceStr, '0123456789', MessageStr)) rtn=false

	return rtn
	}

function AtIsOK(SourceStr)
	{rtn=true
	Position=SourceStr.indexOf('@',0)
	if(Position<2)
		{alert('Please ensure that your email address is correct')
		rtn=false
		}
	else if (Position>(SourceStr.length-6))
		{alert('Please ensure that your email address is correct')
		rtn=false
		}
	return rtn
	}

function DotIsOK(SourceStr)
	{rtn=true
	Position=SourceStr.lastIndexOf(".")
	if (Position<1)
		{alert('please ensure that your email address is correct')
		rtn=false
		}
	else if (Position>(SourceStr.length-3))
		{alert('please ensure that your email address is correct')
		rtn=false
		}
	else if (Position<(SourceStr.length-5))
		{alert('please ensure that your email address is correct')
		rtn=false
		}
	return rtn
	}

//------------------>
