function winWid(){
	//define browser
	var ns4 = (document.layers) ? 1 : 0;
	var ie4 = (document.all) ? 1 : 0;
	var ns6 = (document.getElementById && !document.all) ? 1 : 0;
   return (ns4||ns6) ? window.innerWidth : document.body.clientWidth;
}

function winHei(){
//define browser
	var ns4 = (document.layers) ? 1 : 0;
	var ie4 = (document.all) ? 1 : 0;
	var ns6 = (document.getElementById && !document.all) ? 1 : 0;
   return (ns4||ns6) ? window.innerHeight : document.body.clientHeight;
}

function openwin(filename, width, height) {
	winWidth = winWid();
	winHeight = winHei();
	topPos = (parseInt(winHeight)-parseInt(height))/2;
	topPos = (topPos<0) ? 5:topPos;
	leftPos = (parseInt(winWidth)-parseInt(width))/2;
	leftPos = (leftPos<0) ? 5:leftPos;
	params='width='+width+',height='+height+',left='+leftPos+',top='+topPos+',toolbar=no,scrollbars=yes,resizable=no, status=no';
	newWin = window.open(filename, 'nextstep', params);
	newWin.focus();
}

function setCheckboxes(the_form, do_check, elementname) {
    var items_to_delete			= document.forms[the_form].elements[elementname+'[]'];
    var items_to_delete_num  = items_to_delete.length;

    for (var i = 0; i < items_to_delete_num; i++) {
        items_to_delete[i].checked = do_check;
    } // end for

    return true;
} // end of the 'setCheckboxes()' function

function operateCheckBoxes(e, the_form, elementname) {
//	alert(document.forms[the_form].elements[obj].checked);
//	alert(obj);
	if (e.checked) {
		setCheckboxes(the_form, true, elementname); 
		return false;
	} else {
		setCheckboxes(the_form, false, elementname);
		return false;
	}
}

