/*
 * cg_ui.js
 * Copyright (c) 2009, ComGate Interactive s.r.o. All rights reserved
 * Code licensed under the BSD License
 */
if (typeof CG == "undefined" || !CG) {
    var CG = {};
}

CG.Ui = {};

CG.Ui.onFailure = function(o) {
	try {
		payload = YAHOO.lang.JSON.parse(o.responseText);
		if(payload["location"]) {
			document.location = payload["location"];
			return;
		}
	} catch(e) {}
	
	alert('Chyba: komunikace se serverem byla neúspěšná!.\n\nDetaily:'
        	+ '\n Status: ' + o.status 
        	+ '\n Text: ' + o.statusText 
        	+ '\n Čas: ' + CG.Ui.getDate() 
        	+ '\n UID: ' + o.argument);
};

CG.Ui.getDate = function() {
	var n = new Date();
	return  n.getDate() + '.' 
		+ (n.getMonth() + 1) + '.' 
		+ n.getFullYear() + ' ' 
		+ n.getHours() + ':' 
		+ n.getMinutes() + ':' 
		+ n.getSeconds();
};

