// ErrorAPI functions / class

// begin Global variables
var ErrorAPIzIndex = "100";

// end Global variables

// begin generic functions
function ErrorAPIMessageNext() {
	if (ErrorAPIQueue) { 
		ErrorAPIQueue.next();
	}
}
function ErrorAPIMessageHide(msgID, next_flag) {
	ErrorAPIMessageStatus(msgID, 0);
	if (next_flag) { ErrorAPIMessageNext();	}
}
function ErrorAPIMessageShow(msgID) { ErrorAPIMessageStatus(msgID, 1); }

function ErrorAPIMessageStatus(msgID, visible_flag) {
	((visible_flag) ? message_api_showit(msgID) : message_api_closeit(msgID));
}
// end generic functions

// begin class encapsulation
function ErrorMessage(msgID, title, imagePath) {
	this.id = msgID;
	this.title = title;
	this.imagePath = imagePath;
	this.images = new Array();
	
	this.show = ErrorMessageShow;
	this.hide = ErrorMessageHide;
	this.status = ErrorMessageStatus;
	this.loadImages = ErrorMessageLoadImages;

	this.loadImages();
}

function ErrorMessageHide() { ErrorAPIMessageHide(this.id); }
function ErrorMessageShow() { ErrorAPIMessageShow(this.id); }
function ErrorMessageStatus(flag) { ErrorAPIMessageStatus(this.id, flag); }

function ErrorMessageLoadImages() {
	// sometimes the images don't show up, this is an attempt to help them out by manually downloading them
	var images = new Array("close_up.gif", "close_down.gif", "warning.gif");
	
	for (var i=0; i<images.length; i++) {
		this.images[images[i]] = new Image();
		this.images[images[i]].src = this.imagePath+images[i];
	}
}
// end class encapsulation
