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

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

function dropdown(name,offX,offY,bgc,hic,txtc,txts){
	this.theName = name;
	this.offsetX = offX;
	this.offsetY = offY;
	if(ns) this.offsetX -= 1;
	this.popupCoord = offY;
	this.bgfarbe = bgc;
	this.highfarbe = hic;
	this.txtfarbe = txtc;
	this.txtsize = txts;
	this.dataSize = eval(this.theName+'Data.length');
	this.expand = dropdown_expand;
	this.ange = dropdown_high;
	this.unhigh = dropdown_unhigh;
	this.constuct = dropdown_constructor;
	this.constuct();
}

function dropdown_expand(){
  if(initStat){
	menuCollaps()
	this.unhigh();
	if(ns)	{
		switch(this.theName)
		{
			case 'angebot': 	this.popupCoord = (document.images['ange'].x - 1); break;
			case 'studio': 	  this.popupCoord = (document.images['stud'].x - 1); break;
      case 'aktuell': 	this.popupCoord = (document.images['aktu'].x - 1); break;
			case 'verein':  	this.popupCoord = (document.images['vern'].x - 1); break;
			case 'kontakt': 	this.popupCoord = (document.images['kont'].x - 1); break;
		}
		eval('document.layers[\''+this.theName+'Container\'].visibility = \"show\"');
		eval('document.layers[\''+this.theName+'Container\'].left ='+ this.popupCoord);
	}
	if(ie) {
		this.popupCoord = logo.offsetLeft+this.offsetY;
		eval('document.all[\''+this.theName+'Container\'].style.visibility = \"visible\"');
		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 = \'#FFE1E1\'');
		if (ns) eval('window.document.'+this.theName+'Container.document.layers[\''+this.theName+i+'\'].bgColor = \'#FFE1E1\'');
		if (mz) document.getElementById(this.theName+i).style.backgroundColor = "#FFE1E1";
	}
}

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';
	for(i=0;i<this.dataSize;i++){
		this.codeString += '<div id=\"'+this.theName+i+'\" align=\"left\" onMouseOver=\"window.clearTimeout(zu);\">';
		this.codeString += '<img src=\"siteimages/leer.gif\" width=5 height=13 border=\"0\">';      // Abstand zu Menutext 
		this.codeString += '<a href=\"'+eval(this.theName+'Data['+i+'][1]')+'\" onMouseOver=\"'+ this.theName+'.ange('+i+'); window.clearTimeout(zu);\" class="dropdowntext'+this.theName+'">';
		this.codeString += eval(this.theName+'Data['+i+'][0]');
		this.codeString += '<br><img src=\"siteimages/leer.gif\" width=138 height=1 border=\"0\"></a></div>\n';  // Abstand zwischen Menupunkten
	}
	this.codeString += '<img src=\"siteimages/menubottom.gif\" width=\"138\" height=\"13\"></div>\n\n';   // Abschlußbild bottom
	this.styleString = '<style type=\"text/css\">\n';
	this.styleString += '#'+this.theName+'Container{position: absolute; top:'+this.offsetX+'px; left:'+this.offsetY+'px; width:138px; 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:0px; font-size: 11px; layer-background-color:#'+this.bgfarbe+'; z-index:1;}\n'
		if(ie) this.styleString += '#'+this.theName+i+'{position: relative; width:138px; font-size: 11px; background-color:#'+this.bgfarbe+'; z-index:1;}\n'
		if(mz) this.styleString += '#'+this.theName+i+'{position: relative; width:138px; left:1px; font-size: 11px; background-color:#'+this.bgfarbe+'; z-index:1;}\n'
	}
	this.styleString += '.dropdowntext'+this.theName+':link{font-family: Helvetica, Arial, Geneva, Arial, sans-serif; font-size:8pt; text-decoration: none; color:'+this.txtfarbe+'}\n';
	this.styleString += '.dropdowntext'+this.theName+':visited{font-family: Helvetica, Arial, Geneva, Arial, sans-serif; font-size:8pt; text-decoration: none; color:'+this.txtfarbe+'}\n';
	this.styleString += '.dropdowntext'+this.theName+':active{font-family: Helvetica, Arial, Geneva, Arial, sans-serif; font-size:8pt; text-decoration: none; color:'+this.txtfarbe+'}\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()',50);}

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";}
		unhighlightHeadMenu()
		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 = src;
	return tmp;
}
home00 = newImage("siteimages/home00.gif");	    home01 = newImage("siteimages/home10.gif");	    home10 = newImage("siteimages/home10.gif");
ange00 = newImage("siteimages/angebot00.gif");	ange01 = newImage("siteimages/angebot10.gif");	ange10 = newImage("siteimages/angebot10.gif");
stud00 = newImage("siteimages/studio00.gif");	  stud01 = newImage("siteimages/studio10.gif");	  stud10 = newImage("siteimages/studio10.gif");
aktu00 = newImage("siteimages/aktuell00.gif");	aktu01 = newImage("siteimages/aktuell10.gif");	aktu10 = newImage("siteimages/aktuell10.gif");
vern00 = newImage("siteimages/verein00.gif");	  vern01 = newImage("siteimages/verein10.gif");	  vern10 = newImage("siteimages/verein10.gif");
kont00 = newImage("siteimages/kontakt00.gif");	kont01 = newImage("siteimages/kontakt10.gif");	kont10 = newImage("siteimages/kontakt10.gif");
var pageHighlight = '';
var aktHighlight = '';

function init(){
	if(document.home.src.substr(document.home.src.length-6,2) == '10') pageHighlight = 'home';
	else if(document.ange.src.substr(document.ange.src.length-6,2) == '10') pageHighlight = 'ange';
	else if(document.stud.src.substr(document.stud.src.length-6,2) == '10') pageHighlight = 'stud';
	else if(document.aktu.src.substr(document.aktu.src.length-6,2) == '10') pageHighlight = 'aktu';
	else if(document.vern.src.substr(document.vern.src.length-6,2) == '10') pageHighlight = 'vern';
	else if(document.kont.src.substr(document.kont.src.length-6,2) == '10') pageHighlight = 'kont';
	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.ange.src = (pageHighlight != 'ange')? ange00.src : ange10.src;
		document.stud.src = (pageHighlight != 'stud')? stud00.src : stud10.src;
		document.aktu.src = (pageHighlight != 'aktu')? aktu00.src : aktu10.src;
		document.vern.src = (pageHighlight != 'vern')? vern00.src : vern10.src;
		document.kont.src = (pageHighlight != 'kont')? kont00.src : kont10.src;
	}
}

var angebot 	= new dropdown('angebot',80,100,'FFE1E1','FFCACA','BE0000',7);
var studio 	  = new dropdown('studio' ,80,170,'FFE1E1','FFCACA','BE0000',7);
var aktuell		= new dropdown('aktuell',80,260,'FFE1E1','FFCACA','BE0000',7);
var verein  	= new dropdown('verein' ,80,343,'FFE1E1','FFCACA','BE0000',7);
var kontakt 	= new dropdown('kontakt',80,399,'FFE1E1','FFCACA','BE0000',7);

