function show_answer(id) {
	if ($("#a"+id) && $("#a"+id).attr("class") == "answer dn") {
		$(".answer").addClass("dn");
		$(".question").removeClass("q_border");
		$("#q"+id).addClass("q_border");
		$("#a"+id).removeClass("dn");
	} else {
		$(".answer").addClass("dn");
		$(".question").removeClass("q_border");
	}
}

$(document).ready(function(){
	$('.tm ul li').hover(
		function() {
			
			if ($(this).attr("id") == "one") {	
				$("#one1").attr("style","display:block;");
				$("#three3").attr("style","display:none;");
			}

			if ($(this).attr("id") == "three") {
				$("#three3").attr("style","display:block;");
				$("#one1").attr("style","display:none;");
			}

			$(this).addClass("active");
			$(this).find('ul').stop(true, true);
			$(this).find('ul').slideDown(300).delay(1000);
		},
		function() {
			$(this).removeClass("active");
			$(this).find('ul').slideUp(300);
		}
	); 
});

function showlink(id,action,img) {
	if (img) {
		if (action) {
			$("#b"+id).stop(true,true);
		} else {
			$(".indexvis").delay(500).queue(function(){$(this).addClass("dn");});
		}
	} else {
		if (action) {
			$(".indexvis").stop(true,true).addClass("dn");
			$("#b"+id).toggleClass("dn");
		} else {
			$("#b"+id).delay(1000).queue(function(){$(this).toggleClass("dn");});
		}
	}
}

function flipAnswerDisplay(anc, id) {
	a = document.getElementById('answer_' + id);
	if (anc && a) {
		with (a.style) {
			if (display=='block') {
				display = 'none';
			} else {
				display = 'block';
			}
		}
	}
}


function change_blocks(selectedblock) {

	b = document.getElementById(selectedblock + '_block');
	l = document.getElementById(selectedblock + '_link');

	b1 = document.getElementById('office_block');
	b1.style.display='none';
	b2 = document.getElementById('sklad_block');
	b2.style.display='none';
	b3 = document.getElementById('magazin_block');
	b3.style.display='none';

	l1 = document.getElementById('office_link');
	l1.className = '';
	l2 = document.getElementById('sklad_link');
	l2.className = '';
	l3 = document.getElementById('magazin_link');
	l3.className = '';

    b.style.display='block';
	l.className='selected';
}


