/*  设置点击切换行样式*/
$(document).ready(function(){ 
	$("div[@name='item']").click(function(){ //在点击后切换div_bs_的class
   	$(this).toggleClass("div_bs__");});
	$("input[@name='gms'],span[@name='ljhz']").click(function(){  //阻止点击input和获知商家也切换class
	return false;});
	
	
	$('img[@name="log"]').click(function() {
   	     //
		 if(confirm("您需要登录后才能购买！点击“确定”打开登陆页面进行登陆。点击“取消”继续浏览。")){
		 	open("logon.asp");
		 };
	}); 



});

function zankai(huohao){
	$("#xx_"+huohao+"").slideToggle("slow");
}


function gms_err(huohao)
{
	$("#err_"+huohao+"").html("请填写正确的商品数量");
	setTimeout(function(){$("#err_"+huohao+"").html("");},2000);
}
function gms_err2(huohao)
{
	$("#err_"+huohao+"").html("不能大于库存数量");
	setTimeout(function(){$("#err_"+huohao+"").html("");},2000);
}
function edi_sl(user_id,huohao,sl,cp_id,cp_jg)  //实时修改数量  用户ID，货号，购买数量，产品ID，产品价格
{
	$("#g_"+huohao+"").html("<img src='img/g.gif'>");
	//alert(user_id+huohao+sl)
	if(sl == ""){sl = 0;}
	$.post('edi_sl.asp',{
		user_id: user_id,
		huohao: huohao,
		sl: sl,
		cp_id: cp_id,
		cp_jg: cp_jg},
		function(data){
		//alert(data);//返回echo $_POST['a']+$_POST['b'];
		$(".lay2").html(""+data+"");
		$("#g_"+huohao+"").html("<img src='img/gg.gif'>");
	});
}

function huiche(huohao)  //截获回车键并模拟Tab键
{
		if (window.event.keyCode==13) window.event.keyCode=9;
}

function jihuo(huohao)  //数量框获得焦点
{
	$("#g_"+huohao+"").html("<input style='height:20px;' type='button' value='提交'>");
}




function ljhz(obj)  //立即获知商家价代码
{

	//prompt("首先确认您的商家身份，然后才能为您开通查看商家价格和全部款式的权限。请与我们负责人联系，联系方式如下：","全国统一服务电话：400-702-7020 或 QQ:645405074、466026382");
	
	//、、、、、、、、获得当前坐标
    var x = obj.offsetLeft;    
    var y = obj.offsetTop;    
    while(obj = obj.offsetParent)
	{
        x += obj.offsetLeft;    
        y += obj.offsetTop;    
    }
    //alert("offsetLeft=" + x + "\noffsetTop=" + y);
	//、、、、、、、、获得当前坐标
	$("#ljhz_w").fadeIn("slow");
	document.getElementById('ljhz_w').style.left=(x+90)+"px";
	document.getElementById('ljhz_w').style.top=(y-45)+"px";


	//$("#ljhz_w").animate({left: x-50, opacity: 'show'}, { duration: 500 });
	//$("#ljhz_w").animate({top: x-200, opacity: 'show'}, { duration: 500 });

}

function ljhz_gb()  //关闭 立即获知商家价代码
{
	$("#ljhz_w").fadeOut("slow");
}
