var ns = (document.layers) ? true : false; 
var ie = (document.all) ? true : false;
var mz = (!(document.layers) && !(document.all)) ? true : false; //Mozilla

var webRoot = "/";

var menuArray = new Array();
var initStat = true;

var offX = 187;
var txtcl = '636363';
var activetxtcl = '000000';
var txts = 11;
var mnuwdth = 155;
var bgc = 'FFFFFF';
var hic = 'F5F5F5';

var dropdown_timeout = 100;


function dropdown(ID, name){
	
	this.theName = name;
	this.offsetY = topPos('menub' + ID)+1;
	this.offsetX = offX;
	//if(ns|mz) this.offsetX -= 1;
	this.popupCoord = offX;
	this.bgfarbe = bgc;
	this.highfarbe = hic;
	this.txtfarbe = txtcl;
	this.activetxtfarbe = activetxtcl;
	this.txtsize = txts;
	this.menuwidth =mnuwdth;
	this.dataSize = eval(this.theName+'Data.length');
	this.expand = dropdown_expand;
	this.high = dropdown_high;
	this.unhigh = dropdown_unhigh;
	this.construct = dropdown_constructor;
	this.construct();
}

function dropdown_expand(){
  if(initStat){

	menuCollaps()
	this.unhigh();
	if(ns)	{
	
		eval('document.layers[\''+this.theName+'Container\'].visibility = \"show\"');
//		eval('document.layers[\''+this.theName+'Container\'].left ='+ this.popupCoord);
	}
	if(ie) {
//		this.popupCoord = nav1.offsetLeft+this.offsetX;
		eval('document.all[\''+this.theName+'Container\'].style.visibility = \"visible\"');
//		if (this.theName == 'plan4') {
//			eval('document.all[\''+this.theName+'Container\'].style.right ='+ this.offsetX);
//		} else {			
//			eval('document.all[\''+this.theName+'Container\'].style.left ='+ this.popupCoord);
//		}
		
	}
	if(mz){
		document.getElementById(this.theName+'Container').style.visibility = "visible";
	}
  }	
}

function dropdown_high(x){
	if (ns) {this.unhigh(); eval('window.document.'+this.theName+'Container.document.layers[\''+this.theName+x+'\'].bgColor = \'#'+this.highfarbe+'\''); return;}
	if (ie) {this.unhigh(); eval(this.theName+x+'.style.backgroundColor = \'#'+this.highfarbe+'\'');}
	if (mz) {this.unhigh(); document.getElementById(this.theName+x).style.backgroundColor = '#'+this.highfarbe;}	
}

function dropdown_unhigh(){
	for(i=0;i<this.dataSize;i++){
		if (ie) eval(this.theName+i+'.style.backgroundColor = \'#'+this.bgfarbe+'\'');
		if (ns) eval('window.document.'+this.theName+'Container.document.layers[\''+this.theName+i+'\'].bgColor = \'#'+this.bgfarbe+'\'');
		if (mz) document.getElementById(this.theName+i).style.backgroundColor = '#'+this.bgfarbe;
	}
}

