var layer;
var timer;

function change_layer(page)
{

	$("#baner_top_check_1").css({ background: "url('../img/baner_check.gif') no-repeat", color : "#B1B1B1"});
	$("#baner_top_check_2").css({ background: "url('../img/baner_check.gif') no-repeat", color : "#B1B1B1"});
	$("#baner_top_check_3").css({ background: "url('../img/baner_check.gif') no-repeat", color : "#B1B1B1"});
	$("#baner_top_check_4").css({ background: "url('../img/baner_check.gif') no-repeat", color : "#B1B1B1"});
		
	switch(page)
	{
		case 1:
			$("#baner_top_check_1").css({ background: "url('../img/baner_check_a.gif') no-repeat", "z-index" : 203, color : "#8EC011"});
			$("#baner_top_check_2").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 202, color : "#B1B1B1"});
			$("#baner_top_check_3").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 201, color : "#B1B1B1"});
			$("#baner_top_check_4").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 200, color : "#B1B1B1"});
			
			$("#baner_top").css({ background: "url('../img/action/promo_aw.jpg') no-repeat"});
			break;
		case 2:
			$("#baner_top_check_1").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 200, color : "#B1B1B1"});
			$("#baner_top_check_2").css({ background: "url('../img/baner_check_a.gif') no-repeat", "z-index" : 202, color : "#8EC011"});
			$("#baner_top_check_3").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 201, color : "#B1B1B1"});
			$("#baner_top_check_4").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 200, color : "#B1B1B1"});
			
			$("#baner_top").css({ background: "url('../img/action/promo_cu.jpg') no-repeat"});
			break;
		case 3:
			$("#baner_top_check_1").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 200, color : "#B1B1B1"});
			$("#baner_top_check_2").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 201, color : "#B1B1B1"});
			$("#baner_top_check_3").css({ background: "url('../img/baner_check_a.gif') no-repeat", "z-index" : 202, color : "#8EC011"});
			$("#baner_top_check_4").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 200, color : "#B1B1B1"});
			
			$("#baner_top").css({ background: "url('../img/action/promo_vikki3.jpg') no-repeat"});
			break;
		case 4:
			$("#baner_top_check_1").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 200, color : "#B1B1B1"});
			$("#baner_top_check_2").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 201, color : "#B1B1B1"});
			$("#baner_top_check_3").css({ background: "url('../img/baner_check.gif') no-repeat", 	"z-index" : 202, color : "#B1B1B1"});
			$("#baner_top_check_4").css({ background: "url('../img/baner_check_a.gif') no-repeat", "z-index" : 203, color : "#8EC011"});
			
			$("#baner_top").css({ background: "url('../img/action/promo_pufico.jpg') no-repeat"});
			break;
	}
	
	layer = page;
}

function layer_click(page)
{
	window.clearInterval(timer);

	switch(page)
	{
		case 1: window.open('http://www.vikki-di.ru/show/alpenwolle'); break;
		case 2: window.open('http://www.vikki-di.ru/show/promo-clean-ural'); break;
		case 3: window.open('http://www.vikki3.ru/about.html'); break;
		case 4: window.open('http://www.vikki-di.ru/show/pufico'); break;
	}
	
}

$(document).ready(function()
{	
	change_layer(3);

	timer = window.setInterval(function() { change_layer(Math.floor(Math.random() * (4)) + 1);}, 5000);
});


