function commendByViewHistory(tableId,size){
	var table=document.getElementById(tableId);
	var ts=new Date().getTime();
	var url="/searchhistory/getCommendCommodities.htm?size="+size+"&ts="+ts;
	jQuery.ajax({url:url, 
			type:"GET", 
			timeout:5000, 
			dataType:"json",
			error:function () {
			},
			success:function (data) {
				if(data != undefined && data.length>0) {
					commendByReturnDate(table,size,data);
				}else{
					commendNothing(table);
				}
			}
	});
}

function commendNothing(table){
	var tr0=document.createElement("tr");
	var td0=document.createElement("td");
	td0.setAttribute("align","center");
	td0.setAttribute("valign","top");
	td0.setAttribute("colspan","2");
	td0.className="font5";
	td0.innerHTML="无记录";
	tr0.appendChild(td0);
	var tr1=document.createElement("tr");
	var td10=document.createElement("td");
	td10.setAttribute("align","center");
	td10.setAttribute("valign","top");
	td10.className="l_line4";
	td10.innerHTML="&nbsp;";
	var td11=document.createElement("td");
	td11.setAttribute("align","left");
	td11.setAttribute("valign","top");
	td11.className="l_line4";
	td11.innerHTML="&nbsp;";
	tr1.appendChild(td10);	
	tr1.appendChild(td11);
	table.appendChild(tr0);
	table.appendChild(tr1);
}

function commendByReturnDate(table,size,data){
	for(var i=0;i<data.length;i++){
		var product=data[i];
		var tr0=document.createElement("tr");
		var td00=document.createElement("td");
		td00.setAttribute("width","80");
		td00.setAttribute("align","center");
		td00.setAttribute("valign","top");
		var a0=document.createElement("a");
		a0.setAttribute("href",product.accessUrl);
		a0.setAttribute("target","_blank");
		var img=document.createElement("img");
		img.setAttribute("src",product.smallImgPath);
		img.setAttribute("width","70");
		img.setAttribute("height","98");
		img.setAttribute("border","0");
		img.setAttribute("alt",product.name);
		a0.appendChild(img);
		td00.appendChild(a0);
		tr0.appendChild(td00);
		var td01=document.createElement("td");
		td01.setAttribute("align","left");
		td01.setAttribute("valign","top");
		var a1=document.createElement("a");
		a1.setAttribute("href",product.accessUrl);
		a1.setAttribute("target","_blank");
		a1.className="font9 lh24";
		var name=document.createElement("strong");
		name.appendChild(document.createTextNode(product.name));
		a1.appendChild(name);
		var listPrice=document.createElement("span");
		listPrice.className="price1";
		listPrice.appendChild(document.createTextNode("定价：￥"+product.listPrice));
		var salePrice0=document.createElement("span");
		salePrice0.className="price2";
		salePrice0.appendChild(document.createTextNode("现价："));
		var salePrice1=document.createElement("span");
		salePrice1.className="price3";
		var salePrice2=document.createElement("strong");
		salePrice2.appendChild(document.createTextNode("￥"+product.salePrice));
		salePrice1.appendChild(salePrice2);
		td01.appendChild(a1);
		td01.appendChild(document.createElement("br"));
		td01.appendChild(listPrice);
		td01.appendChild(document.createElement("br"));
		td01.appendChild(salePrice0);
		td01.appendChild(salePrice1);
		tr0.appendChild(td01);
		var tr1=document.createElement("tr");
		var td10=document.createElement("td");
		td10.setAttribute("align","center");
		td10.setAttribute("valign","top");
		td10.className="l_line4";
		td10.innerHTML="&nbsp;";
		tr1.appendChild(td10);
		var td11=document.createElement("td");
		td11.setAttribute("align","left");
		td11.setAttribute("valign","top");
		td11.className="l_line4";
		td11.innerHTML="&nbsp;";
		tr1.appendChild(td11);
		table.appendChild(tr0);
		table.appendChild(tr1);
	}
}