jQuery.noConflict();

jQuery(document).ready(function($) {

    /* z-index fix for IE7 and up */
    if(jQuery.browser.msie) {
        var zIndexNumber = 1000;
        $('div').each(function() {
            $(this).css('zIndex', zIndexNumber);
            zIndexNumber -= 10;
        });

	$('img.ie_imagefix').each(function() {
		$(this).click(function(event) {
			event.preventDefault();
			var l = $(this).parents('a').first();
			if(l) {
				window.location.href = '/' + l.attr('href');
			}
		});
	});
    }
    
	/* Language Menü */
	jQuery("#lang-switch").mouseenter(
		function(){
			$("#langwrap").removeClass().addClass("act");
			$("#dropdown-language").fadeIn(100);
			tlang = setTimeout(function(){
				$("#langwrap").removeClass().addClass("pas");
				$("#dropdown-language").fadeOut(150);                                            
			}, 3500); // adjust your time here 
		}
	);
	jQuery("#dropdown-language").mouseleave(
		function(){
			clearTimeout(tlang);
			$("#langwrap").removeClass().addClass("pas");
			$("#dropdown-language").fadeOut(150);
		}
	);
	
	/* Searchbox Radio-Buttons ersetzen */
	jQuery("#searchtype-product,#searchtype-keyword").uniform();
	
	/* Searchbox Standardwert (Variablen aus Header) */
	jQuery("#searchform").attr("action",searchlinkproconut);
	jQuery("#searchform .sword").attr("name","tx_proconut_main[sword]");
		
	/* Searchbox Typ-Auswahl */
	jQuery("#uniform-searchtype-product").click(
		function(){
			$("#searchform").attr("action",searchlinkproconut);
			$("#searchform .sword").attr("name","tx_proconut_main[sword]");
		}
	);
	jQuery("#uniform-searchtype-keyword").click(
		function(){
			$("#searchform").attr("action",searchlinkindexed);
			$("#searchform .sword").attr("name","tx_indexedsearch[sword]");
		}
	);
	
	
	/* Hauptnavigation */
	var mainnavconfig = {
		over: function () {
					$(this).removeClass().addClass("act");
					if($("a",this).attr("class") == "produkte-und-leistungen"){
						$("#dropdown-matrix").fadeIn(400); // Matrix einblenden
						$(this).removeClass().addClass("act");	
					}
					else {
						$("#dropdown-matrix").fadeOut(150); // Matrix ausblenden
						$(this).find(".sub").css("display","block");
					}
				},
		timeout: 200,
		sensitivity: 7,
		out: function () {
					$(this).removeClass().addClass("pas");
					if($("a",this).attr("class") == "produkte-und-leistungen"){				
						$("#dropdown-matrix").fadeOut(150); // Matrix ausblenden                                         
					}
					else {
						$(this).children(".sub").css("display","none");
					}
				}
	};
	
	jQuery("#navigation li").hoverIntent( mainnavconfig );
	
	
	
	/* Hauptnavigation neu */
	/* WIP, 31.03.2010, DOH */
	jQuery('a.produkte-und-leistungen').after(jQuery('#dropdown-matrix'));
	

/* BACKUP!
	jQuery("#navigation li").mouseenter(
		function(){
			if($("a",this).attr("class") == "produkte-und-leistungen"){
				$("#dropdown-matrix").fadeIn(100); // Matrix einblenden
				$(this).removeClass().addClass("act");
				tprod = setTimeout(function(){
					$("#dropdown-matrix").fadeOut(150); // Matrix ausblenden
					$(this).removeClass().addClass("pas");                                           
				}, 3500); // adjust your time here
				
				$("#dropdown-matrix").mouseleave(
					function(){
						clearTimeout(tprod);
						$("#dropdown-matrix").fadeOut(150); // Matrix ausblenden
						$(this).removeClass().addClass("pas");
					}
				);
				
			}
			else {
				clearTimeout(tprod);
				$("#dropdown-matrix").fadeOut(150); 
				$(this).find(".sub").css("display","block");
				$(this).removeClass().addClass("act");
			}
		}
	);
	jQuery("#navigation li").mouseleave(
		function(){
			$(this).children(".sub").css("display","none");
			$(this).removeClass().addClass("pas")
		}
	);
	
	/*
	
	
	/* Dimensionen Box */
	var dimensionsconfig = {
		over: function () {
			var thisclass = $(this).attr('class');
			var elementToShow = $('div#dimensionboxes div.'+thisclass);
			var elementsToHide = $('div#dimensionboxes div').not('.'+thisclass);
			
			elementsToHide.animate({opacity: 0,top: '-270px'}, 900);
			
			if($(this).parent().hasClass('active') !== true) {
				elementToShow.css({'top': '40px', 'display': 'block'});	
				elementToShow.animate({opacity: 1, top: '0px'}, 1000);
			}
	
			
			$(this).closest('ul').find('li').removeClass('active');
			$(this).parent().addClass('active');
				},
		timeout: 200,
		sensitivity: 9
	};
	
	jQuery("#dimensions ul li a").hoverIntent( dimensionsconfig );
	
	
	
	/* STAGE IMAGE CYCLE */
	/* WIP, 31.03.2010, DOH */
	var arrow_src_right = 'fileadmin/templates/_gfx/icon-stage-arrowright.png';
	var arrow_src_left = 'fileadmin/templates/_gfx/icon-stage-arrowleft.png';
	var arrow_class = 'stagearrow';	
	jQuery('#stagewrap').prepend('<img id="prev" src="'+arrow_src_left+'" class="'+arrow_class+'" />').append('<img id="next" src="'+arrow_src_right+'" class="'+arrow_class+'" />');
	jQuery("#stage").cycle({
		fx:      'fade',
		speed:   1200,
		prev:    '#prev',
		next:    '#next',
		pause: true,
		timeout: 5000
	});
	jQuery("#stagewrap").hover(
		function () {
			jQuery(this).find('.'+arrow_class).animate({'opacity':'0.9'}, 400).css('cursor','pointer');
		},
		function () {
			jQuery(this).find('.'+arrow_class).animate({'opacity':'0.1'}, 600);
		}
	);
	/* STAGE IMAGE CYCLE */
	
	
	jQuery("#referenzteaser div").cycle({
		fx:      'fade',
		speed:   1200,
		prev:    '#prev',
		next:    '#next',
		pause: true,
		slideExpr: 'div',
		timeout: 5000
	});
	
	
	
});