function setColor(theRow, theAction) {
	var theCells = null;
	var theDefaultColor = '#FFFFFF';
	var thePointerColor = '#E5E8F1';
	
 // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
	
	 // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.2 .. with other browsers   
		currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

	 // 4. Defines the new color
    // 4.1 Current color is the default one
	if (currentColor == '' || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
	//alert(currentColor);
        if (theAction == 'over' && thePointerColor != '') {
            newColor = thePointerColor;
        }
	}
	// 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
        if (theAction == 'out') {
            newColor = theDefaultColor;
			
    	}
	}
	// 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

} // end setColor function

//////////////////////////////////////////////////////////////////////////
function browserobj() {
	this.ns4=document.layers&&!document.getElementById;
	this.ns6=document.getElementById&&!document.all;
	this.ie4=document.all;
	this.opr=navigator.userAgent.indexOf("Opera")+1;
	
	this.ms = document.all;
	this.ns = document.layers;
	this.dom = document.getElementById;
}
browserobj.prototype.innerWidth = function () {
	if(this.ns || this.opr) return window.innerWidth;
	else return document.body.offsetWidth;
}

var browser = new browserobj();

/////////////////////////////////////////////////////////////////////////
function init() {
	if (browser.dom && (browser.ie4||browser.ns6)) {
		//document.onclick=drophidenow;
		
		if( (table = document.getElementById("tab-liste")) ) {
			 row = table.getElementsByTagName('tr');
			 rowLength = row.length;
			// alert(rowLength);
			
			for (c = 2; c < rowLength; c++) {
				row[c].onmouseover = function(event) { setColor(this, 'over'); };
				row[c].onmouseout = function(event) { setColor(this, 'out'); };
			}
		}
	}
} // end init function

window.onload = init;


////////////////////////////////////////////////////////////////////////
// Eingabefelder Suchfunktion loeschen
////////////////////////////////////////////////////////////////////////
function sucheFocus(field, standardwert) {
	var wert = document.formular.elements["bp["+field+"]"].value;
	if (wert == standardwert){
		document.formular.elements["bp["+field+"]"].value = "";
	}	
}

function sucheBlur (field, standardwert) {
	var wert = document.formular.elements["bp["+field+"]"].value;
	if (wert == "") {
		document.formular.elements["bp["+field+"]"].value = standardwert;
	}
}
