/********************************************************************************************/
/*Set the number of tabs in the html file "tabCount"  tab file is passed from file also.
when using tabs, content will not show up unless veiwing from server.  Running locally, tabs will 
appear to not work*/
/********************************************************************************************/

var tabCount = 0;

function setTabCount(cnt)
{ tabCount = cnt; }

function activeTab(tab)
	{   
        for(i=1;i<=tabCount; i++)
        { document.getElementById("tab" + i).className = ""; }

		document.getElementById("tab"+tab).className = "active";
}

function getPage(url)
{
		callPage(url + '?rand='+(new Date()).getMilliseconds(), 'content', null, 'Error in Loading page <img src="images/error_caution.gif" />');
	}


var req;

function callPage(pageUrl, divElementId, loadinglMessage, pageErrorMessage) {
     if(loadinglMessage != null)
     { document.getElementById(divElementId).innerHTML = loadinglMessage; }

     try {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
         } catch (E) {
          req = false;
         } 
       } 
     }
     req.onreadystatechange = function() {responsefromServer(divElementId, pageErrorMessage);};
     req.open("GET",pageUrl,true);
     req.send(null);
  }

function responsefromServer(divElementId, pageErrorMessage) {
   var output = '';
   if(req.readyState == 4) {
      if(req.status == 200) {
         output = req.responseText;
         document.getElementById(divElementId).innerHTML = output;
         } else {
         document.getElementById(divElementId).innerHTML = pageErrorMessage+"\n"+output;
         }
      }
  }
  
