function AdminisAdminWindow() {
	return true;
}

function AdminPopUpTool(act,parm) {
	top.WbbPopTool(act,parm);
}

function WbbPopTool(act,parm){
	win = new Object();
    win.popname = "wbbpoptool";
    win.ismodal = 0;
    win.width = 100;
    win.height = 100;
    win.center = 1;
    win.status = 1;
    win.resize = 1;

    ispop = openWindow("about:blank",win);
	
    if(ispop) 
    {
        frm = document.popuptool_form;
        frm.popuptool.value = act;
        frm.popuptoolparm.value = parm;
        frm.submit();	
    }else 
    {
        return false;	
    }
}

function AdminGetID(id) {
	if(document.getElementById && document.getElementById(id)) {
        // W3C Netscape 6老版快 
         rtn_id = document.getElementById(id);
    } else if (document.all && document.all(id)) {
        // MSIE 4 老版快
         rtn_id = document.all(id);
    } else if (document.layers && document.layers[id]) {
        // NN 4 老版快
         rtn_id = document.layers[id];
    }else{
		return false; 	
    }
	return rtn_id;
}


function AdminTrim(val,trim) {
    
    trim = trim==null?'trim':'';
    switch (trim) {
    case "trim":
        val = val.replace(/^\s+/, "").replace(/\s+$/, "");
        break;
    case "compress":
        val = val.replace(/\s+/, "");
        break;
    case "ltrim":
        val = val.replace(/^\s+/, "");
        break;
    case "rtrim":
        val = val.replace(/\s+$/, "");
        break;
     default :
        val = val.replace(/^\s+/, "").replace(/\s+$/, "");
        break;
    }
    return val;
}


function AdminPopHelp(doc,what) {
	win = new Object();
    win.name = "wbbpoptool";
    win.ismodal = 0;
    win.width = 500;
    win.height = 600;
    win.center = 1;
    win.status = 1;
    win.resize = 1;
    url = "/admin/help/help.html?doc="+doc+"&what="+what;
    ispop = openWindow(url,win);
}

function AdminChkAllList(chk,itm) 
{
	frmname = chk.form.name;
	_listbid = eval("document."+frmname+"[\""+itm+"[]\"]");
    if(typeof(_listbid) == "undefined") 
    {
        _listbid = eval("document."+frmname+"."+itm);
    }
	
	if(!_listbid) 
	{
		return false;
	}
    if(_listbid.length) 
    {
    	for(i=0; i<_listbid.length; i++) 
    	{
    		if (chk.checked == true)
    		{
				_listbid[i].checked = true;
    		}else{
				_listbid[i].checked = false;
			}
			AdminListChkBox(_listbid[i],i%2)
    	}
    }else{
		if (chk.checked == true)
		{
			_listbid.checked = true;
			AdminListChkBox(_listbid,0)
		}else{
			_listbid.checked = false;
			AdminListChkBox(_listbid,0)
		}
	}
}
// 格废 眉农矫 tr 胶鸥老 函版
function AdminListChkBox(obj,tri)
{
	_obj_tag = "obj.parentElement";
	while(1) 
	{
		objRow = eval(_obj_tag);
		if(objRow.tagName == "TR") 
		{
			break;
		}else 
		{
			_obj_tag += ".parentElement";
		}
	}
/*
	if (typeof(document.getElementsByTagName) != 'undefined') {
		theCells = objRow.getElementsByTagName('td');
	}
	else if (typeof(objRow.cells) != 'undefined') {
		theCells = objRow.cells;
	}
*/
	if (obj.checked)
	{
		objRow.className = "listtdchecked";
		objRow.style.backgroundColor="#CCFF00";
	}else{
		objRow.className = "listtd"+tri;
		objRow.style.backgroundColor="";
	}

}
