if (typeof webRoot == 'undefined'){
	if (location.protocol  == 'https:'){
		var webRoot = "https://localhost/test/squash24/images/";
	} else {
		var webRoot = "http://localhost/test/squash24/images/";
	}
}

bestell_00 = new Image();		bestell_00.src = webRoot + "konto/bar_cart00.gif";
bestell_01 = new Image();		bestell_01.src = webRoot + "konto/bar_cart01.gif";

function bildwechsel(name) {
	zustand = document.images[name].src;
	zustand = zustand.slice(zustand.length-6,zustand.length-4);
	if (name == "bestell") {
		zustandneu = (zustand == "00") ? "01" : "00";
		document.images[name].src = eval(name + "_" + zustandneu + ".src");
	} else {
		zustandneu = (zustand == "00") ? "01" : "00";
		document.images[name].src = eval(name + "_" + zustandneu + ".src");
	}
}

// var webRoot = "";

var ns = (document.layers) ? true : false; 
var ie = (document.all) ? true : false;
var mz = (document.getElementById && (window.innerWidth > 0)) ? true : false; //Mozilla/Opera
if(mz) ie = false;

if (mz){
	var myoffset = parseInt((window.innerWidth - 974)/974);
	if (myoffset < 0) myoffset = 0;
	document.getElementsByTagName("body")[0].style.marginLeft = myoffset+"px";
}

// 
function getOperaOffset(offset)
{
	if (navigator.userAgent.search(/Opera/) != -1)
		offset += parseInt((window.innerWidth - 974)/974);
	return offset;
}

var menuArray = new Array();
var breitenArray = new Array();
var initStat = false;
var dropdownBreite = 150;


// ** Dropdown Object ***************************************************
function dropdown(name,offX,offY,bgc,hic,txtc,txts,bwidth,menueRichtung){

	this.theName = name;
	this.offsetX = offX;
	this.offsetY = offY;
	this.popupCoord = offY;
	this.bgfarbe = bgc;
	this.highfarbe = hic;
	this.txtfarbe = txtc;
	this.txtsize = txts;
	this.leerwidth = bwidth;
	this.menueRichtung = menueRichtung;
	this.dataSize = eval(this.theName+'Data.length');
	
	this.expand = dropdown_expand;
	this.high = dropdown_high;
	this.unhigh = dropdown_unhigh;
	this.constuct = dropdown_constructor;
	// Other : Get the width of the Reiter, to count the width of the topPullDown Line
	breitenArray[breitenArray.length] = this.offsetY;
	this.constuct();
}


// Objects are declared here
// dropdown (name, Pos top, Pos left, backgroundcolor, highlightcolor, fontcolor, fontsize, buttonwidth, menueRichtung)
var konto 			= new dropdown('konto',23, getOperaOffset(510),'E0E0E0','B0B0B0','000000',11,0,'r');
var service 		= new dropdown('service',23,getOperaOffset(665),'FFF9DE','FFE87E','000000',11,0,'r');

if (mz){
var konto 			= new dropdown('konto',23, getOperaOffset(509),'E0E0E0','B0B0B0','000000',11,0,'r');
var service 		= new dropdown('service',23,getOperaOffset(664),'FFF9DE','FFE87E','000000',11,0,'r');
}

if (navigator.userAgent.search(/Opera/) != -1){
var konto 			= new dropdown('konto',23, getOperaOffset(509),'E0E0E0','B0B0B0','000000',11,0,'r');
var service 		= new dropdown('service',23,getOperaOffset(664),'FFF9DE','FFE87E','000000',11,0,'r');
}
// ** Dropdown Popup ****************************************************
// the Menu is displayed 
// Every Dropdown consists of one Containerlayer that
// holds one cascaded layer for every entry

