/**include
//_javascript/load-wrapper.js;
*/

/**
 * Modal window control
 *
 */
var modalWindow = newObject({
	mWin       : null,
	voile      : null,
	mContent   : null,
	mLoad      : null,
	bigImg     : null,
	
	id_click   : null,
    close      : null,
    loader     : null,
    timer      : null,
	
	init : function () {
	},
	
	onready : function () {
		this.id_click = this.$("a#click_id");
		if(this.id_click){
			this.id_click.addListener(this, "onclick");	
		}
        this.mWin     = this.$("#modal_window");
        this.voile    = this.$("#modal_window #voile");
        this.mContent = this.$("#modal_window #modal_content");
        this.mContent.addListener(this, "onclick", "click_stop");
        this.$w0.addListener(this, "onclick", "click_close");
        
        this.mLoad    = this.$("#modal_window #modal_load");
        this.bigImg   = this.$("#modal_window #bigImg").getChildren()[0];
        
        this.close = this.$("#modal_window a#close");
        this.close.addListener(this, "onclick", "click_close");
	},
	
	onclick : function(evtWr, dt)
    {
        evtWr.eventDrop();
        evtWr.stopBubbling();
        evtWr.elmWr.elm.blur();
        
        this.voile.style.width = this.$w0.getDocumentWidth() + "px";
        this.voile.style.height = this.$w0.getDocumentHeight() + "px";
        this.mWin.show();
    },
    
    click_stop : function(evtWr, dt)
    {
        evtWr.eventDrop();
        evtWr.stopBubbling();
    },
    
    click_close : function(evtWr, dt)
    {
    	if(evtWr.elmW){    	
	        evtWr.eventDrop();
	        evtWr.elmW.elm.blur();
    	}
        this.mWin.hide();
    }
});