function selectedmenu()
{
    var sdate = document.getElementById("hiddatemenu").value;
    var type = document.getElementById("hidshowtype").value;
    
    if (sdate != null && sdate != "")
    {
        var lendate = document.all.datemenu.length;
        var lentype = document.all.showtype.length;
        
        for(var i=0; i<lendate; i++)
        {
           if(document.all.datemenu[i].value == sdate)
           {
              document.all.datemenu[i].selected = true;
           }
        }
                
        for(var j=0; j<lentype; j++)
        {
           if(document.all.showtype[j].value == type)
           {
              document.all.showtype[j].selected = true;
           }
        }        
    }
}

function playV(aid)
{
        self.open("/v001/BAENvideoplay.php?AID="+aid,"","toolbar=0,status=0,menubar=0,top=50,left=100,height=470,width=590,resizable=0,scrollbars=yes");
}

function SendMes(cid,ctype)
{
 window.open("/getemail.php?busid="+cid+"&type="+ctype,"bay","height=310,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,left=100,top=30");

}

function zoompic(pid)
{
 /*if (nwin && !nwin.closed)  
 {
      nwin.close();
 }
 nwin = */
 window.open("ZoomPhoto.php?ph=" + pid,"bay","scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no,left=0,top=0,width=450,height=450");
}

function openp(aid)
{

 window.open("pedigreelink.php?adid="+aid,"nwinped","height=600,width=720,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,left=50,top=0");
}


function print_ads(id)
{
    window.open("Print_Ads.php?AdID=" + id, "print", "height=600,width=700,resizable=0,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,left=100,top=0");
}

function qrySearchAllAds(adid, typeid)
{ 
    location = "/b001/showads.php?ClassType=ID&maintype="+adid+"&subtype=all&mth="+typeid;
}

function checkMileage()
{ 
    var mileage = document.getElementById("miles").value;
    var zip = document.getElementById("zip").value;
    var v = parseInt(zip, 10);
     
    if (mileage == "")      
    {
        alert("Please select the miles.");
        return false;
    }
    else if (/\D+/g.test(v))
    {
         alert("Sorry,you must enter a real Zipcode!");
         return false;
    }
    else
    {
        return true;
    }  
}


function searchid(horo)
{
     var hid = document.getElementById("horseid").value;
     var v = parseInt(hid,10);

     if (/\D+/g.test(v))
     {
        alert("Sorry,you must enter a number!");
        return false;
     }

     var rlid = document.all.cbox.checked;
     if(rlid)
     {
         location = "/b001/showads.php?ClassType=ID&maintype="+hid+"&mth="+horo+"&subtype=all";
     }
     else
     {
         location = "/b001/showads.php?ClassType=ID&maintype="+hid+"&mth="+horo+"&subtype=";
     }

}

function searchkey(horo)
{  
     var keywd = document.getElementById("keywd").value;
     if (keywd == "")
     {
             alert("Sorry,you must enter a keyword!");
             return false;
     }
     else
     {
        location = "/b001/showads.php?ClassType=Key&maintype="+horo+"&subtype="+keywd+"&mth="+horo+"";
     }
}

