function getStateType(strValue)
{
	var strReturn = "";
	switch(strValue)
	{
		case 0:
			strReturn = "审核中"
			break;
		case 1:
			strReturn = "解决中"
			break;
	}
	document.write(strReturn);
}


function getCheckSign(strValue)
{
	var strReturn = "";
	switch(strValue)
	{
		case 0:
			strReturn = "<font color='red'>驳回</font>"
			break;
		case 1:
			strReturn = "<font color='#666666'>未审核</font>"
			break;
		case 2:
			strReturn = "<font color='green'>通过</font>"
			break;
	}
	document.write(strReturn);
}

function getUserLevel(strValue)
{
	var strReturn = "";
	switch(strValue)
	{
		case 0:
			strReturn = "新手"
			break;
		case 1:
			strReturn = "学弟"
			break;
	}
	document.write(strReturn);
}

function getUserSex(strValue)
{
	var strReturn = "";
	switch(strValue)
	{
		case 0:
			strReturn = "小姐"
			break;
		case 1:
			strReturn = "先生"
			break;
	}
	document.write(strReturn);
}

function getReviewType(strValue)
{
	var strReturn = "";
	switch(strValue)
	{
		case 1:
			strReturn = "好评"
			break;
		case 2:
			strReturn = "中评"
			break;
		case 3:
			strReturn = "差评"
			break;
	}
	document.write(strReturn);
}


// 显示星级HTML
function getStarLevel(p_iLevel, p_iMode)
{
	var iEnd;
	var iStep;
	var strHtml = "";
	switch(p_iMode)
	{
		case 1:default:
		{
			iEnd = 5;
			iStep = 2;
			break;
		}
		case 2:
		{
			iEnd = 10;
			iStep = 1;
			break;
		}
	}
	
	var iLevel = p_iLevel;
	var iStar = (iLevel - (iLevel % iStep)) / iStep;
	var iIndex;
	for(iIndex=1; iIndex<=iStar; iIndex++)
	{
		strHtml += '<img src="/images/common/icon_star_2.gif" />';
	}
	
	if(iLevel % iStep!=0)
	{
		strHtml += '<img src="/images/common/icon_star_3.gif" />';
		iIndex++;
	}
	
	for(var i=iIndex; i<=iEnd; i++)
	{
		strHtml += '<img src="/images/common/icon_star_1.gif" />';
	}
	
//	strHtml += "&nbsp;&nbsp;<font color=#FF0000 style='font-size:13px;font-weight:bold'>" + p_iLevel+ "</font>分"; 
	document.write(strHtml);
}



// 点击量统计
function addClick(p_strMode, p_strIDKey)
{
	var iClickNum = 0;
	try
	{
		iClickNum = Pet67.Web.AppServices.InterFaceServices.AddClick(p_strMode, p_strIDKey).value;
		try{
		document.getElementById("idClickNum").innerHTML = iClickNum;
		}
		catch(err)
		{
		}
	}
	catch (e)
	{
	}
	return iClickNum;
}

// 记录用户历史浏览页
function setVisitedUrl(p_strClassName, p_strTitle)
{
/*
	var strSiteUrl = this.location.href;
	Pet67.Web.AppServices.InterFaceServices.SetVisitedUrl(p_strClassName, p_strTitle, strSiteUrl).value;
*/
 //alert(document.cookie)
	var strSiteUrl = this.location.href;
	var strName = p_strClassName + "visited";
//	DelCookie(strName);
//	alert(strName)
//	document.cookie = ""; 
	var strValue = "";
	var strCookieValue = GetCookie(strName);

	if (strCookieValue==null || strCookieValue=="")
	{
			strCookieValue = "";
//			alert("ok")
	}
	
	var arrItem = strCookieValue.split("|");
	var strItem = p_strTitle + "," + strSiteUrl;
	strValue = strItem;
//	strValue = p_strTitle + "," + strSiteUrl  + "|" + strCookieValue;
	var iCount = 0;
	for (var i=0; i<arrItem.length; i++)
	{
			if (strItem != arrItem[i] && iCount<10)
			{
				iCount ++;
				strValue += "|" + arrItem[i];
			}
	}
//	SetCookie(strName, strValue, null, null, ".pet67.com")
	SetCookie(strName, strValue, 30, "/", "pet67.com")
}

