var obj1,obj2,obj3;


// для палуб, кают...
var desk_image = new Array();
var desk_wh = new Array(); // width, height fo decks

var deck_room_ids = new Array(); // id_палубы:id_каюты

var rooms_photo = new Array();
var rphoto_wh = new Array();
var rooms_plan = new Array();
var rplan_wh = new Array();

function show_deck(id,show,title){
	var i;
	obj1 = document.getElementById("before");
	if ( obj1 != null ) obj1.innerHTML = '<a name="decks'+id+'"></a>' + title;

	obj1 = document.getElementById("after");
	if ( obj1 != null ) obj1.innerHTML = '<img src="'+desk_image[id]+'" '+desk_wh[id]+' border=0><br><a href="javascript:returnUp()">наверх</a>';

	obj1 = document.getElementById("decks");
	if ( obj1 != null ){
		obj2 = document.getElementById("deck"+id);
		for ( i=0; i < obj1.childNodes.length; i++ ){
			if ( obj1.childNodes[i].nodeName == "A" ){
				if ( obj1.childNodes[i].innerHTML == obj2.innerHTML ){
					obj1.childNodes[i].style.color = "red";
					obj1.childNodes[i].style.fontWeight = "bold";
				}
				else{
					obj1.childNodes[i].style.color = "#107575";
					obj1.childNodes[i].style.fontWeight = "normal";
				}
			}
		}
	}

	obj1 = new Array();
	for (i=0; i<deck_room_ids.length; i++){
		obj2 = deck_room_ids[i].split(":");
		obj3 = document.getElementById("room"+obj2[1]);
		if ( obj3!=null ){
			obj3.style.color = "#107575";
			obj3.style.fontWeight = "normal";
			if ( obj2[0] == id ) obj1.push(obj2[1]);
		}
	}
	for (i=0; i<obj1.length; i++){
		obj3 = document.getElementById("room"+obj1[i]);
		if ( obj3!=null ){
			obj3.style.color = "red";
			obj3.style.fontWeight = "bold";
		}
	}


	obj2 = document.location.toString().split("#");
	if ( obj2.length > 1 ) obj2 = obj2[0];
	else obj2 = document.location;
	document.location = obj2 + "#decks" + id;
}

function show_room(id,show,title){
	var i;
	obj1 = document.getElementById("before");
	if ( obj1 != null ) obj1.innerHTML = '<a name="rooms'+id+'"></a>' + title;

	obj1 = document.getElementById("after");
	if ( obj1 != null ){
		if ( rooms_photo[id] ) obj1.innerHTML = '<img src="'+rooms_photo[id]+'" '+rphoto_wh[id]+' vspace=5 border=0 alt="фото"><br>';
		else obj1.innerHTML = '';
		if ( rooms_plan[id] ) obj1.innerHTML += '<img src="'+rooms_plan[id]+'" '+rplan_wh[id]+' vspace=5 border=0 alt="план"><br>';
		obj1.innerHTML += '<a href="javascript:returnUp()">наверх</a>';
	}

	obj1 = document.getElementById("rooms");
	if ( obj1 != null ){
		obj2 = document.getElementById("room"+id);
		for ( i=0; i < obj1.childNodes.length; i++ ){
			if ( obj1.childNodes[i].childNodes[0].nodeName == "A" ){
				if ( obj1.childNodes[i].childNodes[0].innerHTML == obj2.innerHTML ){
					obj1.childNodes[i].childNodes[0].style.color = "red";
					obj1.childNodes[i].childNodes[0].style.fontWeight = "bold";
				}
				else{
					obj1.childNodes[i].childNodes[0].style.color = "#107575";
					obj1.childNodes[i].childNodes[0].style.fontWeight = "normal";
				}
			}
		}
	}

	obj1 = new Array();
	for (i=0; i<deck_room_ids.length; i++){
		obj2 = deck_room_ids[i].split(":");
		obj3 = document.getElementById("deck"+obj2[0]);
		if ( obj3!=null ){
			obj3.style.color = "#107575";
			obj3.style.fontWeight = "normal";
			if ( obj2[1] == id ) obj1.push(obj2[0]);
		}
	}
	for (i=0; i<obj1.length; i++){
		obj3 = document.getElementById("deck"+obj1[i]);
		if ( obj3!=null ){
			obj3.style.color = "red";
			obj3.style.fontWeight = "bold";
		}
	}

	obj2 = document.location.toString().split("#");
	if ( obj2.length > 1 ) obj2 = obj2[0];
	else obj2 = document.location;
	document.location = obj2 + "#rooms" + id;
}

function returnUp(){
	obj2 = document.location.toString().split("#");
	if ( obj2.length > 1 ) obj2 = obj2[0];
	else obj2 = document.location;
	document.location = obj2 + "#up_layner";
}




































var idclass = new Array();
var i;
function checkLux(comp,luxi,alrt){

	if ( idclass[comp.value] > 2){
		luxi.value = '1';
		if (alrt == 1)
			alert("Вы выбрали круизную компанию класса люкс!");
	}
	else{// проверим может класс выбрали
		i = comp.value;
		i = i.split("class");
		if (i.length>1 && i[1] > 2 ){
			luxi.value = '1';
			if (alrt == 1)
				alert("Вы выбрали круизные компании класса люкс!");
		}
	}
}

var obj;

function show_zakl(n){
	for(i=1; i<=3; i++){
		obj = document.getElementById("z"+i);
		if ( obj != null ){
			if ( i == n ){
				obj.style.backgroundColor = '#595747';
				obj.style.backgroundImage = 'url(/img/ug.gif)';
				obj = document.getElementById("zc"+i);
				if ( obj != null )
					obj.style.display = 'block';
			}
			else{
				obj.style.backgroundColor = '#888672';
				obj.style.backgroundImage = 'url(/img/ug1.gif)';
				obj = document.getElementById("zc"+i);
				if ( obj != null )
					obj.style.display = 'none';
			}
		}
	}
}



function show_div(id){
	obj = document.getElementById(id);
	if ( obj != null ){
		if ( obj.style.display == "none" )
			obj.style.display = 'block';
		else
			obj.style.display = 'none';
	}
}


function show_mm(){
	obj = document.getElementById("lmore");
	var obj2 = document.getElementById("cmore");
	if ( obj != null ){
		if ( obj.style.display == "none" ){
			obj.style.display = 'inline';
			obj2.style.display = 'none';
		}
		else{
			obj.style.display = 'none';
			obj2.style.display = 'inline';
		}
	}
}