var newClass = function() {
	return function() {
		return this.init.apply(this, arguments);
	}
}

var Smena1 = newClass();

Smena1.prototype = {

  init: function() {
	 var t = this;
	 
	// кнопка play на главной
	$(".Play img").mouseover(function() {
	$(".Play img").addClass("DisplayNone");
	$(".Play img.NavImg").addClass("DisplayBlock");
    });
	
	$(".Play img").mouseout(function() {
	$(".Play img").removeClass("DisplayNone");
	$(".Play img.NavImg").removeClass("DisplayBlock");
    });
	
	$(".PublicTable td").mouseover(function() {
	$(this).parents(".PublicTable tr").addClass("SelTrPT");
    });
	
	$(".PublicTable td").mouseout(function() {
	$(this).parents(".PublicTable tr").removeClass("SelTrPT");
    });
	
	$(".RMenu span").click(function() {
	$(this).toggleClass("SelRM");								
	$(this).parents(".RMenu li").find(".OnclickSelRM").slideToggle("slow");
    });

  $(".OnClickLi b").click(function() {							
	$(this).parents(".OnClickLi").find(".OnClickLiDysplay").slideToggle("slow");
    });
    
  $(".ImgLiEO li a").mouseover(function() {
	$(this).find(".ColorImg").removeClass("DisplayNone");
  $(this).find(".SerImg").addClass("DisplayNone");
    });
    
  $(".ImgLiEO li a").mouseout(function() {
	$(this).find(".ColorImg").addClass("DisplayNone");
  $(this).find(".SerImg").removeClass("DisplayNone");
    });
  
  $(".ListPractik li span").click(function() {
	$(this).toggleClass("SelRM");								
	$(this).parents(".ListPractik li").find(".BlockHoverText").slideToggle(1500);
    });
  
  $(".BlockAS .NameAS span").click(function() {
	$(this).toggleClass("ClickAS");										
	$(this).parents(".BlockAS").find(".ActsSakon").slideToggle(1000);
    });
    
  $("#all_contacts").click(function() {
   // $(".ContactsCitySelect").slide("slow");
   // $(".Contacts").removeClass("ContactsCitySelect");
    
    $(".Contacts").slideDown("slow");
    $(".Contacts").addClass("ContactsCitySelect");
    });
  
  $(".HeaderCP span").click(function() {
	$(this).toggleClass("ClickAS");						 
	$(this).parents(".BlockPriceRasdel").find(".PosPT").slideToggle("slow");									
    });

	  $(".Razdels").find("div.Razdel").mouseover(function() {
							
	$(this).css("background","#3d4248");
	$(this).parents(".BlockR").find(".PhotoBlock").addClass("DisplayNone");
  $(this).parents(".BlockR").find(".FlashBlock").removeClass("DisplayNone");
    });
	
$(".Razdels div.Razdel").mouseout(function() {
							
	$(".Razdels div.Razdel").css("background","#2b3037");
  $(this).parents(".BlockR").find(".PhotoBlock").removeClass("DisplayNone");
  $(this).parents(".BlockR").find(".FlashBlock").addClass("DisplayNone");
    });
	
		  $(".Razdels").find(".FindOut img").mouseover(function() {
  $(this).parents(".FindOut").find(".Ten").removeClass("DisplayNone");
    });
	
		$(".Razdels").find(".FindOut img").mouseout(function() {
  $(this).parents(".FindOut").find(".Ten").addClass("DisplayNone");
    });

    $(".VkladkaF").mouseout(function() {
	$(this).removeClass("Select");
    });


  $(".VkladkaF").mouseover(function() {
		if ($(this).is(".GreyTopButton")) {
		return;
		}
		else {
		$(this).addClass("Select");
		}
    });
   
 $(".PhotoBlockPB").mouseenter(function() {
	$(this).find(".MenuPB").find(".MenuT a").parents(".MenuPB").addClass("SelectMPB");
	$(this).find(".TextTB").fadeIn("fast");
    });
	
	$(".PhotoBlockPB").mouseleave(function() {
	$(".MenuPB").removeClass("SelectMPB");
	$(".TextTB").fadeOut("fast");
    });
	
	$(".RegionRaz span").click(function() {
	$(".SelectRR").slideDown("fast");
	t.timer = setTimeout(function(){t.hideAllPopup()}, 2000);
    });
	
	$(".SelectRR").mouseenter(function() {
	clearTimeout(t.timer);
	});
	
	$(".SelectRR").mouseleave(function() {
	$(this).fadeOut("slow");
    });

	$("#telnumb").focus(function() {
		if($(this).val() == "Ваш номер телефона") {
			$(this).val("");
		}
	});
	
	$("#telnumb").blur(function() {
		if($(this).val() == "") {
			$(this).val("Ваш номер телефона");
		}
	});
	
	$("#list_city_eo ul li a").click(function() {
    var id = $(this).attr("id");
    $("#loader_city").html('<div style="cursor: default;" onclick="this.blur();" onfocus="this.blur();"><img src = "/i/loader.gif"/></div>');
    if (id != '') {
      jQuery.get('/city.php',{
      city: id
      }, function(text) {
        if (id == '73') {
          $("#city").html("Ульяновск");
          $("#phone").html(support_ph ? '<span class="Cod">(8422)</span>277-709' : "<span class='Cod'>(8422)</span>41-28-82");
					
          $("#loader_city").html('');
		  $('#footer .RightColumnF .Studio .InfaSite').fadeIn("fast");
        } else {
		  $('#footer .RightColumnF .Studio .InfaSite').fadeOut("fast");
          if (id == '63') {
            $("#city").html("Самара");
            $("#phone").html(support_ph ? '<span class="Cod">(846)</span>374-54-04' : "<span class='Cod'>(846)</span>342-54-04");
            $("#loader_city").html('');
          } else if  (id == '63t') {
            $("#city").html("Тольятти");
            $("#phone").html("<span class='Cod'>(8482)</span>34-92-00");
            $("#loader_city").html('');
          } else {
            $("#city").html("Москва");
            $("#phone").html(support_ph ? '<span class="Cod">(495)</span>660-76-89' :  "<span class='Cod'>(495)</span>926-26-59");      
            $("#loader_city").html('');
          }
        }
      });
    }
  });
	
		$("#eo_index_city ul li a").click(function() {
    var id = $(this).attr("id");
    $("#loader_city").html('<div style="cursor: default;" onclick="this.blur();" onfocus="this.blur();"><img src = "/i/loader.gif"/></div>');
    if (id != '') {
      jQuery.get('/city.php',{
      city: id
      }, function(text) {
        if (id == '73') {
          $("#city").html("Ульяновск");
          $("#phone").html("<span class='Cod'>(8422)</span>41-28-82");
					
          $("#loader_city").html('');
   	      $('#footer .RightColumnF .Studio .InfaSite').fadeIn("fast");
        } else {
		  $('#footer .RightColumnF .Studio .InfaSite').fadeOut("fast");
          if (id == '63') {
            $("#city").html("Самара");
            $("#phone").html("<span class='Cod'>(846)</span>342-54-04");
          } else if  (id == '63t') {
            $("#city").html("Тольятти");
            $("#phone").html("<span class='Cod'>(8482)</span>34-92-00");
          } else {
            $("#city").html("Москва");
            $("#phone").html("<span class='Cod'>(495)</span>926-26-59");      
          }
        }
				$.get("/inc/eo_index_new_ajax_inc.php?id="+id, function(data) {
					$("#eo_index_new").html(data); 
					$("#loader_city").html('');
				});
      });
			
    }
  });
	
	$("#section_price").change(function(){
		var sec = $("#section_price").val();
		//var text = $("#section_price option:selected").text();
		//$("#price_title").html('Тарифы и цены '+text);
		$(".SectionPrise").hide();
		$("#section_"+sec).show();
	});
	
	
 },
 
	hideAllPopup: function() {
	$(".SelectRR").fadeOut("slow");
	}

};

$(document).ready(function(){
	new	Smena1();
$(".SelectRR").css("display","none");
});
