jQuery().ready(function(){
	jQuery('.pics').cycle({fx:'fade', speed: 2000});
	
	$("#flym").mouseover(function() {
		if(typeof(t)!="undefined")
			clearTimeout(t);
		
		$("#search_type").css({'visibility':'hidden'});
		$("#search_price_to").css({'visibility':'hidden'});
	});
	
	$("#flym").mouseout(function() {
		t = setTimeout(function() { $("#search_type").css({'visibility':'visible'}); $("#search_price_to").css({'visibility':'visible'}); }, 550);
	});
	
	$(".lpmenu a").each(function() {
		$(this).click(function() {
			window.location.href = $(this).attr("href");
			return false;
		});
	});
	
	//Расдвигающееся главное меню
	$(".lmenu").each(function() {
		$(this).click(function() {
			this_id = $(this).attr('pmenu_id');
							   
			$(".lmenu").each(function() {
				if(this_id!=$(this).attr('pmenu_id'))
				{
					if($('#pmenu' + $(this).attr('pmenu_id')).height()>0)	
						$('#pmenu' + $(this).attr('pmenu_id')).animate({height: '0px'}, 'slow');
				}
			});
				
			if($(this).attr('is_pmenu')==1)
			{
				pmenu_height = $(this).attr('pmenu_height') + "px";
								   
				if($('#pmenu' + $(this).attr('pmenu_id')).height()==0)
					$('#pmenu' + $(this).attr('pmenu_id')).animate({height: pmenu_height}, 'slow');
				else
					$('#pmenu' + $(this).attr('pmenu_id')).animate({height: '0px'}, 'slow');
			}
		});
	});
	
	$(".l2pmenu a").each(function() {
		$(this).click(function() {
			window.location.href = $(this).attr("href");
			return false;
		});
	});
	
	//Расдвигающееся менб новостей страны
	$("#l2menu").click(function() {
		if($(this).attr('is_pmenu')==1)
		{
			pmenu_height = $(this).attr('pmenu_height') + "px";
							   
			if($('#p2menu').height()==0)
				$('#p2menu').animate({height: pmenu_height}, 'slow');
			else
				$('#p2menu').animate({height: '0px'}, 'slow');
		}
	});
});
$(document).ready(function(){
	if($.cookie("order_form") !== 'block'){
		$(".order_form").hide();
	}
	$("#order_form_trigger").click(function(){
		$(".order_form").slideToggle("slow", function(){
			$.cookie("order_form", $(".order_form").css("display"));
		});
		return false;
	});
});
