﻿// JScript File

function changePage(sMenuItem)
{
   var sPath = window.location.pathname;
   var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
   
   if(sPage!=sMenuItem) 
   {
    window.location.href=sMenuItem;
   }
}

function changeContents(sMenuItem) 
{
   var myXML, myNodes;
   var display="";
   var sTitle="";
   var sPath = window.location.pathname;
   var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
   
   if(sPage!='Content.aspx') 
   {
    window.location.href="Content.aspx?qMenuItem="+sMenuItem;
   }
   
   myXML= document.all("DonorContentsXML").XMLDocument;
   
   //Put the <name> element into an object.
   myNodes=myXML.getElementsByTagName("Section");
   //Extract the different values using a loop.
   for(var counter=0;counter<myNodes.length;counter++) 
   {
      //alert("Attribute is - > " + myNodes.item(counter).getAttribute("id"));  
      if(sMenuItem==myNodes.item(counter).getAttribute("id"))
      {
      display += myNodes.item(counter).firstChild.nodeValue +"\n";
      sTitle = myNodes.item(counter).getAttribute("Title");
      break;
      }
   }
   //alert(sTitle);
   var divTmpContent = document.getElementById("divContent");
   var divTmpTitle = document.getElementById("divTitle");

   //alert(typeof(divTmpContent) + divTmpContent.id);
  if(divTmpContent!=null) 
  {
   if(typeof(divTmpContent)=='object' && divTmpContent.id=='divContent')
    {
        divTmpContent.innerHTML=display;
    }
  }
  
  if(divTmpTitle!=null) 
  {
   if(typeof(divTmpTitle)=='object' && divTmpTitle.id=='divTitle')
    {
        divTmpTitle.innerHTML=sTitle;
    }
  }
   //alert(divTmpContent.id);
   //document.show.me.value=display;
} 
