/*
	File: main.js
	Created on: 23:35:46, 2009-2-4

	Autor: Alexander Marinov aka ssaki
*/
var $image_rotator_curent = 5;
var $image_rotator_max = 5;

function cycle_rotator() {
	if ( $image_rotator_curent != $image_rotator_max ) {
		setTimeout ( rotator_hide_current, 500);
	} else {
		setTimeout ( rotator_hide_current, 5000);
	}
}

function rotator_show_next(){
	$image_rotator_curent++;
	if ( $image_rotator_curent > $image_rotator_max ) {
		$image_rotator_curent = 0;
	}
	$('#img_rotator_display > img:eq(' + ($image_rotator_curent) + ')' ).fadeIn( cycle_rotator );
}

function rotator_hide_current(){
	$('#img_rotator_display > img:eq(' + ($image_rotator_curent) + ')' ).fadeOut( 200, rotator_show_next );
}

$( function(){
	setTimeout ( rotator_hide_current, 2000);
});