// JScript File


function xPopUp() 
	{
		YAHOO.namespace("RRRM.Panel");		
		var x = YAHOO.RRRM.Panel.xPopUp;
		if (x == null) 
		{ 
	  	YAHOO.RRRM.Panel.xPopUp = 
			new YAHOO.widget.Panel("xPopUp", 
				{										 
					visible:false,					 
					close:true, 
					fixedcenter:true,					
					constraintoviewport:true
					//effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.5} 				
				} 
			);		
			var x = YAHOO.RRRM.Panel.xPopUp;
			x.setHeader('<span id="xPopUp_Header">&nbsp;</span>');
			x.setBody('<iframe id="xPopUp_Iframe" src="loading.html" scrolling="true" frameborder="0" ></iframe>');
			x.setFooter('<span id="xPopUp_Footer">&nbsp;</span>')		
			x.render(document.body);		
		}	
		this.hide = function () {
		  YAHOO.RRRM.Panel.xPopUp.hide();		 
		}	
		this.ShowUrl = function (str_url,_width,_height,isModal,fixedToCenter,onHide) 
		{
			$('xPopUp_Iframe').src = YAHOO.RRRM.Util.GetNoCacheUrl(str_url);
			$('xPopUp_Iframe').style.width = (_width - 5) + "px";
			$('xPopUp_Iframe').style.height = _height + "px";
			
			var x = YAHOO.RRRM.Panel.xPopUp;
						
			x.cfg.setProperty("width", _width + "px");
			x.cfg.setProperty("height", _height + "px");
			x.cfg.setProperty("modal",isModal);
			x.cfg.setProperty("fixedcenter",fixedToCenter);
			
			x.hideEvent.subscribe(function () {
			   try { $('xPopUp_Iframe').src = 'loading.html';  }
		     catch(e) { }
			});
			
			if (typeof(onHide) == 'function') {								
				x.hideEvent.unsubscribe(onHide);	
				x.hideEvent.subscribe(onHide);	
			}
			x.show();				
		};						 													
	}
	
	 function xPanel(strDivContainerId,_width,_height,isModal,fixedToCenter) {
      //YAHOO.namespace("YAHOO.RRRM.panels");      
       
      var x = new YAHOO.widget.Panel(strDivContainerId, { visible:false, close:false, constraintoviewport:true, modal:xIsNull(isModal,false)} );            					
    
			if (xDef(_width)) x.cfg.setProperty("width", _width + "px");
			if (xDef(_height)) x.cfg.setProperty("height", _height + "px");
			//if (xDef(isModal))  { x.cfg.setProperty("modal",isModal);}
			if (xDef(fixedToCenter)) x.cfg.setProperty("fixedcenter",fixedToCenter);
                     					
      $(strDivContainerId).style.display = 'none'; 
      x.render(); 
      x.innerElement.innerHTML += String.format("<div id='xClose_{0}' class='container-close'>&nbsp</div><div>&nbsp;</div>",strDivContainerId);
      
      x.close = $('xClose_' + strDivContainerId);
      if (x.close) {
        $ale(x.close,'click',_doHide,true);
      }
      
                       
      this.doShow = function () {
        $(strDivContainerId).style.display = 'block';                    					                                
        x.show();        
      };
      this.doHide = function () {
        _doHide();
      }
      function _doHide () {
        $(strDivContainerId).style.display = 'none';                 					
        x.hide();
      }
          
   }
  
	function $alert(str_msg, str_title, isModal) 
	{
		YAHOO.namespace("RRRM.Util");
		if (!YAHOO.RRRM.Util.xAlert) {
			YAHOO.RRRM.Util.xAlert = new YAHOO.widget.SimpleDialog('_xAlert_',
																							{  width: "300px",
																							   fixedcenter: true,
																							   visible: false,
																							   draggable: false,
																							   close: true,																							  
																								 icon: YAHOO.widget.SimpleDialog.ICON_ALARM ,
																							   constraintoviewport: true,
																							   buttons: [ { text:"Ok", handler:function () {	this.hide(); }, isDefault:true }  ]
																							} );

			YAHOO.RRRM.Util.xAlert.setHeader("<span id= '_xAlert_title'></span>");
			YAHOO.RRRM.Util.xAlert.setBody("<p id='_xAlert_Message'></p>");
			YAHOO.RRRM.Util.xAlert.render(document.body);
		}
		
		try {		
			$('_xAlert_Message').innerHTML = xIsNull(str_msg,'');
			$('_xAlert_title').innerHTML = xIsNull(str_title,'');
			
			YAHOO.RRRM.Util.xAlert.cfg.setProperty("modal",xIsNull(isModal,false));
			YAHOO.RRRM.Util.xAlert.cfg.applyConfig();
			YAHOO.RRRM.Util.xAlert.show();
		}
		catch(e) {
			alert(e);
		}				

		
	}
	
	function $ShowPanel(str_msg, str_title) 
	{
		YAHOO.namespace("RRRM.Util");
		if (!YAHOO.RRRM.Util.xMessage) {
			YAHOO.RRRM.Util.xMessage = new YAHOO.widget.Panel("xMessage",  
															{ width:"240px", 
															  fixedcenter:true, 
															  close:false, 
															  draggable:false, 
															  modal:true,
															  visible:false,
															  effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.5} 
															} 
														);

			YAHOO.RRRM.Util.xMessage.setHeader("<span id= '_xxx_title'></span>");
			YAHOO.RRRM.Util.xMessage.setBody("<img src=\"http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif\"/><br /><p id='_xxx_Message'></p>");
			YAHOO.RRRM.Util.xMessage.render(document.body);
		}
		
		try {		
			$('_xxx_Message').innerHTML = xIsNull(str_msg,'');
			$('_xxx_title').innerHTML = xIsNull(str_title,'Loading... Please Wait');
			
			YAHOO.RRRM.Util.xMessage.show();
		}
		catch(e) {
			alert(e);
		}				
		
	}
	
	function $HidePanel(str_msg) 
	{
		YAHOO.namespace("RRRM.Util");
		if (YAHOO.RRRM.Util.xMessage) YAHOO.RRRM.Util.xMessage.hide();
	}
	
	YAHOO.RRRM.Util.xpp = null;
	YAHOO.util.Event.onDOMReady(function () { YAHOO.RRRM.Util.xpp = new xPopUp() });
