if( typeof( AdmeaDossier ) == 'undefined' ) AdmeaDossier = {};

AdmeaDossier.Repro = function()
{
	// Private variables
	var _popup = null;
	var _reproFrame = null;
	var _docurl = 'XelynWebFiles/Templates/Repro/Orderlist.aspx';

	// Public
	return {

		init : function()
		{
		},
		
		
		popupRepro : function()
		{
			if( !AdmeaDossier.Session.isAuthorized() )
				return;

			// showPopUp(_docurl);

			if( !_popup )
			{
				// _reproFrame = new Ext.ux.ManagedIFrame({
				_reproFrame = new Ext.ux.ManagedIframePanel({
					id: 'ReproFrame',
					// title: 'Repro',
					defaultSrc : 'XelynWebFiles/Templates/Repro/Orderlist.aspx',
					// autoCreate:{src:_docurl},
					loadMask: true,
					disableMessaging : false,
				    listeners  : { //only subscribe to 'repro' tagged messages 
						'message:repro' : function(srcFrame, message)
						{
							if( message == 'PrettyPleaseClose' )
								AdmeaDossier.Repro.Hide();
						}
					}
				});
				
	    		_popup = new Ext.Window( {
	    			id: 'ReproWindow',
	    			visible: true,
	    			// contentEl: 'adminpanel',
	    			title: AdmeaDossier.Locale.ReproWindowTitle,
	    			width: 700,
	    			height: 300,
	    			modal: false,
	    			// closeAction: 'hide',
	    			closeAction: 'close',
	    			resizable: true,
	    			// autoHeight: true,
	    			layout: 'fit',
	    			listeners: {
	    				'close': function( panel )
	    				{
	    					_popup = null;
	    				}
	    			},
	    			items: [ _reproFrame ]
	    			/*
	    			{
 						xtype: 'panel', 
						id: 'iFrameContainer', 
						defaultType: 'iframepanel',
						// activeItem : 'iFrameContent',
						autoScroll: false, 
						layout: 'fit',
						items: [
						]
					}
					*/
				} );
    		}

    		_popup.show( 'toolBtnRepro' );

			// _reproFrame.setSrc( _docurl );
    		
    		// this.getDocument( ( docid ? docid : '' ) );
		},
		
		Hide : function ()
		{
			if( _popup ) _popup.close( 'toolBtnRepro' );
		},
		
		Refresh : function()
		{
			
		}
		
	};
}();

// Global methods


