function CheckSearch() {
   if(document.f1.what.value=="")
   {
      window.alert('Enter the search criteria, please!');
      document.f1.what.focus();
      return false;
   }
}
function CheckFriend() {
   if(document.sfriend.f1.value=="")
   {
      window.alert('Enter your email address!');
      document.sfriend.f1.focus();
      return false;
   }
   if(document.sfriend.f2.value=="")
   {
      window.alert('Enter your friend email address!');
      document.sfriend.f2.focus();
      return false;
   }
}
function CheckLogin() {
   if(document.lform.us.value=="")
   {
      window.alert('Enter your username, please!');
      document.lform.us.focus();
      return false;
   }
   if(document.lform.ps.value=="")
   {
      window.alert('Enter your password, please!');
      document.lform.ps.focus();
      return false;
   }
}
function CheckForgot() {
   if(document.ForgotForm.u2.value=="")
   {
      window.alert('Enter your username, please!');
      document.ForgotForm.u2.focus();
      return false;
   }
}
function CheckRegister() {
   if(document.RegForm.NewUsername.value=="")
   {
      window.alert('Enter your username, please!');
      document.RegForm.NewUsername.focus();
      return false;
   }
   if(document.RegForm.p1.value=="")
   {
      window.alert('Enter your password, please!');
      document.RegForm.p1.focus();
      return false;
   }
   if(document.RegForm.p2.value=="")
   {
      window.alert('Confirm your password, please!');
      document.RegForm.p2.focus();
      return false;
   }
   if(document.RegForm.p1.value != "" && document.RegForm.p2.value != "" && document.RegForm.p1.value != document.RegForm.p2.value)
   {
      window.alert('Enter and confirm your password again!');
      document.RegForm.p1.value="";
      document.RegForm.p2.value="";
      document.RegForm.p1.focus();
      return false;
   }
   
   if (document.RegForm.CompanyName)
   if(document.RegForm.CompanyName.value=="")
   {
      window.alert('Enter your company name, please!');
      document.RegForm.CompanyName.focus();
      return false;
   }
   if(document.getElementById('select-category').value == '')
   {
      window.alert('Select your business category, please!');
      document.getElementById('select-category').focus();
      return false;
   }
   if(document.RegForm.FirstName.value=="")
   {
      window.alert('Enter your First Name, please!');
      document.RegForm.FirstName.focus();
      return false;
   }
   if(document.RegForm.LastName.value=="")
   {
      window.alert('Enter your Last Name, please!');
      document.RegForm.LastName.focus();
      return false;
   }
   if(document.RegForm.address.value=="")
   {
      alert('Enter your address, please!');
      document.RegForm.address.focus();
      return false;
   }
   if(document.RegForm.city.value=="")
   {
      alert('Enter your city, please!');
      document.RegForm.city.focus();
      return false;
   }
   if(document.RegForm.state.value=="")
   {
      alert('Enter your state, please!');
      document.RegForm.state.focus();
      return false;
   }
   if(document.RegForm.country.value=="")
   {
      alert('Select your country, please!');
      document.RegForm.country.focus();
      return false;
   }
   if(document.RegForm.phone.value=="")
   {
      window.alert('Enter your Phone, please!');
      document.RegForm.phone.focus();
      return false;
   }
   if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.RegForm.email.value))
   {
      return true;
   }
   alert("Invalid E-mail Address! Please re-enter.");
   document.RegForm.email.focus();
   return false;
}
function CheckProfile() {
   if (document.RegForm.CompanyName) 
   if(document.RegForm.CompanyName.value=="")
   {
      window.alert('Enter your Ad Title, please!');
      document.RegForm.CompanyName.focus();
      return false;
   }
   if (document.RegForm.ItemPrice)
   if(document.RegForm.ItemPrice.value=="")
   {
      window.alert('Enter price, please!');
      document.RegForm.ItemPrice.focus();
      return false;
   }
   if(document.getElementById('select-category').value=="")
   {
      window.alert('Confirm your Category, please!');
      return false;
   }
}
function CheckOffer() {
   if(document.PostForm.CategoryID.value=="")
   {
      alert('Select the category in which your offer will appear!');
      document.PostForm.CategoryID.focus();
      return false;
   }
   if(document.PostForm.year.value=="")
   {
      alert('Select the vehicle year, please!');
      document.PostForm.year.focus();
      return false;
   }
   if(document.PostForm.SelectMake.value=="")
   {
      alert('Select the vehicle make, please!');
      document.PostForm.SelectMake.focus();
      return false;
   }
   if(document.PostForm.VehicleModel.value=="")
   {
      alert('Enter the vehicle model, please!');
      document.PostForm.VehicleModel.focus();
      return false;
   }
   if(document.PostForm.VehicleColor.value=="")
   {
      alert('Enter the vehicle color, please!');
      document.PostForm.VehicleColor.focus();
      return false;
   }
   if(document.PostForm.mileage.value=="")
   {
      alert('Enter the vehicle mileage, please!');
      document.PostForm.mileage.focus();
      return false;
   }
   if(document.PostForm.DetailedDesc.value=="")
   {
      alert('Describe your vehicle in details, please!');
      document.PostForm.DetailedDesc.focus();
      return false;
   }
   if(document.PostForm.Price.value=="")
   {
      alert('Enter the price, please!');
      document.PostForm.Price.focus();
      return false;
   }
}
//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="/search.php?c=22">Caravans for sale</a>'
menu1[1]='<a href="/search.php?c=23">Motorhomes for sale</a>'
menu1[2]='<a href="/search.php?c=24">Boats for sale</a>'
menu1[3]='<a href="/search.php?c=25">Towcars for sale</a>'
menu1[4]='<a href="/search.php?c=26">Accessories for sale</a>'
menu1[5]='<a href="/search.php?c=33">Caravan Sites</a>'
menu1[6]='<a href="/search.php?c=34">Marina/Launch Sites</a>'
//Contents for menu 2
var menu2=new Array()
menu2[0]='<a href="/login.php">Login</a>'
menu2[1]='<a href="/addlisting.php">Caravans</a>'
menu2[2]='<a href="/addlisting.php">Motorhomes</a>'
menu2[3]='<a href="/addlisting.php">Boats</a>'
menu2[4]='<a href="/addlisting.php">Towcars</a>'
menu2[5]='<a href="/addlisting.php">Accessories</a>'
menu2[6]='<a href="/addlisting.php">Caravan Sites</a>'
menu2[7]='<a href="/addlisting.php">Marina/Launch Sites</a>'
//Contents for menu 3
var menu3=new Array()
menu3[0]='<a href="/addlisting.php">Place an Advert</a>'
menu3[1]='<a href="/search.php?c=27">Statics for rent</a>'
menu3[2]='<a href="/search.php?c=28">Motorhomes for rent</a>'
menu3[3]='<a href="/search.php?c=32">Holiday Homes for rent</a>'
menu3[4]='<a href="/search.php?c=29">Boats for rent</a>'
//Contents for menu 4
var menu4=new Array()
menu4[0]='<a href="news.php">News &amp; Updates</a>'
menu4[1]='<a href="aboutus.php">About Us</a>'
menu4[2]='<a href="caravansites.php">Caravan Sites</a>'
menu4[3]='<a href="insurance.php">Insurance</a>'
menu4[4]='<a href="finance.php">Finance</a>'
menu4[5]='<a href="hpicheck.php">HPI Check</a>'
menu4[6]='<a href="usedprices.php">Used Prices</a>'
menu4[7]='<a href="marinas.php">Marinas/Launch sites</a>'
menu4[8]='<a href="towingadvice.php">Towing Advice</a>'
menu4[9]='<a href="contactus.php">Contact Us</a>'
menu4[10]='<a href="dealers.php">Dealers</a>'
menu4[11]='<a href="testimonials.php">Testimonials</a>'
menu4[12]='<a href="feedback.php">Feedback</a>'
menu4[13]='<a href="termsandconditions.php">Terms and Conditions</a>'
menu4[14]='<a href="privacypolicy.php">Privacy Policy</a>'
menu4[15]='<a href="cookiepolicy.php">Cookie Policy</a>'
menu4[16]='<a href="links.php">Links</a>'
var menuwidth='165px'
var menubgcolor='#4ba0d6'
var disappeardelay=250
var hidemenu_onclick="yes"
var ie4=document.all
var ns6=document.getElementById&&!document.all
if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}
function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}
function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}
function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}
function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}
function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
if (hidemenu_onclick=="yes")
document.onclick=hidemenu
function buy1feature()
{
  if (id = document.getElementById('buy_fad'))
  {
    id.innerHTML = '&nbsp;<input type="text" name="count" value="1" size="4" id="buy_fad_count"> <input type="button" value="buy" onclick="buy_fad()">';
  }
}
function buy_fad()
{
  if (id = document.getElementById('buy_fad_count'))
  {
    window.location.href = 'buy1feature.php?&count=' + id.value;
  }
}
