WIDGET = function(){

    return{
    
    
       wait : function(msg){

           try{

				var panel = new YAHOO.widget.Panel("wait",  
							{ width: "330px",
							  fixedcenter:true, 
							  close:false, 
							  draggable:false, 
							  zindex:4,
							  modal:false,
							  visible:false
							} 
						);
				
				if(typeof msg=="undefined"){
				   msg = "Processing, please wait...";
				}
				panel.setHeader("<span>" + msg + "</span>");
				panel.setBody('<div class="fs_loader_bar"></div>');
				panel.render(document.body);
				
				return panel;
				
           
           }
           catch(err){
               alert(err + " wait() widget.js");
           }
       
       },   
     
       dialog : function(dialogId, frmContent, buttons, submitUrl, submitSuccess, submitFailure, isModal){
           try{
           
                if(typeof isModal == "undefined"){
                   isModal=false;
                }

                var dialog = new YAHOO.widget.Dialog(dialogId, {width:"400px",
                												fixedcenter:true,
                												postmethod: "async",
                												close:false,
                												effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.15},
                												modal:isModal}); 
                dialog.setBody("");

                dialog.cfg.queueProperty("buttons", buttons); 
                dialog.callback.success = submitSuccess;
                dialog.callback.failure = submitFailure;
                dialog.render(document.body);   
                dialog.show();     
                var frm = dialog.form;
                frm.setAttribute("method", "POST");
                frm.setAttribute("id", "frm_dialog");
                frm.setAttribute("action", submitUrl);
                frm.appendChild(frmContent);
                
                            
           }
           catch(err){
              alert(err + " container() panel.js");
           }       
       },    
 
       panel : function(){
           try{
              var panel = new YAHOO.widget.Panel("win", {
														width:"400px", 
														fixedcenter: true, 
														constraintoviewport: true, 
														close:false, 
														visible:true, 
														draggable:false,
														modal:true} );
              panel.setHeader("This is my header content");
              panel.setBody("This is my body content");
              panel.setFooter("This is my footer content");   
              panel.render(document.body);             

           }
           catch(err){
              alert(err + " container() panel.js");
           }       
       },
          
       overlay : function(){
           try{
              var overlay = new YAHOO.widget.Overlay("overlay", { fixedcenter:true, 
	                                                              visible:true, 
	                                                              width:"300px" } );
              overlay.setHeader("This is my header content");
              overlay.setBody("This is my body content");
              overlay.setFooter("This is my footer content");   
              overlay.render(document.body);             

           }
           catch(err){
              alert(err + " container() overlay.js");
           }       
       },
       
       module : function(){
           try{
              var module = new YAHOO.widget.Module("module"); 
              module.setHeader("This is my header content");
              module.setBody("This is my body content");
              module.setFooter("This is my footer content");   
              module.cfg.queueProperty("visible", true);
              module.render(document.body);             
           }
           catch(err){
              alert(err + " container() widget.js");
           }
       },
    
       processBox : function(msg, icon, id){
           try{
	           
	           var url= ENV.getURL();
	           if(url==null){
	               url="";
	           }
	           
	           if(typeof icon=="undefined"){
	               icon = url + "images/processbar.gif";
	           }

	           var box = document.createElement("DIV");
	           box.appendChild(document.createTextNode(msg));
	           
	           YAHOO.util.Dom.setStyle(box, "border", "#333333 solid 1px");
	           YAHOO.util.Dom.setStyle(box, "background", "url(" + icon + ") #f7f7f7 no-repeat 10px 33px");
	           YAHOO.util.Dom.setStyle(box, "font-size", "100%");
	           YAHOO.util.Dom.setStyle(box, "font-weight", "bold");
	           YAHOO.util.Dom.setStyle(box, "width", "150px");
	           YAHOO.util.Dom.setStyle(box, "height", "30px");  
	           YAHOO.util.Dom.setStyle(box, "padding", "10px 0px 22px 10px");  
	           YAHOO.util.Dom.setStyle(box, "margin-bottom", "10px");                     
	                      
	           YAHOO.util.Dom.setStyle(box, "position", "absolute");
	           YAHOO.util.Dom.setStyle(box, "display", "block");
	           YAHOO.util.Dom.setStyle(box, "zIndex", "999");
	           	           
	           window.document.body.appendChild(box);
	           DOM.centerEl(box);
		  return box; 

		   }
		   catch(err){
		       alert(err + ' processBox');
		   }  
       
       },
       
       alertBox : function(msg, icon, header, id, pos){
           
           try{
           
	           if(typeof icon=="undefined"){
	               icon = "";
	           }
	           
	           if(typeof header=="undefined"){
	               header = "";
	           }	           
	           
                   alertBox2 = new YAHOO.EXT.MessageBox(header, msg, icon, 'alert', pos);

               alertBox2.show();
			  ANIM.fadeout(document.getElementById('alert'), 400, 2, true);            
		   }
		   catch(err){
		       alert(err + ' alertBox');
		   }          
       
       },
       
       messagebox : function(msgboxId, msg, icon, header, secs, width){
           try{
           
	           if(typeof icon=="undefined"){
	               icon = "";
	           }
	           
	           if(typeof header=="undefined"){
	               header = "";
	           }	           
	           
                   alertBox2 = new YAHOO.EXT.MessageBox(header, msg, icon, msgboxId);

                   alertBox2.show();
		   
		   if(secs>0){
	                   ANIM.fadeout(document.getElementById(msgboxId).parentNode, secs, 2, true);                 
		   }

          }
          catch(err){
		   alert(err + ' messagebox');
	  }          
       
       },
       
       blanketPage : function(){

	 try{
				   var blanket = document.createElement("DIV");
				   blanket.style.backgroundColor = "#000000";
				   blanket.style.width = YAHOO.util.Dom.getDocumentWidth() + "px";   
				   blanket.style.height = ((YAHOO.util.Dom.getDocumentHeight() - js_get_scrollTop())*2)/1.5 + "px";  
				
				   blanket.style.zIndex = "999";
				   moveToY(blanket,0);
				   moveToX(blanket,0);
				
				   YAHOO.util.Dom.setStyle(blanket, "opacity", 0.8);
				   document.body.appendChild(blanket);
			return blanket;

	}
	catch(err){
		alert(err + ' messagebox');
	}


       },

       
       modalWindow : function(divEl, blanketId){
		   
		   try{
			   
			  if(typeof blanketId!="undefined"){
				   var blanket = document.createElement("DIV");
				   blanket.style.backgroundColor = "#000000";
				   blanket.style.width = YAHOO.util.Dom.getDocumentWidth() + "px";   
				   blanket.style.height = ((YAHOO.util.Dom.getDocumentHeight() - js_get_scrollTop())*2) + "px";  
				
				   blanket.style.zIndex = "999";
				   blanket.setAttribute("id", blanketId);
				   moveToY(blanket,0);
				   moveToX(blanket,0);
				
				   YAHOO.util.Dom.setStyle(blanket, "opacity", 0.3);
				   document.body.appendChild(blanket);
				   	   
			   }
			   
			   divEl.style.display = "inline";
			   var winX = (YAHOO.util.Dom.getViewportWidth()/2) - (js_get_elementWidth(divEl)/2) + YAHOO.util.Dom.getDocumentScrollLeft();
			   var winY = ((YAHOO.util.Dom.getViewportHeight()/2) - (js_get_elementHeight(divEl)/2)) + YAHOO.util.Dom.getDocumentScrollTop() ;   
			
			   divEl.style.top = winY + "px";
			   divEl.style.left = winX + "px";
			   
			   divEl.style.zIndex = "1000";
			   
			   YAHOO.util.Dom.setStyle(divEl, "opacity", 0);
			   ANIM.fadein(divEl, 5);
		   }
		   catch(err){
		       alert(err + ' modalWindow');
		   }
		   
		}

    };

}();