function bindVisitedList(p_strClassName)
{
try{
//	alert(document.cookie)
	var strName = p_strClassName + "visited";
//	alert(strName)
	var strItemList = GetCookie(strName);
//	alert(strItemList)

		var obj = document.getElementById("idVisitedListBlock");
		var strHtml = "";
//		var strItemTemplate = "<li>·<a href='$url$' title='$titleAlt$'>$title$</a></li>";
		var strItemTemplate = "<li>&nbsp;<a href='$url$' title='$titleAlt$'>$title$</a></li>";
		
//		var strItemList = Pet67.Web.AppServices.InterFaceServices.GetVisitedUrl(p_strClassName).value;
//		alert(strItemList);
		var arrItem = strItemList.split('|');
		var iEnd = (arrItem.length<5) ? arrItem.length : 5;
		for(var i=0; i<iEnd ; i++)
		{
			if (arrItem[i]!="")
			{
				var arrValue = arrItem[i].split(',');
				var strItem = strItemTemplate; 
				strItem = strItem.replace("\$url\$", arrValue[1]);
				strItem = strItem.replace("\$title\$", arrValue[0].substring(0, 18));
				strItem = strItem.replace("\$titleAlt\$", arrValue[0]);
				strHtml += strItem;
			}
		}
		obj.innerHTML = strHtml;
	}
	catch(e)	{
	}

}


function SearchKeyRecord(strKeyWord, strClassName)
{
	Pet67.Web.AppServices.InterFaceServices.SearchKeyRecord(strKeyWord, strClassName).value;
}



function SiteSearchSubmit()
{
	var obj;
	obj = document.getElementById("SiteSearchKeyWord");
	var strKeyWord = obj.value;
	if (strKeyWord=="")
	{
		AlertFocus("SiteSearchKeyWord", "提示:[搜索关键字]不能为空!!!")
		return false;
	}
	obj = document.getElementById("SiteSearchClassName");
	var strActionMode = obj.value;
	
	SiteSearchAction(strActionMode, strKeyWord)
//	return false;
}

function SiteSearchAction(p_strActionMode, p_strKeyword)
{
	SearchKeyRecord(p_strKeyword, p_strActionMode)

	switch (p_strActionMode)
	{
		case "news":
		{
			location.href = "/news/search.aspx?skey=" + p_strKeyword;
			return false;
			break;
		}
		case "intro":
		{
			location.href = "/petintro/search.aspx?skey=" + p_strKeyword;
			return false;
			break;
		}
		case "card":
		{
			location.href = "/card/search.aspx?skey=" + p_strKeyword;
			return false;
			break;
		}
		case "trade":
		{
			location.href = "/trade/Index.aspx?skey=" + p_strKeyword;
			return false;
			break;
		}
		case "iask":
		{
			location.href = "/iask/list.aspx?skey=" + p_strKeyword;
			return false;
			break;
		}
		default :
		{
			return false;
			break;
		}
	}
}


function GetUserIDByCookie()
{
		return Pet67.Web.AppServices.InterFaceServices.GetUserID().value;
}

function GetUserIDKeyByCookie()
{
		return Pet67.Web.AppServices.InterFaceServices.GetUserIDKey().value;
}

function GetNickNameByCookie()
{
		return Pet67.Web.AppServices.InterFaceServices.GetNickName().value;
}

function GetPBlogSignByCookie()
{
		return Pet67.Web.AppServices.InterFaceServices.GetPBlogSign().value;
}

/*

document.write("<form name=\"SearchForm\" onsubmit='javascript:{return SiteSearchSubmit()}'>");
document.write("<table width=\"950\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"SearchTable\">");
document.write("<tr>");
document.write("<td>　全站搜索： ");
document.write("<input name=\"SiteSearchKeyWord\" id=\"SiteSearchKeyWord\"  type=\"text\" class=\"input_type\" size=\"40\" /> ");
document.write("<select name=\"SiteSearchClassName\" id=\"SiteSearchClassName\">");
//document.write("<option>宠物产品库</option>");
document.write("<option value='news'>信息资讯</option>");
document.write("<option value='intro'>物种资料库</option>");
document.write("<option value='card'>企业名片</option>");
document.write("<option value='trade'>供求信息</option>");
//document.write("<option>宠物资讯</option>");
document.write("</select> ");
document.write("<input name=\"Submit\" type=\"submit\" class=\"button_type\" value=\"　搜索　\" />");
document.write(" 热门关键词：");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=狗\">狗</a> ");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=猫\">猫</a> ");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=饲养\">饲养</a> ");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=训导\">训导</a> ");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=诊所\">诊所</a> ");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=养护\">养护</a> ");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=护理\">护理</a> ");
document.write("<a href=\"http://news.pet67.com/SearchArticle.aspx?KeyWord=繁殖\">繁殖</a> ");
document.write("</td>");
document.write("</tr>");
document.write("</table>");
document.write("</form>");
*/