jQuery(document).ready(function(){
	var delay=300;
	jQuery("#tab1").hover(
		function () {
			clearInterval(sh);
			showItem(1);
		},
		function () {
			sh = setInterval(autoRotate, timer);;
		}
	);

	jQuery("#tab2").hover(
		function () {
			clearInterval(sh);
			showItem(2);
		},
		function () {
			sh = setInterval(autoRotate, timer);;
		}
	);

	jQuery("#tab3").hover(
		function () {
			clearInterval(sh);
			showItem(3);
		},
		function () {
			sh = setInterval(autoRotate, timer);;
		}
	);
});

var curr_no=1;
var timer_no=1;
var rotate_timer="";
var timer=5000;
var sh;

function showItem(no){
	if(curr_no!=no){
		resetItems();
		jQuery("#slide-"+no).fadeIn();
		t=0+(no*81)-81;
		jQuery("#tab"+no).css("background-position","-20px top");
		jQuery("#tab"+no).children().removeClass();

		jQuery("#tab"+no).children("#white").addClass("tab-big");
		curr_no=no;
	}
}

function resetItems(){
	jQuery("#slide-"+curr_no).fadeOut();
	jQuery("#tab"+curr_no).css("background-position","left top");
	jQuery("#tab"+curr_no).children().removeClass();
//	jQuery("#tab"+curr_no).children("#white").addClass("tab-small-link");
}



function autoRotate(){
	showItem(timer_no);
	timer_no++;
	if(timer_no>5){
		timer_no=1;
	}
}

sh = setInterval(autoRotate, timer);
