g_oDebug.debugMode = false;

// Initialise CPaint
var	g_oCPaint = new cpaint();
g_oCPaint.set_debug(0);
g_oCPaint.set_transfer_mode("get");
g_oCPaint.set_async(true);
g_oCPaint.set_response_type("object");

// Default cpaint_error.  May be overridden, e.g. in content.html.
function cpaint_error()
{
	alert("A network error has occurred while communicating with the Elumos server.\nPlease try again later.");
	hideMessage();
}

// =======================================================
//  Helper Functions
// =======================================================
// dump() -- Generic function to test response from PHP
// ======
function dump(p_oResponse)
{
	g_oDebug.dumpObject(p_oResponse, g_oDebug.DUMP_PATH);
}

// protectFormat()
function protectFormat(p_sValue)
{
	// Protect against CPaint removing leading zeros from digit-only strings
	return 'X' + p_sValue;	
}

function unprotectFormat(p_sValue)
{
	if (p_sValue.length > 0 && p_sValue.charAt(0) == 'X')
	{
		return p_sValue.substring(1);
	}
}
