$(function(){
 $("#AllSort").load("category.asp?action=cate&mn="+Math.random()); 
 $('#addNum').bind("click",addnum)
 $('#divNum').bind("click",Divnum)
 $('#procutNum').bind("change",NumChange)
 $('#addToCart').bind("click",addToCart)
 $('#addToColledge').bind("click",addToColledge)   
 
  $("#danweiLabel").css("display","none");
  $(".ra").bind("click",myshowBlock);

  
 $("#AllSort").ajaxError (function(){$(this).html("发生错误，请重新操作");});
 $("#Loading").hide();
 $("#Loading").ajaxStart(function(){$(this).show();$(this).html("开始处理");});  
 $("#Loading").ajaxSend  (function(){$(this).show();$(this).html("发送数据");});
 $("#Loading").ajaxSuccess (function(){$(this).html("事件处理完");});
 $("#Loading").ajaxComplete(function(){});
 $("#Loading").ajaxStop (function(){$(this).hide("");});    
 $("#Loading").ajaxError (function(){$(this).html("发生错误，请重新操作");});
// $(".productInfo>>form").hover (alert("00"));

 $(".cartTable>td>#num").each(
	
	 //$(this).change(function() {alert("00")})
						 )

})


function myshowBlock()
{
	

	if($(this).val()=="1")
	{
		$("#danweiLabel").css("display","block");
	}
	else
	{
		$("#danweiLabel").css("display","none");
	}

}



/*增加产品数量*/
function addnum()
{	
	$('#procutNum').val(parseInt($('#procutNum').val())+1);	
}
/*减少产品数量*/
function Divnum()
{
	$('#procutNum').val(parseInt($('#procutNum').val())-1);	
	NumChange();
}

/*产品数量框改变*/
function NumChange()
{
	
	d=$('#procutNum').val();
	if(isNaN(d))
	{
		alert("产品数必须为大于0的数字且为整数");
		$('#procutNum').val(1);
		return;
	}

	d=parseInt($('#procutNum').val());
	if(d<1)
	{
		alert("产品数量不能小于1");
		$('#procutNum').val(1)
	}

}
/*把产品加入购物车*/
function addToCart()
{
	var productId,procutNum;
	productId=$('#productId').val();	
	procutNum=$('#procutNum').val();	
	$("#m").load("cart.asp?action=ajaxAdd&productId="+productId+"&procutNum="+procutNum+"&s="+Math.random());

	
	return false;
}

/*把产品加入收藏夹*/
function addToColledge()
{
	alert("产品已加入你的收藏夹");
}



