// JavaScript Document

/*------------------------------------------------------+
 | dvswtch: Toggle between divs on a page  (div switch) |
 +------------------------------------------------------*/
//toggle between divs on a page (div switch)
function dvswtch(the_id,totaltabs) {
	var dom_popout = (document.getElementById && !document.all)? 1: 0; // Do we use DOM or not?
	  // Get Advanced settings object

	var obj = (dom_popout)? document.getElementById('ihfTab'+the_id): document.all['ihfTab'+the_id];
	
	if (obj.style.display == "none" && !document.all) {
		obj.style.display = "table-row"; // If hidden, show it
	}
	else if (obj.style.display == "none") {
		obj.style.display = "block"; // If hidden, show it
	}
	else {
		obj.style.display = "none";  // If showing, hide it
	}
	
	for (var x = 1; x <= totaltabs; x++)
   {
		 
		 if (x != the_id) {
			var obj2 = (dom_popout)? document.getElementById('ihfTab'+x): document.all['ihfTab'+x];
			obj2.style.display = "none"; 
		 }
   }
	
	//var objHide = (dom_popout)? document.getElementById('ihfTab1'): document.all['ihfTabl'];
		//	objHide.style.display = "none"; 
}

/*----------------------------------------------------------+
 | twoDiv_show_hide: Show and Hide specified divs on a page |
 +----------------------------------------------------------*/
function twoDiv_show_hide(show_id,hide_id)
{
  var dom_popout = (document.getElementById && !document.all)? 1: 0; // Do we use DOM or not?
  var objShow = (dom_popout)? document.getElementById(show_id): document.all[show_id];  // Get Advanced settings object
  var objHide = (dom_popout)? document.getElementById(hide_id): document.all[hide_id];  // Get Advanced settings object

  if (!document.all)
  {
    objShow.style.display = "table-row";	// If hidden, show it
    objHide.style.display = "none";				// If visible, hide it
  }
  else
  {
    objShow.style.display = "block";	// If hidden, show it
    objHide.style.display = "none";		// If visible, hide it
  }
}

/*-----------------------------------------------------------+
| addLoadEvent: Add event handler to body when window loads |
+-----------------------------------------------------------*/
function addLoadEvent(func)
{
  var oldonload = window.onload;
      
  if (typeof window.onload != "function")
  {
    window.onload = func;
  }
  else
  {
    window.onload = function ()
    {
      oldonload();
      func();
    }
  }
}
    
/*------------------------------------+
| Functions to run when window loads |
+------------------------------------*/
addLoadEvent(function () {
  initChecklist();
});
    
/*----------------------------------------------------------+
 | initChecklist: Add :hover functionality on labels for IE |
 +----------------------------------------------------------*/
function initChecklist()
{
  if (document.all && document.getElementById)
  {
    // Get all unordered lists
    var lists = document.getElementsByTagName("ul");
    
    for (i = 0; i < lists.length; i++)
    {
      var theList = lists[i];
      
      // Only work with those having the class "checklist"
      if (theList.className.indexOf("checklist") > -1)
      {
        var labels = theList.getElementsByTagName("label");
        
        // Assign event handlers to labels within
        for (var j = 0; j < labels.length; j++)
        {
          var theLabel = labels[j];
          theLabel.onmouseover = function() { this.className += " hover"; };
          theLabel.onmouseout = function() { this.className = this.className.replace(" hover", ""); };
        }
      }
    }
  }
}


