<!--
/***********
*时间格式
************/
function formatDate(date){
	var d;
	if(!(d=Date_Ex(date)))
		return date;
	var year=d.getFullYear();
	var month=d.getMonth()+1;
	var day=d.getDate();
	
	return year.toString().right(2)+"年"+month+"月"+day+"日";
}

/***********
*物品所属业务
************/
function formatType(serverId){
	if(serverId=="11")
		return "QQ秀";
	else if(serverId=="12")
		return "Qzone";
}
function formatUrl(serverId){
	var url;
	if(getCookie("zzpaneluin")==""){
		url="j.html?uin="+getCookie("uin")+"&key="+getCookie("skey")+"&type=1";
	}else{
		url="j.html?uin="+getCookie("zzpaneluin")+"&key="+getCookie("zzpanelkey")+"&type=2";
	}
	if(serverId=="11"){
		if(getCookie("zzpaneluin")==""){
			url+="&l=http://qqshow.qq.com/my/";
		}else{
			url="http://ptlogin.qq.com/jump?clientuin="+getCookie("zzpaneluin")+"&clientkey="+getCookie("zzpanelkey")+"&keyindex=0&u1=http%3A%2F%2Fqqshow.qq.com%2Fmy"
		}
	}else if(serverId=="12"){
		url+="&l=http://rc.qzone.qq.com/?myitem";
	}
	return url;
}
/************
*物品名称
*************/
function formatName(itemName){
	return TruncateStr(itemName,8);
}
/***********
*物品价格
************/
function formatPrice(itemPrice){	
	return FormatNumber(itemPrice/100.0,1);
}
function showLogin(){
	var id = "loginDiv";
	if($E(id)){
		$E("loginDiv").style.display="";
		$E("loginFrame").src="gift_login.html";
	}else{
		var div = document.createElement("div");
		with(div.style){
			position="absolute";
			display="";
			height=360;
			zIndex=100;
			visibility="hidden";
		}

		//div.innerHTML='<span style="position:relative; left:88%; top:40px;cursor:hand;" onclick="if(this.parentNode)'+
		//	'this.parentNode.style.display=\'none\'">关闭</span><iframe src="gift_login.html" style="top:-300" h' +
		//	'eight="100%" width="100%" id="loginFrame" allowtransparency="true" frameborder="0" align="center" hspac' + 
		//	'e="0" marginwidth="0" marginheight="0"></iframe>'
		
		

		//div.outerHTML = '<DIV id=loginDiv style="Z-INDEX: 100; LEFT: 54px; VISIBILITY: visible; WIDTH: 310px; POSITION: absolute; TOP: 130px; HEIGHT: 360px"><SPAN style="LEFT: 88%; CURSOR: hand; POSITION: relative; TOP: 5px" onclick="if(this.parentNode)this.parentNode.style.display=\'none\'">关闭</SPAN><IFRAME id=loginFrame style="margin-TOP: -40px" align=center marginWidth=0 marginHeight=0 src="gift_login.html" frameBorder=0 width="100%" height="100%" allowTransparency></IFRAME></DIV>';
		
		div.innerHTML = '<SPAN style="LEFT: 88%; CURSOR: hand; POSITION: relative; TOP: 5px" onclick="if(this.parentNode)this.parentNode.style.display=\'none\'">关闭</SPAN><IFRAME id=loginFrame style="margin-TOP: -40px" align=center marginWidth=0 marginHeight=0 src="gift_login.html" frameBorder=0 width="100%" height="100%" allowTransparency></IFRAME>';
		
		div.id=id;

		document.body.insertBefore(div);
		
		
		with(div.style){
			if(document.body.clientWidth){
				width=310;
				pixelLeft=document.body.scrollLeft + (document.body.clientWidth - div.offsetWidth)/2;
			}else{
				//width="100%";
				width=310;
				pixelLeft=96;
			}
			pixelTop=document.body.scrollTop + (document.body.clientHeight?(document.body.clientHeight - div.offsetHeight)/2:0);
			visibility="visible";
		}
		
		
	}
}
/***********
*处理出错
************/
function doError(x){
	if(typeof(x)!="object"){
		showError("服务器忙，请稍候再试");
		return true;
	}
	if(x && x.getElementsByTagName("error").length==0){
		return false;
	}
	var err = x.getElementsByTagName("error")[0];
		if(err.getAttribute("type")=="login"){
			hideOpratingMsg();
			showLogin();
		}else{
			showError(err.text);
			if(err.text.indexOf("验证码")!=-1 && typeof(verify)=="function")
				verify();
		}
		
	return true;
}

/*specified prompt support*/


function doErrorV2(x, callback)
{
	if(typeof(x)!="object")
	{
		showError("服务器忙，请稍候再试");
		return true;
	}
	
	if(x && x.getElementsByTagName("error").length==0)
	{
		return false;
	}
	var err = x.getElementsByTagName("error")[0];
	if(err.getAttribute("type")=="login")
	{
		hideOpratingMsg();
		showLogin();
	}
	else
	{
		if (err.getAttribute("type") != "")
		{
			showErrorV2(err.getAttribute("type"));
		}
		else
		{
			showErrorV2(callback(err.text));
		}
		
		if(err.text.indexOf("验证码")!=-1 && typeof(verify)=="function")
			verify();
	}
		
	return true;
}


function formatNick(c, len)
{
		if (len)
		{
			return TruncateStr(c,len);
		}
		else
		{
			return TruncateStr(c,8);
		}
}

//-->