//function showimg(img) {
//	document.getElementById("zttp").innerHTML = "<img src='touxiangimg/"
//			+ img.value + "' width='116px' height='105px'></img>";
//}
function chec() {
	var a = $("#ck");
	var m = $("#m");
	var sm = $("#sm");
	if (a.attr("checked") == false) {
		m.val("");
		sm.val("");
		m.attr("readonly", "readonly");
		sm.attr("readonly", "readonly");

	} else {
		m.removeAttr("readonly");
		sm.removeAttr("readonly");
	}
}

function sub()
{
	var a = $("#ck");
	var nc = $("#nc");
	var m = $("#m");
	var sm = $("#sm");
	if(nc.val() == "")
	{
		alert("昵称不能为空");
	}
	if (a.attr("checked")) {
		if(m.val() == "")
		{
			alert("密码不能为空");
		}
		if(sm.val() == "")
		{
			alert("重复密码不能为空");
		}
		if(m.val() != sm.val())
		{
			alert("前后密码不一致");
		}
	}
		document.forms[0].action="/j/updateYhzl.jsp";
		document.forms[0].submit();
	
}

function validfile(){  
    //格式必须为以下格式
	    var ftype="jpeg,jpg,gif,bmp";   
		  var fileObject=$("input[name='yh.tx']");  
	    var filepath=$("input[name='yh.tx']").val();   
	    if(filepath!=undefined||$.trim(filepath)!=""){ 
		       var filetype = filepath.substring(filepath.lastIndexOf(".")+1,filepath.length);
		       if(ftype.indexOf(filetype)=="-1"){
			       alert("上传文件必须为图片文件！");
			       $("#zttps").after($("#zttps").clone().val("")); //清空文本域
			       $("#zttps").remove();
			       return false;
		       }
    }
    	return true;
	}
	
	 function showimg(img){
		 if(validfile())
		 {
         document.getElementById("zttp").innerHTML="<img src='"+img.value+"' width='108px' height='130px'></img>";
     	}
	 }