function dropdown_expand(){
	if(initStat){
		menuCollaps();
		this.unhigh();
		if(ns)	{
			switch(this.theName)
			{
				case 'konto': 			this.popupCoord = (document.images['kont'].x); break;
				case 'service': 			this.popupCoord = (document.images['serv'].x); break;
			}
			document.layers[this.theName+'Container'].visibility = "show";
			if (this.menueRichtung == "l") {
				document.layers[this.theName+'Container'].left = (this.popupCoord - (dropdownBreite - this.leerwidth - 1));
			} else {
				document.layers[this.theName+'Container'].left = this.popupCoord;
			}
		}
		if(ie) {
			this.popupCoord = logo.offsetLeft+this.offsetY;
			if (this.menueRichtung == "l") {
				document.all[this.theName+'Container'].style.left = (this.popupCoord - (dropdownBreite - this.leerwidth - 1));
			} else {
				document.all[this.theName+'Container'].style.left = this.popupCoord;
			}
			document.all[this.theName+'Container'].style.visibility = "visible";
		}
		if(mz){
			this.popupCoord = document.getElementById('logo').offsetLeft+this.offsetY;
			if (this.menueRichtung == "l") {
				document.getElementById(this.theName+'Container').style.left = (this.popupCoord - (dropdownBreite - this.leerwidth - 1));
			} else {
				document.getElementById(this.theName+'Container').style.left = this.popupCoord;
			}
			document.getElementById(this.theName+'Container').style.visibility = "visible";
		}
	}
}
// ** End of Dropdown Popup *********************************************
// ** Dropdown Highlight Functions **************************************
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 (ns) eval('window.document.'+this.theName+'Container.document.layers[\''+this.theName+i+'\'].bgColor = \''+this.bgfarbe+'\'');
		if (ie) eval(this.theName+i+'.style.backgroundColor = \''+this.bgfarbe+'\'');
		if (mz) document.getElementById(this.theName+i).style.backgroundColor = this.bgfarbe;
	}
}
// ** End of Dropdown Highlight Functions *******************************



