$(document).ready(function()
{
	$('.message_type').change(function(e)
	{
		$('.message_form').hide();
		if ($(this).val() == 1)
		{
			$('#form_first').show();
		}
		if($(this).val() == 2)
		{
			$('#form_second').show();
		}
		if ($(this).val() == 3)
		{
			$('#form_third').show();
		}
	});
	$("#main_title").text($("#main").attr("title"));
	$("#main_title").text($("#maingal").attr("title"));
	$("#main_title").text($("#mainstep").attr("title"));

	$(".small").css("cursor","pointer");
    $(".small").hover(function()
	{
		$(this).fadeTo("slow", 0.50);
    },
    function()
	{
		$(this).fadeTo("slow", 1.00);
    });

    $(".small").click(function()
	{
    	var newsrc = $(this).attr("alt");
    	var newname = $(this).attr("title");

    	$("#main").attr("src","/img/objects/big/"+newsrc);
    	$("#mainsale").attr("src","/img/sale/big/"+newsrc);
    	$("#maingal").attr("src","/img/gallery/middle/"+newsrc);
    	$("#mainstep").attr("src","/img/steps/big/"+newsrc);
    	//$("#main").attr("title",newname);
    	$("#main_title").text(newname);
    });
});

$(document).ready(function()
{
	$('.m-img a').click(function(e)
	{
		e.preventDefault();
		var src = $(this).children('img').attr('src');
		$('#main_img').attr('src', src);
		$(this).addClass('active');
		$(this).siblings().removeClass('active');
	});
	
	$('.show_popup').click(function(e)
	{
		e.preventDefault();
		$('.popup-box.zav').toggle();
	});
	
	$('.close').click(function(e)
	{
		e.preventDefault();
		$('.popup-box').hide();
	});
	
	$('#phone').focus(function()
	{
		if ($(this).val() == 'Например, +7(3452)41-59-64')
		{
			$(this).val('');
		}
	});
	
	$('.order').click(function(e)
	{
		$('.popup-box.cat').toggle();
	});
	
	$('.proj').mouseover(show_proj);
	$('.proj').mouseleave(hide_proj);
	
	$('.proj').mouseover(show_proj);
	$('.proj').mouseleave(hide_proj);
	
	$('.proj').mouseover(show_proj);
	$('.proj').mouseleave(hide_proj);
	
	$('.proj').mouseover(show_proj);
	$('.proj').mouseleave(hide_proj);
	
});

function show_proj()
{
	$(this).children('p').animate({opacity: "show"}, "slow");
}

function hide_proj()
{
	$(this).children('p').animate({opacity: "hide"}, "slow");
}
