
// description: Browser Detection and Dom-Switch
// JAN-15-2001 / PF : update for NS6
// JAN-31-2001 / PF : update CCS for Mac
// NOV-20-2003 / UEE: update for NS7==Mozilla 1.x
//
//

// ----------- Global Variables used by these Scripts ------------- //
// var doc: domswitch
// var sty: domswitch
// var htm: domswitch

// ----------- FUNCTION/ OBJECT DESCRIPTIONS --------------- //

// Is(): creates an Object to determine Browser Versions
// following properties are available:
// major: Major Appversion
// minor: minor Appversion
// nc: is some version of netscape
// nc4b: Netscape Version 4.01 trough 4.03
// nc4:
// nc6b: Betas have "Netscape6/6.0bn", where n = 1, 2, or 3
// nc6: Netscape Version >5
// ie: is some InternetExplorer Version
// ie3:
// ie4:
// op3: Verison 3 of opera
// win: os windows
// mac: os macintosh
// x11: os unix

// domSwitch(is): Sets the Dom-Switch Variables according to browser
// is: an Is Object
// Sets Following variables: 
// doc : document/document.all
// sty : ""/.style
// htm : .document/""

// setStyleSheet(is, nc, ms): sets a css  according to Browser 
// is: an Is() Object to determine Browser Versions
// nc: a valid url to StyleSheet for Netscape
// ms: a valid url to StyleSheet for InternetExplorer

  



// 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.nc7 = (this.nc && (agent.indexOf('gecko')!=-1));
  this.ie = (agent.indexOf("msie") != -1);
  this.ie3 = (this.ie && (this.major == 2));
  this.ie4 = (this.ie && (this.major >= 4));
  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 || is.nc7){
		  doc = "document.getElementById(\"";
		  sty = "\")";
		  htm = ""; 	
		}
	} else {
		alert("\'is\' not set !");	
	}
}

// Writes the Stylesheet according to Browser Version (if ie then ie specific else nc)
function setStyleSheet(is, ncStyleSheet, ieStyleSheet){
	var sheet = "";
	if(is.nc4 || is.nc6b || is.nc6 || is.nc7 || is.nc){
		sheet = ncStyleSheet;
	} else {
		sheet = ieStyleSheet;
	}

      // PF : bei mac wird '_mac' am CSS angehängt.
/*	if(is.mac){
       var sheetsplit
	 sheetsplit=sheet.split(".")
       sheet = '';
       for(a=0;a<sheetsplit.length;a++)
       {
        b = (a +1);
        if(!sheetsplit[a] && sheetsplit[b]){
         sheet = sheet + "..";
        }else if(sheetsplit[a] == 'css'){
         sheet = sheet +"_mac." + sheetsplit[a];
        }else{
         sheet = sheet + sheetsplit[a];
        }
       }
      }
*/
document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/gud/css/"+sheet+"\">\n");
document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"print\" href=\"/gud/css/print/"+sheet+"\">\n");	
//alert("browsr_css.js:<link rel=\"stylesheet\" type=\"text/css\" href=\"/all/style/"+sheet+"\">\n"+navigator.userAgent.toLowerCase());
}



  var is = new Is();
  domSwitch(is);
  setStyleSheet(is,'all_ns.css','all.css');
  setStyleSheet(is,'intranet_ns.css','intranet.css');