	function Timer(){
		this.obj = (arguments.length)?arguments[0]:window;
		return this;
	}
	Timer.prototype.setInterval = function(func, msec){
		var i = Timer.getNew();
		var t = Timer.buildCall(this.obj, i, arguments);
		Timer.set[i].timer = window.setInterval(t,msec);
		return i;
	}
	Timer.prototype.setTimeout = function(func, msec){
		var i = Timer.getNew();
		Timer.buildCall(this.obj, i, arguments);
		Timer.set[i].timer = window.setTimeout("Timer.callOnce("+i+");",msec);
		return i;
	}
	
	Timer.prototype.clearInterval = function(i){
		if(!Timer.set[i]) return;
		window.clearInterval(Timer.set[i].timer);
		Timer.set[i] = null;
	}
	Timer.prototype.clearTimeout = function(i){
		if(!Timer.set[i]) return;
		window.clearTimeout(Timer.set[i].timer);
		Timer.set[i] = null;
	}
	
	Timer.set = new Array();
	Timer.buildCall = function(obj, i, args){
		var t = "";
		Timer.set[i] = new Array();
		if(obj != window){
			Timer.set[i].obj = obj;
			t = "Timer.set["+i+"].obj.";
		}
		t += args[0]+"(";
		if(args.length > 2){
			Timer.set[i][0] = args[2];
			t += "Timer.set["+i+"][0]";
			for(var j=1; (j+2)<args.length; j++){
				Timer.set[i][j] = args[j+2];
				t += ", Timer.set["+i+"]["+j+"]";
			}
		}
		t += ");";
		Timer.set[i].call = t;
		return t;
	}
	Timer.callOnce = function(i){
		if(!Timer.set[i]) return;
		eval(Timer.set[i].call);
		Timer.set[i] = null;
	}
	Timer.getNew = function(){
		var i = 0;
		while(Timer.set[i]) i++;
		return i;
	}
  
		function addEvent(obj, evType, fn){
			 if (obj.addEventListener){
				 obj.addEventListener(evType, fn, true);
				 return true;
			 } else if (obj.attachEvent){
				 var r = obj.attachEvent("on"+evType, fn);
				return r;
			 } else {
				return false;
			 }
		}
    
		function PageLocator(propertyToUse, dividingCharacter) {
			this.propertyToUse = propertyToUse;
			this.dividingCharacter = dividingCharacter;
		}
		PageLocator.prototype.getLocation = function() {
			return eval(this.propertyToUse);
		}
		PageLocator.prototype.getHash = function() {
			var url = this.getLocation();
			if(url.indexOf(this.dividingCharacter)>-1) {
				var url_elements = url.split(this.dividingCharacter);
				return url_elements[url_elements.length-1];
			} else {
				return '';
			}
		}
		PageLocator.prototype.getHref = function() {
			var url = this.getLocation();
			var url_elements = url.split(this.dividingCharacter)
			return url_elements[0];
		}
		PageLocator.prototype.makeNewLocation = function(new_qs) {
			return this.getHref() + this.dividingCharacter + new_qs;
		}
 
		function AjaxUrlFixer() {			
			this.locator = new PageLocator("window.location.href", "#");
			this.timer = new Timer(this);
			this.checkWhetherChanged(0);
		}
		AjaxUrlFixer.prototype.checkWhetherChanged = function(location){
			if(this.locator.getHash() != location) {
				getUrl(this.locator.getHash());
			}
			this.timer.setTimeout("checkWhetherChanged", 100, this.locator.getHash());
		}
	
	function setContent(new_content) {
		if(!document.getElementById || !document.getElementsByTagName) return;
		var container = document.getElementById("pageContent");
		container.innerHTML = new_content;
	}
	function FixBackAndBookmarking() {
		if(!document.getElementById || !document.getElementsByTagName) return;
			fix = new AjaxUrlFixer();
	}
	
	addEvent(window, "load", FixBackAndBookmarking);
