var IfengAppCmt = {
	encoding:'utf-8',
	author:'kewenxing',
	date:'2008.3.10'
};

(function(){
	//截取字符串
	IfengAppCmt.substr = function(s, d) {
		if(typeof(s)=='undefined'||s.length==0){
			return '';
		}
		if(s.length>d){
			return s.substr(0, d)+'...';
		}else{
			return s;
		}
	}
    IfengAppCmt.callBackYello = function(divId){
		var str = '';
		for( var k in commentlist.commentList) {
			str += '<table width="433" height="79" border="0" cellpadding="0" cellspacing="0" style=" margin-bottom:3px;background:url(http://img.ifeng.com/tres/news/news_taitan_spectial_ask_maxie_ask_13.jpg) no-repeat">';
            str += ' <tr>';
            str += '<td width="14" height="68">&nbsp;</td>';
            str += '<td width="323"><table width="322" height="41" border="0" cellpadding="0" cellspacing="0">';
            str += '    <tr>';
            str += '      <td height="41" valign="top"><span class="f141">问题：</span><span class="txt02"><a href="http://cmt.ifeng.com/viewcmts.do?docName='+encodeURI(commentlist.commentList[k].docName)+'&docUrl='+encodeURI(commentlist.commentList[k].docUrl)+'&cmtId='+commentlist.commentList[k].ID+'&fromReply=true" target="_blank">'+IfengAppCmt.substr(commentlist.commentList[k].COMDETAIL, 48)+'</a></span></td>';
            str += '    </tr>';
            str += '</table></td>';
            str += '<td width="19">&nbsp;</td>';
            str += '<td width="82"><table width="82" height="49" border="0" cellpadding="0" cellspacing="0">';
            str += '    <tr>';
            str += '      <td height="31" class="num" align="center"><span id="c-'+commentlist.commentList[k].ID+'-a">'+commentlist.commentList[k].UPTIMES+'</span></td>';
            str += '    </tr>';
            str += '    <tr>';
            str += '      <td height="18"><a href="javascript:;" onclick="javascript:sp(this, '+commentlist.commentList[k].ID+'); return false;"><img src="http://img.ifeng.com/tres/news/news_taitan_spectial_ask_maxie_dot.gif" width="82" height="20" border="0" /></a></td>';
            str += '    </tr>';
            str += '</table></td>';
            str += '<td width="31">&nbsp;</td>';
            str += '</tr>';
            str += '</table>';
		}
		var div = document.getElementById(divId);
		div.innerHTML = str;
		
	}
	
    IfengAppCmt.callBackBlue = function(divId){
		var str = '';
		for( var k in commentlist.commentList) {
			str += '<table width="433" height="79" border="0" cellpadding="0" cellspacing="0" style=" margin-bottom:3px;background:url(http://img.ifeng.com/tres/news/news_taitan_spectial_ask_maxie_ask_133.jpg) no-repeat">';
            str += ' <tr>';
            str += '<td width="14" height="68">&nbsp;</td>';
            str += '<td width="323"><table width="322" height="41" border="0" cellpadding="0" cellspacing="0">';
            str += '    <tr>';
            str += '      <td height="41" valign="top"><span class="blue">问题：</span><span class="txt02"><a href="http://cmt.ifeng.com/viewcmts.do?docName='+encodeURI(commentlist.commentList[k].docName)+'&docUrl='+encodeURI(commentlist.commentList[k].docUrl)+'&cmtId='+commentlist.commentList[k].ID+'&fromReply=true" target="_blank">'+IfengAppCmt.substr(commentlist.commentList[k].COMDETAIL, 48)+'</a></span></td>';
            str += '    </tr>';
            str += '</table></td>';
            str += '<td width="19">&nbsp;</td>';
            str += '<td width="82"><table width="82" height="49" border="0" cellpadding="0" cellspacing="0">';
            str += '    <tr>';
            str += '      <td height="31" class="num_blue" align="center"><span id="c-'+commentlist.commentList[k].ID+'-a">'+commentlist.commentList[k].UPTIMES+'</span></td>';
            str += '    </tr>';
            str += '    <tr>';
            str += '      <td height="18"><a href="javascript:;" onclick="javascript:sp(this, '+commentlist.commentList[k].ID+'); return false;"><img src="http://img.ifeng.com/tres/news/news_taitan_spectial_ask_maxie_dot.gif" width="82" height="20" border="0" /></a></td>';
            str += '    </tr>';
            str += '</table></td>';
            str += '<td width="31">&nbsp;</td>';
            str += '</tr>';
            str += '</table>';
		}
		var div = document.getElementById(divId);
		div.innerHTML = str;
		
	}
	
	IfengAppCmt.hello = function(){
	    alert('hello');
	}
	
    IfengAppCmt.callBack1 = function(){
	    IfengAppCmt.callBackYello("div1");
	}
    IfengAppCmt.callBack2 = function(){
	    IfengAppCmt.callBackYello("div2");
	}
    IfengAppCmt.callBack3 = function(){
	    IfengAppCmt.callBackBlue("div3");
	}
    IfengAppCmt.callBack4 = function(){
	    IfengAppCmt.callBackBlue("div4");
	}
    IfengAppCmt.callBack5 = function(){
	    IfengAppCmt.callBackYello("div5");
	}
    IfengAppCmt.callBack6 = function(){
	    IfengAppCmt.callBackYello("div6");
	}
    IfengAppCmt.callBack7 = function(){
	    IfengAppCmt.callBackBlue("div7");
	}
    IfengAppCmt.callBack8 = function(){
	    IfengAppCmt.callBackBlue("div8");
	}
 
})();