var username = "";

function getUserCookie()
{
	var tmpstr = document.cookie;
	var inx = tmpstr.indexOf("userid");
	if (inx!=-1)
	{
		var inx3 = tmpstr.indexOf(";",inx);
		var tmp;
		if (inx3 !=-1)
		tmp = tmpstr.substr(inx+7,inx3-inx-7);
		else
		tmp = tmpstr.substr(inx+7);
		username = tmp;
		n=username.indexOf("@");
		if (n>0)
		username = username.substr(0,n);
	}
		
}

var dd = new Date();
var timestr = dd.getTime();

//document.write(document.cookie);
getUserCookie();
//document.write("%%%%%%%%%username="+username);
                function add2cartzhuanti(spec,node,selcount)

                {

                        var info = "";

                        for (var i=0;i<selcount;i++)

                        {

                                var obj = eval("document.mainform.usersel"+node+i);

                                if (obj != null)

                                {

                                        info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","

                                }

                        }

                        window.open("http://store.sohu.com/Cart.jsp?stay=1&action=add&sppid="+spec+"&dlpid=-1&producttype=0&productcount=-1&begintime="+info+"&t="+timestr);

                }

                
		function add2cart(spec,node,selcount)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			window.open("http://store.sohu.com/Cart.jsp?action=add&sppid="+spec+"&dlpid=-1&producttype=0&productcount=-1&begintime="+info+"&t="+timestr);			
		}
		function add2cart4(node,selcount)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			var specobj = eval("document.mainform.psid"+node);		
			if (specobj == null || specobj.value == "")	
			{
				alert("请选择规格");	
				return;
			}
			window.open("http://store.sohu.com/Cart.jsp?action=add&sppid="+specobj.value+"&dlpid=-1&producttype=0&productcount=-1&begintime="+info+"&t="+timestr);
		}
		function add2cart4withsessionid(node,selcount,sessionid)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			var specobj = eval("document.mainform.psid"+node);		
			if (specobj == null || specobj.value == "")	
			{
				alert("请选择规格");	
				return;
			}
			window.open("http://store.sohu.com/Cart.jsp;jsessionid="+sessionid+"?action=add&sppid="+specobj.value+"&dlpid=-1&producttype=0&productcount=-1&begintime="+info+"&t="+timestr);
		}
		
		function add2cartwithsessionid(spec,node,selcount,sessionid)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			window.open("http://store.sohu.com/Cart.jsp;jsessionid="+sessionid+"?action=add&sppid="+spec+"&dlpid=-1&producttype=0&productcount=-1&begintime="+info+"&t="+timestr);
		}
		
		function add2cart2(spec,node,selcount,url)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			window.open("http://store.sohu.com/Cart.jsp?action=add&sppid="+spec+"&dlpid=-1&producttype=0&productcount=-1&begintime="+info+"&t="+timestr);
		}
		
		function add2cart2withsessionid(spec,node,selcount,url,sessionid)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			window.open("http://store.sohu.com/Cart.jsp;jsessionid="+sessionid+"?action=add&sppid="+spec+"&dlpid=-1&producttype=0&productcount=-1&begintime="+info+"&t="+timestr);
		}
		
		
		function add2cart3(node,selcount,speccount,url)
		{			
			var info = "";
			
			for (var i=0;i<selcount;i++)
			{				
				var obj = eval("document.mainform.usersel"+node+i);				
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			
			var sppidstr = "";
			for (var i=0;i<speccount;i++)
			{
				var checkobj = eval("document.mainform.multiSpec"+node+i);
				if (checkobj.checked)
				{
					sppidstr += "&sppid="+checkobj.value+"&begintime="+info;
				}
			}
			if (sppidstr == "")
			{
				alert("请选择产品");	
				return;
			}
			window.open("http://store.sohu.com/Cart.jsp?action=add"+sppidstr+"&dlpid=-1&producttype=0&productcount=-1&backurl="+url);
		}
		
		function add2cart3withsessionid(node,selcount,speccount,url,sessionid)
		{			
			var info = "";
			
			for (var i=0;i<selcount;i++)
			{				
				var obj = eval("document.mainform.usersel"+node+i);				
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			
			var sppidstr = "";
			for (var i=0;i<speccount;i++)
			{
				var checkobj = eval("document.mainform.multiSpec"+node+i);
				if (checkobj.checked)
				{
					sppidstr += "&sppid="+checkobj.value+"&begintime="+info;
				}
			}
			if (sppidstr == "")
			{
				alert("请选择产品");	
				return;
			}
			window.open("http://store.sohu.com/Cart.jsp;jsessionid="+sessionid+"?action=add"+sppidstr+"&dlpid=-1&producttype=0&productcount=-1&t="+timestr);
		}
		
		function add2wish3(node,selcount,speccount)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			var sppidstr = "";
			for (var i=0;i<speccount;i++)
			{
				var checkobj = eval("document.mainform.multiSpec"+node+i);
				if (checkobj.checked)
				{
					sppidstr += "&sppid="+checkobj.value+"&remark="+info;
				}
			}
			if (sppidstr == "")
			{
				alert("请选择产品");	
				return;
			}
			window.open("http://store.sohu.com/WishList.jsp?action=add"+sppidstr+"&t="+timestr);
		}
		
		function add2wish3withsessionid(node,selcount,speccount,sessionid)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			var sppidstr = "";
			for (var i=0;i<speccount;i++)
			{
				var checkobj = eval("document.mainform.multiSpec"+node+i);
				if (checkobj.checked)
				{
					sppidstr += "&sppid="+checkobj.value+"&remark="+info;
				}
			}
			if (sppidstr == "")
			{
				alert("请选择产品");	
				return;
			}
			window.open("http://store.sohu.com/WishList.jsp;jsessionid="+sessoinid+"?action=add"+sppidstr+"&t="+timestr);
		}
		
		
		function add2wish4(node,selcount)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			var specobj = eval("document.mainform.psid"+node);		
			if (specobj == null || specobj.value == "")	
			{
				alert("请选择规格");	
				return;
			}			
			window.open("http://store.sohu.com/WishList.jsp?action=add&sppid="+specobj.value+"&remark="+info+"&t="+timestr);
		}
		function add2wish4withsessionid(node,selcount,sessionid)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			var specobj = eval("document.mainform.psid"+node);		
			if (specobj == null || specobj.value == "")	
			{
				alert("请选择规格");	
				return;
			}			
			window.open("http://store.sohu.com/WishList.jsp;jsessionid="+sessionid+"?action=add&sppid="+specobj.value+"&remark="+info+"&t="+timestr);
		}
		
		function add2wish(spec,node,selcount)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			
			
			window.open("http://store.sohu.com/WishList.jsp?action=add&sppid="+spec+"&remark="+info+"&t="+timestr);
		}
		
		function add2wishwithsessionid(spec,node,selcount,sessionid)
		{
			var info = "";
			for (var i=0;i<selcount;i++)
			{
				var obj = eval("document.mainform.usersel"+node+i);
				if (obj != null)
				{
					info = info + obj.options[obj.selectedIndex].value +":"+obj.options[obj.selectedIndex].text+","
				}
			}			
			
			window.open("http://store.sohu.com/WishList.jsp;jsessionid="+sessionid+"?action=add&sppid="+spec+"&remark="+info+"&t="+timestr);
		}

