/* define global object variable */
var ibridge = {

   popup : null,
 
  /* return for non-supporting browsers; else setup for table event listening */
   init : function(){
   
      /* block non-supporting browsers */
      if (!document.getElementById || !document.createElement || !document.createTextNode) {return;}  
  
      /* configure event handlers */
      this.configEvents();
           
      /* create number vx popup box */
      this.createPopup();        
     
   }, /* end init */
  

   /* generate number vaccines popup box */
   createPopup : function(){

      /* popup text */
      var popupText = document.createElement('p');
      popupText.appendChild(document.createTextNode('The Innovation Bridge tracks how many vaccines are currently in development around the world, focusing on vaccines in five priority areas (HIV/AIDS, malaria, tuberculosis, diarrheal diseases and pneumonia-related diseases).  By "in development", we mean in preclinical stage or in Phase I, Phase II or Phase III clinical trials.*'));
        
      var popupCite = document.createElement('p');
      popupCite.className = 'smallertext';
      popupCite.appendChild(document.createTextNode('*Sourced from Citeline, WHO and through interviews with company representatives or from company websites.'));
         
      /* create popup div */
      ibridge.popup = document.createElement('div');
      ibridge.popup.id = 'popup';
      ibridge.popup.className = 'hide';

      /* append popup text */
      ibridge.popup.appendChild(popupText);
      ibridge.popup.appendChild(popupCite);
     
      /* assign mouse listeners to how many vx div */
      var howmanyDiv = document.getElementById('howMany');
      this.addEvent(howmanyDiv, 'mouseover', this.showhide, false);
      this.addEvent(howmanyDiv, 'mouseout', this.showhide, false);
      
      /* add popup to document */
      var boxPara = document.getElementsByTagName('p')[0];
      howmanyDiv.insertBefore(ibridge.popup,boxPara);
      
   }, /* end createPopup */
    
       
   /* process mouseover/mouseout on howmany div */
   showhide : function(){file:///D:/lspera/Desktop/IB_WorkingCopy_09Apr09/home.html.#
      ibridge.popup.className = (ibridge.popup.className === '' ? 'hide' : '');        
   }, /* end showhide*/
   
 
   /* set the addEvent() method based on object detection */
   configEvents : function() {

      // W3C approach for non-IE modern browsers
      if (document.addEventListener) {
      
         this.addEvent = function(el, type, func, capture) {
            el.addEventListener(type, func, capture);
         };
      }
      
      // configure for IE
      else if (document.attachEvent) {

         this.addEvent = function(el, type, func) {
            el["e" + type + func] = func;
            el[type + func] = function() {
               el["e" + type + func] (window.event);
            };
            el.attachEvent("on" + type, el[type + func]);
         };
      }
   } /* end configEvents */
             
         
}; /* end global variable definition */
 
  
/* call init method */
ibridge.init();