YAHOO.namespace('EXT');

YAHOO.EXT.LoadingPanel = function(msg, icon, id) {
                
    YAHOO.EXT.LoadingPanel.superclass.constructor.call(this, 
        id || YAHOO.util.Dom.generateId() , 
        {
            width: "300px", 
            fixedcenter: true, 
            constraintoviewport: true, 
            underlay: "shadow", 
            close: false, 
            visible: false, 
            draggable: false
        }
    );

    this.setHeader(msg);
    this.setBody('<img src="' + icon + '" />');
    YAHOO.util.Dom.setStyle(this.header, 'fontSize', '150%');
    YAHOO.util.Dom.setStyle(this.header, 'padding-top !important', '0px');
    YAHOO.util.Dom.setStyle(this.body, 'textAlign', 'left');
    this.render(document.body);
    
};

YAHOO.lang.extend(YAHOO.EXT.LoadingPanel, YAHOO.widget.Panel);
YAHOO.register('EXT.LoadingPanel', YAHOO.EXT.LoadingPanel, {version: "1", build: '1'});

YAHOO.EXT.MessageBox = function(header, msg, icon, id, boxWidth, pos) {
     
    if(typeof pos == "undefined" || pos == null || pos == ''){   
	    YAHOO.EXT.MessageBox.superclass.constructor.call(this, 
	        id || YAHOO.util.Dom.generateId() , 
	        {
	            width: boxWidth, 
				fixedcenter: true, 
				constraintoviewport: true, 
				close: false, 
				visible:true, 
				draggable:false,
				modal:false,
				underlay: "none" 
			}
	    );
    }
    else{

        pos[0] -= 215;
        pos[1] -= 8;

	    YAHOO.EXT.MessageBox.superclass.constructor.call(this, 
	        id || YAHOO.util.Dom.generateId() , 
	        {
	            width:"450px", 
				xy: pos, 
				constraintoviewport: false, 
				close: false, 
				visible:true, 
				draggable:false,
				modal:false,
				underlay: "none" 
			}
	    );    
    }
    
    this.setHeader(header);
    if(typeof icon !="undefined" && icon!=""){
        this.setBody('<img src="' + icon + '" />' + ' <span style="position:relative; bottom: 10px">' + msg + '</span>');
    }
    else{
        this.setBody(msg);    
    }
    this.setFooter("");   
    this.render(document.body);  

/*    YAHOO.util.Dom.setStyle(this.header, 'fontSize', '170%');
    YAHOO.util.Dom.setStyle(this.header, 'fontWeight', 'bold');
    YAHOO.util.Dom.setStyle(this.header, 'color', '#71A728');
    YAHOO.util.Dom.setStyle(this.body, 'textAlign', 'left');
    YAHOO.util.Dom.setStyle(this.body, 'fontSize', '140%');
    YAHOO.util.Dom.setStyle(this.body, 'color', '#474747'); */

//    YAHOO.util.Dom.setStyle(this.body, 'zIndex', '1000');

    this.render(document.body);
    
};

YAHOO.lang.extend(YAHOO.EXT.MessageBox, YAHOO.widget.Panel);
YAHOO.register('EXT.MessageBox', YAHOO.EXT.MessageBox, {version: "1", build: '1'});

/* Example usage */
/*
if(typeof loadingPanel2=="undefined") {
    loadingPanel2 = new YAHOO.EXT.LoadingPanel(msg, icon, id);
}
loadingPanel2.show();
return loadingPanel2; 
*/

