function secondlevelmenu()
{
// Breite der li holen, damit a mit position:absolute an gleicher Stelle bleibt
	$$("#secondlevelmenu a.lvl1").each(function(slm_el){
		slm_el.up(0).style.width = slm_el.getWidth() + 1 + "px";
		if  ( slm_el.next(0) ){
			if ( slm_el.next(0).match("ul") )
			slm_el.next(0).style.width = "auto";
		}
	})

// Level 3 entfernen
	$$("#secondlevelmenu a.lvl3").each(function(slm3_el){
		slm3_el.up(1).remove();
	})
}
function emptyfield(my_el, my_value) {
	my_el = $(my_el);
	if (my_el) {
		this.value = my_value;
		my_el.onfocus = function(){
			this.value = (this.value == my_value) ? '' : this.value;
		}
		my_el.onblur = function(){
			this.value = (this.value.match(/\S/)) ? this.value : my_value;
		}
	}
}

function boxes(){
	var home = $('home');
	if (home) {
		var boxes = $$('.locations .box');
		boxes.each(function(el) {
			el.down().onmouseover = function () {
				boxes.each(function(el) {
					el.removeClassName('active');
				});
				el.addClassName('active');
			}
		});
		boxes[0].addClassName("active");
		boxes[2].addClassName("last");
	}
}

function linked_boxes(box){
	var box = $(box);
	if (box) {
		var box_link = box.select('a');
		box.onclick = function(){
			location.href = box_link;
		}	
	}
}


function height()
{
	var sub = $('sub');
	if ( sub ) {
		var content = $('sub').down('div.content');
		var right_content = $('sub').down('div.right-content');
		if (content && right_content)
		{
			var offset = 40;
			var c_h = parseInt(content.getHeight() - offset);
			var r_h = parseInt(right_content.getHeight());
			if (r_h > c_h)
			{
				content.setStyle({height: r_h - offset + 'px', minHeight: r_h - offset + 'px'});
			}		}
	}
}


function init()
{
	boxes();
	linked_boxes('serviceplus');
	linked_boxes('salesplus');
	height();
	//emptyfield("quicksearchtoken","Suchbegriff eingeben");
		//secondlevelmenu();
	if ( !Prototype.Browser.IE6 ) 
	{
		// nothing to do so far ...	
	}
}
document.observe("dom:loaded", function()
{
	init();
});

