
function getMth()
{
    var stype = ""; 
    var obj = document.getElementsByName("adstype");
   
    if (obj)
    {
        var m = obj.length;         
         var maintypeid = getMainTypeID();
       
         if (14 != maintypeid && 15 != maintypeid)
         {        
            for(var i=0; i<m; i++)
            {
               if(obj[i].checked == true)
               {
                  stype = obj[i].value;
               }
            }
        }
        else
        {
            stype = 5;
        }
      
        return stype;
    }
    else
    {
        return "";
    }
}

function getMainTypeID()
{
    var mainid = document.getElementById("mainid").value;
    return mainid;
}
/*
function search7(typeid)
{       
     var mainid = getMainTypeID();
     var mth = getMth();

     location = "showads.php?ClassType=Other&maintype="+mainid+"&subtype="+mainid+"&mth="+mth+"&type="+typeid;
}
   */
function search7()
{       
     var mainid = getMainTypeID();
     var mth = getMth();
     var dt = getDropDownMenuSelectedValue("ddldate");
     var typeid = getDropDownMenuSelectedValue("ddltype");     
  
     //location = "showads.php?ClassType=Other&maintype="+mainid+"&subtype=&mth="+mth+"&type="+typeid;
     location = "Other_"+mainid+"_"+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 = "Other-"+mainid+"-"+mth+"-"+typeid+".htm";    
}

function searchall()
{
     var sdate = document.getElementById("datemenu").value;
     var stype = document.getElementById("showtype").value;
     var mainid = getMainTypeID();
     var mth = getMth();

     location = "showads.php?ClassType=Other&maintype="+mainid+"&subtype=0&sdate="+sdate+"&mth="+mth+"&type="+stype;
}

function searchid()
{
 var hid = document.oads.horseid.value;
 var v = parseInt(document.oads.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=0&adscatid="+hid;

}

function searchkey()
{
 var key = document.oads.keyword.value;
 var catid = document.oads.maintype.value

 if (key == "")
 {
         alert("Sorry,you must enter a keyword!");
         return false;
 }

 var m = document.oads.subtype.length
 for(i=0;i<m;i++)
 {
     if(document.oads.subtype[i].checked == true)
     {
        var adstype = document.oads.subtype[i].value
     }
 }
 location = "showads.php?adscatid="+catid+"&maintype=key&mth="+adstype+"&subtype=0&sdate="+key;
}

function searcmenu(id)
{

 var m = document.oads.subtype.length
 for(i=0;i<m;i++)
 {
     if(document.oads.subtype[i].checked == true)
     {
        var stype = document.oads.subtype[i].value
     }
 }

 location = id+"&mth="+stype;

}

function clickMenu(mainid, subid)
{      
    try{ 
        if(arguments[2] == undefined)
        { 
            var mymth = getMth();
        }
        else
        {       
            var mymth = arguments[2]; 
        }

        //location = strLine+"&mth="+mymth;
        //location = ClassType=Other&maintype=7&subtype=141&mth=1
        location = "Other_"+mainid+"_"+subid+"_"+mymth+".htm";  
    }
    catch(e)
    {
        //alert(e);
    }
}

function viewcat(mid,bid,typeid,mth)
{
    try
    {
         var mymth = "";
         var typeval = "";
         var mthval = "";
         
         if (mth == "5")
         {
            mymth = mth;
         }
         else
         {
             var getmth = getMth();
             mymth = (getmth=="") ? mth : getmth;
         }
         
         if (typeid == "5")
         {
            //typeval = "&type=" + typeid + "";   
            location = "Other_"+mid+"_"+bid+"_"+mymth+"_"+typeid+".htm";  
         }
         else
         {
            location = "Other_"+mid+"_"+bid+"_"+mymth+".htm";  
         }
              
         //location = "showads.php?ClassType=Other&maintype="+mid+"&subtype="+bid+"&mth=" + mymth+typeval;   

    }     
    catch(e)     
    {
        //alert(e);
    }
}

function openall()
{
    var mth = getMth();
    var mainid = getMainTypeID();
    //location = "showads.php?ClassType=Other&maintype="+mainid+"&subtype=1&mth="+mth+"&type=5";
    //location = "showads.php?ClassType=Other&maintype="+mainid+"&subtype="+mainid+"&mth="+mth+"&type=5"; 
    location = "Other_"+mainid+"_"+mainid+"_"+mth+"_5.htm";  
}
