
function showOKDialog(text,title) {
	if (arguments.length >= 3){
		myWidth= arguments[2];
	} else {
		myWidth= "20em";
	}
	var handleOK = function(e) {
		this.hide();
	}
	dlg = new YAHOO.widget.SimpleDialog("dlg", 
		{width: myWidth,  effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25}, 
			fixedcenter:true, modal:true, draggable:false,constraintoviewport: true, 
			buttons : [ { text:txt_Close, handler:handleOK, isDefault:true }]
		 });
	dlg.setHeader(title);
	dlg.setBody(text);
	dlg.render(document.body); 
	dlg.show();
	return dlg;
}

var progress;

function showProgress(afunction) {	
		showProgressReal();
		if (afunction != undefined) {
			window.setTimeout(afunction, 50);
		}
}

function showProgressReal() {
	
	progress =    
	         new YAHOO.widget.Panel("wait",     
	             { width:"260px",    
	               fixedcenter:true,    
	              close:false,    
	              draggable:false,    
	               zindex:4,   
	               modal:true,   
	               visible:false  
	             }    
	         );   	   
	 progress.setHeader(loadingtextTitle);   
	 progress.setBody('<center><img src="/images/rel_interstitial_loading.gif" /></center>');   
	 progress.render(document.body);   
	 progress.show();
}



function hideProgress() {
	try {
		progress.hide();
	} catch (e) {}
}

   function Pause(duration, busy){
      this.duration= duration ;
      this.busywork = null; // function to call while waiting.
      this.runner = 0;

      if (arguments.length == 2) {
         this.busywork = busy;
      }

      this.pause(this.duration);

   } // Pause class

   /** pause method 
   
       @param duration: integer in seconds
       
    */
   Pause.prototype.pause = function(duration){
      if ( (duration == null) || (duration < 0)) {return;}

      var later = (new Date()).getTime() + duration;

      while(true){
         if ((new Date()).getTime() > later) {
            break;
         }

         this.runner++;

         if (this.busywork != null) {
            this.busywork(this.runner);
         }

      } // while

   } // pause method