window.addEvent('domready', function() { outputFirebugLog(gJson); }); function outputFirebugLog(input) { if (typeof(input) == 'undefined' || typeof(input.firebugLog) == 'undefined' || typeof(console) == 'undefined' || typeof(console.log) == 'undefined' || typeof(console.warn) == 'undefined') { return; } for (var i = 0; i < input.firebugLog.length; ++i) { if (input.firebugLog[i].match(/^\[MYSQL DEBUG ERROR/)) console.warn(input.firebugLog[i]); else console.log(input.firebugLog[i]); } return; } function handleJsonResponse(input) { if (typeof(input) == 'undefined') { if (typeof(console) != 'undefined' && typeof(console.error) != 'undefined') console.error('JSON response was not received'); return false; } outputFirebugLog(input); input.firebugLog = null; if (typeof(console) != 'undefined' && typeof(console.dir) != 'undefined') console.dir(input); if (input.errors.length > 1) { var msg = ''; for (i in input.errors) msg += '- ' + input.errors[i].message + '\n'; alert(msg); return false; } else if (input.errors.length > 0) { alert(input.errors[0].message); return false; } return true; }