
function searchall()
{
     var sdate = document.getElementById("datemenu").value;
     var stype = document.getElementById("showtype").value;
     var mainid = getMainTypeID();
     var mth = getMth();

     location = "showads.php?ClassType=Horse&maintype="+mainid+"&subtype=&sdate="+sdate+"&mth="+mth+"&type="+stype;
}

function getMth()
{
    var stype; 
    //var m = document.all.adstype.length;
    var obj = document.getElementsByName("adstype");
    var m = obj.length;
    var mainid = document.getElementById("mainid").value;   
    
    if ("3" == mainid)
    {
        stype = "5";
    }
    else
    {
        for(var i=0; i<m; i++)
        {
           if(obj[i].checked == true)
           {
              stype = obj[i].value;
           }
        }
    }
    
    return stype;
}

function getMainTypeID()
{
    var mainid = document.getElementById("mainid").value;
    return mainid;
}

function search7()
{       
     var mainid = getMainTypeID();
     var mth = getMth();
     var dt = getDropDownMenuSelectedValue("ddldate");
     var typeid = getDropDownMenuSelectedValue("ddltype");     
  
     //location = "showads.php?ClassType=Horse&maintype="+mainid+"&subtype=&mth="+mth+"&type="+typeid;
     location = "Horse_"+mainid+"_"+mth+"_"+typeid+"_"+dt+".htm";    
}

function search77(typeid)
{       
     var mainid = getMainTypeID();
     var mth = getMth();  
  
     //location = "showads.php?ClassType=Horse&maintype="+mainid+"&subtype=&mth="+mth+"&type="+typeid;
     location = "Horse-"+mainid+"-"+mth+"-"+typeid+".htm";    
}

function searchid()
{
  /*
   var hid = document.hads.horseid.value;
   alert(hid);
   return false;
  */
 var hid = document.hads.horseid.value;
 var v = parseInt(document.hads.horseid.value,10);

 if (/\D+/g.test(v))
 {
         alert("Sorry,you must enter a number!");
         return false;
 }

 location = "showads.php?maintype=id&mth=4&subtype=1&adscatid="+hid;


}

function searchkey()
{
 var key = document.hads.keyword.value;

 if (key == "")
 {
         alert("Sorry,you must enter a keyword!");
         return false;
 }

 var m = document.hads.subtype.length
 for(i=0;i<m;i++)
 {
     if(document.hads.subtype[i].checked == true)
     {
        var stype = document.hads.subtype[i].value
     }
 }

 location = "showads.php?maintype=key&mth="+stype+"&subtype=1&sdate="+key;
}

function searcmenu()
{
    var breed = document.getElementById("breed").value
    var arr = breed.split(':');
    var mth = getMth();

    if ("" == breed)
    {
    alert("Please select a category from\n     the Drop-Down Menu!");return false;
    }

    //location = "Breed_Horse_"+arr[0]+"_"+arr[1]+"_"+mth+".htm";
    location = "Horse_"+arr[0]+"_"+arr[1]+"_"+mth+".htm";  
    //location = breed + "&mth="+mth;
}

function openall(aid)
{
    var mth = getMth();
    var mainid = getMainTypeID();
    //location = "showads.php?ClassType=Horse&maintype="+mainid+"&subtype=1&mth="+mth+"&type=5";
    location = "Horse_"+mainid+"_"+mth+".htm"; 
}