// BROWSER SNIFFER (Sniff out the good and bad browsers)
function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4));
    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);
}

var is = new Is();

function onerror() {
    document.location.href = "javascript:";
}

// DOCUMENT OBJECT SWITCH (Used for building cross_browser functions)
if(is.ns4) {
	if (document.getElementById){
	    doc = "document.getElementById";
	    sty = ".style";
	    htm = ".document";
		kla1 = "(";
		kla2 = ")";
	} else {
		doc = "document";
    	sty = "";
    	htm = ".document"
		kla1 = "[";
		kla2 = "]";
	}
} else if(is.ie4) {
    doc = "document.all";
    sty = ".style";
    htm = ""
	kla1 = "[";
	kla2 = "]";
}

//  PRELOADING
var count = 0;

function preLoad() {
    sonne = new Image();
    sonne.onload = (is.ns4b) ? loadCheck() : loadCheck;
    sonne.src = "images/sonne.gif";

    bground = new Image();
    bground.onload = (is.ns4b) ? loadCheck() : loadCheck;
    bground.src = "images/bg_fruehling.jpg";

    
}

function loadCheck() {
    // count ist anzahl der preloaded images
	count++;
    if(count == 2) {
        var status = eval(doc + kla1 + '"msgLyr"' + kla2 + sty);
		status.visibility = "hidden";
        positionLayers();
    } else {
        var status = eval(doc + kla1 + '"msgLyr"'+ kla2 + htm);
        var msg = '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=300><TR><TD WIDTH=' + Math.round((count/17)*100) + '% BGCOLOR=#FF0000 ALIGN=RIGHT>' + '<FONT class="status">' + Math.round((count/17)*100) + '%</FONT>' +'</TD><TD BGCOLOR=#800000 VALIGN=MIDDLE>&nbsp;</TD></TR><TR><TD COLSPAN=2 ALIGN=CENTER><FONT class="main">Percent Images Loaded</FONT></TD></TR></TABLE>';
        if(is.ns4) {
            status.write(msg);
            status.close();
        } else if(is.ie4) {
            status.innerHTML = msg;
        }
    }
}

//  POSITIONING
function positionLayers() {
 	FillerTopObj = eval(doc + kla1 + '"filler_top"' + kla2 + sty);
    FillerTopObj.width = available_width-846;
    FillerTopObj.top = 0;
	
	FillerLeftObj = eval(doc + kla1 + '"filler_left"' + kla2 + sty);
    FillerLeftObj.height = available_height-512;
    FillerLeftObj.top = 512;


	FillerTopObj.visibility = "visible";
	FillerLeftObj.visibility = "visible";
}

