/*
datei: js.js
author: Piero Chiussi
created: 09.08.2006
modified: 04.09.2006 -> Piero Chiussi
*/
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);

/*
image array for main menu
*/

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
  return this;
}

function initNav()
{
	imgSuffix="png";
	for (var key in arrMenuImg)
	{
		eval("document."+arrMenuImg[key]+ "UP" + " = new Image();");
		eval("document."+arrMenuImg[key]+ "UP" + ".src = 'imago/btns/"+arrMenuImg[key]+"."+imgSuffix+"';");
		eval("document."+arrMenuImg[key]+ "DWN" + " = new Image();");
		eval("document."+arrMenuImg[key]+ "DWN" + ".src = 'imago/btns/"+arrMenuImg[key]+"_dwn."+imgSuffix+"';");
	}
}

function swapImg(img,akt)
{
	theObj = getObj(img);
	akt=="on"? theImg = document[""+img+"DWN"].src : theImg = document[""+img+"UP"].src;
	theObj.obj.src = theImg;
}

//MAIL
function encode(str)
{
	nStr = "";
	for (var i = 0; i < str.length; i++)
	{
		nStr += "&#" + Number(str.charCodeAt(i)).toString() + ";";
	}
	return nStr;
}

function doMail(usr,dom,tld)
{
	prex = encode("mailto:");
	at = "@";
	dt = ".";
	ecMail = encode(usr+at+dom+dt+tld);
	document.write("<a href=\""+prex+ecMail+"\">"+ecMail+"</a>");
}

