// USGS_NATMAP_client_debug_log.js
// functions for logging debug messages to a window on the client system

var theLogWindow = null;

function clientLog(memo, body) {
	if (allowClientLog) {
		checkLogWindow();
		if (theLogWindow.isLoaded != null && theLogWindow.isLoaded) {
			theLogWindow.appendToLog(memo, body);
		}
	}
}

function clientLogRequest(request) {
	clientLog('REQUEST', request);
}

function clientLogResponse(response) {
	clientLog('RESPONSE', response);
}

function clientLogMemo(memo) {
	clientLog(memo, "");
}

function checkLogWindow () {
	if (allowClientLog) {
		if (theLogWindow == null || theLogWindow.document == null) {
			var theUrl = appDir + "client-log.html";
			theLogWindow = window.open(theUrl, "Client_Log");
		}
	}
}
