UI = function() {
}
UI.pb = function(elem, ev) {
	if(window.__uiPrepostBack) {
		window.__uiPrepostBack();
	}
	var id = '';
	if(typeof(elem)=='string') {
		id = elem;
	} else {
		id = elem.id;
	}
	document.forms[0].__uievent.value=id+':'+ev;
	document.forms[0].submit();
}
UI.confirm = function(txt) {
	return window.confirm(txt);
}
UI.open = function(url, name, attrs) {
	window.open(url, name, attrs);
	return;
}
UI.alert = function(txt) {
	return window.alert(txt);
}
UI.setFocusOn = function(id) {
	var el = UI.getElementById(id);
	if(el && el.focus) {
		el.focus();
	}
}
UI.getKeyFrom = function(ev) {
	if (window.event) {
		return window.event.keyCode;
	} else if (ev) {
		return ev.which;
	}
	return null;
}
UI.getElementById = function(id) {
	return UI._getElementByIdRec(id,window.document);
}
UI.elem = UI.getElementById;
UI._getElementByIdRec = function(id, doc) {
	if (doc.getElementById) {
		var o = doc.getElementById(id);
		if(o) {
			return o;
		}
	}
	if (doc.all) {
		var o = doc.all[id];
		if(o) {
			return o;
		}
	}
	if(doc.layers) {
		for (var i=0; i<doc.layers.length; i++) {
			o = UI._getElementByIdRec(id, doc.layers[i].document);
			if(o) {
				return o;
			}
		}
	}
	return null;
}


