$(document).ready(function() {
//	$('select').selectbox();
	$('div#header3 > ul > li').mouseover(function() {
		var col = this.getElementsByTagName('ul');
		if (col.length > 0) {
			col[0].style.display = 'block';
			var span = this.getElementsByTagName('span');
			$(span[0]).addClass('selected');
		}
	});
	
	$('div#header3 > ul > li').mouseout(function() {
		var col = this.getElementsByTagName('ul');
		if (col.length > 0) {
			col[0].style.display = 'none';
			var span = this.getElementsByTagName('span');
			$(span[0]).removeClass('selected');
		}
	});

	activeBanner = 0;
	oldBanner = 0;
	$('#imageitem1').hide();
	$('#imageitem2').hide();
	$('#imageitem3').hide();

	
	banner_ticker();
	timerBanner = setInterval("banner_ticker()", 5000);
	
	
	$('#banner a.item').mouseover(function(){
		clearInterval(timerBanner);
		$('#banner a.item').removeClass('active');
		$('#banner div.image').css('z-index', 1);
		$('#imageitem'+oldBanner).hide();
		$('#imageitem'+activeBanner).css('z-index',2);

		oldBanner = activeBanner;
		activeBanner = parseInt(this.id.charAt(4));
		$('#banner #item' + activeBanner).addClass('active');
		$('#imageitem'+activeBanner).css("z-index", 3);
		$('#imageitem'+activeBanner).fadeIn("slow");
	});
	
	$('#banner a.item').mouseout(function(){
		activeBanner = parseInt(this.id.charAt(4));
		clearInterval(timerBanner);
		timerBanner = setInterval("banner_ticker()", 5000);
	});

	$('form#autosubmit select').change(function() {
		$('form#autosubmit').submit();
	});
	
	$('form#autosubmit input').remove();
});


function banner_ticker() {
	countBanners = 3;
	$('#banner a.item').removeClass('active');
	$('#banner div.image').css('z-index', 1);
	$('#imageitem'+oldBanner).hide();
	$('#imageitem'+activeBanner).css('z-index',2);

	oldBanner = activeBanner;
	if (activeBanner < countBanners)
		activeBanner++;
	else
		activeBanner = 1;
	$('#banner #item' + activeBanner).addClass('active');
	$('#imageitem'+activeBanner).css("z-index", 3);
	$('#imageitem'+activeBanner).fadeIn("slow");
}

