﻿$(document).ready(function () {
							
	$('#accordion-1').easyAccordion({ 
			autoStart: true, 
			slideInterval: 5000
	});
	
  
  $('#leftmenu ul li.active ul li:last').css('background-image', 'none');

    $('[name=modal]').click(function(e) {
        $(this).hide();
		 $('.teh').hide();
        var id = $(this).attr('href');
		
		if(!id){
		  var id = $(this).attr('alt');
		  $('#'+id).fadeIn();
		}else{
		  $(id).fadeIn();
     }
    });

      $('div[rel=zvonok]').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();

        var id = $(this).attr('name');
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        $('#mask').css({'width':maskWidth,'height':maskHeight});
  
        $('#mask').fadeIn(1000);   
        $('#mask').fadeTo("slow",0.8); 
     
        var winH = $(window).height();
        var winW = $(window).width();

        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);
        $(id).fadeIn();
		$('html, body').animate({scrollTop:0}, 'slow');
     
    });
     
   
     $('.close').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();
        $('#mask, .window').hide();
		 $('#zvonokForm').hide();
		$(this).hide();
        $('.window').hide();
    });      

    $('#mask').click(function () {
        $('#zvonokForm').hide();
		$(this).hide();
        $('.window').hide();
    });
    $("#Form dl.requrement").hover(
      function () {
           $(this).append($("<span class='req'>Поле обязательно к заполнению</span>"));
      }, 
      function () {
           $(this).find("span:last").remove();
      }
    );
	
	
   $("#Form select:eq(1)").live('change', function()  {
    $('#Form select:eq(1) option[rel="pod"]:selected').each(function (i) {
	        $(".opor").hide();
			$(".pod").show();
    });
	$('#Form select:eq(1) option[rel!="pod"]:selected').each(function (i) {
	        $(".opor").show();
			 $(".pod").hide();
    });	 
	});
	
	$("a#photo").fancybox();
});













