// Javascript Functions


/* opens a new Browserwindow */
function newWindow(URL,Name,Extension) {
	window.open(URL,Name,Extension);
}


/* Reloads window if NN4 resized */
function MM_reloadPage(init) {
	if (init == true) with (navigator) {
		if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
			document.MM_pgW = innerWidth; 
			document.MM_pgH = innerHeight; 
			onresize = MM_reloadPage; 
		}
	} else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) {
		location.reload();
	}
}
MM_reloadPage(true);


/* Manages the Backgroundcolor of a complete Table row in diff Hoverstats */

// theRow				this
// theRowStat			over, out (Mousemodus)
// theRowColorOver		OnMouseoverColor
// theRowColorOut		OnMouseoutColor
function lite(theRow, theRowStat, theRowColorOver, theRowColorOut) {
	
	//when onmouseover -> change the cursor to a link-cursor
	//fixes the IE 5 and below cursor Problem
	if (navigator.appName == "Microsoft Internet Explorer") {
		theRow.style.cursor = "hand";
	} else {
		theRow.style.cursor = "pointer";
	}
	
	//Get Mousestats
	if (theRowStat == 'over') {
		theRowColor = theRowColorOver; //****Highlight Color****//
	} else if (theRowStat == 'out') {
		theRowColor = theRowColorOut; //****Female Color****//
	}
	
	//Check Colorvalues
	if (theRowColor == '' || typeof(theRow.style) == 'undefined') {
		return false;
	}
	
	//get all Cells
	if (typeof(document.getElementsByTagName) != 'undefined') {
		var theCells = theRow.getElementsByTagName('td');
	}
	else if (typeof(theRow.cells) != 'undefined') {
		var theCells = theRow.cells;
	} else {
		return false;
	}
	
	//Count affected Cells and change their Color
	var rowCellsCnt = theCells.length;
	for (var c = 0; c < rowCellsCnt; c++) {
		theCells[c].style.backgroundColor = theRowColor;
	}
	return true;
}


/* Show / Hide an LayerObject

// objectname = name of the object that should be hidden / shown
// run:

//Link <a href="#" onClick="showhide('Layer')>ShowLayer</a>
//Layertag<div id="Layer" style="position: absolute; visibility: hidden">Hello</div>
*/
function toggleLayer(objectname) {
	//IE
	if (document.getElementById) {
		if (document.getElementById(objectname).style.visibility == 'visible')
			document.getElementById(objectname).style.visibility = 'hidden';
		else
			document.getElementById(objectname).style.visibility = 'visible';
	}
	//NN
	else if (document.layers && document.layers[objectname] != null) {
		if (document.layers[objectname].visibility == 'visible' || document.layers[objectname].visibility == 'show' )
			document.layers[objectname].visibility = 'hidden';
		else
			document.layers[objectname].visibility = 'visible';
	}
	//restl.
	else if (document.all) {
		if (document.all[objectname].style.visibility == 'visible')
			document.all[objectname].style.visibility = 'hidden';
		else
			document.all[objectname].style.visibility = 'visible';
	}
	return false;
}


/* DONOT USE UNDER NN4!!! */
//Shows / Hides a table row / table / colum

// e.g.:
/*	<table border="1" width="400">
		<tr id="row">
			<td>toggle row</td>
		</tr>
		<tr>
			<td>Fix row</td>
		</tr>
	</table>
	<a href="" onClick="showhide('row'); return false;">Show/Hide</a>
*/
function toggleTable(objectname) 
{
	if(document.all[objectname].style.display == 'none')
		document.all[objectname].style.display ='';
	else
		document.all[objectname].style.display ='none';
	return false;
}


//hides an specific layer by its id
function hide_Layers (layernames) {
	for (var i = 0; i < hide_Layers.arguments.length; i++)
		//IE
	if (document.getElementById) {
		document.getElementById(hide_Layers.arguments[i]).style.visibility = 'hidden';
	}
	//NN
	else if (document.layers && document.layers[hide_Layers.arguments[i]] != null) {
		document.layers[hide_Layers.arguments[i]].visibility = 'hidden';
	}
	//restl.
	else if (document.all) {
		document.all[hide_Layers.arguments[i]].style.visibility = 'hidden';
	}
	return false;
}

//shows an specific layer by its id
function show_Layer(layername)
{
	//IE
	if (document.getElementById) {
		document.getElementById(layername).style.visibility = 'visible';
	}
	//NN
	else if (document.layers && document.layers[layername] != null) {
		document.layers[layername].visibility = 'visible';
	}
	//restl.
	else if (document.all) {
		document.all[layername].style.visibility = 'visible';
	}
	return false;
}
