document.observe('dom:loaded',function(){
	var modal1 = window_factory($('picModal'));
});
var window_factory = function(container,options){
	var titleTxt = '左のＸをクリックすると画像が閉じます。（X以外をドラッグすると移動します）';
    var window_close = new Element('div',{
        className: 'window_close'
    });
		var window_wrapp = new Element('div',{
        className: 'window_wrapp'
    });
	
    var window_header = new Element('div',{
        className: 'window_header'
    });
    var window_title = new Element('div',{
        className: 'window_title'
    });
    var window_contents = new Element('div',{
        className: 'window_contents'
    });
    var w = new Control.Window(container,Object.extend({
        className: 'window',
        closeOnClick: window_close,
        draggable: 'window',
        insertRemoteContentAt: window_contents,
        afterOpen: function(){
            window_title.update(titleTxt)
        }
    },options || {}));
    w.container.insert(window_close);
    w.container.insert(window_wrapp);
			window_wrapp.insert(window_header);
				window_header.insert(window_title);
			window_wrapp.insert(window_contents);
    return w;
};
