
var current = -1;

function openMenu(id) {
	cancelClose();
	if(id!=current) {
		if(current>0) {
			closeMenu();
		}
		if (document.getElementById("mi" + id)){
			var elem = document.getElementById("mi" + id);
			elem.style.display = "block";

		}
		current = id;
	}
}

function closeMenuDelay() {
	delay = setTimeout("closeMenu()", 800);
}

function closeMenu() {
	if (document.getElementById("mi" + current)){
		var elem = document.getElementById("mi" + current);
		elem.style.display = "none";
		current = -1;
	}
}

function cancelClose() {
	if(self.delay) clearTimeout(delay);
}

function mover2(id,id2){
	var elem = document.getElementById("mi" + id + "_" + id2);
	elem.style.display = "block";
}

function mout2(id,id2){
	var elem = document.getElementById("mi" + id + "_" + id2);
	elem.style.display = "none";
}

function switch_map(type_in){
	$("#test_cont").html('');
	$("#map").html('');
	$.ajax({
			type:"GET",
			url:"/map.php",
			datatype:"html",
			data:{type: type_in},
			success:function(data){
				//alert(data);
				$("#test_cont").html(data);
			}
		}); // $.ajax()
}

function pWait() {

	$("#waitDiv").fadeIn();

}


$(document).ready(function(){

	$(".form-reserv form").submit(function() {

		if($("#c-in").val() == "") {
			alert("Необходимо выбрать желаемую дату въезда");
			$("#c-in").focus();
			return false;
		}
		if($("#c-out").val() == "") {
			alert("Необходимо выбрать желаемую дату выезда");
			$("#c-out").focus();
			return false;
		}
	});

});
/*
$(document).ready(
	function(){
		$(".srec").click(
			function(){
				if ($("#recall").css("display") == "block"){
					$("#recall").css("display", "none");
					return false;
				}
				$("#recall").css("display", "block");
				return false;
			}
		);

		if (window.location.hash == "#show"){
			$("#recall").css("display", "block");
			return false;
		}
	}
);
*/
$(document).ready(
	function(){
		$(".shaxl").click(
			function(){
				if ($("#axl").css("display") == "block"){
					$("#axl").css("display", "none");
					return false;
				}
				$("#axl").css("display", "block");
				return false;
			}
		);
		$(".shax2").click(
			function(){
				if ($("#ax2").css("display") == "block"){
					$("#ax2").css("display", "none");
					return false;
				}
				$("#ax2").css("display", "block");
				return false;
			}
		);

		$("#recall dt strong a").toggle(
			function (){
				$("#opidresp" + $(this).attr("id")).slideDown();
				return false;
			},
			function (){
				$("#opidresp" + $(this).attr("id")).slideUp();
				return false;
			}
		);
	}


);