var overWhite = function (e) {
	e.target.set('morph', {link: 'chain', duration: 100, transition: 'elastic:out'});	
e.target.morph({'color':'#333333', 'background-color': '#c0bfc0', 
'background-repeat':'no-repeat'});	

	//'background-image': 'url(bilder/site/markew.jpg)', 
}

var outGray = function (e) {
	e.target.set('morph', {link: 'chain', duration: 500, transition: 'sine:in'});	
e.target.morph({'color':'#444444', 'background-color': '#cacaca'});	
//, 'background-image': 'none'
}

var outGray2 = function (e) {
	e.target.set('morph', {link: 'chain', duration: 500, transition: 'sine:in'});	
e.target.morph({'color':'#444444', 'background-color': '#d8d6d6'});	
//, 'background-image': 'none'
}

var allHover = function (togg) {
        tagg = togg;//.getElements('llevel_2');
     // tagg.setStyle('display','none');
	//tagg.setStyle('background-color','#f00');
        tagg.addEvent('mouseover', overWhite);
        tagg.addEvent('mouseout', outGray);
	//togg.addEvent('click', outGray);

}

var allHover1 = function (togg) {
        tagg = togg;//.getElements('llevel_2');
     // tagg.setStyle('display','none');
	//tagg.setStyle('background-color','#f00');
        tagg.addEvent('mouseover', overWhite);
        tagg.addEvent('mouseout', outGray2);
	//togg.addEvent('click', outGray);

}

var clearInput = function (e) {
        //alert('hallo');
	e.target.set('value','');
        e.target.removeEvents('click', clearInput);	
}

var orangeFade = function (togg) {
        togg.setStyle('opacity','0');
//togg.setStyle('margin-left','-25px');
togg.set('morph', {link: 'chain', duration: 500, transition: 'sine:in'});	
togg.morph({'opacity':'1'});	
//, 'margin-left':'0'
}

var resize = function (e) {
     
     //alert('hallo');
    // alert (left.getStyle('height'));
	main.setStyle('height', tabcontrol.getStyle('height'));
	//alert (tabcontrol.getStyle('height'));
}
var buttonsMouse = function(button) {
	if (button.getElements('img')) {
		button = button.getElements('img');
		
		button.addEvent('mouseover', buttonHover);
		button.addEvent('mouseout', buttonNormal);
	}
}

var buttonHover = function (e) {
	var bild = e.target;
	bild.setStyle('opacity', .8);
	//var orgY = bild.getStyle('margin-top').toInt();
	//bild.setStyle('border-top-width', '0px');
	//bild.setStyle('border-bottom-width', '2px');
	/*var orgWidth = bild.getStyle('width').toInt();
	var orgHeight = bild.getStyle('height').toInt();
	bild.setStyle('width', (orgWidth * 1.01) + 'px');
	bild.setStyle('height', (orgHeight * 1.01) + 'px');*/
	
}

var buttonNormal = function (e) {
	var bild = e.target;
	bild.setStyle('opacity', 1);
	//bild.setStyle('border-top-width', '1px');
	//bild.setStyle('border-bottom-width', '1px');
	/*var orgWidth = bild.getStyle('width').toInt();
	var orgHeight = bild.getStyle('height').toInt();
	bild.setStyle('width', (orgWidth * .99) + 'px');
	bild.setStyle('height', (orgHeight * .99) + 'px');*/
}

var container;
var main;
var left;
var tabcontrol;
window.addEvent('domready', function() {
	var toggler = $$('.llevel_2');
	toggler.each(allHover);
        var llevel1 = $$('.llevel_1');
        llevel1.each(allHover1);
        var suche = $('ctrl_keywords');
        if (suche.get('value') == '') {
           suche.set('value','Suche');
           suche.addEvent('click', clearInput);
        }

        var orange = $$('.active');
        orange.each(orangeFade);
        
        
        
        var buttons = $$('a');
        buttons.each(buttonsMouse);
      /*   main = $('main');
         left = $('left');
         container = $('container');
         tabcontrol = $('abfallinfo');
         if (tabcontrol) {tabcontrol.addEvent('click', resize);}
       // alert (left.getStyle('height') + ' +++ ' + main.getStyle('height'));
       
       if (left.getStyle('height') > main.getStyle('height')) {
       		main.setStyle('height', left.getStyle('height'));
       }
       */
	//toggler[0].setStyle('background-color','#f00');
	//toggler[0].removeEvent('mouseout', outGray2);
	//alert(toggler);
});
