/*留言字数限制*/
function checkMaxInput(maxLen,value) {
if (value.length > maxLen) {
alert("最大长度"+maxLen+"");
}
}

/*检测还剩余字数*/
function checkLength(which,len,content) { 
var maxChars = len; 
if (which.value.length > maxChars) 
	which.value = which.value.substring(0,maxChars); 
	var curr = maxChars - which.value.length; 
	document.getElementById(content).innerHTML = curr.toString(); 
} 

/*个人照片自动缩放*/
function DrawImage(ImgD){
var flag=false;
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 90/120){
if(image.width>90){
ImgD.width=90;
ImgD.height=(image.height*120)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}

}
else{
if(image.height>120){
ImgD.height=120;
ImgD.width=(image.width*90)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
}

/*CheckAll为复选框全选  PerList为提交时判断是否至少选择一项*/
function CheckAll(oCheckAllBox){
	var checked = oCheckAllBox.checked;
	var oCheckBox = document.getElementsByName("PerCheckBox");
	if(typeof(oCheckBox.length) == 'undefined') {
		oCheckBox.checked = checked;
	}else {
		for(var i=0;i<oCheckBox.length;i++){
			oCheckBox[i].checked = checked;
		}
	}
}

function CheckList(){
	var temp = false;
	var oCheckBox = document.getElementsByName("PerCheckBox");
	if(typeof(oCheckBox.length) == 'undefined') {
		if(oCheckBox.checked){
			temp = true;
		}
	}else {
		for(var i=0;i<oCheckBox.length;i++){
			if(oCheckBox[i].checked){
				temp = true;
				break;
			}
		} 
	}
	if(temp){
		return true;
	}
	else{
		return false;
	}
}

function PerList(url){
	if(!CheckList()){
		alert("请至少选择一项");
		return false;
	}	
	var oFrm = document.getElementById("Frm");
	oFrm.action = url;
	oFrm.submit();
	return true;
}


function printsetup(){ 
// 打印页面设置 
wb.execwb(8,1); 
} 
function printpreview(){ 
// 打印页面预览 
　
wb.execwb(7,1); 
　　} 

function printit() 
{ 
if (confirm('确定打印吗?')) { 
wb.execwb(6,6) 
} 
}

//弹出窗口 设定打开窗口的大小和位置参数，并且打开的窗口中没有地址栏、滚动栏、菜单栏和工具栏等
function popupPage(l, t, w, h, u) {
var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes" +
",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;    

var URL = u;                                        <!--将要链接到的网页位置-->
popup = window.open(URL,"MenuPopup",windowprops);   <!--使用window对象的open方法按照设定的参数打开对应的网址-->
}


/*点击关闭当前窗口*/
function CloseWin()
{
var ua=navigator.userAgent
var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
if(ie){
    var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))))
 if(IEversion< 5.5){
    var str  = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
    str += '<param name="Command" value="Close"></object>';
    document.body.insertAdjacentHTML("beforeEnd", str);
    document.all.noTipClose.Click();
    }
    else{
    window.opener =null;
    window.close();
    }
}
else{
window.close()
}
}
