var np = 0;
var pl = 0;

function scrollimg() {
	if (np >= pl) np = 0;
	
	imgcol = $("#homebanner IMG");
	
	imgcol.fadeOut(1000, function() {
		$(imgcol[np++]).fadeIn(500, function() { window.setTimeout("scrollimg();",10000); });
	});
	
	/*
	$("#homebanner").scrollTo( 
		$("#homebanner IMG")[np++], 
		5000, 
		{onAfter: 
			function() {
				window.setTimeout("scrollimg();",5000);
			} 
		}
	);
	*/
}

function nextproduct() {
	t = 1000;
	d = 5000;
	
	if (np >= pl) { np = 0; t = 0; d = 0; }
		
	$("#scrollblock").scrollTo(
		$("#scrollblock DIV")[np++], t, 
		{onAfter: 
			function() {
				window.setTimeout("nextproduct();", d);
			} 
		}
	);
}

function lightslide() {
	$("#homebanner .light").animate(
		{ left: 600 }, 1000,
		function() {
			$(this).css('left','-373px');
			window.setTimeout("lightslide();", 10000);
		}
	);
}
	
$(document).ready(function() {
	imgcol = $("#homebanner IMG");
	imgcol.css('display','none');
	$("#scrollblock").append( '<div>' + $("#scrollblock DIV").get(0).innerHTML + '</div>' );
	pl = $("#scrollblock DIV").length;
	
	nextproduct();
	lightslide();
	
	$("#mainmenu LI A")
	.mouseover(function() {
		c = $(this).parent().attr('class');
		$("#homebanner IMG." + c).fadeIn(300);
	})
	.mouseout(function() { 
		imgcol.fadeOut(300);
	});
});
