document.writeln('<script src="/javascripts/jquery.js" language="javascript"               type="text/javascript">  </script>');
document.writeln('<script src="/javascripts/ui/jquery.ui.all.js" language="javascript"               type="text/javascript">  </script>');
document.writeln('<link rel="stylesheet" href="/javascripts/themes/base/ui.all.css" type="text/css" media="screen" />');
            
function setActiveMenuButton()
{
  var path = location.pathname;
  
  if(path.search("/biodiversitybrowser/")!= -1 ||
    path.search("/humanfootprint/") != -1||
    path.search("/habitat/")!= -1
  ){
  
        document.getElementById("nav-browser").className="active";
        sendAllGlossaryRequst('Biodiversity Browser Overview');
        var divId = "";
        if (path.search("/biodiversitybrowser/")!= -1){
             divId = "nav-species";
             if (path.search("/biodiversitybrowser/species.jsp")!= -1) {
                sendAllGlossaryRequst("Species");
             }
        }
        else if (path.search("/humanfootprint/")!= -1){
             divId = "nav-humanfootprint";
              if (path.search("/humanfootprint/hfsummary.jsp")!= -1) {
                    sendAllGlossaryRequst('Human Footprint');
            }
        }
        else if (path.search("/habitat/")!= -1){
            divId = "nav-habitat";
        }
        var sppDiv = document.getElementById(divId);
        if (sppDiv){
            sppDiv.className = "active";
        }
    }
  else if(path.search("/rawdata/")!= -1){
  
    document.getElementById("nav-data").className="active";    
    sendAllGlossaryRequst('Raw Data');
    }
  else if(path.search("/reports/")!= -1){
    document.getElementById("nav-reports").className="active";
    sendAllGlossaryRequst('Reports');
    }
  else if(path.search("/aboutabmi/")!= -1){
    document.getElementById("nav-about").className="active";    
    sendAllGlossaryRequst('About ABMI');
    }
  else if(path.search("/home/")!= -1){
    document.getElementById("nav-home").className="active";
   // sendAllGlossaryRequst('Home');
    }
  else if(path.search("/contacts/")!= -1){
    document.getElementById("nav-about-us").className="active";    
    }
  else if(path.search("/glossary/")!= -1){
    document.getElementById("nav-glossary").className="active";     
    }
  else if(path.search("/jobs/")!= -1){
    document.getElementById("nav-jobs").className="active";       
    }
  else if(path.search("/login/")!= -1){
    document.getElementById("nav-login").className="active";  
//    sendAllGlossaryRequst('Raw Data'); // for test
    }
    
}

function setTitle(pageTitle)
{
  document.title = pageTitle;
}


            
   function sendAllGlossaryRequst(page){
           
            var loginDiv = document.getElementById("loginDiv");
            if (loginDiv != null)
            return;
            params = "GlossaryRequest=GlossaryRequest&list=all&webPage=" + page;
            $.post("/abmi/ajax", params, displayAllGlossary, "xml");
            //        var xh = EsriUtils.sendAjaxRequest("/abmi/index.jsp", params, false, function() { displayAllGlossary(xh); });
     
    }
    
    
    function openSearch () {
          if ($("#cse").dialog("option", "width")){
                    $("#cse").dialog( 'open' ) ;
            }
         else{
                 $("#cse").dialog({height:400,width:600,  title: "Search ABMI.ca"});   
            }
 }
 
 
 
function toggleWindowHTML(id) {

    obj1=document.getElementById(id);
   
  if(obj1.style.display == 'none'){
    obj1.style.display = ''
    }
    else
    obj1.style.display = 'none';
}

function toggleBox(id, bShow){
    if (bShow){
        $("#" + id).show();
    }
    else
            $("#" + id).hide();
}