/* ################################################
################################################# */

function objEventHandler( _obj, _event, _handler ) {	
	if ( _obj.addEventListener ) {
		_obj.addEventListener( _event , _handler, false);
	} else {
		_onevent = 'on' + _event;
		if ( _obj.attachEvent ){     // IE
			_obj.attachEvent(_onevent, _handler);
		}	
	}
}

/* ################################################
################################################# */
function getRequest () {
	 var req = null;

	try{
		req = new XMLHttpRequest();
	}
	catch (ms){
		try{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (nonms){
			try{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (failed){
				req = null;
			}
		}  
	}

	if (req == null)
		  alert("Error creating request object!");
	return req;
}

/* ################################################
################################################# */
function log(message) {
    if (!log.window_ || log.window_.closed) {
        var win = window.open("", null, "width=400,height=200," +
                              "scrollbars=yes,resizable=yes,status=no," +
                              "location=no,menubar=no,toolbar=no");
        if (!win) return;
        var doc = win.document;
        doc.write("<html><head><title>Debug Log</title></head>" +
                  "<body></body></html>");
        doc.close();
        log.window_ = win;
    }
    var logLine = log.window_.document.createElement("div");
    logLine.appendChild(log.window_.document.createTextNode(message));
    log.window_.document.body.appendChild(logLine);
}