//****** 选中全部的checkbox
var checkAllCounter = 0;
function checkAll(checkboxName){
	var boxes = document.all(checkboxName);
	var bChk = true;
	if(checkAllCounter%2!=0)
		bChk = false;
	if(boxes){
		for(var i=0; i<boxes.length; i++){
			boxes[i].checked = bChk;
		}
	}
	checkAllCounter++;
}

//****** 翻页提交
function turnpage(x){
	var theForm = eval("document.search_form");
	var thePage;
	if(theForm){
		thePage = getPage(theForm);
		thePage.value = x;
		theForm.submit();
	}
	else{
		theForm = document.forms[0];
		if(!theForm){
			alert("页面上没有search_form这个表单！");
			return;
		}
		thePage = getPage(theForm);
		thePage.value = x;
		theForm.submit();
	}
}
function getPage(theForm){
	var thePage = theForm.page;
	if(!thePage){
		thePage = document.createElement("<input type='hidden' name='page' value='1'>");
	}
	return thePage;
}

//****** 重置表单
function formReset(form){
	var theForm = eval("document."+form);
	if(theForm){
		for(var i=0; i<theForm.elements.length; i++){
			if(theForm.elements(i).tagName=="INPUT"){
				if(theForm.elements(i).type=="hidden" || theForm.elements(i).type=="password" || theForm.elements(i).type=="text")
					theForm.elements(i).value = "";
			}
			if(theForm.elements(i).tagName=="SELECT"){
				theForm.elements(i).options.selectedIndex = 0;
			}
		}
	}
	else{
		alert("页面上没有要重置的表单！");
		return;
	}
}

function selectUser(eleName,eleId){
	var sWindowProperty = new String("width=300,height=200,top=100,left=100,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
	window.open("/selectUser.do?todo=all&eleName="+eleName+"&eleId="+eleId,"select_user",sWindowProperty);
}