/*------------------	dkj.com	--------------------------*/
/* Application:	Website DKJ.com					  						  */
/* Type: JS-Template																		*/
/* Function: provide basic JavaScript-functions					*/
/* Description:	n/a																			*/
/* Owner:	info@mori.de																	*/
/* Version:	1.00																				*/
/* Last	modified:	13.06.2004 (dd.mm.yyyy)								*/
/* by: mori																						  */
/*------------------------------------------------------*/

// get browser family
var bName = navigator.appName;
var bVer = parseFloat(navigator.appVersion);

if (document.all) {navigator.family = "ie4"}
if (window.navigator.userAgent.toLowerCase().match(/gecko/)) {navigator.family = "gecko"}
if (window.navigator.userAgent.toLowerCase().indexOf('opera') != -1) {navigator.family = 'opera';}
if (document.layers) {navigator.family = 'ns4';}


// Function to "activate" images
function imgOver(imgName,StatusMsg)
{
	document[imgName].src = eval(imgName + "h.src");
	window.status = StatusMsg;
}


// Function to "deactivate" images.
function imgOut(imgName)
{
	document[imgName].src = eval(imgName + "n.src");
	window.status = '';
}


// show+hide layers
var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var layerID = getElemRefs(id);
  if (layerID && layerID.css) layerID.css.visibility = "visible";
}

function hideLayer(id) {
  var layerID = getElemRefs(id);
  if (layerID && layerID.css) layerID.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}
// get reference to nested layer for ns4
// from old dhtmllib.js by Mike Hall of www.brainjar.com
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
	  	theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
	    	if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}


// Netscape CSS-Bugfix to avoid loss of css-styles after resizing window
function MM_reloadPage(init) {  // reloads the window if Nav4 resized
  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);

// open window function
function openWindow(url,name,x,y,width,height,params)
{
  name = name.replace(/ /g,"");

	if (navigator.appName.indexOf("Netscape") != -1 && parseFloat(navigator.appVersion < 5))
	{
		browser = "n";
	}
	else
	{
		browser = "e";
	}

	if (x > 0)
	{
		if (browser == "n")
		{
			params += ",screenX="+x;
		}
		else
		{
			params += ",left="+x;
		}
	}

	if (y > 0)
	{
		if (browser == "n")
		{
			params += ",screenY="+y;
		}
		else
		{
			params += ",top="+y;
		}
	}

	if (width > 0)
	{
		if (browser == "n")
		{
			params += ",innerWidth="+width;
		}
		else
		{
			params += ",width="+width;
		}
	}

	if (height > 0)
	{
		if (browser == "n")
		{
			params += ",innerHeight="+height;
		}
		else
		{
			params += ",height="+height;
		}
	}

	if (params.charAt(0) == ",")
	{
		params = params.substring(1);
	}

	popup = window.open(url,name,params);
  popup.focus();
}
