﻿$(function() {
	// /* imgsRef */
		
	
	$('#menuHome div.conts img.imgsMenu').css({'width':'150px','height':'170px',
												'margin-left':'8px'});
	$('#menuHome div.conts img.imgsRef').css({'width':'150px','height':'119px',
												'margin-left':'8px'});
	
	$('#menuHome div.conts').hover(function(){
		$(this).animate({backgroundPosition: '0 0'},'fast'); 
		$(this).find('img.imgsMenu').animate({width:167,height:189,
											marginLeft:0,marginTop:-12},'fast');
		$(this).find('img.imgsRef').animate({width:167,height:133,
											marginLeft:0,marginTop:-25},'fast');
	},function(){
		$(this).animate({backgroundPosition: '0 100px'},'slow');
		$(this).find('img.imgsMenu').animate({width:150,height:170,
											marginLeft:8,marginTop:0},'slow');
		$(this).find('img.imgsRef').animate({width:150,height:119,
											marginLeft:8,marginTop:0},'slow');
	});
	var lid = 0;
	function diapoFc() {
		var last = parseInt($('#homeSsh img:last').attr('id').replace("img",""));
		if(lid==last){
			imgNext = $("#homeSsh #img0");
		}else{
			var next = lid+1;
			imgNext = $("#homeSsh #img"+next);
		}
		
		$("#homeSsh #img"+lid).fadeOut("fast", function(){
			imgNext.fadeIn('fast',function(){lid=next;});
		});
	}
	
	diapo = setInterval(diapoFc, 3000 );

});
	
