
// Add load events
// --------------------------------------------------------------------------------
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		}
	}
}

// Menu function used for IE - proper browsers use CSS
// --------------------------------------------------------------------------------
sfHover = function() {
	var sfEls = document.getElementById("md_tabs").getElementsByTagName("li");
	
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"),"");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// Check all tick boxes
// --------------------------------------------------------------------------------
function checkAll(field) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = true;
	}
}
function uncheckAll(field) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = false;
	}
}

// Add event handlers for cust price list
// --------------------------------------------------------------------------------
function md_custom_pricelist() {
	
	var md_cpl_sel_all = document.getElementById('md_cpl_sel_all');
	if (!md_cpl_sel_all) return false;
	
	var md_cpl_rem_all = document.getElementById('md_cpl_rem_all');
	if (!md_cpl_rem_all) return false;
	
	md_cpl_sel_all.onclick = function() {
		checkAll(document.md_cpl.CatID);
	}
	md_cpl_rem_all.onclick = function() {
		uncheckAll(document.md_cpl.CatID);
	}
	
}

addLoadEvent(md_custom_pricelist);











