function ConfirmDel()
{
        if(confirm("确定要删除吗？删除将不能恢复！"))
                return true;
        else
                return false;
        
}
function setCookie(name, value) //cookies设置 
{ 
	var argv = setCookie.arguments; 
	var argc = setCookie.arguments.length; 
	var expires = (argc > 2) ? argv[2] : null; 
	if(expires!=null) 
	{ 
		var LargeExpDate = new Date (); 
		LargeExpDate.setTime(LargeExpDate.getTime() + (expires*1000*3600*24)); 
	} 
	document.cookie = name + "= " + escape(value)+';path=/'+((expires == null) ? " " : ( "; expires= " +LargeExpDate.toGMTString())); 
} 
//取cookie
function getCookie(name) //cookies读取 
{   
	var search = name + "=" 
	if(document.cookie.length > 0) 
	{ 
		offset = document.cookie.indexOf(search);
		if(offset != -1) 
		{ 
			offset += search.length;
			end = document.cookie.indexOf( "; ", offset);
			if(end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		} 
		else return ""; 
	} 
}
//////////////////////////////////////////////查看历史记录
function GetHistoryView()
{
	var str = getCookie('hlook');
	if (str != ""||str !="underfind")
	{
		var tArr = str.split('||$$||');
		if (tArr.length > 0)
		{
			for (i = 0; i < tArr.length; i++)
			{
				var sArr = tArr[i].split('|$|');
				if (sArr.length > 1)
				{
					LoadHistoryView(sArr[0],sArr[1],sArr[2],i);
				}
			}
		}
	}
}

function LoadHistoryView(pId,pName,pImg,i)
{
		var td0= document.createElement("li");
		
//		td0.setAttribute("width","190px");
		
		td0.innerHTML = '<A HREF="Detail.aspx?cid='+pId+'" target="_blank"><img src="/Upload/commodity/'+pImg+'" width="88" height="88" alt="'+pName+'" border="0" style=" border:1px solid #e3e3e3;"></A>'+'<INPUT TYPE="hidden" id="uPid" NAME="uPid" value="'+pId+'"><INPUT TYPE="hidden" id="uPName" NAME="uPName" value="'+pName+'"><INPUT TYPE="hidden" id="uPImg" NAME="uPImg" value="'+pImg+'">';
		document.getElementById("h_ul").appendChild(td0);
		
}
//添加点
function AddHistoryView(pId,pName,pImg)
{   
    
	if (checkHistorySub(pId))
	{   
	    var td0= document.createElement("li");
		td0.innerHTML = '<A HREF="Detail.aspx?cid='+pId+'" target="_blank"><img src="../Upload/commodity/'+pImg+'" width="9" height="9" alt="'+pName+'" border="0"></A>'+'<INPUT TYPE="hidden" id="uPid" NAME="uPid" value="'+pId+'"><INPUT TYPE="hidden" id="uPName" NAME="uPName" value="'+pName+'"><INPUT TYPE="hidden" id="uPImg" NAME="uPImg" value="'+pImg+'">';
		document.getElementById("h_ul").appendChild(td0);
		setCookie('hlook',getHistoryPidStr());
	}
	
}
function checkHistorySub(upid) // 检测此ID是否已被加入
{
	var uPidArr = document.getElementsByName("uPid");
	for(i=0;i<uPidArr.length;i++)
	{
		if (upid==uPidArr[i].value)
		{
			return false;
			break;
		}
	}
	return true;
}
//cookie赋值
function getHistoryPidStr()
{
	pidStr = "";
	var uPidArr = document.getElementsByName("uPid");
	var uPNameArr = document.getElementsByName("uPName");
	var uPImgArr = document.getElementsByName("uPImg");
	for(i=0;i<uPidArr.length;i++)
	{
		if (pidStr == "")
		{
			pidStr = ""+uPidArr[i].value +"|$|"+ uPNameArr[i].value +"|$|"+ uPImgArr[i].value +"";
		}else
		{
			pidStr = pidStr +"||$$||"+uPidArr[i].value +"|$|"+ uPNameArr[i].value +"|$|"+ uPImgArr[i].value +"";
		}
	}
	return pidStr;
}
//清空历史
function ClearHistoryView()
{
	document.getElementById("h_ul").innerHTML="";
	setCookie('hlook','');
}