jQuery(document).ready(function() { 
    //jQuery("#herstellerSlider").scrollable().mousewheel(50);
	
	jQuery('#audio').toggle(
			function(){
				jQuery('#audio img').attr('src', 'fileadmin/assets/img/sound-on.png');
			},
			function(){
				jQuery('#audio img').attr('src', 'fileadmin/assets/img/sound-off.png');
			}
	);
	
	bottomAPI =  jQuery("#herstellerSlider").scrollable({
		 clickable: false,
		 keyboard: false
	}).circular().mousewheel().autoscroll({      //.circular()
	    autoplay: true, 
	    api: true,
	    steps: 3,
	    interval: 2500,
	    vertical: false
	}); 

  //bottomAPI =  jQuery("#herstellerSlider").scrollable({api: true});
  jQuery("#bottomRight").click(function(){ bottomAPI.pause();   bottomAPI.move(3); bottomAPI.stop(); }).css("cursor", "pointer"); 
  jQuery("#bottomLeft").click(function(){   bottomAPI.pause(); bottomAPI.move(-3); bottomAPI.stop(); }).css("cursor", "pointer"); 

  
	
  
  topAPI =  jQuery("#geraeteSlider").scrollable({  clickable: false, keyboard: false, vertical: false }).circular().mousewheel().autoscroll({
				  autoplay: false, 
				  api: true,
				  steps: 2,
				  interval: 2500000,
				  vertical: false
				});  
				
			
//  jQuery("#geraeteSlider").scrollable({  clickable: false, keyboard: false, vertical: false, steps: 3 }).circular().mousewheel();

  //console.log(topAPI);
  //bottomAPI =  jQuery("#herstellerSlider").scrollable({api: true});
  jQuery("#topRight").click(function(){ topAPI.pause();   topAPI.move(2); topAPI.stop(); }).css("cursor", "pointer"); 
  jQuery("#topLeft").click(function(){   topAPI.pause(); topAPI.move(-2); topAPI.stop(); }).css("cursor", "pointer"); 

   


  
  //functions und Variablen für die Startseite
  
  
  ////var clicked = false;
   
    
   initMain();
   
   /*
   jQuery('#topSlider li .mo').click( function(){
   		var temp = this.id.split('_');
   		var id = temp[1];
   		clicked = true;
   		
   		jQuery('#infoKasten').empty();
   		jQuery('#info_' + id).clone().appendTo('#infoKasten');
   		jQuery('#infoKasten #info_' + id).show(); 	  
   		initMain();
   		
   		
   		jQuery('#picPrev').empty();
    	jQuery('#bigPic_' + id).clone().appendTo('#picPrev');
    	jQuery('#picPrev #bigPic_' + id).fadeIn();
    	
    	jQuery('#picPrevHer').empty();
    	jQuery('#herName_' + id).clone().appendTo('#picPrevHer');
    	jQuery('#picPrevHer #herName_' + id).fadeIn();
     });
	
	*/
   jQuery('#topSlider li').css("cursor", "pointer").hover(
	function() 
	{
		var temp = this.id.split('_');
   		var id = temp[1];
   		
		////if(clicked == false)
		////{
			
	   		jQuery('#infoKasten').empty();
	   		jQuery('#info_' + id).clone().appendTo('#infoKasten');
	   		jQuery('#infoKasten #info_' + id).show();
	   		jQuery('#infoKasten').fadeIn();
	   		initMain();

	   		jQuery('#picPrev').empty();
	    	jQuery('#bigPic_' + id).clone().appendTo('#picPrev');
	    	jQuery('#picPrev #bigPic_' + id).fadeIn();
	    	
	    	jQuery('#picPrevHer').empty();
	    	jQuery('#herName_' + id).clone().appendTo('#picPrevHer');
	    	jQuery('#picPrevHer #herName_' + id).fadeIn();
		////}
		
	},
	
	function() 
	{
		////if(clicked == false)
			jQuery('#infoKasten').hide();
		
	});
   
   jQuery('#topSlider li:first-child').triggerHandler('mouseover');
   jQuery('#infoKasten').hide();
   
   function initMain()
   {
	   jQuery(".geraeteGroup").css("cursor", "pointer").fancybox({ "zoomSpeedIn": 300, "zoomSpeedOut": 300, "overlayShow": true, "autoScale": false }); 
	  //// jQuery('#infoKasten .close').css("cursor", "pointer").click(function(){   clicked = false; jQuery('#infoKasten').fadeOut();    });
   }
   
   
   jQuery(".uGalerie").fancybox({ "zoomSpeedIn": 300, "zoomSpeedOut": 300, "overlayShow": true, "autoScale": false }); 
   
}); 