var newClass = function() {
	return function() {
		return this.init.apply(this, arguments);
	}
}

var Toggle = newClass();

Toggle.prototype = {
  init: function() {
    var t = this;

    t.VotingBtn = $('div.VotingBtn');
    t.CommentBtn = $('div.CommentBtn');
    t.CommentPopup = $('div.CommentPopup');


    t.VotingBtn.click(function(){
      t.showVoid();
    });

    $('div.CloseP').click(function(){
      t.showVoid();
    });

    t.CommentBtn.click(function(){
      t.showComment();
    });

    $('div.ClosePop').click(function(e){
      e.stopPropagation();
      e.preventDefault();
      t.showComment();
    });

  },

  showVoid: function() {
     var t = this;
     $('div.VBl').slideToggle(0);
     $('div.Point').slideToggle(0);
  },

  showComment: function() {
     var t = this;
     $('div.CommentPopup').slideToggle(0);
  }
}




var Smena = newClass();

Smena.prototype = {

  init: function() {
	 var t = this;


  $("div.SBtn").click(function() {
	$(this).parents(".AbsBB").find(".New").removeClass("DisplayNone");
	$(this).parents(".AbsBB").find(".Popular").addClass("DisplayNone");
	$(this).find("img").addClass("DisplayNone");
	$(this).find("img.Sel").removeClass("DisplayNone");
	$(this).parents(".AbsBB").find(".Pop img").removeClass("DisplayNone");
	$(this).parents(".AbsBB ").find(".Pop img.Sel").addClass("DisplayNone");
    });

  $("div.Pop").click(function() {
	$(this).parents(".AbsBB").find(".Popular").removeClass("DisplayNone");
	$(this).parents(".AbsBB").find(".New").addClass("DisplayNone");
	$(this).find("img").addClass("DisplayNone");
	$(this).find("img.Sel").removeClass("DisplayNone");
	$(this).parents(".AbsBB").find(".SBtn img").removeClass("DisplayNone");
	$(this).parents(".AbsBB ").find(".SBtn img.Sel").addClass("DisplayNone");
    });

  $(".BtnVideo a.Ser").click(function() {
    $(this).parents(".Buttons").find("a").toggleClass("DisplayNone");
    $("#razdel_foto").hide("");
    $("#razdel_video").show("");;
  });

  $(".BtnPhoto a.Ser").click(function() {
    $(this).parents(".Buttons").find("a").toggleClass("DisplayNone");
    $("#razdel_video").hide("");
    $("#razdel_foto").show("");
  });

  $(".NewH a.RazdelNew").click(function() {
    $(this).parents(".NewH").find("a.RazdelNew").addClass("Select");
    $(this).parents(".NewH").find("a.RazdelPop").removeClass("Select");
    $(this).parents(".RazdelButtons").find(".RazdelButtonsPop").hide("");
    $(this).parents(".RazdelButtons").find(".RazdelButtonsNew").show("");
  });

  $(".NewH a.RazdelPop").click(function() {
    $(this).parents(".NewH").find("a.RazdelPop").addClass("Select");
    $(this).parents(".NewH").find("a.RazdelNew").removeClass("Select");
    $(this).parents(".RazdelButtons").find(".RazdelButtonsNew").hide("");
    $(this).parents(".RazdelButtons").find(".RazdelButtonsPop").show("");
  });
 }
};



$(document).ready(function(){
	new	Smena();
	$('div.Pop').click();
});
