// JavaScript Document
function change_smclass(id,smid,arr)
{
	obj = document.getElementById(smid);
	obj.length = 1;
	for(i=0;i<arr.length;i++)
	{
		if(arr[i][1] == id)
		{
			obj.options[obj.length] = new Option(arr[i][0],arr[i][2]);	
		}
	}
}

//修改购物车产品数量
function edit_cart(pid,nums)
{
	///请求页面
	$.ajax({
		  type: "GET",
		  url: "/dfwl/car.php",
		  data: "forajax=1&eid="+pid+"&enums="+nums,
		  success: function(msg)
		  {
				$("#main").html(msg);
		  }
		});
}

//选择支付方式
function change_pays(nums,ids)
{
	var obj;
	for(i=1;i<=nums;i++)
	{
		obj = document.getElementById("pays_"+i);
		if(obj == null) continue;
		obj.style.display = "none";
	}
	obj = document.getElementById("pays_"+ids);
	obj.style.display = "";
}

function change_display(ids,obj)
{
	var display = "none";
	var o;
	if(obj.checked) display = "";
	
	o = document.getElementById(ids);
	o.style.display = display;
	//alert(display);
}

////types:
//1:全选
//2：返选
//3：全不选
//4：根据OBJ确定
function change_checkbox(names,types,obj)
{
	var objs = document.getElementsByTagName("input");
	var checkeds = null;
	if(types == "1") checkeds = true;
	if(types == "3") checkeds = false;
	if(types == "4") checkeds = obj.checked;
	for(i=0;i<objs.length;i++)
	{
		if(objs[i].name == names)
		{
			if(checkeds == null)
			{
				objs[i].checked = !objs[i].checked;
			}
			else
			{
				objs[i].checked = checkeds;	
			}
		}
	}
}