var History = {

	history_cur : -1,

	historyChange : function(newLocation, historyData) {
		History.checkChange();
	},

	checkChange : function(){
		var str = "" + document.location;
		var hashIndex = str.indexOf("#");
		var ourarg = 1;
		if (hashIndex != -1){
			var hashString = str.substring(hashIndex + 5);
			var hashInt = parseInt(hashString);
			if (hashString == "" || hashInt == -1){
				hashInt = 1;
			}
			ourarg = hashInt;
		}
	},

	history_change : function(){
		var str = "" + document.location;
		var hashIndex = str.indexOf("#");
		var ourarg = 1;
		if (hashIndex != -1){
			var hashString = str.substring(hashIndex + 5);
			ourarg = hashString;
		}
		if (ourarg != History.history_cur){
			History.history_cur = ourarg;
			if (ourarg == "login"){
				sakai.Index.logInOnTop2();
			} else {
				sakai.Index.cancelLogInOnTop2();
			}
		}
		setTimeout("History.history_change()",100);
	}, 

	addBEvent: function(id){

		var a = new Array();
		a[0] = "evnt" + id;
		a[1] = "evnt" + id;
		dhtmlHistory.add(a[0],a[1]);

	}

}

window.dhtmlHistory.create({debugMode: false});

var temponload = window.onload;

window.onload = function() {
    temponload();
	dhtmlHistory.initialize();
	dhtmlHistory.addListener(History.historyChange);
	History.history_change();
};
