

var hirforgatoAnimacioTimer = 600;
var hirforgatoTimer = 6000;
var hirforgatoLength = 0;
var hirforgatoI = 0;
var hirforgatoHeight = 184;


var refLength = 0;
var refI = 0;
var refWidth = 188;
var refAnimate = 500;


jQuery(document).ready(function() {

	hirforgatoLength = jQuery("#hirforgato li").length;
	hirforgato();


	refLength = jQuery("#ref_scroller ul li").length;
	jQuery("#ref-right").click(function () {
		refI++;
		
		if( refI + 4 >= refLength ) {refI = 0;}
		scrollRef( refI );
	});
	jQuery("#ref-left").click(function () {
		if( refI == 0 ) return;
		scrollRef( refI );
		refI--;
	});

});

function hirforgato() {

	if( hirforgatoI >= hirforgatoLength ) hirforgatoI = 0;
	
	jQuery("#hirforgato_scroller").animate({
		top: -1 * hirforgatoI * hirforgatoHeight + "px"
	}, hirforgatoAnimacioTimer);

	hirforgatoI++;
	setTimeout("hirforgato()", hirforgatoTimer + hirforgatoAnimacioTimer);
}

function scrollRef( i ) {
	jQuery("#ref_scroller").animate({
		left: -1 * refWidth * i + "px"
	}, refAnimate);
}
