HOTPRODUCTLIST=function(){}
HOTPRODUCTLIST.prototype.list=function(){
	var fncSuc = XHR.Delegate(this,this.listSuc);
	var param = {act: "listHotProduct"};
	new XHR("post",fncSuc).send($PN+"/Proc",param);	
}
HOTPRODUCTLIST.prototype.listSuc=function(r){
	var xml = new XML(r);
	var html = "";
	if (xml.value){
		var html="";
		var pro = xml.get("product");
		var height = 0;
		for(var i=0; i < pro.length; i++){
			html+="<div>"+this.gen1Block(pro[i])+"</div>";
			height+=180;
		}
		if(pro.length==0){
			html = "No data";
			$("hotproductlist").innerHTML = html;
		}else{
			html = "<marquee id=\"hot_product_marquee\" direction=\"up\" scrollamount=\"2\" scrolldelay=\"2\" loop=\"-1\" class=\"marquee_hotproduct\"  onmouseover=\"this.stop()\" onmouseout=\"this.start()\">"+
						html+
					"</marquee>";
			$("hotproductdiv").style.display="block";
			$("hotproductlist").innerHTML = html;
		}

		try{$("title_hot_product").value = xml.get("title")[0].getAttribute("value");}catch(e){}
		try{$("title_hot_product").innerHTML = xml.get("title")[0].getAttribute("value");}catch(e){}
		
	}
}
HOTPRODUCTLIST.prototype.gen1Block=function(pro){
	try{
		var html="";
		var title;
		var id = pro.getAttribute("id");
		
		var file = (pro.getAttribute("filepic")=="") ? "../../images/noimg.gif" : $LIB_PATH+getThumbPath(pro.getAttribute("filepic"))
		
		var pic = 	"";
		var price = "";	
		var text = "Giá: ";
		if($LANG=="en")
			text = "Price: "
		var saleprice = pro.getAttribute("saleprice");
		var stylesale = "",styleprice="";
		if(saleprice!="" && saleprice!="null"){
			saleprice= "<div>"+text+"<span class=\"price\">"+saleprice+"</span></div>";
			stylesale="style=\"text-decoration: line-through;\"";
			styleprice="style=\"font-size:11px;font-weight:normal\"";
		}else{
			saleprice="";
		}
		if(pro.getAttribute("price")!=""){
			price = "<div "+stylesale+">"+text+"<span "+styleprice+" class=\"price\">"+pro.getAttribute("price")+"</span></div>";
		}
		
		
		title = "<a class=\"title_hotproduct\" href=\"?act=productdetail&id="+id+"&lang="+$LANG+"\">"+
					pro.getAttribute("title")+
				"</a>";
		pic = "<a href=\"?act=productdetail&id="+id+"&lang="+$LANG+"\"><img class=\"pic_hotproduct\" align=\"left\" style=\"margin-right:7px\" src=\""+file+"\"/></a>";
		html = "<table cellpadding='0' cellspacing='0' width='100%' class='border_hotproduct'><tr>" +
					"<td width='10%' valign='top' style='padding-bottom:5px'>" +
						pic+
					"</td>" +
					"<td width='90%' valign='top' style='padding-bottom:5px'>" +
						title+price+saleprice+
					"</td>"+
				"</tr></table>";
		return html;
	}catch(e){
		return "";
	}
}
