/**
* Constructor for URLManager
*
* @param	_location	Type Object - The Window's location object.
*/
function URLManager(_location){
    // _location
    this.location = _location;
    // queryString is private
    var queryString = new Object();
    // use the get/set methods to make sure this is case insensitive
    this.setQueryStringValue = function(name, value){
        queryString[name.toLowerCase()] = value;
    }
    this.getQueryStringValue = function(key){
        return queryString[key.toLowerCase()];
    }
}

/**
* takes the location.search string and parses it to a query string
* name/value pair array
*/
URLManager.prototype.parseQueryString = function(){
    if(trim(this.location.search.substr(1)) == ""){
        return 0;
    }
    var ary=this.location.search.substr(1).split("&");
    for (var m=0;m<ary.length;m++) {
        ary[m]=ary[m].split("=");
    }
    for (var i=0;i<ary.length;i++) {
        ary[i][0]=ary[i][0].replace(/\+/g," ");
        ary[i][0]=unescape(ary[i][0]);
        ary[i][1]=ary[i][1].replace(/\+/g," ");
        ary[i][1]=unescape(ary[i][1]);
        this.setQueryStringValue(ary[i][0],ary[i][1]);
        //this.queryString[ary[i][0].toLowerCase()]=ary[i][1];
    }
    return ary.length;
}
URLManager.prototype.getHash = function(){
    return this.location.hash.substr(1);
}
URLManager.prototype.getHostname = function(){
    return this.location.hostname;
}
URLManager.prototype.getFullURL = function(){
    return this.location.href;
}
URLManager.prototype.getSelf = function(){
   return this.getProtocol()+"//"+this.getHostname()+this.getPathname();
}
URLManager.prototype.getProtocol = function(){
    return this.location.protocol;
}
URLManager.prototype.getPathname = function(){
    return this.location.pathname;
}
