

$(function() {
    $(".gradient").pxgradient({ //произвольный селектор jQuery
        step: 5, // размер шага градиента в пикселях. Меньше шаг - больше качество, но меньше производительность
        colors: ["#682d90","#ff4d34","#f9971a"], // цвета. формат - hex (#4fc05a или #333)
        dir: "x" // направление градиента. x - горизонтальное, y - вертикальное
    });
   
    //ie6-9
    if (window.PIE) {
        $('.gradient,.tab-wrap,.tab-wrap div, .gradient-bord, .gradient-bord div').each(function() {
            PIE.attach(this);
        });
    }
});//end dom ready

$(document).ready(function (){

	jQuery.fn.center = function() 
	{
	var w = $(window);
	this.css("position","absolute");
	this.css("top",(w.height()-this.height())/2+w.scrollTop() + "px");
	this.css("left",(w.width()-this.width())/2+w.scrollLeft() + "px");
	return this;
	}
	
	//$('#order_div').show();
	$('#order_div').center();
	$(window).scroll(function () {
		$('#order_div').center();
	});
	
	
	$('#aj_but').click(function() {
		if($('#aj_name').val()!=''||$('#aj_email').val()!='')
			{
			$('#order_div').hide();
			alert("Ваше сообщение отправлено");
			}
			else alert("Заполните контактные данные");
	})
	
	$('.manager-online .link-l').click(function() {
		$('#order_div').show();
		$('#order_div').center();
	})

	
	$('#close_but').click(function() {
		$('#order_div').hide();
		
	})
	

	$('.act_off').click(function() {
	 document.location.href='office_obj/';
	});
	
	$('.act_rest').click(function() {
	 document.location.href='rest_obj/';
	});
	
	$('.act_shop').click(function() {
	 document.location.href='shop_obj/';
	});
	
	
	$('.act_off1').click(function() {
	 document.location.href='../../../../offices/office_obj/';
	});
	
	$('.act_rest1').click(function() {
	 document.location.href='../../../../restaurants/rest_obj/';
	});
	
	$('.act_shop1').click(function() {
	 document.location.href='../../../../shops/shop_obj/';
	});
	
	
	$('.shop').click(function() {
	 document.location.href='../../../../shops/';
	});
	
	$('.office').click(function() {
	 document.location.href='../../../../offices/';
	});
	
	$('.saloon').click(function() {
	 document.location.href='../../../../restaurants/';
	});

	$(".shop").hover(
	  function () {
		$(this).find('a').addClass('dd');
		
	  }, 
	  function () {
		$(this).find('a').removeClass('dd');
	  }
	);
	
	$(".office").hover(
	  function () {
		$(this).find('a').addClass('dd');
		
	  }, 
	  function () {
		$(this).find('a').removeClass('dd');
	  }
	);
	
	$(".saloon").hover(
	  function () {
		$(this).find('a').addClass('dd');
		
	  }, 
	  function () {
		$(this).find('a').removeClass('dd');
	  }
	);
	
	$('.show_year').click(function(){
	
		var id_year=$(this).attr('id');
		
		my_year=id_year.split('_');
		year=my_year[1];
		
		$('.my_year').css('display','none');
		$('.y_'+year).css('display','block');
	
		
	
	if(mn==1)
		{
		$('.result h4').html("Проекты офисов, выполненные за "+$(this).html()+" год:");
		}
		else if(mn==3)
			{
			$('.result h4').html("Проекты магазинов, выполненные за "+$(this).html()+" год:"); 
			}
			else $('.result h4').html("Проекты ресторанов, выполненные за "+$(this).html()+" год:");
	
	});
});

