document.write("<script src=\"\/Js\/AjaxClient.js\"><\/script>");
function request(para)
	{
		var i;
		var searchString=location.search;
		para	= para.toLowerCase();
		searchString=searchString.toLowerCase();
		var pos=searchString.indexOf("?");
		if (pos==0)
		{
			var str,str1,arr,strpos;
			arr=searchString.split('&');
			for (i=0;i<=arr.length-1;i++)
			{
				str	= arr[i];
				strpos	= str.indexOf(para);
				if (strpos!=-1)
				return str.replace("?","");
			}
		}
		return "";
	}
	function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+escape(value)+expires+"; path=/;";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
function CreateMyCookies(name,value,count)
{
	var newvalue = value.split('$');
	var MyCookie = readCookie(name);
	
	if(MyCookie==null)
	{
		createCookie(name,","+value+",",300);
	}
	else
	{
		if(MyCookie.indexOf(","+newvalue[0]+"$")<=-1)
		{
			if(name.indexOf("Collect")<=-1)
			{
				var MyCookieList = readCookie(name).split(',');
				if(MyCookieList.length>=count+2)
				{
					
					var NewCookie = MyCookie.substring(MyCookie.indexOf(MyCookieList[1])+MyCookieList[1].length,MyCookie.length);
					createCookie(name,NewCookie+value+",",300);
				}
				else
				{
					createCookie(name,MyCookie+value+",",300);
				}
			}
			else
				createCookie(name,MyCookie+value+",",300);
		}
	}
}
function FillDivAsCookies(DivName,CookieName)
{
		if(readCookie(CookieName)==null||readCookie(CookieName)=="")
	{
		document.getElementById(DivName).innerHTML = "您没有浏览产品的记录！";
		return;
	}
	else
	{
	var divInnerHtml = "";
	var MyCookieList = readCookie(CookieName).split(',');
	for(i=MyCookieList.length-1;i>=0;i--)
	{
		if(MyCookieList[i].indexOf('$')>-1)
		{
			var MyProduct = MyCookieList[i].split('$');
	
			divInnerHtml+="<ul><li class=\"li1\"></li><li class=\"li2\"><img src=\"http://img.ey360.cn"+MyProduct[2].replace("/aduser/product","").replace("/AdUser/Product","")+"\" width=\"50\" height=\"50\" class=\"border_wheat\" /></li><li class=\"li3 height16\"><span class=\"bold red1\"><a href=\"/ProductInfo/"+MyProduct[0]+".shtml\" target=\"_blank\">"+MyProduct[1].substring(0,12)+"</a></span></li></ul>";
		}
	}
	document.getElementById(DivName).innerHTML = divInnerHtml;
	}
}
function rhbbrowserfill(DivName,CookieName)
{  
	if(readCookie(CookieName)==null||readCookie(CookieName)=="")
	{
		document.getElementById(DivName).innerHTML = "您没有浏览产品的记录！";
		return;
	}
	else
	{
	var divInnerHtml = "";
	var MyCookieList = readCookie(CookieName).split(',');
	for(i=MyCookieList.length-1;i>=0;i--)
	{
		if(MyCookieList[i].indexOf('$')>-1)
		{
			var MyProduct = MyCookieList[i].split('$');
	
			divInnerHtml+="<ul><li class=\"li1\"></li><li class=\"li2\"><img src=\"http://img.ey360.cn"+MyProduct[2].replace("/aduser/product","").replace("/AdUser/Product","")+"\" width=\"50\" height=\"50\" class=\"border_wheat\" /></li><li class=\"li3 height16\"><span class=\"bold red1\"><a href=\"/ProductInfo/"+MyProduct[0]+".shtml\" target=\"_blank\">"+MyProduct[1].substring(0,12)+"</a></span></li></ul>";
		}
	}
	document.getElementById(DivName).innerHTML = divInnerHtml;
	}
}
function FillBrowseDivAsCookies(DivName,CookieName)
{  
	if(readCookie(CookieName)==null)
	{
		document.getElementById(DivName).innerHTML = "您没有浏览产品的记录！";
		return;
	}
	var divInnerHtml = "<ul>";
	var MyCookieList = readCookie(CookieName).split(',');
	for(i=MyCookieList.length-1;i>=0;i--)
	{
		if(MyCookieList[i].indexOf('$')>-1)
		{
			var MyProduct = MyCookieList[i].split('$');
	
			divInnerHtml+="<li class=\"uue\"><a href=\"http://www.ey360.cn/ProductInfo/"+MyProduct[3]+"/"+MyProduct[0]+".shtml\" target=\"_blank\"><img src=\"http://img.ey360.cn"+MyProduct[2].replace("/aduser/product","").replace("/AdUser/Product","")+"\" class=\"img1\" width=\"43\" height=\"35\"></a></li><li class=\"li font14 blue2 stron\"><a href=\"http://www.ey360.cn/ProductInfo/"+MyProduct[3]+"/"+MyProduct[0]+".shtml\" target=\"_blank\">"+MyProduct[1].substring(0,8)+"</a></li>";
		}
	}
	document.getElementById(DivName).innerHTML = divInnerHtml+"<li class=\"uu2\">&nbsp;</li></ul>";
}
function FillCompareDivAsCookies(DivName,CookieName)
{
	if(readCookie(CookieName)==null)
	{
		document.getElementById(DivName).innerHTML = "您没有对比产品的记录！";
		return;
	}
	var divInnerHtml = "<ul>";
	var MyCookieList = readCookie(CookieName).split(',');
	for(i=MyCookieList.length-1;i>=0;i--)
	{
		if(MyCookieList[i].indexOf('$')>-1)
		{
			var MyProduct = MyCookieList[i].split('$');
			divInnerHtml+="<li class=\"e25\"><input id=\""+MyProduct[0]+"\" onclick=\"ValidSelectDiv(this);\" type=\"checkbox\" name=\"ProductId\" value=\""+MyProduct[0]+"\" title=\"点击【勾选进行对比】查看对比结果\"></li><li class=\"uue\"><a href=\"http://www.ey360.cn/ProductInfo/"+MyProduct[3]+"/"+MyProduct[0]+".shtml\" target=\"_blank\"><img src=\"http://img.ey360.cn/ProductImage/"+MyProduct[2].replace("/aduser/product","").replace("/AdUser/Product","")+"\" width=\"43\" height=\"35\" class=\"img1\"></a></li><li class=\"li2 font14 blue2 stron\"><a href=\"http://www.ey360.cn/ProductInfo/"+MyProduct[3]+"/"+MyProduct[0]+".shtml\" target=\"_blank\">"+MyProduct[1].substring(0,6)+"</a></li>";
		}
	}
	document.getElementById(DivName).innerHTML = divInnerHtml+"<li class=\"red le_2\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style=\"CURSOR:hand\" onclick=\"GetSelectProductId();\"><img src=\"http://img.ey360.cn/images/bt_zhuce.jpg\" width=\"94\" height=\"19\"></a></li></ul>";
}
function GetCollect(DivName,CookieName)
{
	if(readCookie("Corp")==null&& readCookie(CookieName)!=null)
	{
		var divInnerHtml = "<ul>";
		var MyCookieList = readCookie(CookieName).split(',');
		for(i=MyCookieList.length-1;MyCookieList.length-i<=(MyCookieList.length>15?15:MyCookieList.length);i--)
		{
			if(MyCookieList[i].indexOf('$')>-1)
			{
				var MyProduct = MyCookieList[i].split('$');
		
				divInnerHtml+="<li class=\"uue \"><a href=\"http://www.ey360.cn/ProductInfo/"+MyProduct[3]+"/"+MyProduct[0]+".shtml\" target=\"_blank\"><img class=\"img1\" src=\"http://img.ey360.cn/ProductImage/"+MyProduct[2].replace("/aduser/product","").replace("/AdUser/Product","")+"\" width=\"43\" height=\"35\"></a></li><li class=\"li font14 blue2 stron\"><a href=\"http://www.ey360.cn/ProductInfo/"+MyProduct[3]+"/"+MyProduct[0]+".shtml\" target=\"_blank\">"+MyProduct[1].substring(0,8)+"</a></li>";
			}
		}
		document.getElementById(DivName).innerHTML = divInnerHtml+"<li class=\"uu2\">...<a href=\"/ProductCollectList.aspx\" target=_blank>更多</a></li></ul>";
	}
	if(readCookie(CookieName)==null)
	{
		document.getElementById(DivName).innerHTML = "您没有收藏产品的记录！";
		return;
	}
	if(readCookie("Corp")!=null)
	{
		document.getElementById(DivName).innerHTML = Yllz.ProductCollectList.GetTopCollection("20").value;
	}
}
function GetSelectProductId()
	{
		var ProductIdList = document.getElementsByName("ProductId");
		var SelectProductCount =0;
		var ProductIdStr = ""; 
		for(var i =0;i<ProductIdList.length;i++)
		{
			if(ProductIdList[i].checked)
			{
				SelectProductCount ++;
				if(ProductIdStr == "")
				{
					ProductIdStr = ProductIdList[i].value;
				}
				else
				{
					ProductIdStr += ","+ProductIdList[i].value;
				}
			}
		}
		if(SelectProductCount >1)
		{
			window.open("http://www.ey360.cn、ProductCompareDetails.aspx?ProductId="+ProductIdStr);
			return;
		}
		if(SelectProductCount <2)
		{
			alert("请选择对比项！");
			return;
		}
	} 
	function ValidSelectDiv(checkboxselect)
	{
		var ProductIdList = document.getElementsByName("ProductId");
		var SelectCount=0;
		for(var i =0;i<ProductIdList.length;i++)
		{
			if(ProductIdList[i].checked) SelectCount ++;
			if(SelectCount>3)
			{
				checkboxselect.checked = false;
				alert("【注意】最多选择三项进行对比！");
				return false;
			}
		}
	}
	function RemoveCollect(FavorId,CookieValue,CookieName)
	{
		if(readCookie("Corp")==null&& readCookie(CookieName)!=null)
		{
			var MyCookie = readCookie(CookieName);
			var start = MyCookie.indexOf(CookieValue)
			MyCookie = MyCookie.substring(0,start-1)+MyCookie.substring(start+CookieValue.length,MyCookie.length);
			createCookie(CookieName,MyCookie,null);
			window.location.href = window.location.href.split('?')[0];
			alert("移除成功！");
		}
		if(readCookie("Corp")!=null)
		{
			Yllz.ProductCollectList.RemoveCollect(FavorId);
			window.location.href = window.location.href.split('?')[0];
			alert("移除成功！");
		}
	}
	 //utility function called by getCookie()
            function getCookieVal(offset)
            {
                var endstr = document.cookie.indexOf(";", offset);
                if(endstr == -1)
                {
                    endstr = document.cookie.length;
                }
                return unescape(document.cookie.substring(offset, endstr));
            }


           // primary function to retrieve cookie by name
            function getCookie(name)
            {
                var arg = name + "=";
                var alen = arg.length;
                var clen = document.cookie.length;
                var i = 0;
                while(i < clen)
                {
                    var j = i + alen;
                    if (document.cookie.substring(i, j) == arg)
                    {
                        return getCookieVal(j);
                    }
                    i = document.cookie.indexOf(" ", i) + 1;
                    if(i == 0) break;
                }
                return;
            }
