var list = {};
var ps = {};
var columns = {};
var oldValue = '';

var award_image = new Array();
var award_link = new Array();

tour_images = []
tour_images[1] = 'images/tour_1.jpg';
tour_images[2] = 'images/tour_2.jpg';
tour_images[3] = 'images/tour_3.jpg';

//tour_link[1] = 'http://www.malina.ru';
//tour_link[2] = 'http://www.malina.ru';
//tour_link[3] = 'http://www.malina.ru';

award_image[1] = 'images/award_1.jpg';
award_image[2] = 'images/award_2.jpg';
award_image[3] = 'images/award_3.jpg';
award_image[4] = 'images/award_4.jpg';
award_image[5] = 'images/award_5.jpg';
award_image[6] = 'images/award_6.jpg';
award_image[7] = 'images/award_7.jpg';

//award_link[1] = 'http://catalog.malina.ru/category2.php?code=gg0070';
//award_link[2] = 'http://catalog.malina.ru/category2.php?code=gg0042';
//award_link[3] = 'http://catalog.malina.ru/category2.php?code=gc0160';
//award_link[4] = 'http://catalog.malina.ru/category2.php?code=gg0002';

document.getElementById("award_image_1").src = award_image[1];
document.getElementById("award_image_2").src = award_image[2];
document.getElementById("award_image_3").src = award_image[3];
document.getElementById("award_image_4").src = award_image[4];
//document.getElementById("award_1").href = award_link[1];
//document.getElementById("award_2").href = award_link[2];
//document.getElementById("award_3").href = award_link[3];
//document.getElementById("award_4").href = award_link[4];

var award_selector = 1;
var awards_total = 7;
var tour_selector =1;
var tour_total =3;
var slides = [];

window.addEvent('domready', function(){

   	if(typeof(layer_hide)=='undefined')
   		layer_hide = 'layer_1';

	if(layer_hide=='layer_2')
	{
    	$('layer_2').style.display = 'block';
    	$('layer_1').style.display = 'none';
	}
/*
    for(var i=1; i<=4; i++){
    	var key = 'layer_'+i;
		slides[key] = new Fx.Slide(key);
		if(key!=layer_hide)
			slides[key].hide();
    	$(key).style.display = 'block';
    }
*/
	if(layer_hide=='layer_2'){
		window.scrollTo(0, 770);
		initialize();
	}
})


function awards_right(i){
	if (award_selector == awards_total) { award_selector = 0
	}
	award_selector = award_selector +1;
	document.getElementById("award_image_1").src = award_image[award_selector];
//	document.getElementById("award_1").href = award_link[award_selector];	
	if (award_selector+1 <= awards_total) 
			{ document.getElementById("award_image_2").src = award_image[award_selector+1]; 
//			  document.getElementById("award_2").href = award_link[award_selector+1];
			  }
	else 	{ document.getElementById("award_image_2").src = award_image[award_selector+1-awards_total]; 
//			  document.getElementById("award_2").href = award_link[award_selector+1-awards_total];
			  }
	if (award_selector+2 <= awards_total) 
			{ document.getElementById("award_image_3").src = award_image[award_selector+2]; 
//			  document.getElementById("award_3").href = award_link[award_selector+2];
			  }
	else 	{ document.getElementById("award_image_3").src = award_image[award_selector+2-awards_total]; 
//			  document.getElementById("award_3").href = award_link[award_selector+2-awards_total];
			  }
  	if (award_selector+3 <= awards_total) 
			{ document.getElementById("award_image_4").src = award_image[award_selector+3]; 
//			  document.getElementById("award_4").href = award_link[award_selector+3];
			  }
	else 	{ document.getElementById("award_image_4").src = award_image[award_selector+3-awards_total]; 
//			  document.getElementById("award_4").href = award_link[award_selector+3-awards_total];
			  }
}

function awards_left(i){
	if (award_selector == 1) { award_selector = awards_total+1;}
	award_selector = award_selector -1;
	document.getElementById("award_image_1").src = award_image[award_selector];
//	document.getElementById("award_1").href = award_link[award_selector];	
	if (award_selector+1 <= awards_total) 
			{ document.getElementById("award_image_2").src = award_image[award_selector+1]; 
//			  document.getElementById("award_2").href = award_link[award_selector+1];
			  }
	else 	{ document.getElementById("award_image_2").src = award_image[award_selector+1-awards_total]; 
//			  document.getElementById("award_2").href = award_link[award_selector+1-awards_total];
			  }
	if (award_selector+2 <= awards_total) 
			{ document.getElementById("award_image_3").src = award_image[award_selector+2]; 
//			  document.getElementById("award_3").href = award_link[award_selector+2];
			  }
	else 	{ document.getElementById("award_image_3").src = award_image[award_selector+2-awards_total]; 
//			  document.getElementById("award_3").href = award_link[award_selector+2-awards_total];
			  }
  	if (award_selector+3 <= awards_total) 
			{ document.getElementById("award_image_4").src = award_image[award_selector+3]; 
//			  document.getElementById("award_4").href = award_link[award_selector+3];
			  }
	else 	{ document.getElementById("award_image_4").src = award_image[award_selector+3-awards_total]; 
//			  document.getElementById("award_4").href = award_link[award_selector+3-awards_total];
			  }
}

function tour_left (i){
	if (tour_selector == 1) { tour_selector = tour_total+1;}
	tour_selector = tour_selector -1;
	document.getElementById("tour_image").src = tour_images[tour_selector];
//	document.getElementById("tour_link").href = tour_link[tour_selector];		
}

function tour_right (i){
	if (tour_selector == tour_total) { tour_selector = 0;}
	tour_selector = tour_selector +1;
	document.getElementById("tour_image").src = tour_images[tour_selector];
//	document.getElementById("tour_link").href = tour_link[tour_selector];		
}

function layer_show(z){

    if(z!=layer_hide){
    	$(z).style.display = 'block';
    	$(layer_hide).style.display = 'none';
/*
		if(layer_hide=='layer_2')
			$('map_canvas').style.display = 'none';

		if(z=='layer_2')
			$('map_canvas').style.display = 'block';
*/
//		slides[layer_hide].toggle();

		layer_hide = z;
//	id = z;
//	fxslide = new Fx.Slide(id);
//	$(id).style.display = 'block';
//		slides[z].toggle();
    	if(z=='layer_2')
    		if(typeof(map)=='undefined')
    			initialize()
	}
}

function toggleTableRules(btn){
	var id = 'rules';
	var fxslide = new Fx.Slide(id);
	if($(id).style.display!='block'){
		fxslide.hide();
		$(id).style.display = 'block';
	}
	fxslide.toggle();


	if(btn.src=='http://promo.malina.ru/33promo/images/promo4_p2_16_red.png')
		btn.src = 'http://promo.malina.ru/33promo/images/promo4_p2_16.png';
	else
		btn.src = 'http://promo.malina.ru/33promo/images/promo4_p2_16_red.png';
}