function dropdown_constructor(){

	if(!mz) this.codeString = '<div id=\"'+this.theName+'Container\">\n';
	if(mz) this.codeString = '<div id=\"'+this.theName+'Container\" onMouseOut=\"javascript:dropdown_mouseLeave()\">\n';
	var cellwidth=this.menuwidth - 4;
	
	for(i=0;i<this.dataSize;i++){
		
		this.codeString += '<div id=\"'+this.theName+i+'\" align=\"left\" onMouseOver=\"window.clearTimeout(zu);\">';
		this.codeString += '<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
		this.codeString += '<tr><td valign=\"middle\" width=\"+this.cellwidth\">';
		this.codeString += '<img src=\"' + webRoot + 'images/spacer.gif\" width=3 height=3 border=\"0\">';
		this.codeString += '<a href=\"'+eval(this.theName+'Data['+i+'][1]')+'\" onMouseOver=\" window.clearTimeout(zu);\" class="dropdowntext'+this.theName+'">';
		this.codeString += eval(this.theName+'Data['+i+'][0]');
		this.codeString += '</a></td><td background=\"' + webRoot + 'images/menu_right_shad.gif"><img src=\"' + webRoot + 'images/spacer.gif\" width=4 height=17 border=0></td></tr>\n';
		
		this.codeString += '<tr><td><img src=\"' + webRoot + 'images/menu2_line2.gif\" width=151 height=1 border=\"0\"></a>';
		this.codeString += '</td><td background=\"' + webRoot + 'images/menu_right_shad.gif"><img src=\"' + webRoot + 'images/spacer.gif\" width=4 height=1 border=0></td></tr></tr></table>';
		this.codeString += '</div>\n';
	}
	this.codeString += '<img src=\"' + webRoot + 'images/dropdownbottom.gif\" width=\"155\" height=\"4\"></div>\n\n';
	this.codeString += '</table>';
	this.codeString += '</div>\n\n';
	this.styleString = '<style type=\"text/css\">\n';
	if (this.theName == 'plan4') {
		this.styleString += '#'+this.theName+'Container{position: absolute; top:'+this.offsetY+'px; right:'+this.offsetX+'px; width:142px; visibility:hidden; z-index:2;';
	} else {
		this.styleString += '#'+this.theName+'Container{position: absolute; top:'+this.offsetY+'px; left:'+this.offsetX+'px; width:142px; visibility:hidden; z-index:2;';
	}
	this.styleString += (ns)? 'layer-background-color:#FFFFFF;}\n':'background-color:#FFFFFF;}\n'
	for(i=0;i<this.dataSize;i++){
		if(ns) this.styleString += '#'+this.theName+i+'{position: relative; left:1px; font-size: 12px; layer-background-color:#'+this.bgfarbe+'; z-index:1;}\n'
		if(ie) this.styleString += '#'+this.theName+i+'{position: relative; width:'+this.menuwidth+'px; font-size: 12px; background-color:#'+this.bgfarbe+'; z-index:1;}\n'
		if(mz) this.styleString += '#'+this.theName+i+'{position: relative; width:'+this.menuwidth+'px; left:1px; font-size: 12px; background-color:#'+this.bgfarbe+'; z-index:1;}\n'
	}
	this.styleString += '.dropdowntext'+this.theName+':link{font-family: Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color:'+this.txtfarbe+'}\n';
	this.styleString += '.dropdowntext'+this.theName+':visited{font-family: Arial, Helvetica, sans-serif;  font-size: 10pt; text-decoration: none; color:'+this.txtfarbe+'}\n';
	this.styleString += '.dropdowntext'+this.theName+':active{font-family: Arial, Helvetica, sans-serif;  font-size: 10pt; text-decoration: none; color:'+this.activetxtfarbe+'}\n';
	this.styleString += '.dropdowntext'+this.theName+':hover{font-family: Arial, Helvetica, sans-serif;  font-size: 10pt; text-decoration: none; color:'+this.activetxtfarbe+'}\n';
	this.styleString += '</style>\n';
	menuArray[menuArray.length] = this.theName;
	document.writeln(this.styleString);
	document.writeln(this.codeString);
	if(ns){
		eval('window.document.layers[\''+this.theName+'Container\'].captureEvents(Event.MOUSEOUT|Event.MOUSEMOVE)');
		eval('window.document.layers[\''+this.theName+'Container\'].onMouseOut = dropdown_mouseLeave');
	}
	if(ie) eval('document.all[\''+this.theName+'Container\'].onmouseout = dropdown_mouseLeave;');
}
var zu;
function dropdown_mouseEnter() {window.clearTimeout(zu)}
function dropdown_mouseLeave() {zu = window.setTimeout('menuCollaps()', dropdown_timeout);}

function menuCollaps(){
	for(i=0;i < menuArray.length; i++){
		if(ns){eval('document.layers[\''+menuArray[i]+'Container\'].visibility = "hide"');}
		if(ie){eval('document.all[\''+menuArray[i]+'Container\'].style.visibility = "hidden"');}
		if(mz){document.getElementById(menuArray[i]+'Container').style.visibility = "hidden";}
		window.clearTimeout(zu);
	}
}	
window.onresize = resize;
window.saveInnerWidth  = window.innerWidth; 
window.saveInnerHeight = window.innerHeight;
function resize() {
    if (saveInnerWidth != window.innerWidth || saveInnerHeight != window.innerHeight ) document.location.reload();
}
function newImage(src){
	var tmp = new Image();
	tmp.src = webRoot + src;
	return tmp;
}

function initMenu(){
	initStat = true;
}

function highlightHeadMenu(which){
  if(initStat){
	unhighlightHeadMenu();
	eval('document.'+which+'.src = '+which+'01.src');
  }	
}

function unhighlightHeadMenu(){
	if(initStat){
		/*document.home.src = (pageHighlight != 'home')? home00.src : home10.src;
		document.high.src = (pageHighlight != 'high')? high00.src : high10.src;
		document.shpi.src = (pageHighlight != 'shpi')? shpi00.src : shpi10.src;
		document.serv.src = (pageHighlight != 'serv')? serv00.src : serv10.src;
		document.kont.src = (pageHighlight != 'kont')? kont00.src : kont10.src;*/
	}
}


function getTop(refObj){
   yPos = refObj.offsetTop;
   parentObj=refObj.offsetParent;
   while(parentObj != null) {yPos+=parentObj.offsetTop;parentObj=parentObj.offsetParent}
   return yPos;
}
   
function topPos(refName){
   ref=document.images[refName];
   return (document.layers)? ref.y : getTop(ref);
}
   
