function update_stats(){
	$.ajax({
		   type: "POST",
		   url: "ajaxHendler.php",
		   data: "action=getStats",
		   success: function(msg){
			 html_res = get_response_tag('tag1',msg);
			 live = get_response_tag('tag2',msg);
			 if(live!='1') document.location = 'index.php';
			 if ($("#nbc")){
				 $("#nbc").html(html_res);  
			 }
			 
			 setTimeout("update_stats()",5000);
		   }
		});
		
	if ($("#jw_bit_rate")){ $("#jw_bit_rate").html(jwplayer('jwp_player').getMeta().videodatarate); }
}

function getVideos(page){
	$.ajax({
	   type: "POST",
	   url: "ajaxHendler.php",
	   data: "action=getVideos&page="+page,
	   success: function(msg){
		hcont = get_response_tag('tag1',msg);
		 //alert(hcont);
		 $("#videos").html(hcont);  
	   }
	});
}

function playFile(id){
	$.ajax({
	   type: "POST",
	   url: "ajaxHendler.php",
	   data: "action=playFile&id="+id,
	   success: function(msg){
		hcont = get_response_tag('tag1',msg);
		v_tit = get_response_tag('tag2',msg);
		 $("#player").html(hcont);  
		 $("#v_title").html(v_tit);  
	   }
	});
}

function showArhiva(){
	$.ajax({
	   type: "POST",
	   url: "ajaxHendler.php",
	   data: "action=showArhiva",
	   success: function(msg){
		hcont = get_response_tag('tag1',msg);
		 $("#video_cont").html(hcont);  
		 getVideos(1);
	   }
	});
}

function showLive(){
	$.ajax({
	   type: "POST",
	   url: "ajaxHendler.php",
	   data: "action=showLive",
	   success: function(msg){
		hcont = get_response_tag('tag1',msg);
		 $("#video_cont").html(hcont);  
	   }
	});
}

//** DIV Hide
$(document).ready(function(){

$(".divClass .deleteDiv").click(function(){
$(this).parents(".divClass").animate({ opacity: 'hide' }, "slow");
});

});