function windowresize()
{
	if (document.all.copyrightpane)
	{
		if (document.all.leftpane && document.all.rightpane && document.all.centerpane)
		{
			var top2 = document.all.leftpane.offsetHeight+document.all.leftpane.offsetTop+20;
			var top3 = document.all.rightpane.offsetHeight+document.all.rightpane.offsetTop+20;
			var top4 = document.all.centerpane.offsetHeight+document.all.centerpane.offsetTop+20;
			if (top2 > top3)
				top3 = top2;	
			if (top3 > top4)
				top4 = top3;						
			document.all.copyrightpane.style.top = top4;
		}else if (document.all.leftpane && document.all.rightpane)
		{
			//var top2=document.all.leftpane.pixelTop+document.all.leftpane.height+20;
			var top2 = document.all.leftpane.offsetHeight+document.all.leftpane.offsetTop+20;
			var top3 = document.all.rightpane.offsetHeight+document.all.rightpane.offsetTop+20;
			if (top2 > top3)
				top3 = top2;	
			document.all.copyrightpane.style.top = top3;
		}
	}
}		

function showprice(storenodeid)
{
	//alert(storenodeid);
	
	var theobj = eval("document.mainform.specselect"+storenodeid);
	if (theobj != null)
	{
		var thevalue = theobj.options[theobj.selectedIndex].value;
		if (thevalue.length>0)
		{
			var pos = thevalue.indexOf(";");	
			if (pos != -1)
			{
				var specid  = thevalue.substring(0,pos);
				var psidobj = eval("document.mainform.psid"+storenodeid);
				if (psidobj)
				{										
					psidobj.value = specid;	
				}
				thevalue = thevalue.substring(pos+1);
				pos = thevalue.indexOf(";");		
				if (pos != -1)
				{
					var listprice  = thevalue.substring(0,pos);
					var listobj = eval("document.mainform.lprice"+storenodeid);
					if (listobj !=null)
					{
						listobj.value = listprice;	
					}
					thevalue = thevalue.substring(pos+1);
					pos = thevalue.indexOf(";");		
					if (pos != -1)
					{
						var nowprice = 	thevalue.substring(0,pos);
						var nowobj = eval("document.mainform.nprice"+storenodeid);
						if (nowobj != null)
						{
							nowobj.value = nowprice;	
						}
						var saveprice = thevalue.substring(pos+1);
						var saveobj = eval("document.mainform.sprice"+storenodeid);
						if (saveobj != null)
						{
							saveobj.value = saveprice;	
						}
					}
				}
			}
		}
	}
	
}