if(!window.$namespace)
	window.$namespace = function(ns,delimiter){
	    var d=delimiter||'.';var a = ns.split(d);var p = window;
	    for(var n=0;n<a.length;n++){
		    if(!p[a[n]]) p[a[n]] ={};
		    p=p[a[n]];
	    };
	    return p;
	};
$namespace('Twofour.Web');
/*
* Twofour.Web.ContentLoader: logic for downloading data over HTTP 
* class declaration
*/
Twofour.Web.ContentLoader = function(url, username, password){
        this.url = url;
	    this.username = username;
	    this.password = password;
	    this.method = 'GET';
    };
Twofour.Web.ContentLoader.prototype = {
    createXmlHttpRequest: function () {
        var xhr = null;
		if(window.XMLHttpRequest){
            xhr = new XMLHttpRequest(); 
        }
        else if(window.ActiveXObject){
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        };
        return xhr;
    },
    load: function(){
        var xhr = this.createXmlHttpRequest();
	    var inst = this;
        xhr.onreadystatechange=function(){
		    if(xhr.readyState==4){
                if(xhr.status==200){
                    if(inst.onComplete!=null){
						inst.onComplete(inst, {response:xhr.responseText, xmlhttp:xhr});
                    };
                }
			    else{
				    if(inst.onError!=null){
                        inst.onError(inst, {xmlhttp:xhr});
                    };
			    };
            };
        };
        xhr.open(this.method,this.url,true, this.username, this.password);
        xhr.send(this.xml);
    },
    onComplete: null,
    onError: null
};