var AjaxNameSpace = window.AjaxNameSpace || {};

/*
* The AjaxEvent class 
*
* @namespace AjaxNameSpace
* @class AjaxEvent
* @constructor
*/
AjaxNameSpace.AjaxEvent = function() {
return this;
}

AjaxNameSpace.AjaxEvent.prototype = {

/*
* Subscribes a function or method to the custom event.
*
* @method subscribe
* @param {Function} fn The function to execute
* @param {Object} oScope An object to be passed as scope for the function
*/
subscribe: function(fna, oScope) {
if (!this.oEvent) {
this.oEvent = new YAHOO.util.CustomEvent("ajaxevent", this, false, YAHOO.util.CustomEvent.FLAT);
}
if (oScope) {
this.oEvent.subscribe(fna, oScope, true);
} else {
this.oEvent.subscribe(fna);
}
},

/*
* Performs an asynchronous request using the YUI Connection manager
* and fires our custom event upon success.
*
* @method connect
* @param {String} sUri Fully qualified path of resource
*/
connect: function(sUri,targetDiv,method) {
if (!sUri && !this.sUri) {
return false;
} else {
this.sUri = (!sUri) ? this.sUri : sUri;

YAHOO.util.Connect.asyncRequest(method, this.sUri, {
success: function (o) {
document.getElementById(targetDiv).innerHTML = o.responseText;


},
scope: this
});
}
}

}