var mocha_win = new Class({
	Implements: Options,

	options: {
		id: 'dialog',
		y: null,
		width: 500,
		height: 500,
		headerStartColor: [0,0,102],
		headerStopColor: [0,0,255],
		type: 'window',
		scrollbars: 1,
		cornerRadius: 4,
		title: 'title',
		loadMethod: 'iframe',
		contentURL: null,
		content: null,
		maximizable: true,
		minimizable: true,
		resizable: false,
		draggable: true,
		resizableColor: [255,0,0]
	},

	initialize: function(options){
		this.setOptions(options);
		this.options.id = 'win_' + this.options.id;

		//if( $chk($(this.options.id)) ) alert( $(this.options.id) );

		if( typeof(this.options.headerStartColor) == 'string' )
		{
			this.options.headerStartColor = [this.options.headerStartColor.substring(1,2), this.options.headerStartColor.substring(3,4), this.options.headerStartColor.substring(5,6)].hexToRgb(true);
		}
		if( typeof(this.options.headerStopColor) == 'string' )
		{
			this.options.headerStopColor = [this.options.headerStopColor.substring(1,2), this.options.headerStopColor.substring(3,4), this.options.headerStopColor.substring(5,6)].hexToRgb(true);
		}

		switch( this.options.loadMethod )
		{
			case 'html':
			break;

			case 'iframe':
				this.options.contentURL = path + this.options.contentURL;
				this.options.onContentLoaded = function(){
													if( this.options.scrollbars == 0 )
													{
														$(this.options.id + '_iframe').scrolling = 'no';
													}
												};
			break;
		}
	},

	open: function(){
		set_viewport();
		if( this.options.width == 'max' ) this.options.width = max_dialog_width;
		if( this.options.height == 'max' ) this.options.height = max_dialog_height;
		if( this.options.width > document.x ) this.options.width = document.x - 50;
		if( this.options.height > document.y - 50 ) this.options.height = document.y - 100;

		this.options.y = $(document.body).getScroll().y + parseInt((document.y - this.options.height) / 2) - 20;

		this.win = new MochaUI.Window(this.options)
	},

	close: function(){
		MochaUI.closeWindow($(this.options.id));
	},

	set_title: function(title){
		MochaUI.setTitle($(this.options.id), title);
	}
});
