    // AJAX Search for models
    
    var criteria = "date";
    var video_start_page = 0;
    var photo_start_page = 0;

    var xmlHttp;

    function doVideoSearch()
    {   
      document.getElementById("searchStatus").innerHTML="<img src='/public/images/loading.gif' width='32' height='32' alt=''/>";
      var url="/public/pages/shoot_search_internal_videos.php?video_start_page=" + video_start_page + "&criteria=" + criteria + "&r=" + Math.random();
      //new Effect.DropOut(document.getElementById("searchResultsVideos"));           
      xmlHttp=GetXmlHttpObject(videoStateChanged);
      xmlHttp.open("GET", url , true);
      xmlHttp.send(null);
    } 

    function doPhotoSearch()
    {   
      document.getElementById("searchStatus").innerHTML="<img src='/public/images/loading.gif' width='32' height='32' alt=''/>";
      var url="/public/pages/shoot_search_internal_photos.php?photo_start_page=" + photo_start_page + "&criteria=" + criteria + "&r=" + Math.random();
      //new Effect.DropOut(document.getElementById("searchResultsPhotos"));     
      xmlHttp=GetXmlHttpObject(photoStateChanged);
      xmlHttp.open("GET", url , true);
      xmlHttp.send(null);
    }
    
    function doVideoSearchByModel(modelnum)
    {
      var url="/public/pages/shoot_search_internal_videos_by_model.php?video_start_page=" + video_start_page + "&criteria=" + criteria + "&m=" + modelnum + "&r=" + Math.random();
      xmlHttp=GetXmlHttpObject(videoStateChangedByModel);
      xmlHttp.open("GET", url , true);
      xmlHttp.send(null);
    } 

    function doPhotoSearchByModel(modelnum)
    {   
      var url="/public/pages/shoot_search_internal_photos_by_model.php?photo_start_page=" + photo_start_page + "&criteria=" + criteria + "&m=" + modelnum + "&r=" + Math.random();
      xmlHttp=GetXmlHttpObject(photoStateChangedByModel);
      xmlHttp.open("GET", url , true);
      xmlHttp.send(null);
    } 

    function videoStateChanged() 
    { 
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      { 
        //if (document.getElementById("searchResultsVideos").filters) {
        //  document.getElementById("searchResultsVideos").filters[0].Apply();
        //}
        document.getElementById("searchResultsVideos").innerHTML=xmlHttp.responseText;
        //new Effect.SlideDown(document.getElementById("searchResultsVideos"));
        //if (document.getElementById("searchResultsVideos").filters) {        
        //  document.getElementById("searchResultsVideos").filters[0].Play();
        //}
        document.getElementById("searchStatus").innerHTML="<img src='/public/images/px.gif' width='32' height='32' alt=''/>";
      } 
    } 

    function photoStateChanged() 
    { 
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      { 
        //if (document.getElementById("searchResultsPhotos").filters) {
        //  document.getElementById("searchResultsPhotos").filters[0].Apply();
        //}
        document.getElementById("searchResultsPhotos").innerHTML=xmlHttp.responseText;
        //new Effect.SlideDown(document.getElementById("searchResultsPhotos"));
        //if (document.getElementById("searchResultsPhotos").filters) {        
        //  document.getElementById("searchResultsPhotos").filters[0].Play();
        //}
        document.getElementById("searchStatus").innerHTML="<img src='/public/images/px.gif' width='32' height='32' alt=''/>";
      } 
    } 

    function videoStateChangedByModel() 
    { 
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      { 
        document.getElementById("searchResultsVideos").innerHTML=xmlHttp.responseText;
      } 
    } 

    function photoStateChangedByModel() 
    { 
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      { 
        document.getElementById("searchResultsPhotos").innerHTML=xmlHttp.responseText;
      } 
    } 

    function GetXmlHttpObject(handler)
    { 
      var objXmlHttp=null;

      if (window.XMLHttpRequest) {
        objXmlHttp = new XMLHttpRequest();
        objXmlHttp=new XMLHttpRequest();
        objXmlHttp.onreadystatechange=handler;
        objXmlHttp.onload=handler;
        objXmlHttp.onerror=handler;
        return objXmlHttp;
      }
      else if (window.ActiveXObject) {
        try
        {       
          objXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
          objXmlHttp.onreadystatechange=handler;
          return objXmlHttp;          
        }
        catch(e)
        { 
          alert("Please enable ActiveX on your browser");
          return;
        }         
      }
    }   
