if(typeof ws == "undefined") var ws = new Object();
ws.outset = {};

// UTILS
ws.outset.utils = {};
ws.outset.utils.Address = function(){
	this.top = top;
	this._location = this.top.location;
	this._hash = top.location.search || top.location.hash;
}
ws.outset.utils.Address.prototype = {
	getQuaryParameter:function(param) {		
		if(this._hash){
			var startIndex = this._hash.indexOf(param +"=");
			var endIndex = (this._hash.indexOf("&", startIndex) > -1) ? this._hash.indexOf("&", startIndex) : this._hash.length;
			if (this._hash.length > 1 && startIndex > -1) {
				return this._hash.substring(this._hash.indexOf("=", startIndex)+1, endIndex);
			}
		}
		return "";
	},
	getPath:function() {
		if(this._hash.indexOf("#") < 0){
			return "";
		} else {			
			if(this._hash.charAt(this._hash.length-1) == "/"){
				return this._hash.slice(2, this._hash.length-1);
			} else {
				return this._hash.slice(2);
			}
		}
	},
	getPathAsArray:function() {	
		if(this._hash.indexOf("#") < 0){
			return "";
		} else {
			this._hash = this._hash.slice(1);
			arr = this._hash.split("/");
			temp = Array();
			for(i=0; i<arr.length; i++){
				if(arr[i] != ""){
					temp.push(arr[i]);
				}
			}
			return temp;
		}
	},
	setPath:function(path) {
		if(this._location) {
			top.location = path;
		}
	}
}

// MANAGERS
ws.outset.managers = {}
ws.outset.managers.ElementManager = function(elementId){
	this.elementId = elementId;
	this.element = document.getElementById(elementId);
}
ws.outset.managers.ElementManager.prototype = {
	write:function(text){
		this.element.innerHTML = text;
	}
}

// CLASSES
var Address = ws.outset.utils.Address
var ElementManager = ws.outset.managers.ElementManager
