 
function init() {
 
  dwr.util.useLoadingMessage();
  //Tabs.init('tabList', 'tabContents');
  
  //fillGjTable();
  
}

function init(keyword,pageno,pagesize,sort,reverse) {
 
  //dwr.util.useLoadingMessage();
      
  fillGjTable(keyword,pageno,pagesize,sort,reverse);
 
}

var GjSearchResultCache = { };
 
 
function fillGjTable(keyword,pageno,pagesize,sort,reverse) {
	
  
 
	GjSearchResult.fillGjSearchResult(keyword,pageno,pagesize,sort,reverse, function(GjSearchResult) {
 
	 
    // Delete all the rows except for the "pattern" row
    dwr.util.removeAllRows("gjSearchResultbody", { filter:function(li) {
		
      return (li.id != "pattern");
    }});

	
    // Create a new set cloned from the pattern row
    var songInfo, id;

	var tolResultnum='0';//满足关键字的总记录数
	var firstSongno='';//第一个songno
	var firstSinger='';//第一个有专辑的singer
	var firstTime='';//第一个有专辑 
 
     
	 GjSearchResult.sort(function compare(a,b){return a.id-b.id;});
 
	 var subResultnum=GjSearchResult.length;

    for (var i = 0; i < pagesize; i++) {
		 
	 
      
     // id = songInfo.id;
	  id=i+1;
	  dwr.util.cloneNode("pattern", { idSuffix:id });
	 if(i<subResultnum){
		     songInfo = GjSearchResult[i];
			
			dwr.util.setValue("tableId" + id, songInfo.id);
			dwr.util.setValue("tableSongname" + id, "<a href='http://rbt.sohu.com/clwcms/sendring/songsend.php?songno="+songInfo.songno+"' target='_blank'>"+songInfo.songname+"</a>", {escapeHtml:false });

			if((songInfo.singerpath).length==0){
				dwr.util.setValue("tableSingername" + id, songInfo.singername);
			}
			else{

				dwr.util.setValue("tableSingername" + id, '<a target=_blank href=singer'+songInfo.singerpath+'>'+songInfo.singername+'</a>', {escapeHtml:false });

			}
			 
			if((songInfo.albumpath).length==0){
			    dwr.util.setValue("tableAlbum" + id, songInfo.album);
			}
			else{

				dwr.util.setValue("tableAlbum" + id, '<a target=_blank href=album'+songInfo.albumpath+'>'+songInfo.album+'</a>', {escapeHtml:false });


			}

			dwr.util.setValue("tableTime" + id, songInfo.time);
			dwr.util.setValue("tableRqNum" + id, '<center>'+ songInfo.up_num+"/"+songInfo.down_num+'</center>', {escapeHtml:false });
			dwr.util.setValue("tableStNum" + id, '<center>'+songInfo.stNum+'</center>', {escapeHtml:false });
			dwr.util.setValue("tableValue" + id, '<center>'+songInfo.value+'</center>', {escapeHtml:false });

			dwr.util.setValue("tableSend" + id, '<center><a href=http://rbt.sohu.com/clwcms/sendring/songsend.php?songno='+songInfo.songno+' target=_blank><img src=\"http://img.mms.sohu.com/rbt/rbt0316/images/motocl.gif\"></a></center>', {escapeHtml:false });

			
 
			dwr.util.setValue("syclnum1", songInfo.tolnum+"首");

			tolResultnum=songInfo.tolnum;
			if(firstSongno.length==0) firstSongno=songInfo.songno;
 
            firstTime=songInfo.time;
			if (firstTime.length>0 && firstSinger.length==0) {
				firstSinger=songInfo.singername
			}
			 
			$("pattern" + id).style.display = "";  
			 GjSearchResultCache[id] = songInfo;
	 }
	 else{

 
		dwr.util.setValue("tableId" + id, '');
		dwr.util.setValue("tableSongname" + id, '');
		dwr.util.setValue("tableSingername" + id, '');
		dwr.util.setValue("tableAlbum" + id, '');
		dwr.util.setValue("tableTime" + id, '');
		dwr.util.setValue("tableRqNum" + id,'');
		dwr.util.setValue("tableStNum" + id, '');
		dwr.util.setValue("tableValue" + id, ''); 
		dwr.util.setValue("tableSend" + id, '');


	 }
	 
	   
     
	  
    }
	 
 
	fillShowPage(vkey,tolResultnum,pageno,pagesize,sort,reverse);
	   


  });
 
 
}

 
 
 