//*********************************************************************

//	FacesMusic Class

//*********************************************************************

// Set up the Namespace for the Application
YAHOO.namespace("cb");

// Create the Application Class
YAHOO.cb.FacesMusic = function(inOverlayManager) {
	this.content_simpledialog = null;
	this.overlayManager = inOverlayManager;
	this.init();
};

YAHOO.cb.FacesMusic.prototype.content_simpledialog = null;


//*********************************************************************

//	Init

//*********************************************************************
YAHOO.cb.FacesMusic.prototype.init = function() { 
	if ( this.content_simpledialog == null ) {
		
		this.content_simpledialog = new YAHOO.widget.SimpleDialog(
	        "FacesMusic",
	        { 
	            constraintoviewport: true,
	            fixedcenter:false,
	            width:"158px",
	            x:10,
	            y:50,
				effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.25},
				modal:false,
				visible:false
	        }
	    );

		this.content_simpledialog.setHeader("");
		this.content_simpledialog.setBody("");
		// this.content_simpledialog.setFooter("");
		this.content_simpledialog.render(document.body);
		
		if ( this.overlayManager != null ) {
			this.overlayManager.register([this.content_simpledialog]); 
		}
	}
	this.content_simpledialog.beforeHideEvent.subscribe(this.closeDialog, this, true);
}

YAHOO.cb.FacesMusic.prototype.loadContent = function(inURL){ 
	// ::TODO:: if its already up don't reload!
	this.content_simpledialog.setHeader("Loading ....");
	this.content_simpledialog.setBody("");
	this.content_simpledialog.show();

	// Load Content
	var transaction = YAHOO.util.Connect.asyncRequest('GET', inURL, this, null);
}

YAHOO.cb.FacesMusic.prototype.closeDialog = function() { 
	this.content_simpledialog.setBody('');
}

// ::TODO:: Make this an Obj so I can have more asyncRequests 
YAHOO.cb.FacesMusic.prototype.success = function(obj){ 
	this.content_simpledialog.setHeader("Faces.com");
	this.content_simpledialog.setBody( obj.responseText );
	// this.content_simpledialog.setFooter("");
	this.content_simpledialog.show();
}
YAHOO.cb.FacesMusic.prototype.failure = function(obj){ 
	this.content_simpledialog.setHeader("Error");
	this.content_simpledialog.setBody( "" );
	// this.content_simpledialog.setFooter( "" );
	this.content_simpledialog.show();
}

