$(function(){
	$("#newsShow li p").each(function(){
		this.innerHTML = this.innerHTML.substr(0,6) + "...";				  
	});
});


function downFlash(nextNum)
{	
	
	if(nextNum/4==1)nextNews();
	if(nextNum==0)prevNews("first");
	$("#newsImg>a").hide();
	$("#heading>h1").hide().eq(nextNum).show();
	$("#brief>p").hide().eq(nextNum).show();
	
	/*if(document.all)
	{
		$("#newsImg")[0].filters[0].Apply();
		$("#newsImg>a").eq(nextNum).show();
		$("#newsImg")[0].filters.revealTrans.transition=23;
		$("#newsImg")[0].filters[0].Play();
	}else{
		$("#newsImg>a").eq(nextNum).show();
		
	}*/
	$("#newsImg>a").eq(nextNum).fadeIn(1000);
	$("#nav li").removeClass("nonceNav").eq(nextNum).addClass("nonceNav");
	nextNum==maxNum?nextNum=0:nextNum++;
	
	MyMar=setTimeout("downFlash("+nextNum+")",5000);
	
	
	
}
function gotoTag(i)
{
	clearTimeout(MyMar);
	MyMar=setTimeout("downFlash("+i+")",1);
}

function addComment()
{
	var comment = $("#commentText").attr("value");
	if (comment.trim() == '') {
		TB_remove();
		cuju.errorMsg("不能发表空评论。");
		return;
	}
	$.ajax({
	   type: "POST",
	   url: pathApp+"news/addNewsComment/",
	   data: "comment="+$("#commentText").val()+"&news_id="+newsId,
	   error:function(){alert("服务器忙，请稍后再试。。。。");TB_remove();},
	   success: function(data){
			
			if(data=="error"){
				cuju.errorMsg("出错了，请尝试重新发表或刷新。");
			}else if (data=='loginWrong') {
				cuju.errorMsg("找不到此用户账号，可能您已经退出登录。");
			}else if (data=='frequency') {
				cuju.errorMsg("您发表的频率太快，先休息一下再聊吧。");
			}else if (data=='ban') {
				cuju.errorMsg("对不起，请不要发表含有不适当内容的评论。");
			}else{
				$("#gameCommentBox").prepend(data);
				$("#commentText").val("");
				$("#add_comment .btn_003").attr("disabled",1).css("color","#ccc");
				
				/*$(".commentTable tr").removeClass();
				$(".commentTable tr:even").addClass("even");*/
				//$("#commentNum").html(Number($("#commentNum").html())+1);
			}
	   }
	});	
}

function get_file_name()
{
	var n=Math.round(Math.random()*10);
	
	return n>5 ? "epl_ad_zhibo8" : "NBA_Ad";
	
}