// JavaScript Document
var activehotprogram=1;

function liactive(ids){
/*
 if(ids!=activehotprogram){
		$("#hotp"+activehotprogram).removeClass("hilight");
		$("#hotp"+ids).addClass("hilight");
		activehotprogram=ids;
	}
	*/
}
function tabtop5(tabname){
closetabtop5();
$('#'+tabname).fadeIn(500);
$("#link_"+tabname).addClass("active");
}
function closetabtop5(){
$('#top5news').css({ "display": "none" });
$("#link_top5news").removeClass("active");
$('#top5programs').css({ "display": "none" });
$("#link_top5programs").removeClass("active");
}
var tabcat=['politic','foreign','economic'];
function tabcategory(tabname){
closetabcategory();
$("#link_"+tabname).addClass("active");
$('#tab_'+tabname).fadeIn(500);
}
function closetabcategory(){
jQuery.each(tabcat, function() {
        $('#tab_'+this).css({ "display": "none" });
		$("#link_"+this).removeClass("active");
    });
}
var tabcat2=['crime','security','entertain'];
function tabcategory2(tabname){
closetabcategory2();
$("#link_"+tabname).addClass("active");
$('#tab_'+tabname).fadeIn(500);
}
function closetabcategory2(){
jQuery.each(tabcat2, function() {
        $('#tab_'+this).css({ "display": "none" });
		$("#link_"+this).removeClass("active");
    });
}
var tabpro=['program1','program2','program3'];
function tabprogram(tabname){
closetabprogram();
$("#link_"+tabname).addClass("active");
$('#'+tabname).fadeIn(500);
}
function closetabprogram(){
jQuery.each(tabpro, function() {
        $('#'+this).css({ "display": "none" });
		$("#link_"+this).removeClass("active");
    });
}
var tabbreaking=['1','2','3'];
var bg_breaking ='';
/*
function get_breaking(tabid){
closetabbreaking();
$('#breakingnews_nationupdatenews_'+tabid).fadeIn(500);
}
function closetabbreaking(){
jQuery.each(tabbreaking, function() {
        $('#breakingnews_nationupdatenews_'+this).css({ "display": "none" });
    });
}
*/

 function get_breaking(tabid){
	         if(tabid==1){
				 bg_breaking='#CCCCCC';
			 }else if(tabid==2){
				 bg_breaking='#578ad6'; 
			 }else{
				 bg_breaking='#a5b6e1';
			 }
			 $('#breakingnews_nationupdatenews').css('background-color',bg_breaking);
             $('#breakingnews_nationupdatenews').html('<center><br><br><p><font style="font-size:14px; font-weight:800; color:#FFF;">Loading...</font></p></center>');
			 $.ajax({
				   type: "POST",
				   url: "http://www.nationchannel.com/home/breakingnews/getnews/",
				   data: "tabid="+tabid,
				   success: function(txt){
				        $('#breakingnews_nationupdatenews').html(txt);
				   }
			 });
	          
		
	 }

function getcaptcha(){

  $.ajax({
				   type: "POST",
				   url: urlhome+"captcha/index/mtm/",
				   data: {},
				   success: function(txt){
				        $('#captcha_img').html(txt);
				   }
				 });
}			
function mtm() { 

var msg1=$('#talk1-form').val();
var msg2=$('#talk2-form').val();
var name=$('#sender').val();
var captcha=$('#captcha').val();


    if ( !captcha || !msg1 || !msg2 || !name ) { 
        $('#status_form').html('¡ÃØ³ÒãÊè¢éÍÁÙÅãËé¤Ãº¶éÇ¹¹Ð¤ÃÑº'); 
    } else{
    $('#status_form').html(' <p>&nbsp; &nbsp;<font style="color:#CC0000; font-size:12px;">Loading.. </font></p>');
	$("#Submit").attr("disabled", "disabled");
				  $.ajax({
				   type: "POST",
				   url: urlhome+"opinion/post_mtm/",
				   data: "name="+name+"&msg1="+msg1+"&msg2="+msg2+"&captcha="+captcha,
				   success: function(txt){
				        Response(txt);
				   }
				 });
	}
} 
 

function Response(responseText)  { 
 $("#Submit").removeAttr("disabled");
 var Result = responseText.split("|");
if(Result[0]==1){
clearForm();
$('#status_form').html('<p>'+Result[1]+'</p>');
}else{
$('#status_form').html('<p>'+Result[1]+'</p>');
}
} 
function clearForm(){
$('#talk1-form').val('');
$('#talk2-form').val('');
$('#sender').val('');
$('#captcha').val('');
getcaptcha();
}
function mtm_related(){
window.open('http://www.nationchannel.com/show_banleng.php','mywin','width=540,height=590,toolbar=0,scrollbars=1,resizable=0');
}
function livechannel(bit)
{
window.open('http://www.nationchannel.com/livechannel.php?bitrate='+bit,'mywin','width=700,height=640,toolbar=0,scrollbars=0,resizable=0');
}
function panda_live(){
window.open('http://www.nationchannel.com/home_bak/panda_live.php','mywin','width=575,height=448,toolbar=0,resizable=0');
}