(function($) {
	$(function() { //on DOM ready
		$("#scroller").simplyScroll({
			className: 'simply-scroll',
			speed: 5
		});
	});
	
	$(function() { //on DOM ready
		$("#scroller2").simplyScroll({
			className: 'simply-scroll2',
			speed: 10
		});
	});
	
})(jQuery);

       var paircount = 0;
 
      /* If you want to desaturate after page loaded - use onload event
       * of image.
      */
      function initImage(obj)
      {
        obj.onload = null;
        var $newthis = $(obj);
        if ($.browser.msie)
        {
          // You need this only if desaturate png with aplha channel
          $newthis = $newthis.desaturateImgFix();
        }
        // class for easy switch between color/gray version
        $newthis.addClass("pair_" + ++paircount);
        var $cloned = $newthis.clone().attr('id', '');
        // reset onload event on cloned object
        $cloned.get(0).onload = null;
        // add cloned after original image, we will switch between
        // original and cloned later
        $cloned.insertAfter($newthis).addClass("color").hide();
        // desaturate original
        $newthis = $newthis.desaturate();
        // add events for switch between color/gray versions
        $newthis.bind("mouseenter mouseleave", desevent);
        $cloned.bind("mouseenter mouseleave", desevent);
      };
 
      function desevent(event) 
      {
        var classString = new String($(this).attr('class'));
        var pair = classString.match(/pair_\d+/);
        // first I try was $("."+pair).toggle() but IE switching very strange...
        $("."+pair).hide();
        if (event.type == 'mouseenter')
          $("."+pair).filter(".color").show();
        if (event.type == 'mouseleave')
          $("."+pair).filter(":not(.color)").show();
      }
	  
	  



$(document).ready(function(){
						   
 $('a.title').cluetip({width: '120px', height:'30px', positionBy: 'fixed', topOffset: '20px', leftOffset: '-30px'});
 


$('#press li img').mouseenter(function() {
$('#desc').empty();								  
$('#desc').append($(this).attr('desc'))});
$('#press li img').mouseleave(function() {
$('#desc').empty()});

  $('#s3slider').s3Slider({ 
      timeOut: 3000 
   });

$('.thumbimg em').hide();
	$('.thumbimg img').mouseenter(function() {
		$('.thumbimg em').animate({opacity: 'hide'}, 'fast');
		$(this).next('em').animate({opacity: 'show'}, 'slow');
		});
	
	$('.thumbimg em').mouseleave(function() {
		$(this).animate({opacity: 'hide'}, 'fast');
	});
		$('.thumbimg em').mouseleave(function() {
		$(this).animate({opacity: 'hide'}, 'fast');
	});
		
	
	
$("#videopg dl dd").click(function(){
var youtubeID=$(this).attr("id");
$("#show_div").empty();


$('<iframe />', { 
id:"ytvideo",
title:'Quadronica su YOUTUBE',
width:'270',
height:'180',
src:'http://www.youtube.com/v/'+youtubeID+'&autoplay=0',
frameborder:'0',
allowfullscreen:'true'
  }).appendTo("#show_div");

});




});

