$(document).ready(function() {
	/* formula vlasti */
	$(".fvl_block .media_tabs li").click(function() {
		if(!$(this).hasClass("active")) {
			$(".fvl_block .media_filter_content").html("Загрузка..");
			
			$.ajax({
				url: "/fvl/" + $(this).attr("id").substr(4) + ".html",
				success: function(data){
					$(".fvl_block .media_tabs_content").html(data);
					$("#scroller").jScrollPane({
						scrollbarWidth: 11
					});
					jQuery(".fvl_block .media_tabs_content a.pw_audio").live("click", function() {
						j_this4 = jQuery(this);
						j_href = j_this4.attr("href");
						j_name = "pw_audio";
						var j_params = "width=350,height=68,menubar=no,location=no,resizable=yes,scrollbars=no,status=no";
						window.open(j_href,j_name,j_params);
					        return false;
					});
				}
			});
			
			$(this)
				.siblings().removeClass("active").end()
				.addClass("active");
		}
	});
	
	/* echo planety */
	$(".echo_block .media_tabs li").click(function() {
		if(!$(this).hasClass("active")) {
			$(".echo_block .media_filter_content").html("Загрузка..");
			
			$.ajax({
				url: "/echo/" + $(this).attr("id").substr(4) + ".html",
				success: function(data){
					$(".echo_block .media_tabs_content").html(data);
					$("#scroller2").jScrollPane({
						scrollbarWidth: 11
					});
				}
			});
			
			$(this)
				.siblings().removeClass("active").end()
				.addClass("active");
		}
	});

	/* multimedia */
	$(".media_block_2 .media_tabs li").click(function() {
		if(!$(this).hasClass("active")) {
			$(".media_block_2 .media_filter_content").html("Загрузка..");
			
			$.ajax({
				url: "/mm/" + $(this).attr("id").substr(4) + ".html",
				success: function(data){
					$(".media_block_2 .media_tabs_content").html(data);
					$("#scroller3").jScrollPane({
						scrollbarWidth: 11
					});
					jQuery(".media_block_2 .media_tabs_content a.pw_audio").live("click", function() {
						j_this4 = jQuery(this);
						j_href = j_this4.attr("href");
						j_name = "pw_audio";
						var j_params = "width=350,height=68,menubar=no,location=no,resizable=yes,scrollbars=no,status=no";
						window.open(j_href,j_name,j_params);
					        return false;
					});
				}
			});
			
			$(this)
				.siblings().removeClass("active").end()
				.addClass("active");
		}
	});

	
	/* formula vlasti */
	$(".fvl_block .media_filter li").live('click', function() {
		if(!$(this).hasClass("active")) {
			$(".fvl_block .media_filter_content").html("Загрузка...");
			
			$.ajax({
				url: "/fvl/" + $(this).attr("id").substr(4) + ".html",
				success: function(data){
					$(".fvl_block .media_filter_content").html(data);
					$("#scroller").jScrollPane({
						scrollbarWidth: 11
					});
					jQuery(".fvl_block .media_filter_content a.pw_audio").live("click", function() {
						j_this4 = jQuery(this);
						j_href = j_this4.attr("href");
						j_name = "pw_audio";
						var j_params = "width=350,height=68,menubar=no,location=no,resizable=yes,scrollbars=no,status=no";
						window.open(j_href,j_name,j_params);
					        return false;
					});
				}
			});
			
			$(this)
				.siblings().removeClass("active").end()
				.addClass("active");
		}
	});

	/* echo planety */
	$(".echo_block .media_filter li").live('click', function() {
		if(!$(this).hasClass("active")) {
			$(".echo_block .media_filter_content").html("Загрузка...");
			
			$.ajax({
				url: "/echo/" + $(this).attr("id").substr(4) + ".html",
				success: function(data){
					$(".echo_block .media_filter_content").html(data);
					$("#scroller2").jScrollPane({
						scrollbarWidth: 11
					});
				}
			});
			
			$(this)
				.siblings().removeClass("active").end()
				.addClass("active");
		}
	});

	/* multimedia */
	$(".media_block_2 .media_filter li").live('click', function() {
		if(!$(this).hasClass("active")) {
			$(".media_block_2 .media_filter_content").html("Загрузка...");
			
			$.ajax({
				url: "/mm/" + $(this).attr("id").substr(4) + ".html",
				success: function(data){
					$(".media_block_2 .media_filter_content").html(data);
					$("#scroller3").jScrollPane({
						scrollbarWidth: 11
					});
					jQuery(".media_block_2 .media_filter_content a.pw_audio").live("click", function() {
						j_this4 = jQuery(this);
						j_href = j_this4.attr("href");
						j_name = "pw_audio";
						var j_params = "width=350,height=68,menubar=no,location=no,resizable=yes,scrollbars=no,status=no";
						window.open(j_href,j_name,j_params);
					        return false;
					});
				}
			});
			
			$(this)
				.siblings().removeClass("active").end()
/*				.addClass("active")*/;
		}
	});

	
	/* formula vlasti */
	$(".fvl_block .media_list li a").live('click', function() {
		$(".fvl_block .video_box").html("Загрузка...");
		
		$.ajax({
			url: "/fvl/" + $(this).attr("href") + ".html",
			success: function(data){
				$(".fvl_block .video_box").html(data);
				jQuery(".fvl_block .video_box a.pw_audio").live("click", function() {
					j_this4 = jQuery(this);
					j_href = j_this4.attr("href");
					j_name = "pw_audio";
					var j_params = "width=350,height=68,menubar=no,location=no,resizable=yes,scrollbars=no,status=no";
					window.open(j_href,j_name,j_params);
				        return false;
				});
			}
		});
		
		return false;
	});

	/* echo planety */
/*	$(".echo_block .media_list li a").live('click', function() {
		$(".echo_block .video_box").html("Загрузка...");
		
		$.ajax({
			url: "/echo/" + $(this).attr("href") + ".html",
			success: function(data){
				$(".echo_block .video_box").html(data);
			}
		});
		
		return false;
	});*/

	/* multimedia */
	$(".media_block_2 .media_list li a").live('click', function() {
		$(".media_block_2 .video_box").html("Загрузка...");
		
		$.ajax({
			url: "/mm/" + $(this).attr("href") + ".html",
			success: function(data){
				$(".media_block_2 .video_box").html(data);
				jQuery(".media_block_2 .video_box a.pw_audio").live("click", function() {
					j_this4 = jQuery(this);
					j_href = j_this4.attr("href");
					j_name = "pw_audio";
					var j_params = "width=350,height=68,menubar=no,location=no,resizable=yes,scrollbars=no,status=no";
					window.open(j_href,j_name,j_params);
				        return false;
				});
			}
		});
		
		return false;
	});
	
	/* formula vlasti */
	$("#scroller").jScrollPane({
		scrollbarWidth: 11
	});

	/* echo planety */
	$("#scroller2").jScrollPane({
		scrollbarWidth: 11
	});

	/* multimedia */
	$("#scroller3").jScrollPane({
		scrollbarWidth: 11
	});


});
