var iCategoryId=0;
function searchTopLevelCat(iCategoryId)
{
  if (typeof(document.getElementById('searchTLCSelected_browseFilters')) !='undefined' && 
      typeof(document.getElementById('searchTLCSelected_browserFilters').value) !='undefined')
  {
    document.getElementById('searchTLCSelected_browseFilters').value= iCategoryId;
    if (typeof(document.browseFilters)!='undefined')
    {
      document.browseFilters.submit();
    }
  }
}
function kaango_openPrintView()
{
    kaango_windowRef = window.open('/fePvListAds','Print_View','status=no,toolbar=no,location=no,menubar=yes,scrollbars=yes,resizable=yes,width=680,height=598');
}
function submitSortBy(sortValue) 
{
  document.getElementById("sortBy").value = sortValue;
  showOptions.submit();
}
function showAddressForm()
{
  document.getElementById('mqShowAddressForm').style.display='none';
  document.getElementById('mqGetUserAddress').style.display='';
  return true;
}
function checkFields(){
  if (document.getElementById('userStreet').value=='' || document.getElementById('userZip').value=='')
  {
    alert('Please Enter Your Street And Zipcode.');
    return false;
  }
  else if (isNaN(document.getElementById('userZip').value) || document.getElementById('userZip').value.length == 0)
  {
    alert('Please Enter A Valid Zipcode.');
    return false;
  }
  else
  {
    return true;
  }
}
function showMapQuestIFrame()
{
  document.getElementById('mapQuestIFrame').style.display='';
  document.getElementById('mapLoading').style.display='none';
  return true;
}

var linkMetric='';
var bCheckRad = false;
function setMet(bCheckRad)
{
 if (bCheckRad) checkRadius();
 linkMetric="ZipSearch";
}
function checkRadius()
{
 if ( document.zipFilters.zipWithin.options[document.zipFilters.zipWithin.selectedIndex].value > 75 )
 {
  document.browseFilters.zipWithin.value = document.zipFilters.zipWithin.options[document.zipFilters.zipWithin.selectedIndex].value;
  document.browseFilters.filterNewspaper[1].checked = true;
  alert( "Expanding your search radius beyond 75 miles will \n\r automatically set your search mode to 'Ads from All Sources'" );
  document.browseFilters.submit();
  return false;
 }
 return true;
}
function lockFilters()
{
 if (typeof(document.getElementById("zip").readonly)!='undefined')
 {
  document.getElementById("zip").readonly = true;
 }
 if (typeof(document.getElementById("zipGo").disabled)!='undefined')
 {
  document.getElementById("zipGo").disabled = true;
 }
 this.document.browseFilters.submit();
}

