function qsearch(id, check){
	if(id.value=='' && check =='w'){
	id.value='Business Name, Type or Keyword';
	}else if(id.value=='' && check =='l'){
	id.value='County, Town, Postcode';
	}
	}
	
function deftxt(inputid){
if(inputid.id == 'what' && inputid.value == 'Business Name, Type or Keyword'){
inputid.value = '';
}
if(inputid.id == 'where' && inputid.value == 'County, Town, Postcode'){
inputid.value = '';
}
}

function showhide(id){

obj = document.getElementById(id);

if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}

}

function nextAd(county, town, location, n)
{
    var now = new Date();
    //var url = '/run/ajax-banner.php?ts=' + now.getTime() + '&county=<?php echo $county; ?>&town=<?php echo $town; ?>&location=<?php echo $location; ?>' ;
	var url = '/run/ajax-banner.php?ts=' + now.getTime() + '&county=' + county + '&town=' + town + '&location=' + location + '&n=' + n;
    makeHttpRequest(url, 'loadBanner', true);
}

 function checkForm()
{
   var cwhat, cwhere;
   with(window.document.search)
   {
      cwhat    = b_what;
      cwhere   = b_where;
   }

   if(trim(cwhat.value) == 'Business Name, Type or Keyword')
   {
	  cwhat.value   = '';
	  return true;
   }
   else
   {
      if(trim(cwhere.value) == 'County, Town, Postcode')
   	  {
      cwhere.value   = '';
	  }else{
	  cwhere.value   = trim(cwhere.value);  
	  }
	  cwhat.value    = trim(cwhat.value);
      return true;
   }
}

function trim(str)
{
   return str.replace(/^\s+|\s+$/g,'');
}