function EES_widgetGetObject( ctrlid ) {
	var a = null;
	eval("if (typeof(nto"+ctrlid+")!=\"undefined\") a = nto"+ctrlid +";");
	return a;
}

function EES_widgetSetObject( ctrlid , a ) {
	eval("nto"+ctrlid +"=a;");
}

function EES_widgetSetEnabled( ctrlid , val ) {
	var o = EES_widgetGetObject( ctrlid );if (!o) return;
	var c = o.Obj;if (!c) return;
	c.disabled = !val;
}

function EES_widgetGetEnabled( ctrlid ) {
	var o = EES_widgetGetObject( ctrlid );if (!o) return;
	var c = o.Obj;if (!c) return;
	if (!c) return false;
	return !(c.disabled);
}

function EES_widgetSetValid( ctrlid , val ) {
	var o = EES_widgetGetObject( ctrlid );if (!o) return;
	o.Valid = val;
	var c = o.Obj;if (!c) return;
	c.className=(val) ? "NTvalid" : "NTinvalid";
}

function EES_widgetGetValid( ctrlid ) {
	var o = EES_widgetGetObject( ctrlid );if (!o) return;
	return o.Valid;
}

function EES_widgetSetTitle( ctrlid , val ) {
	var o = EES_widgetGetObject( ctrlid );if (!o) return;
	var c = o.ObjTitle;if (!c) return;
	o.Title = val;
	c.innerHTML = val;
}

function EES_widgetGetTitle( ctrlid ) {
	var o = EES_widgetGetObject( ctrlid );if (!o) return;
	return o.Title;
}

function EES_widgetAddEvent( obj , eventtype , func ) {
	if (obj.addEventListener) {
		var s = "";
		if (eventtype=="mousewheel") {
			s="obj.addEventListener('DOMMouseScroll',"+func+",false );";eval( s );
		}
		s="obj.addEventListener(eventtype,"+func+",false );";eval( s );
	} else if (obj.attachEvent) {
		var ev="";
		switch (eventtype) {
		default: ev = "on" + eventtype;
		}
		var s = "obj.attachEvent(\""+ev+"\"," + func + ");";
		eval( s );
	}
}

function EES_widgetGetParamsFromUri() {
	return getURLVars( document.location.href );
}

function EES_widgetKeyEvent( e ) {
	return (e) ? e : (window.event) ? window.event : null;
}

function EES_widgetReturnKeyEvent( e , retval ) {
	if (typeof(event)!="undefined") {
		event.returnValue = retval;
	} else {
		if (!retval) {
			e.preventDefault();
		}
	}
	return retval;
}

function EES_widgetReturnMouseWheelEventDelta( e ) {
	var delta = 0;
	if (!e) e = window.event;
	if (e.wheelDelta) {
		delta = e.wheelDelta / 120;
		// if (window.opera) delta = -delta; // oldschool opera
	} else if (e.detail) {
		delta = -e.detail/3;
	}
	if (delta>0) delta = 1;
	if (delta<0) delta = -1;
	return delta;
}

function EES_widgetPrepareValue( v ) {
	return v;
}


if (typeof( console )=="undefined") {
	console = new Object;
	console.log = function ( x ) {
		var c = document.getElementById( "EES_debuglog" );
		if (c) c.innerHTML+=x + "<br/>";
	}
}

