var timeoutID;
var image1 = new Image(); image1.src = "/images/pic1_a.png";
var image2 = new Image(); image1.src = "/images/pic2_a.png";
var image3 = new Image(); image1.src = "/images/pic3_a.png";
var image4 = new Image(); image1.src = "/images/pic4_a.png";
var image5 = new Image(); image1.src = "/images/umi_hover.png";

function format(a)
{
	s=a.toFixed(1).replace(/(\d{1,3}(?=(\d{3})+\.\d))/g,"\$1 ");
    return s.replace(".0","");
} 

var shown = false;

jQuery(document).ready(function()
{
	var hash = window.location.hash;
	if (hash=='#about' || hash=='#program' || hash=='#reg' || hash=='#map' || hash=='#otchet')
	{
		$(".menu").addClass('dashed');
		$(hash+'_sel').removeClass('dashed');
		$('.menu2').hide();
		$(hash).show();
		$(".menu").find(".f_14").text('');
		$(hash+'_sel').find(".f_14").text(' →');
	}
	
	seo_text=$('.seo_text').html();
	
	/*$(".seo_but").hover(
		function () {
			text=$(this).children('.my-text').html();
			$('.seo_text').html(text);
		},
		function () {
			$('.seo_text').html(seo_text);
	});*/

	$(".chess").mouseleave(function()
	{
		$(this).children('a').children().addClass("color");
		$(".cloud-inner").empty();
		$(".cloud-inner").append("<span class='f_30 l-grey'>Готовые решения</span>")
	})
	
	$(".chess").children('a').children().mouseenter(function()
	{
		$(".chess").children('a').children().removeClass("color");
		$(this).addClass("color");
		$(".cloud-inner").empty();
		var text = $(this).children(".my-text").html();
		$(".cloud-inner").append(text);
	})
	
	$(".make_order").mouseenter(function()
	{$(".flash").addClass("sel");})
	$(".make_order").mouseleave(function()
	{$(".flash").removeClass("sel");})
	
	$(".show-brief").click(function(event)
	{
		event.preventDefault();
		if(!shown)
		{
			$('.brief').animate( {'height': '650px'}, { queue:true, duration:700 } );
			shown = true;
		}
		else
		{
			$('.brief').animate( {'height': '0px'}, { queue:true, duration:700 } );
			shown = false;
		}
	})
	$("#logos").click(function(event)
	{
		event.preventDefault();
		$(this).addClass('port-cat-selected');
		$(this).removeClass('dashed');
		$("#list").removeClass('port-cat-selected');
		$("#list").addClass('dashed');
		$('#work_logos').show();
		$('#work_list').hide();
	})
	$("#list").click(function(event)
	{
		event.preventDefault();
		$(this).addClass('port-cat-selected');
		$(this).removeClass('dashed');
		$("#logos").removeClass('port-cat-selected');
		$("#logos").addClass('dashed');
		$('#work_list').show();
		$('#work_logos').hide();
	})
	$("#all_work").click(function(event)
	{
		event.preventDefault();
		$(this).addClass('port-cat-selected');
		$(this).removeClass('dashed');
		$("#graph").removeClass('port-cat-selected');
		$("#graph").addClass('dashed');
		$("#site").removeClass('port-cat-selected');
		$("#site").addClass('dashed');
		$('.graph').show();
		$('.site').show();
	})
	$("#site").click(function(event)
	{
		event.preventDefault();
		$(this).addClass('port-cat-selected');
		$(this).removeClass('dashed');
		$("#graph").removeClass('port-cat-selected');
		$("#graph").addClass('dashed');
		$("#all_work").removeClass('port-cat-selected');
		$("#all_work").addClass('dashed');
		$('.graph').hide();
		$('.site').show();
	})
	$("#graph").click(function(event)
	{
		event.preventDefault();
		$(this).addClass('port-cat-selected');
		$(this).removeClass('dashed');
		$("#all_work").removeClass('port-cat-selected');
		$("#all_work").addClass('dashed');
		$("#site").removeClass('port-cat-selected');
		$("#site").addClass('dashed');
		$('.graph').show();
		$('.site').hide();
	})
	$("#about_sel").click(function about(event)
	{
		event.preventDefault();
		$(".menu").addClass('dashed');
		$(this).removeClass('dashed');
		$('.menu2').hide();
		$('#about').show();
		$(".menu").find(".f_14").text('');
		$(this).find(".f_14").text(' →');
	})
	$("#program_sel").click(function program(event)
	{
		event.preventDefault();
		$(".menu").addClass('dashed');
		$(this).removeClass('dashed');
		$('.menu2').hide();
		$('#program').show();
		$(".menu").find(".f_14").text('');
		$(this).find(".f_14").text(' →');
	})
	$("#otc_sel").click(function reg(event)
	{
		event.preventDefault();
		$(".menu").addClass('dashed');
		$(this).removeClass('dashed');
		$('.menu2').hide();
		$('#otchet').show();
		$(".menu").find(".f_14").text('');
		$(this).find(".f_14").text(' →');
	})
	$("#map_sel").add('.map_sel').click(function map(event)
	{
		event.preventDefault();
		$(".menu").addClass('dashed');
		$("#map_sel").removeClass('dashed');
		$('.menu2').hide();
		$('#map').show();
		$(".menu").find(".f_14").text('');
		$("#map_sel").find(".f_14").text(' →');
	})
	
	$("#text_sel").click(function(event)
	{
		$("#people_sel").addClass('dashed');
		$(this).removeClass('dashed');
		$('#people').hide();
		$('#text').show();
		$("#people_sel").find(".f_14").text('');
		$(this).find(".f_14").text(' →');
	})
	$("#people_sel").click(function(event)
	{
		$("#text_sel").addClass('dashed');
		$(this).removeClass('dashed');
		$('#people').show();
		$('#text').hide();
		$("#text_sel").find(".f_14").text('');
		$(this).find(".f_14").text(' →');
	})
})
