

function saveValue(){
	var v=new validate();
	v.form=document.getElementById("form1");
	if (!v.start()){  //验证必填项
	   return ;
	}
	
	var maxImg,maxValue;
	var minImg,minValue,imgw,imgh;
	if (form1.r1_1.checked){
		maxImg=1;
	}else if (form1.r1_2.checked){
		maxImg=2;
	}else{
		maxImg=0;
	}
	
	if (form1.r2_1.checked){
		minImg=1;
	}else if (form1.r2_2.checked){
		minImg=2;
	}else{
		minImg=0;
	}
	
	maxValue=form1.imgValue.value;
	minValue=form1.ximgValue.value;
	
	imgw=form1.imgw.value;
	imgh=form1.imgh.value;
	
	
	var objResponse=new JHttpResponse();
	objResponse.write("maxImg",maxImg);
	objResponse.write("minImg",minImg);
	objResponse.write("maxValue",maxValue);
	objResponse.write("minValue",minValue);
	objResponse.write("imgw",imgw);
	objResponse.write("imgh",imgh);
	
	var out=objAjax.getText("post","imgPar.aspx?type=save",objResponse,null);
	if (out=="OK"){
		alert("设置成功");
	}else{
		alert(erStr(out));
	}
}

function readPar(){
	var out=objAjax.getText("post","imgPar.aspx?type=read",null,null);
	out=comminute(out,c1,c2);
	//[name],[value]
	form1.imgValue.value=out[2][1]
	form1.ximgValue.value=out[3][1]
	form1.imgw.value=out[4][1];
	form1.imgh.value=out[5][1];
	
	
	out[0][1]=parseInt(out[0][1]);
	switch (out[0][1]){
		case 0:
			form1.r1_3.checked=true;
			break;
		case 1:
			form1.r1_1.checked=true;
			break;
		case 2:
			form1.r1_2.checked=true;
			break;
	}
	
	out[1][1]=parseInt(out[1][1]);
	switch (out[1][1]){
		case 0:
			form1.r2_3.checked=true;
			break;
		case 1:
			form1.r2_1.checked=true;
			break;
		case 2:
			form1.r2_2.checked=true;
			break;
	}
	
	//alert(out);
}


function  upimg(obj){

	var photo=openUpfile(9);
	if (photo!=null){
		photo=photo.split(c1);
		var textObj=obj.previousSibling;
		textObj.value=photo[0];
	}

}