
//全选
function checkall(name){
	var aa = document.getElementsByName(name);

	for (var i=0; i<aa.length; i++) { 
	   aa[i].checked = document.getElementById('chkall').checked;; 
	} 
} 


//被选中的ID
function in_ids(name){

	var ss='';
	var aa = document.getElementsByName(name); 
	for (var i=0; i<aa.length; i++) 
	{ 
		if (aa[i].checked) ss+=aa[i].value+',';
	}
	var len=ss.length - 1; 
	return ss.substring(0,len);
}

//删除数据
function clickdel(id,url){

	if (confirm("确定要删除该记录吗？"))
	{
		document.getElementById('actiontype').value = "row_del";
		search_form.actionid.value = id;
		search_form.action = url;
		search_form.submit();
	}
	return false;
}

//提交动作
function submit_mult(actiontype,url){

	document.getElementById('actionid').value = in_ids('rows_id[0]');//获得选中的行编号
	var arr = document.getElementById('actionid').value.split(',');

	var n = 0;
	for(var j=0;j<arr.length;j++){
		if(arr[j]>0){ 
			n++;
		}
	}

	if(n == 0){
		alert('请选择至少一个操作项！');
		return false;
	}

	var msg;
	switch(actiontype){
		case "multdel":
			msg = '确定要删除所选'+n+'条记录吗？';
			if (confirm(msg)){
				search_form.action = url;
				document.getElementById('actiontype').value = actiontype;
				search_form.submit();
			}
			break;
		case "modify":
			if(n > 1){
				alert('最多只能选择一条记录！');
				return false;
			}
			msg = '确定要修改编号为'+arr+'记录吗？';
			if (confirm(msg)){
				document.getElementById('actiontype').value = actiontype;
				search_form.submit();
			}
			break;
		case "refresh":
			msg = '确定要刷新所选'+n+'条记录吗？';
			if (confirm(msg)) {
				search_form.action = url;
			   document.getElementById('actiontype').value = actiontype;
			   search_form.submit();
			}
			break;
	}
}


function op_cl_menu(key)
{
	if($("#menu_"+key).attr("class") == "")
	{
		$("#menu_"+key).attr("class", "selected");
		$("#menu_"+key).find(".end_collapsable").attr("class", "end_expandable");
		$("#menu_"+key).find(".folder_collapsable").attr("class", "folder_expandable");
		$("#menu_ul_"+key).hide();
	}
	else
	{
		$("#menu_"+key).attr("class", "");
		$("#menu_"+key).find(".end_expandable").attr("class", "end_collapsable");
		$("#menu_"+key).find(".folder_expandable").attr("class", "folder_collapsable");
		$("#menu_ul_"+key).show();
	}
	
}