/*
 * AlertPanel 
 */
function AlertPanel() { this.me=this;}
AlertPanel.prototype.notificationsList = [];
AlertPanel.prototype.name = "AlertPanel";

AlertPanel.prototype.init = function(data){
	
	this.data = data;	
	
	Phire.placeTemplate("#overlay", "AlertPanel.html", $.callback(this, this.onInit));	
}



AlertPanel.prototype.onInit = function()
{
	
	$("#alertpanel_text").html(this.data.text);
	$("#alertpanel_ok").text(this.data.ok == null ? "OK" : this.data.ok);
	if (this.data.cancel == null)
	{
		$("#alertpanel_cancel").hide();
	}
	else
	{
		log(this.data.cancel);
		$("#alertpanel_cancel").show();
		$("#alertpanel_cancel").text(this.data.cancel);
	}
	
	$("#alertpanel_ok").click($.callback(this, this.onClick, true));
	$("#alertpanel_cancel").click($.callback(this, this.onClick, false));
	reloadImages();
}

AlertPanel.prototype.onClick = function(value){
	Phire.removeTemplate("#alertpanel");
	
	if (this.data.callback != null) {
		if (this.data.data != null){
			this.data.callback(value, this.data.data);
		}else{
			this.data.callback(value);
		}
	}
};

