dropDownMenu = function() {
	if (!document.getElementById("navbar")) { return; }
	var sfEls = document.getElementById("navbar").getElementsByTagName("LI");
	for (var i=0, sL = sfEls.length; i<sL; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

selectFix = function() {
	if (!document.getElementById("navbar")) { return; }
	var menu = document.getElementById("navbar");
	var selects = document.getElementById("content").getElementsByTagName("SELECT");

	menu.onmouseover=function() {
		for (var i=0, sL = selects.length; i<sL; i++) {
			selects[i].style.visibility = "hidden";
		}
	}
	menu.onmouseout=function() {
		for (var i=0, sL = selects.length; i<sL; i++) {
			selects[i].style.visibility = "visible";
		}
	}
}

tableHover = function() {
	if (!document.getElementById("documentlist")) { return; }
	var sfEls = document.getElementById("documentlist").getElementsByTagName("TR");
	for (var i=0, sL = sfEls.length; i<sL; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

if (window.attachEvent && typeof(window.opera) == 'undefined') {
	window.attachEvent("onload", dropDownMenu);
	//window.attachEvent("onload", selectFix);
	window.attachEvent("onload", tableHover);
}

function confirmDelDoc() {
	return confirm('Are you sure you want delete this document?');
}

function confirmDelUser() {
	return confirm('Are you sure you want delete this user?');
}

function confirmDelRecord() {
	return confirm('Are you sure you want delete this row?');
}

function confirmMassDelete() {
	var frm = document.getElementById('datatableHasForm');
	var checkboxes = frm.getElementsByTagName('input');
	var checkboxCount = 0;
	for (var i=1, cL = checkboxes.length; i<cL; i++) {
		if (checkboxes[i].type == "checkbox" & checkboxes[i].checked == true) {
			checkboxCount++;
		}
	}

	if (checkboxCount > 0) {
		return confirm('Are you sure you want delete the selected rows?');
	} else {
		alert('You must select rows using the check box first.');
		return false;
	}
}
function confirmMassStatus() {
	var frm = document.getElementById('datatableHasForm');
	var checkboxes = frm.getElementsByTagName('input');
	var checkboxCount = 0;
	for (var i=1, cL = checkboxes.length; i<cL; i++) {
		if (checkboxes[i].type == "checkbox" & checkboxes[i].checked == true) {
			checkboxCount++;
		}
	}

	if (checkboxCount > 0) {
		return confirm('Are you sure you want to change the status of the selected rows?');
	} else {
		alert('You must select rows using the check box first.');
		return false;
	}
}
function confirmMassSelect() {
	var frm = document.getElementById('datatableHasForm');
	var checkboxes = frm.getElementsByTagName('input');
	var checkboxCount = 0;
	for (var i=1, cL = checkboxes.length; i<cL; i++) {
		if (checkboxes[i].type == "checkbox" & checkboxes[i].checked == true) {
			checkboxCount++;
		}
	}

	if (checkboxCount > 0) {
		return true;
	} else {
		alert('You must select rows using the check box first.');
		return false;
	}
}
function confirmClearLogs() {
	return confirm('Are you sure you want clear the logs?');
}
function toggleAll(parent, children) {
	var frm = document.getElementById('datatableHasForm');
	var checkboxes = frm.getElementsByTagName('input');
	var checkedStatus = parent.checked;
	var checkboxCount = 0;
	for (var i=1, cL = checkboxes.length; i<cL; i++) {
		if (checkboxes[i].type == "checkbox" & checkboxes[i].name == children) {
			checkboxes[i].checked = checkedStatus;
		}
	}
}