$(document).ready(function() {
	
//SHOW	
	$('#mainslide').show();
	$('#tabvanilla').show();
	$('#newsbilderslide').show();
	$('#artikelbilderslide').show();
	$('#filialbilderslide').show();
	$('#inhaltslide').show();
	$('#produktionsstatte_slide').show();
	$('#unternehmen_slide').show();
	$('#productlistslide').show();
	
	
	//$('#artikelbilderslide').css('z-index','1000');
	//$('#artikelbilderslide').css('position','relative');

//BROWSER DETECT / LOGO POSITION
	var isBrowserIE=false;
	var browserVer = 0.0;
	jQuery.each(jQuery.browser, function(i, val) {
/*		
		if(i!="msie" && jQuery.browser.version.substr(0,3)=="1.9"){
			$('#logo').show();
			$('#logoCafe').show();
			isBrowserIE=false;
		} else {
			isBrowserIE=true;
		}
		browserVer=parseInt(jQuery.browser.version);
*/
      });
	
	if (isBrowserIE && browserVer==6){
		$('#topmenuMain').width(845);
	}
	
	//if (isBrowserIE){
		setLogo();
	//}
	   
	function setLogo() {
		var pos = $('#topimgslide').position();
		var winWidth = pos.left;
		//var winWidth = $(window).width();
		//var winHeight  = $(window).height();
		$('#logo').css('top',12);
		$('#logo').css('left',winWidth+3);
		
		$('#logo').show();
		
		$('#logoCafe').css('top',160);
		$('#logoCafe').css('left',winWidth+715);
		$('#logoCafe').show();
	};
	   
	var resizeTimer = null;
	$(window).bind('resize', function() {
		if (isBrowserIE){
			if (resizeTimer) clearTimeout(resizeTimer);
		    	resizeTimer = setTimeout(setLogo, 100);
		}
	});

//SLIDE	
	$('#mainslide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000 
	});
	
	$('#productlistslide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000 
	});
	
	
	$('#newsbilderslide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000 
	});
	
	$('#artikelbilderslide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000
	    //,
	    //cssAfter: {  
        //	zIndex: 0  
    	//}
	});
	
	$('#inhaltslide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000
	    //,
	    //cssAfter: {  
        //	zIndex: 0  
    	//}
	});
	
	$('#produktionsstatte_slide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000
	    //,
	    //cssAfter: {  
        //	zIndex: 0  
    	//}
	});
	
		$('#unternehmen_slide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000
	    //,
	    //cssAfter: {  
        //	zIndex: 0  
    	//}
	});
	
	$('#filialbilderslide').cycle({
	    fx:    'fade', 
	    speed:  2500,
	    pause:  1,
	    timeout:  4000 
	});
	

//SELECTION 
     $('.selection').hover(
      function () {
        $(this).animate({ opacity: "0.5" });
        $(this).addClass("cursor_hand");
      }, 
      function () {
        $(this).animate({ opacity: "1" }, "fast")
        $(this).removeClass("cursor_hand");
      }
    );
     
     $('.selection2').hover(
    	      function () {
    	        $(this).animate({ opacity: "0.3" });
    	        $(this).addClass("cursor_hand");
    	      }, 
    	      function () {
    	        $(this).animate({ opacity: "1" }, "fast")
    	        $(this).removeClass("cursor_hand");
    	      }
    	    );

   //Filialitem 
        $('.filialitem').click(
         function () {
        	 window.location = $(this).parent().attr("href");
        	 return false;
         } 
       );
        
   //Productitem 
   $('.productitem').click(
		   function () {
			   window.location = $(this).parent().attr("href");
			   return false;
		   } 
   );
    
    

});
