/**
 * @alias gui
 * @author WilC <wilz04@gmail.com>
 * @since 2008
 */

var gui = {
	
	containers: {
/* ---------------------------------------------------------------- */
		Frame: function (url) {
			
			this.url = url;
			this.handler = null;
			this.target = "_blank";
			this.style = {
				width: 550,
				height: 400,
				resizable: 0,
				fullscreen: 0,
				titlebar: 0,
				location: 0,
				menubar: 0,
				statusbar: 0,
				toolbar: 0,
				scrollbars: 1,
				left: null,
				top: null
			};
			
			var style = {};
			
			var args = arguments[1];
			if (args) {
				style = args;
			}
			
			var key;
			for (key in style) {
				this.style[key] = style[key].toString();
			}
			
			if (this.style.left == null) {
				this.style.left = Math.round((screen.width - this.style.width)/2);
			}
			if (this.style.top == null) {
				this.style.top = Math.round((screen.height - this.style.height)/2);
			}
			
			this.show = function () {
				var args = new Array();
				var key;
				for (key in this.style) {
					args.push(key+"="+this.style[key].toString());
				}
				this.handler = window.open(this.url, this.target, args.join(", "));
			};
			
			this.close = function () {
				if (this.handler != null) {
					this.handler.close();
				}
			};
			
		},
/* ---------------------------------------------------------------- */
		OptionPane: {
			
			description: {
				0: "Exito!",
				1: "Por favor, rellene los campos marcados con *!"
			},
			
			showMessageDialog: function (index) {
				alert(gui.containers.OptionPane.description[index]);
				return false;
			},
			
			showConfirmDialog: function (index) {
				return confirm(gui.containers.OptionPane.description[index]);
			},
			
			showInputDialog: function (index) {
				var args = arguments[1];
				var value = "";
				if (args) {
					value = args.value ? args.value : value;
				}
				return prompt(gui.containers.OptionPane.description[index], value);
			}
			
		}
		
	},
/* ---------------------------------------------------------------- */
	controls: {},
	
	display: {}
	
};
