
if (typeof(feedback_func) == "undefined")
{

	var feedback_func = true;
	var profileUserList = "";
	var profileCache = true;
	var profileUserDef = "";
	var profileUserFunc = "";
	
	
	if (typeof(domain)=="undefined"){
	var my_url = window.location.href;
	host = my_url.split("//")[1].split("/")[0];
	var temp=host.split(".");
	if(host.indexOf("staging")!=-1){
			if(temp.length<=4){
					domain = host.substring(temp[0].length, host.length);
				}else{
					domain = host.substring(temp[0].length+temp[1].length+1, host.length);
				}	
		}		
	else{
			if(temp.length<=3){
					domain = host.substring(temp[0].length, host.length);
				}else{
					domain = host.substring(temp[0].length+temp[1].length+1, host.length);
				}
		} 
	}

	var feedback_server = "http://feedback" + domain;
	var static_server = "http://image"+ domain;
	var my_server = "http://my"+ domain;


	static_server = "http://image.eachnet.com";

	var UserProfile=function ()
	{
		this.usrOnlyId = "";
		this.usrStatus = "";
		this.totalCredit = "";
		this.totalPositiveRate = "";
		this.mobileStatus = "";
		this.idcardStatus = "";
		this.bankcardStatus = "";
		this.PSStatus = "";
		this.quanlityStatus = "";
		
	}

	var setProfileUserlist=function(userid)
	{
		if (profileUserList.indexOf(userid) < 0)
		{
			profileUserList = profileUserList + userid + "~";
		}
	}

	var setProfileCache=function(cacheStatus)
	{
		if (cacheStatus == false)
		{
			profileCache = false;
		}
	}
	
	var getUserProfile=function(userid, userfunc)
	{
		profileUserDef = userid;
		profileUserFunc = userfunc;
		setProfileUserlist(userid);
	}
	
	var showTotalCredit=function(userid)
	{
		setProfileUserlist(userid)
		document.write("<span id=UserProfile_" + userid +" name=UserProfile_" + userid +" tarname=TotalCredit>&nbsp;</span>");
	}

	var showTotalPositiveRate=function(userid)
	{
		setProfileUserlist(userid)
		document.write("<span id=UserProfile_" + userid +" name=UserProfile_" + userid +" tarname=TotalPositiveRate>&nbsp;</span>");
	}

	var showTotalStar=function(userid)
	{
		setProfileUserlist(userid)
		document.write("<span id=UserProfile_" + userid +" name=UserProfile_" + userid +" tarname=TotalStar>&nbsp;</span>");
	}

	var showCertIcon=function(userid, showtype)
	{
		setProfileUserlist(userid);
		if (showtype == 0)
		{
			setProfileCache(false);
		}
		document.write("<span id=UserProfile_" + userid +" name=UserProfile_" + userid +" tarname=CertIcon showtype=" + showtype + ">&nbsp;</span>");
	}

	var showPSIcon=function(userid)
	{
		setProfileUserlist(userid);
		document.write("<span id=UserProfile_" + userid +" name=UserProfile_" + userid +" tarname=PSIcon>&nbsp;</span>");
	}
	
	var showQualityIcon=function(userid)
	{
		setProfileUserlist(userid);
		document.write("<span id=UserProfile_" + userid +" name=UserProfile_" + userid +" tarname=QualityIcon>&nbsp;</span>");
	}
	
	var showQualityPic=function(userid)
	{
		setProfileUserlist(userid);
		document.write("<span id=UserProfile_" + userid +" name=UserProfile_" + userid +" tarname=QualityPic>&nbsp;</span>");
	}

	var displayUserProfile=function()
	{

		profileArray = new Array();
		if (profileUserList.indexOf("~") < 0)
		{
			profileArray[0] = profileUserList;
		}
		else
		{
			profileArray = profileUserList.split("~");
		}


		for (i=0; i<profileArray.length; i++)
		{
			if (profileArray[i] == "")
			{
				continue;
			}
			userid = profileArray[i];
			
			obj_name = "UserProfile_" + userid;
			obj = document.getElementsByName(obj_name);
			if (obj == null){
				return;
			}
			
			eval("profile_data=userProfile_" + userid +";");//userProfile_从action中获得
			dataArray = new Array();
			dataArray = profile_data.split(";");

			for(j =0; j<obj.length; j++)
			{
				switch(obj[j].getAttribute("tarname"))
				{
					case "TotalCredit":
						obj[j].innerHTML = _profileTotalCredit(userid, dataArray);
						continue;
					case "TotalPositiveRate":
						obj[j].innerHTML = _profileTotalPositiveRate(userid, dataArray);
						continue;
					case "TotalStar":
						obj[j].innerHTML = _profileTotalStar(dataArray);
						continue;
					case "CertIcon":
						showtype = obj[j].getAttribute("showtype");
						obj[j].innerHTML = _profileCertIcon(dataArray[0], dataArray[3], dataArray[4], dataArray[5], dataArray[8],  showtype);
						continue;
					case "PSIcon":
						obj[j].innerHTML = _profilePSIcon(dataArray[6]);	
						continue;
					case "QualityIcon":
						obj[j].innerHTML = _profileQualityIcon(dataArray[7]);	
						continue;
					case "QualityPic":
						obj[j].innerHTML = _profileQualityPic(dataArray[7]);	
						continue;
					default:
						continue;
				}
			}
			if (profileUserDef != "")
			{
				eval("profile_data=userProfile_" + userid +";");//userProfile_从action中获得
				dataArray = new Array();
				dataArray = profile_data.split(";");
				up = new UserProfile();
				up.usrOnlyId = profileUserDef;
				up.usrStatus = dataArray[0];
				up.totalCredit = dataArray[1];
				up.totalPositiveRate = dataArray[2];
				up.mobileStatus = dataArray[3];
				up.idcardStatus = dataArray[4];
				up.bankcardStatus = dataArray[5];
				up.PSStatus = dataArray[6];
				up.quanlityStatus = dataArray[7];
				eval(profileUserFunc+"(up);");
			}

		}
	}

	var _profileTotalCredit=function(userid, fbvalue)
	{
		if (_checkCertStatus(fbvalue) == false)
		{
			return "未认证";
		}
		url = feedback_server + "/feedback/viewAllMyFeedback.do?usrOnlyID=" + userid;
		htmlstr = "<a href=" + url + " target=_blank>" + fbvalue[1] + "</a>";
		return htmlstr;
	}

	var _profileTotalPositiveRate=function(userid, fbvalue)
	{
		if (_checkCertStatus(fbvalue) == false)
		{
			return "未认证";
		}
		url = feedback_server + "/feedback/viewAllMyFeedback.do?usrOnlyID=" + userid;
		rate = Math.round(fbvalue[2] * 100) + "%";
		htmlstr = "<a href=" + url + " target=_blank>" + rate + "</a>";
		return htmlstr;
	}

	var _profileTotalStar=function(fbvalue)
	{
		if (_checkCertStatus(fbvalue) == false)
		{
			return "未认证";
		}
		star_pic = "";
		fb_val = fbvalue[1];
		if (fb_val>=5 && fb_val <=19)
		{
			star_pic = "icon_star1_1.gif";
		}
		if (fb_val>=20 && fb_val <=49)
		{
			star_pic = "icon_star1_2.gif";
		}
		if (fb_val>=50 && fb_val <=99)
		{
			star_pic = "icon_star1_3.gif";
		}
		if (fb_val>=100 && fb_val <=199)
		{
			star_pic = "icon_star1_4.gif";
		}
		if (fb_val>=200 && fb_val <=499)
		{
			star_pic = "icon_star1_5.gif";
		}
		if (fb_val>=500 && fb_val <=999)
		{
			star_pic = "icon_star2_1.gif";
		}
		if (fb_val>=1000 && fb_val <=1999)
		{
			star_pic = "icon_star2_2.gif";
		}
		if (fb_val>=2000 && fb_val <=9999)
		{
			star_pic = "icon_star2_3.gif";
		}
		if (fb_val>=10000 && fb_val <=49999)
		{
			star_pic = "icon_star2_4.gif";
		}
		if (fb_val>=50000)
		{
			star_pic = "icon_star2_5.gif";
		}
		if (star_pic=="")
		{
			return "";
		}
		star_url = static_server+ "/pic/"+star_pic;
		return "<img src="+star_url+">";
	}

	var _profileCertIcon=function(usrStatus, mobileStatus, idcardStatus, bankcardStatus, merchantStatus, showtype)
	{
		certurl = my_server + "/usrverify/tousrverify.do";
		htmlStr = "";
		if(merchantStatus == "0")
		{
			htmlStr = "<img src="+ static_server +"/pic/icon_business_16x16.gif alt=易趣认证商家>"
			return htmlStr;
		}
		if (bankcardStatus == "1")
		{
			if (showtype == "0")
			{
				htmlStr = "<a href="+certurl+">查看认证状态</a>";
				return htmlStr;
			}
		}
		if (bankcardStatus == "0")
		{
			htmlStr = "<img src="+ static_server +"/pic/icon_va_bank_16x16.gif alt=银行实名认证用户>";
			return htmlStr;
		}
		if (mobileStatus == "0")
		{
			if (showtype == "0")
			{	
				htmlStr = "<img src="+ static_server +"/pic/icon_va_mobile_16x16.gif alt=手机认证用户>";
				return htmlStr;
			}
			else
			{
				return "";
			}
		}	
		if (usrStatus == "0")
		{
			switch(showtype)
			{
				case "0":
					htmlStr = "<font color=red>要卖更多物品或提取货款，请立即进行</font><a href="+certurl+">实名认证</a>";
					return htmlStr;
				case "1":
					htmlStr = "<img src="+ static_server +"/sys/img/common/iconewuser.gif alt=易趣新用户>";
					return htmlStr;
				case "2":
					htmlStr = "未认证";
					return htmlStr;
			}
		}
		if (usrStatus == "1" || usrStatus == "2")
		{
			switch(showtype)
			{
				case "0":
					htmlStr = "<span style=\"font-size:12px; font-weight:normal\">老平台认证用户请尽快通过<a href="+certurl+">银行实名认证</a></span>";
					return htmlStr;
				default:
					return "";
			}
		}
		return "";
	}

	var _profilePSIcon=function(psvalue)
	{
		htmlStr = "";
		if(psvalue>0)
		{			
			htmlStr = "<img src="+ static_server +"/pic/icon_power_seller.gif alt=超级卖家>";
		}
		return htmlStr;
	}

	var _checkCertStatus=function(dataArray)
	{
		return true;
		if (dataArray[3] == "0" || (dataArray[4] == "0" && dataArray[5] == "0") || dataArray[0] == "1" || dataArray[0] == "2")
		{
				return true;
		}
		else
		{
				return false;
		}
	}


	var showUserProfile=function()
	{
		url_str = profileUserList.substring(0, profileUserList.length - 1);
		dataurl = feedback_server + "/feedback/getUsrProfile.do?usrId=" + url_str;
		_rsCl = '<scr'+'ipt language="JavaScript" type="text/javascript" src="'+dataurl+'"><\/scr'+'ipt>';
		document.write(_rsCl);
	}

	var showFeedback=function()
	{
		url_str = profileUserList.substring(0,profileUserList.length-1);
		dataurl = feedback_server + "/feedback/getUsrProfile.do?usrId="+url_str;
		_rsCl = '<scr'+'ipt language="JavaScript" type="text/javascript" src="'+dataurl+'"><\/scr'+'ipt>';
		document.write(_rsCl);
	}
	
	var _profileQualityIcon=function(qualityvalue)
	{
		htmlStr = "";
		if(qualityvalue == "0")
		{			
			htmlStr = "<a href=\"http://help.eachnet.com/help/tns/pinzhibaozhang.htm\" target=\"_blank\"><img src="+ static_server +"/pic/icon_quality_16x16.gif alt=已通过品质卖家认证></a>";
		}
		return htmlStr;
	}

	var _profileQualityPic=function(qualityvalue)
	{
		htmlStr = "";
		if(qualityvalue == "0" || qualityvalue == "2")
		{			
			htmlStr = "<img src="+ static_server +"/pic/banner_qualityseller.gif alt=品质保障 购物无忧>";
		}
		return htmlStr;
	}
}





