dom = (document.getElementById) ? true : false;
ie4 = (document.all && !dom) ? true : false;
ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
ns4 = (document.layers && !dom) ? true : false;
ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
ns6 = (dom && !document.all) ? true : false;
nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

function init(){
  if (ns4 || ns5 || ns6){
	updateNSLayer('mainDIVns', ' ');
	showLyr('pieChartDIVns', 'mainDIVns');
  }
  else
  { 
  	hideDiv('pieChartDIV');
  }
}


// IE functions

function revealDiv(divId)
{  
   if (ie4 || ie5)
    {    divId = divId + 'ie';
         divName = eval(divId);
	 divName.style.display = "";
         return;
    }
    return;
}

function hideDiv(divId){
   
    if (ie4 || ie5){
        divId = divId + 'ie';
	divName = eval(divId);
	divName.style.display = "none";
       return;
    }
    return;
}

function updateLayer(object, text) {
if (ie4 || ie5)
  {object = (object + 'ie');}
else
  {object = (object + 'ns');}

if (document.getElementById)
    {document.getElementById(object).innerHTML = text;}
else
    {
    if (document.all)
      {document.all[object].innerHTML = text;}
    else 
        {
    	if (document.layers && document.layers[object]) 
    	  {	document.layers[object].document.open();
    		document.layers[object].document.write(text);
    		document.layers[object].document.close();
  	  }
  	}
    }
 }
 
 
// NETSCAPE functions

function show(divId)
{
if (ns4 || ns5 || ns6)
   document.layers[divId].visibility = 'visible';
//else
//   if (document.all)
//     document.all[divId].style.visibility = 'visible';
}


function hide(divId)
{
if (ns4 || ns5 || ns6)
 document.layers[divId].visibility = 'hidden';
//else
//   if (document.all)
//     document.all[divId].style.visibility = 'hidden';
}

function showLyr(curPg, pg) {

if (ns4 || ns5 || ns6){
        //curPg = (curPg + 'ns');
        //pg = (pg + 'ns');
	var oldPg = curPg;
	hideIt(oldPg);
        curPg = pg;
	showIt(pg);
	}
}

function showIt(lyr) {

if (document.layers){

   if (ie4 || ie5)
      lyr = (lyr + 'ie');
   else
      lyr = (lyr + 'ns');

   var theLyr = (ns4)? document.layers[lyr] : (ie4)? document.all[lyr].style : (ie5||ns5)? document.getElementById(lyr).style: null;
   if (!theLyr) return;
     theLyr.visibility = "visible";
     }
}

function hideIt(lyr) {

if (document.layers){

if (ie4 || ie5)
      lyr = (lyr + 'ie');
   else
      lyr = (lyr + 'ns');

var theLyr = (ns4)? document.layers[lyr] : (ie4)? document.all[lyr].style : (ie5||ns5)? document.getElementById(lyr).style: null;
if (!theLyr) return;
  theLyr.visibility = "hidden";
}  
}


function updateNSLayer(object, text) {
if (ns4 || ns5 || ns6){
  //object = (object + 'ns');
  
  if (document.getElementById)
    {document.getElementById(object).innerHTML = text;}
  else
    {
    if (document.all)
      {document.all[object].innerHTML = text;}
    else 
        {
    	if (document.layers && document.layers[object]) 
    	  {	document.layers[object].document.open();
    		document.layers[object].document.write(text);
    		document.layers[object].document.close();
  	  }
  	}
      }
    }
 }
