$(document).ready(function(){
      $(document).pngFix(); 
	  
	  //kundenauswahl
	 
	  $("#select_kundenwahl").change(function(){
	 //  alert(this.options[this.selectedIndex].value);
		  $(".tx-ambildergalerie-pi1 p.tx-ambildergalerie-pi1-listrowField-bild").fadeOut("slow");
		  $(".tx-ambildergalerie-pi1 p.listrowField-kunde_"+this.options[this.selectedIndex].value).fadeIn("slow");
		  if (this.selectedIndex==0){
		       $(".tx-ambildergalerie-pi1 p.tx-ambildergalerie-pi1-listrowField-bild").fadeIn("slow");
		  }
	  });
      //$(".tx-ambildergalerie-pi1 p.tx-ambildergalerie-pi1-listrowField-bild").
	  
	  
	  $(".tx-ambildergalerie-pi1").find("img").css({margin:"1"})
	  $(".tx-ambildergalerie-pi1 p.tx-ambildergalerie-pi1-listrowField-bild").hover(
		function(){
		 

      $(this).find("img").animate({
	      
		   
	   }, {queue:false,duration:50});
	      
    },
	function(){
	
      $(this).find("img").animate({
	    
	   
			 
			
			}, {queue:false,duration:50});
    }	
	
	);
	
	  
	  $('#content .scroll-pane').jScrollPane({scrollbarWidth: 8,dragMinHeight : 53, dragMaxHeight : 53});
	  
	  
	//scrollbar bei news
	$('#scrollbereich1').jScrollPane({scrollbarWidth: 8,dragMinHeight : 53, dragMaxHeight : 53});
	
	
	   $(".jScrollPaneTrack").css("opacity","0.5");
	  $(".jScrollPaneDrag").css("opacity","1");
    
	//$('.normallayout li ul').hide();
	$('.magiclist ul li').find("li:parent").addClass("last").end();
	  $('.magiclist ul li').not('.last').contents().filter(function() {
      return this.nodeType == 3;
    }).wrap('<a href="javascript:;"></a>');
	 
	// $('.normallayout ul a').click(
		// function(){
		// alert("jx");
				    // //$(this).hide(); 
				   // // $(this).find('a').css("color","#f3c000");
				   // // $(this).find('li').css("background","url(fileadmin/images/dreieck.gif) no-repeat 0px 3px");
				   // // $(this).parent().css( 
						// // "background","");
						// // return false;
		// } 
		// // function(){    
				  // // $(this).parent().find('ul').slideUp();
				  // // $(this).css("color","#ffffff");
				  // // $(this).find('a').css("color","#ffffff");
				  // // $(this).css("background","url(fileadmin/images/dreieck_weis.gif) no-repeat 0px 3px");
		// // }

	// ).next;
	
	$('.magiclist li').find('a').hover(function(){
			
			$(this).css( 
						"background","url(fileadmin/images/bg_hover.png)");
			$(this).css( 
						"width","300px");
						$(this).css( 
						"display","block");
							
			 $(this).parent().css("background","url(fileadmin/images/dreieck.gif) no-repeat 0px 3px");
	   },
	   function(){
			 $(this).css("background","");
			 $(this).parent().css("background","url(fileadmin/images/dreieck_weis.gif) no-repeat 0px 3px");
	   }
	);
	
	$('.magiclist ul li a').click(function() {
		$(this).next(':hidden').parent().addClass('ausgewaehlt');
	 $('.magiclist ul li a').not(this).next(':visible').toggle('slow');
		$('.magiclist ul li a').not(this).parent().removeClass('ausgewaehlt');
		$(this).next().toggle('slow');
		
		return false;
	}).next().hide();
	
	
	
	
	//news menü ein- und ausklappen
	   $("#newsdiv").hide();
	 	// $('#newsmenu a').hover(
		// function(){
				   
				  // // $(this).css("color","#f3c000");
				  // // $(this).css("background","url(fileadmin/images/news_pfeil_unten.gif) no-repeat");
				   // // $(this).css("backgroundPosition","62px 7px");
				   
		// },
		// function(){    
				 // $(this).css("color","#46859d");
				// $(this).css("background","url(fileadmin/images/news_pfeil_open.gif) no-repeat");
				   // $(this).css("backgroundPosition","62px 7px");
		// }

	// );
	$('#newsmenu a').toggle(
		function(){
				  $("#newsdiv").fadeIn();
				  
				  $(this).css("color","#f3c000");
				    $(this).css("background","url(fileadmin/images/news_pfeil_oben.gif) no-repeat");
				    $(this).css("backgroundPosition","62px 7px");
				  
				   
		},
		function(){    
				  $("#newsdiv").fadeOut();
				  $(this).css("color","#46859d");
				    $(this).css("background","url(fileadmin/images/news_pfeil_unten.gif) no-repeat");
				    $(this).css("backgroundPosition","62px 7px");
	 
		}

	);
	 // alert($("#newsdiv").css('display'));
	 
	 // if ($("#newsdiv:visible")){
		  // $("#newsmenu a").css("background","url(fileadmin/images/news_pfeil_unten.gif) no-repeat");
	      // $("#newsmenu a").css("backgroundPosition","62px 7px");
	 	  
	 
	 // }
	 
	  
	 

	//hover für die news Bilder
	$("div#scrollbereich1 div.left").hover(
		function() {
			var hoehe;
			var offset = $(this).parent().offset();
			hoehe= offset.top;
		    if(hoehe<500){
			
			$(this).parent().find(".pic").stop()
				.animate({left: "32", opacity:1}, "slow")
				.css("display","block");
			}
				$(this).parent().css("background","url(fileadmin/images/grau.gif) repeat-y");

		}, function() {
			 
			$(this).parent().find(".pic").stop()
				.animate({left: "15", opacity: 0}, "slow");
			$(this).parent().css("background","url(fileadmin/images/weis.gif) repeat-y");	
		 	 
	});
	
	//news  Problem mit Layergröße 
		$("#newsdiv").mousemove(function(e){
			if(e.pageX>200){
				
				$("#content").css("zIndex","20");
			}else{
				$("#content").css("zIndex","5");
			}  
		});
	 
	
	//hintergrundbild maximieren
	$.fn.supersized.options = {  
				startwidth: 1280,  
				startheight: 1024,
				 
				vertical_center: 1,
				slideshow: 0,
				navigation: 0,
				transition: 0, //1-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
				pause_hover: 0,
				slide_counter: 0,
				slide_captions: 0,
				slide_interval: 3000  
			};
	$('#supersize').supersized();
	
	
});
