var Dialog = {};
Dialog.current = null;
Dialog.hide = function()
{
    Control.Modal.current.close();
}

Dialog.createStandardWindow = function(container, options, content)
{
    var window_header = new Element('div', {
        className :'window_header'
    });
    var window_title = new Element('div', {
        className :'window_title'
    });
    var window_close = new Element('div', {
        className :'window_close'
    });
    var window_contents = new Element('div', {
        className :'window_contents'
    });
    var window_actionBar = new Element('div', {
        className :'window_actionBar'
    });
    options['iframe'] = false;
    var w = new Control.Modal(container, Object.extend( {
        className :'window',
        closeOnClick : window_close,
        fade :true,
        fadeDuration :0.25,
        iframe :false,
        indicator :false,
        overlayOpacity :0.35,
        position :'relative',
        resizeable :true,
        unique: false,
        width :350,
        offsetLeft:50,
        offsetTop:10,
        afterOpen : function()
        {
    		var auto = this.container.down('.autofocus');
			if(auto) auto.focus();
            this.ensureInBounds();
        },
        afterClose : function()
        {
        }
        }, options || {}
    ));
    w.href = false;
    window_title.update(container.readAttribute('title'));
    w.container.update(window_header);
    window_header.update(window_title);
    window_header.insert(window_close);
    w.container.insert(window_contents);
    if (content)
    {
    	if(w.unique){
    		window_contents.update(content.replace(''));
    	}else{
    		window_contents.update(content);
    	}
    }
    w.container.insert(window_actionBar);
    Dialog.current = w;    
    return w;
}
