// initialize ourselves when the page is
// finished loading
window.onload = initialize;
//showContent('news');

/** Our function that initializes when the page
    is finished loading. */
function initialize() {
   // initialize the DHTML History framework
   dhtmlHistory.initialize();
   if (dhtmlHistory.isFirstLoad()) {
	showIntro();
	}else{
		var c = document.getElementById("music").style;
		c.display="inline";
	}
   
   // add ourselves as a DHTML History listener
   dhtmlHistory.addListener(handleHistoryChange);

   // subscribe to mouse clicks on the menu
   var menu = document.getElementById("menuBar");
   if (typeof window.attachEvent != "undefined") {
      // Internet Explorer
      menu.attachEvent("onclick", 
                       handleMouseClick);
   }
   else { // W3C standards
      menu.addEventListener("click", 
                            handleMouseClick,
                            false);
   }
   
   // determine what our initial location is
   // by retrieving it from the browser's
   // location after the hash
   var currentLocation = 
      dhtmlHistory.getCurrentLocation();
      
   // if there is no location then display
   // the default, which is the inbox
   if (currentLocation == "") {
      currentLocation = "section:news";
   }
   
   // extract the section to display from
   // the initial location 
   currentLocation = 
         currentLocation.replace(/section\:/, "");
   
   // display this initial location
   showContent('news');
}


function handleHistoryChange(newLocation, 
                             historyData) {
   // if there is no location then display
   // the default, which is the inbox
   if (newLocation == "") {
      newLocation = "section:news";
   }
   
   // extract the section to display from
   // the location change; newLocation will
   // begin with the word "section:" 
   newLocation = 
         newLocation.replace(/section\:/, "");
   
   // update the browser to respond to this
   // DHTML history change
   showContent(newLocation);
}