function getExpDate(days, hours, minutes)
            {
                var expDate = new Date();
                if(typeof(days) == "number" && typeof(hours) == "number" && typeof(hours) == "number")
                {
                    expDate.setDate(expDate.getDate() + parseInt(days));
                    expDate.setHours(expDate.getHours() + parseInt(hours));
                    expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
                    return expDate.toGMTString();
                }
            }


            // store cookie value with optional details as needed
            function setCookie(name, value, expires, path, domain, secure)
            {
                document.cookie = name + "=" + escape(value) +
                    ((expires) ? "; expires=" + expires : "") +
                    ((path) ? "; path=" + path : "") +
                    ((domain) ? "; domain=" + domain : "") +
                    ((secure) ? "; secure" : "");
            }
			function docookies()
			{
				var tt=getExpDate(36500,0,0)
				setCookie("nname",document.getElementById("CorpName").value,tt,"/");
				setCookie("nguestname",document.getElementById("GuestName").value,"/");
				setCookie("tel",document.getElementById("Tel").value,tt,"/");
				setCookie("mobile",document.getElementById("Mobile").value,tt,"/");
				setCookie("email",document.getElementById("Email").value,tt,"/");
				setCookie("address",document.getElementById("Address").value,tt,"/");
				setCookie("post",document.getElementById("Post").value,tt,"/");
			}
			
//从新显示页面的总数
//由于数据不统一，总数以标签页为准
//zqs 2007-10-11
function resetCount()
{
	var querystring = new String(document.location.search.toLowerCase());
	
	if (querystring=='') return;
			
	var start = querystring.indexOf("search",0);
	
	if (start < 0 ) return;
	
	var end = querystring.length;
			
	var search = querystring.substring(start,end).split('=')[1];
	
	if (search=='otc')
	{
		document.getElementById('Label1').innerText = document.getElementById('cnt1').innerText;
	}
	
	if (search=='处方药')
	{
		document.getElementById('Label1').innerText = document.getElementById('cnt2').innerText;
	}
	
	if (search=='保健品')
	{
		document.getElementById('Label1').innerText = document.getElementById('cnt3').innerText;
	}
	
	if (search=='医疗器械')
	{
		document.getElementById('Label1').innerText = document.getElementById('cnt4').innerText;
	}
	
	if (search=='原料药')
	{
		document.getElementById('Label1').innerText = document.getElementById('cnt5').innerText;
	}

}
		
		