// ** Object Constructor ************************************************
// HTML Code and Styles are generated
// Every Dropdown consists of one Containerlayer that
// holds one cascaded layer for every entry
// **********************************************************************
function dropdown_constructor(){
	// HTML-Layers
	this.codeString = '<div id=\"'+this.theName+'Container\" onMouseOver=\"window.clearTimeout(zu);\">\n';
	this.codeString += '<a href=\"'+eval(this.theName+'Data[0][1]')+'\" onMouseOver=\"'+ this.theName+'.high(0); window.clearTimeout(zu);\">';
	if (this.menueRichtung == "r") {
		if(this.leerwidth != "0") {
			this.codeString += '<img src=\"'+webRoot+'konto/clear.gif\" width=\"' + (this.leerwidth + 1) + '\" height=\"1\" border=\"0\">';
		}
		this.codeString += '<img src=\"'+webRoot+'konto/konto_dot.gif\" width=\"' + (dropdownBreite - 1 - this.leerwidth) + '\" height=\"1\" border=\"0\"></a>';
	} else {
		if(this.leerwidth != "0") {
			this.codeString += '<img src=\"'+webRoot+'konto/konto_dot.gif\" width=\"' + (dropdownBreite - 1 - this.leerwidth) + '\" height=\"1\" border=\"0\">';
		}
		this.codeString += '<img src=\"'+webRoot+'konto/clear.gif\" width=\"' + (this.leerwidth + 1) + '\" height=\"1\" border=\"0\"></a>';
	}
	for(i=0;i<this.dataSize;i++){
		this.codeString += '<div id=\"'+this.theName+i+'\" align=\"left\" onMouseOver=\"window.clearTimeout(zu);\">';
		this.codeString += '<img src=\"'+webRoot+'konto/clear.gif\" width=\"6\" height=\"13\" border=\"0\">';
		this.codeString += '<a href=\"'+eval(this.theName+'Data['+i+'][1]')+'\" onMouseOver=\"'+ this.theName+'.high('+i+'); window.clearTimeout(zu);\" class="dropdowntext'+this.theName+'">';
		this.codeString += eval(this.theName+'Data['+i+'][0]');
		this.codeString += '<br><img src=\"'+webRoot+'konto/clear.gif\" width=\"'+(dropdownBreite - 2)+'\" height=\"1\" border=\"0\"></a></div>\n';
	}
	this.codeString += '<img src=\"'+webRoot+'konto/bg_menu_' + this.theName + '.gif" width=\"'+dropdownBreite+'\" height=\"6\"><br>\n';
	this.codeString += '<img src=\"'+webRoot+'konto/konto_bottom.gif\" width=\"'+dropdownBreite+'\" height=\"3\"></div>\n\n';
	
	// HTML-Styles
	this.styleString = '<style type=\"text/css\">\n';
	this.styleString += '#'+this.theName+'Container{position: absolute; top:'+this.offsetX+'px; left:'+this.offsetY+'px; width:'+dropdownBreite+'px; visibility:hidden; z-index:10;';
	this.styleString += (ns)? ' layer-background-image:url(\"'+webRoot+'konto/bg_menu_'+this.theName+'.gif\");}\n':' background:url(\"'+webRoot+'konto/layer_bg_'+this.theName+'.gif\");}\n';

	for(i=0;i<this.dataSize;i++){
		if(ns) this.styleString += '#'+this.theName+i+'{position: relative; left:1px; font-size: '+this.txtsize+'px; layer-background-color:#'+this.bgfarbe+'; z-index:5;}\n'
		if(ie) this.styleString += '#'+this.theName+i+'{position: relative; width:'+(dropdownBreite - 2)+'px; font-size: '+this.txtsize+'px; background-color:#'+this.bgfarbe+'; z-index:5;}\n'
		if(mz) this.styleString += '#'+this.theName+i+'{position: relative; width:'+(dropdownBreite - 2)+'px; left:1px; font-size: '+this.txtsize+'px; backgroundColor:#'+this.bgfarbe+'; z-index:5;}\n'
	}
	this.styleString += '.dropdowntext'+this.theName+':link{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;  text-decoration: none; color:'+this.txtfarbe+'}\n';
	this.styleString += '.dropdowntext'+this.theName+':visited{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;  text-decoration: none; color:'+this.txtfarbe+'}\n';
	this.styleString += '.dropdowntext'+this.theName+':active{font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;  text-decoration: none; color:'+this.txtfarbe+'}\n';
	this.styleString += '</style>\n';

	// Other
	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;');
	if(mz) eval("document.getElementById('"+this.theName+"Container').onmouseout = dropdown_mouseLeave");

	
}
// ** End of Object Constructor. *******************************************



// function dropdown_mouseLeave() {zu = window.setTimeout('alert(zu)',500);}
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 Resize Bugfix **********************************************
window.onresize = resize;
window.saveInnerWidth  = window.innerWidth; 
window.saveInnerHeight = window.innerHeight;

function resize() {
    if (saveInnerWidth != window.innerWidth || saveInnerHeight != window.innerHeight ) document.location.reload();
}
// ** End of Window Resize Bugfix ***************************************

kont00 = new Image(); 	kont00.src = webRoot+"konto/bar_konto00.gif";		kont01 = new Image(); 	kont01.src = webRoot+"konto/bar_konto10.gif";		kont10 = new Image(); 	kont10.src = webRoot+"konto/bar_konto10.gif";
serv00 = new Image(); 	serv00.src = webRoot+"konto/bar_info00.gif";		serv01 = new Image(); 	serv01.src = webRoot+"konto/bar_info10.gif";		serv10 = new Image(); 	serv10.src = webRoot+"konto/bar_info10.gif";

var pageHighlight = '';
var aktHighlight = '';

function init(){
	if(document.kont.src.substr(document.kont.src.length-6,2) == '10') pageHighlight = 'konto';
	else if(document.serv.src.substr(document.serv.src.length-6,2) == '10') pageHighlight = 'serv';
	initStat = true;
}

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

function unhighlightHeadMenu(){
	if(initStat){
		document.images["kont"].src = (pageHighlight != 'kont')? kont00.src : kont10.src;
		document.images["serv"].src = (pageHighlight != 'serv')? serv00.src : serv10.src;
	}
}




