var obj, t, t2, t_cd;
var tek;

function show_help(){
	obj = document.getElementById("hfon");
	if ( obj != null ){
		if ( navigator.userAgent.indexOf ("Mozilla/5.0") == -1 ) obj.filters["Alpha"].opacity = 0;
		else obj.style.opacity = 0;
		obj.style.display = "inline";
		clearTimeout(t);
		t = setTimeout("appear(0)",0);
	}
}


function appear(n){
	clearTimeout(t);

	obj = document.getElementById("top");
	if ( obj != null ){
		obj.style.zIndex = 5;
		obj.style.position = "relative";
	}


	obj = document.getElementById("hfon");
	var flag = 0;

	if ( navigator.userAgent.indexOf ("Mozilla/5.0") == -1 ){
		if ( n < 80 ){
			n += 5;
			if ( obj != null ) obj.filters["Alpha"].opacity = n;
		}
		else flag = 1;
	}
	else{
		if ( n < 0.8 ){
			n += 0.05;
			if ( obj != null ) obj.style.opacity = n;
		}
		else flag = 1;
	}

	if ( flag == 1 ){
		obj = document.getElementById("help");
		if ( obj != null ) obj.style.display = "inline";
		obj = document.getElementById("hpic");
		if ( obj != null ) obj.style.display = "inline";
		obj = document.getElementById("toph");
		if ( obj != null ) obj.style.backgroundImage = "url(/img/arr2.gif)";
	}
	else t = setTimeout("appear("+n+")",30);
}

function disappear(n){
	clearTimeout(t);
	obj = document.getElementById("hfon");
	var flag = 0;

	if ( navigator.userAgent.indexOf ("Mozilla/5.0") == -1 ){
		if ( n == 100 ) n = 80;
		if ( n < 0 ) flag = 1;
		else{
			n -= 5;
			if ( obj != null ) obj.filters["Alpha"].opacity = n;
			if ( n == 40 ) flag = -1;
		}
	}
	else{
		if ( n == 100 ) n = 0.8;
		if ( n <= 0 ) flag = 1;
		else{
			n -= 0.05;
			if ( obj != null ) obj.style.opacity = n;
			if ( n <= 0.4 ) flag = -1;
		}
	}
	if ( flag != 1 ) t = setTimeout("disappear("+n+")",30);
	if ( flag == -1 ){
		obj = document.getElementById("help");
		if ( obj != null ) obj.style.display = "none";
		obj = document.getElementById("hpic");
		if ( obj != null ) obj.style.display = "none";
		obj = document.getElementById("toph");
		if ( obj != null ) obj.style.backgroundImage = "url(/img/arr1.gif)";
	}
	if ( flag == 1 ){
		obj = document.getElementById("top");
		if ( obj != null ){
			obj.style.zIndex = -1;
			obj.style.position = "static";
		}
		obj = document.getElementById("hfon");
		if ( obj != null ) obj.style.zIndex = -1;
		obj = document.getElementById("help");
		if ( obj != null ) obj.style.zIndex = -1;
	}
}



var heightTopAdv = 100;
function show_adv(){
	obj = document.getElementById("topAdv");
	if (obj != null){
		if ( obj.style.height == "0px" || !obj.style.height ){
			clearTimeout(t);
			t = setTimeout("go_down(0)",0);

			obj = document.getElementById("adv");
			if ( obj != null ){
				obj.lastChild.childNodes[0].src = "/img/adv_minus.gif";
				obj.lastChild.childNodes[0].alt = "закрыть";
				obj.lastChild.childNodes[0].title = "закрыть";
				clearTimeout(talert);
			}
		}
		else{
			clearTimeout(t);
			t = setTimeout("go_up("+heightTopAdv+")",0);

			obj = document.getElementById("adv");
			if ( obj != null ){
				obj.lastChild.childNodes[0].src = "/img/adv_plus.gif";
				obj.lastChild.childNodes[0].alt = "открыть";
				obj.lastChild.childNodes[0].title = "открыть";
				talert = setTimeout("talert_()",500);
			}
		}
	}
}


function go_down(n){
	clearTimeout(t);
	if ( n < heightTopAdv ){
		n += 5;
		obj = document.getElementById("topAdv");
		if (obj != null) obj.style.height = n + "px";
		t = setTimeout("go_down("+n+")",50);
	}
	else return;
}
function go_up(n){
	clearTimeout(t);
	if ( n > 0 ){
		n -= 5;
		obj = document.getElementById("topAdv");
		if (obj != null) obj.style.height = n + "px";
		t = setTimeout("go_up("+n+")",50);
	}
	else return;
}








/* меню */
function show_sub_menu(pre,show_hide){
	if ( tek != null && tek.id == "lev2" && show_hide == 1 ){
		clearTimeout(t2);
		tek.style.visibility = "hidden";
	}
	tek = pre.nextSibling.nextSibling;
	if ( tek != null && tek.id == "lev2" ){
		if ( show_hide == 1 ) tek.style.visibility = "visible";
		else t2 = setTimeout("show_hide_sub_menu()",1000);
	}
}

function show_hide_sub_menu(){
	clearTimeout(t2);
	if ( tek != null && tek.id == "lev2" ) tek.style.visibility = "hidden";
}


















/* поиск */
function show_search(n){
	obj = document.getElementById("srch"+n);
	if (obj != null){
		if ( obj.style.display == "block"){
			obj.style.display = "none";
			obj = document.getElementById("zag"+n);
			if (obj != null) obj.style.backgroundImage = "url(/img/find_a_cruise_Plus.gif)";
		}
		else{
			obj.style.display = "block";
			obj = document.getElementById("zag"+n);
			if (obj != null) obj.style.backgroundImage = "url(/img/find_a_cruise_Minus.gif)";
		}
	}
}










/* Показ поиска в шапке */
function shTS(){
	obj = document.getElementById("stform");
	if ( obj != null ){
		if ( obj.style.visibility == "visible" ){
			obj.style.visibility = "hidden";
			obj = document.getElementById("st");
			if ( obj != null ) obj.src = "/img/arS1.gif";
		}
		else{
			obj.style.visibility = "visible";
			obj = document.getElementById("st");
			if ( obj != null ) obj.src = "/img/arS2.gif";
		}
	}
}























/* Реклама в шапке */
var talert = setTimeout("talert_()",500);
function talert_(){
	clearTimeout(talert);
	obj = document.getElementById("alert");
	if (obj != null ){
		if ( obj.style.color == "red" ) obj.style.color = "#32587d";
		else obj.style.color = "red";
	}
	talert = setTimeout("talert_()",500);
}
