

// Creates an Is Object. Used to determine the Browser Version
function Is() {
  var agent = navigator.userAgent.toLowerCase();
  var pos = agent.indexOf("netscape6");
  var str = agent.substr(pos);
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.nc = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) &&
						(agent.indexOf('compatible') == -1)));
  this.nc4b = (this.nc && (this.minor < 4.04));
  this.nc4 = (this.nc && (this.major >= 4 && this.major < 5.0));
  this.nc6b = (this.nc && (this.major >= 5) && (str.search(/\/[\d.]+b/) != -1));   // Betas have "Netscape6/6.0bn", where n = 1, 2, or 3
  this.nc6 = (this.nc && (this.major >= 5));
  this.ie = (agent.indexOf("msie") != -1);
  this.ie3 = (this.ie && (this.major == 2));
  this.ie4 = (this.ie && (this.major >= 4) && this.major < 5);
  this.ie5 = (this.ie && (this.major >= 5));  
  this.op3 = (agent.indexOf("opera") != -1);
  this.win = (agent.indexOf("win")!=-1);
  this.mac = (agent.indexOf("mac")!=-1);
  this.unix = (agent.indexOf("x11")!=-1);
}

// Setting the DOM Variables according to Netscape or InternetExplorer
var doc ="";
var sty ="";
var htm ="";
function domSwitch(is){
	if (is){
		if (is.nc4){
		  doc = "document";
		  sty = "";
		  htm = ".document";	
		} else if (is.ie4){
		  doc = "document.all";
		  sty = ".style";
		  htm = ""; 	
		} else if (is.nc6){
		  doc = "document.getElementById(\"";
		  sty = "\")";
		  htm = ""; 	
		} 
	} else {
		alert("\'is\' not set !");	
	}
}

var is = new Is();
domSwitch(is);

// Returns a Browser Specific Reference to an Object
function getObject(obName){
	if (is.ie4 || is.nc4){
	return eval(doc+"."+obName+sty);
 	} else if (is.nc6){
	// div möglichkeiten.
	//alert(document.getElementById("specialAdd").style);
	//alert(document.getElementById("object1"));
	//alert(document.getElementsByTagName("object1"));
	return eval(doc+obName+sty);
	}
}
// Set an Objects Visibility to visible
function show(ob){
	if (is.nc6){ob = ob.style;}
	ob.visibility = "visible";	
}


// Set an Objects Visibility to hidden
function hide(ob){
	if (is.nc6){ob = ob.style;}
	ob.visibility = "hidden";	
}

// Toggles the layers visibility
function showHide(ob){
	// Check if hidden (IE) or hide (NC)
	if (is.nc6){
		if (ob.style.visibility == "hidden" || ob.style.visibility == "hide"){
			show(ob);	
		} else {
			hide(ob);
		}
	} else {
		if (ob.visibility == "hidden" || ob.visibility == "hide"){
   show(ob);	
		} else {
			hide(ob);
		}
	}	
}
