﻿function HideSelects() {
	if (JQ.browser.msie) {
		JQ('select').each(function () {
			if (typeof (this.undoDisplay) == 'undefined' || this.undoDisplay == null) {
				this.undoDisplay = this.style.display;
				this.style.display = 'none';
			}
		});
	}
}

function ShowSelects() {
	if (JQ.browser.msie) {
		JQ('select').each(function () {
			if (typeof (this.undoDisplay) != 'undefined' && this.undoDisplay != null) {
				this.style.display = this.undoDisplay;
				this.undoDisplay = null;
			}
		});
	}
}

function SetUniqueRadioButton(nameregex, current) {
	re = new RegExp(nameregex);
	for (i = 0; i < document.forms[0].elements.length; i++) {
		elm = document.forms[0].elements[i]
		if (elm.type == 'radio') {
			if (re.test(elm.name)) {
				elm.checked = false;
			}
		}
	}
	current.checked = true;
}

function addUnLoadEvent(func) {
	var oldonunload = window.onunload;
	if (typeof window.onunload != 'function') {
		window.onunload = func;
	} else {
		window.onunload = function () {
			if (oldonunload) {
				oldonunload();
			}
			func();
		}
	}
}


