function fillTPL(aData, sListID)
{
	var sImgPath = "http://imgcache.qq.com/qqshow/v2/syndata/data/";
	var listdata = aData.findmul_if(function(v){ return v[0][0]==sListID; }).transform(function(v){ return aData[v]; }).transform(function(v){ return [sImgPath+v[1][0], v[2][0], v[3][0], v[4][0], v[5][0], v[6][0]]; });

	var sHtml = document.body.innerHTML.between("<!--TPL."+sListID, "TPL."+sListID+"-->");
    if (sHtml == "")
	{
		return;
	}

	var oParent = document.getElementById(sListID);
    if(oParent == 'undefined')
	{
		return;
	}

	var mapName=[
		['0', '<%img%>'],
		['1', '<%name%>'],
		['2', '<%targeturl%>'],
		['3', '<%mktPrice%>'],
		['4', '<%paipaiPrice%>'],
		['5', '<%itemno%>']
    ];
    showQQSHOWData(listdata, oParent, sHtml, mapName);
}

function Login()
{
	ShowLogin(457, 356, 250, 20,'/inc/login_box.html?url='+window.location.href.escUrl());
}

function getUserInfo()
{
	if(!ChkUin(GetUin()))
	{
		return;
	}
	
	function onSucc(xmlReq)
	{
		var o = xmlReq.getElementsByTagName("node")[0];
		var nick = o.getAttribute("name");
		var vip = o.getAttribute("vip");

		if(vip == 1)
		{
			document.getElementById('loginStr').innerHTML = '欢迎光临，<span class="VIP">'+nick.escHtml()+'</span>[<a href="javascript:reset();" class="exit" >退出</a>]<a href="http://service.qq.com/faq.html?c=2&cid=3&sid=1" title="帮助" class="btnFaq" target="_blank"><span>帮助</span></a>';
		}
		else
		{
			document.getElementById('loginStr').innerHTML = '欢迎光临，<span class="normal">'+nick.escHtml()+'</span>[<a href="javascript:reset();" class="exit" >退出</a>]<a href="http://service.qq.com/faq.html?c=2&cid=3&sid=1" title="帮助" class="btnFaq" target="_blank"><span>帮助</span></a>';
		}

	}
	function onFail(xmlReq)
	{
		var code = xmlReq.getElementsByTagName("QQSHOW")[0].getAttribute("code");
		if(code == -1001)
		{
			alert("您登录已超时，请重新登录！");
			return Login();
		}
		else if(code == -1005)
		{
			alert("对不起，您尚未注册QQ秀业务，不能参与活动！");
			window.location.href = "http://show.qq.com/my/inc/reg01.html";
		}
		else
		{
			alert("操作失败，请您稍候再试！");
		}
	}
	function onErr()
	{
		alert("系统繁忙，请稍候再试！");
	}
	getQQSHOWXml("http://show.qq.com/cgi-bin/qqshow_user_info", onSucc, onFail, onErr);
}

var sPGVMatch = "ISD.QQShow.Paipai2.Match";
var sPGVReality = "ISD.QQShow.Paipai2.Reality";

var g_title = "QQ秀";
var g_sUrl = "http://show.qq.com/";
var g_mallid = 1;
var iVip;
var oSubWin;


//A begin
//百搭，新开窗口
function GoRedirect(sUrl,bFresh)
{
	if (oSubWin)
	{
		try{
     	    if (oSubWin.mainfra&&!bFresh)
     	    {
     	    	  var sSub="/inc/main.html";
     	    	  var iNum = sUrl.indexOf("MUrl=");
     	    	  if (-1 == iNum)
     	    	  {
     	    	     	sSub=sUrl;
     	    	  }
     	    	  else
     	    	  {
     	    	  	  sSub=sUrl.substring(iNum+5,sUrl.length);
     	    	  	  sSub=unescape(sSub);
     	    	  	  var iSub = sSub.indexOf(".htm");
     	    	  	  var iTemp = 5;
     	    	  	  if (-1 == sSub.indexOf(".html"))
     	    	  	  {
     	    	  	  	 iTemp = 4;
     	    	  	  }
     	    	  	  var Cha="";
     	    	  	  
     	    	  	  if (iSub+iTemp<sSub.length)
     	    	  	  {   
     	    	  	  	  Cha = sSub.substring(iSub+iTemp,iSub+iTemp+1);
     	    	  	  }	
     	    	  	  if (Cha.length>0&&Cha!="?")
     	    	  	  {
     	    	  	  	Cha="?";
     	    	  	  }

					  sSub=sSub.substring(0,iSub+iTemp)+Cha+sSub.substring(iSub+iTemp+1,sSub.length);
     	    	   }
     	    	   
     	    	   if (-1 == sSub.indexOf("http:"))
     	    	   {
     	    	  	  	sSub="http://show.qq.com"+sSub;
     	    	   } 	
     	    	   
     	    	  //alert(sSub);
     	    	  oSubWin.mainfra.location=sSub;
     	    }
     	    else
     	    {
				oSubWin.location = sUrl;
            }
			oSubWin.focus();
		}
		catch(e)
		{
		    oSubWin = window.open(sUrl, g_title);
            oSubWin.focus();
		}
    }
    else
    {
        oSubWin = window.open(sUrl, g_title);
        oSubWin.focus();
    }
};

//单品跳转百搭页面
function GoMatch(iNo, ext1,mallid,iTry)
{
	if (!ext1&&g_mallid)
	ext1=4;
	var iMatchSex=QUSER.getAvSex()=="F"?0:1;
	if((ext1 & 4) > 0)	
    {
		var sUrl="http://show.qq.com/show.html?MUrl=/mall/inc/suit.html&itemno=" + iNo + "&sex=" + iMatchSex;
		if (!iTry)
		sUrl=sUrl+"&try=1";
		GoRedirect(sUrl);
	}
	else
	{
		if (!mallid)	
		    return;
		GoMall(iNo,mallid);
	}

	SendPGV(sPGVMatch);
};

//单品跳转对应专区
function GoMall(no,mallid)
{
	var sUrl="http://show.qq.com/show.html?MUrl=/mall/inc/item.html%3Fmallno%3D102010000%26mallid%3D"+mallid+"%26itemno%3D"+no;
    GoRedirect(sUrl);
};

//整套跳转百搭物品详情页面
function GoDetail(no)
{
	var sUrl="http://show.qq.com/show.html?MUrl=http://show.qq.com/js/item_detail/item_detail_"+no+".html";
	GoRedirect(sUrl);
};

function GoNewDetail(ItemSn)
{
	var sUrl = "http://show.qq.com/mall/inc/before_set_detail.html?sShow="+escape(ItemSn);
    GoRedirect(sUrl);
}

//pgv统计
function SendPGV(CORD)
{
	if ('function' == typeof(pgvSendClick))
	{
	   pgvSendClick({hottag:CORD});
	}
}

//A end



function GotoPaipai(url)
{
	SendPGV(sPGVReality);
	window.open(url,"_blank");
}


/*  |xGv00|919e99de27403c4f8f369d65cc79dc3f */