 <!--
 var shop={
		     check:function(a){
			  for(var k=0;k<=a;k++)
			  {
			   if ($("#attr"+k).val()=='')
			   {
			     alert('请选择'+$("#attrname"+k).html());
				 return false;
			   }
			  }
			  if ($("#num").val()==0||$("#num").val()=='')
			  {
			   alert('请输入购买数量!');
			   return false;
			  }
			  if (parseInt($("#num").val())>parseInt($("#stock").text()))
			  {
			   alert('对不起，您最多只能购买'+$("#stock").text()+'!');
			   return false;
			  }
			  return true;
			 },
             gobuy:function(a){
			  if (shop.check(a)){
			  $("#cartform").submit();
			  }
		     },
			 getAttr:function(obj,i,a,l){
			 
			  $("#attr"+i).val(obj.innerHTML);
			  for(var k=0;k<=l;k++)
			  {
			   $("#att"+i+k)[0].className='txt';
			  }
			  obj.className='curr';
			  var attr='';
			  var attrs='';
			  for(var k=0;k<=a;k++)
			  {
			   if ($("#attr"+k).val()!=''){
			    if (attr==''){
			      attr='“'+$("#attr"+k).val()+'”';
				  attrs=$("#attrname"+k).html()+$("#attr"+k).val();
			     }else{
			      attr+=',“'+$("#attr"+k).val()+'”';
				  attrs+='  '+$("#attrname"+k).html()+$("#attr"+k).val();
				 }
			   }
			  }
			  $("#AttributeCart").val(attrs);
			  $("#buyselect").html("<b>已选择：<font color=brown>"+attr+"</font></b>");
			 },
			 addCart:function(ev,id,a,dir){
			  if (shop.check(a)){
			    new KesionPopup().mousepop("<img src='"+dir+"Images/user/log/5.gif' align='absmiddle'>宝贝已成功添加到购物车！","<form name='paymentform' action='"+dir+"shop/payment.asp' method='post'><div id='cartShow'></div><div style='text-align:center;margin:10px'><input type='image' src=\'"+dir+"shop/images/hesuan.gif\'> <a href=\'"+dir+"shop/shoppingcart.asp\'><img src=\'"+dir+"shop/images/chakangouwuche.gif\'></a> <a href=\'javascript:closeWindow()\'><img src=\'"+dir+"shop/images/jixugouwu.gif\'></a></form></div>",400);
				$.get(dir+"plus/ajaxs.asp",{action:"addCart",id:id,num:$("#num").val(),AttributeCart:escape($("#AttributeCart").val())},function(d){
				   if (d!=''&&d!=null){
				    $("#cartShow").html(unescape(d));
				   }
				});
			   }
			 }
 }
 //-->
