document.observe("dom:loaded", function() {
	/* Neuer Button (Facelift 2011) */
	$$(".new_button").each( function(new_button) {

		Event.observe(new_button, 'mouseover', function() {
			new_button.addClassName('hover');
		});

		Event.observe(new_button, 'mouseout', function() {
			new_button.removeClassName('hover');
		});
	});

	$$(".new_button_large").each( function(new_button_large) {

		Event.observe(new_button_large, 'mouseover', function() {
			new_button_large.addClassName('hover');
		});

		Event.observe(new_button_large, 'mouseout', function() {
			new_button_large.removeClassName('hover');
		});
	});

  	// set all submenu backgrounds to semi-transparency
	  $$('.submenu_spacer').each(function(o){
    		o.setOpacity(0.98);
	});
	$$('.av_size').each(function(c){
		c.setOpacity(0.9);
	});

	if($('advantage_menu_layer') != null) $('advantage_menu_layer').setOpacity(0.0);

	if($('menue2') != null) $('menue2').setOpacity(0.7);
	if($('menue3_container1_popup') != null) $('menue3_container1_popup').setOpacity(0.0);
	if($('menue3_container2_popup') != null) $('menue3_container2_popup').setOpacity(0.0);
	if($('menue3_container3_popup') != null) $('menue3_container3_popup').setOpacity(0.0);
	if($('menue3_container4_popup') != null) $('menue3_container4_popup').setOpacity(0.0);
	if($('menue3_container1_popup_container') != null) $('menue3_container1_popup_container').setOpacity(0.0);
	if($('menue3_container2_popup_container') != null) $('menue3_container2_popup_container').setOpacity(0.0);
	if($('menue3_container3_popup_container') != null) $('menue3_container3_popup_container').setOpacity(0.0);
	if($('menue3_container4_popup_container') != null) $('menue3_container4_popup_container').setOpacity(0.0);
	if($('basket') != null){
		$('basket').observe('mouseover',function(){this.setStyle({'fontWeight':'bold'})});
		$('basket').observe('mouseout',function(){this.setStyle({'fontWeight':'normal'})});
	}

});

/*
 * definition for banner-fade
 */
var bannerFadeLow       = 1.0;
var bannerFadeHigh      = 1;
var bannerFadeDuration  = 0.5;

function myAccount_hover(pBool) {
	if (pBool)
	{
        Element.clonePosition('sign_in', 'myAccount', {setLeft:true, setTop:false, setWidth:false, setHeight:false, offsetLeft:-120, offsetTop:24});
		$('sign_in').style.display = 'block';
	}
    else
	{
		$('sign_in').style.display = 'none';
	}
}

function SetLanguageCountry () {
	alert('changing country request detected.');
}

function SetLanguage () {
	document.LanguageForm.submit();
}

function mouseX(evt)
{
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX)
	   return evt.clientX + (document.documentElement.scrollLeft ?
	   document.documentElement.scrollLeft :
	   document.body.scrollLeft);
	else return null;
	}
function mouseY(evt)
{
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
	   return evt.clientY + (document.documentElement.scrollTop ?
	   document.documentElement.scrollTop :
	   document.body.scrollTop);
	else return null;
}

function addEvent(obj, evType, fn)
{
	 if (obj.addEventListener){
	   obj.addEventListener(evType, fn, false);
	   return true;
	 } else if (obj.attachEvent){
	   var r = obj.attachEvent("on"+evType, fn);
	   return r;
	 } else {
	   return false;
	 }
}

function fadefx(element, mode)
{
    if (mode == 'out')
        return new Effect.Morph(element,
                { duration:bannerFadeDuration, style:'opacity:' + bannerFadeLow });
    else
        return new Effect.Morph(element,
                { duration:bannerFadeDuration, style:'opacity:' + bannerFadeHigh });
}

/*
 * Globale Variable für iPhone und iPad-Erkennung
 */

var isiDevice = navigator.userAgent.match(/iPad|iPhone/i) != null;

if(isiDevice)
{


	$$(".sidemenu_category_link").each(function(element){
		observe('touchstart', function(){
		});
	});

	$$(".topmenu_submenu_link").each(function(element){
		observe('touchstart', function(){
		alert('test');
		});
	});

	$$(".topmenu_submenu").each(function(element){
		observe('touchstart', function(){
		alert('test');
		});
	});
}

