/**
 * @author jk
 */

isIE = document.all;
var init;
function inithistorial(){
	init=true;
	setTimeout("chkhistorial()",500);
	//this.paginasvisitadas=new Array();
	if(window.location.hash.match('#')){
		var inicial=window.location.hash.split("#");
		paginainicial=inicial[inicial.length-1];
		//this.addtohistory(inicial[inicial.length-1]);
	}
	if(isIE){
	
	if (!window.parent.document.getElementById("ifriesux")) {
		var ifriesux = document.createElement("iframe");
		ifriesux.id="ifriesux";
		ifriesux.style.display="none";
		ifriesux.src=window.location;
		document.body.appendChild(ifriesux);
	}else{
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		try {
			window.parent.location.hash = sPage;
		} 
		catch (e) {
		}
	}
	}
}


var paginaanterior;
var paginainicial;

/*Akhistory.prototype.addtohistory=function(pagina){
	var encontrado=false;
	for (var i = 0; i < this.paginasvisitadas.length; i++) {
        if (this.paginasvisitadas[i] == pagina) {
            encontrado=true;
			break;
        }
    }
	if (encontrado==false){
		this.paginasvisitadas.push(pagina);
	}
}*/


function chkhistorial(){
	var inicial=window.location.hash.split("#");
	if(paginaanterior!=inicial[inicial.length-1]){
		if (inicial[inicial.length - 1] != "") {
			eval(inicial[inicial.length - 1].replace(".php", "") + "()");
			paginaanterior = inicial[inicial.length - 1];
		}else{
			paginaanterior = "";
			if (!init) {
				eval(paginainicial.replace(".php", "") + "()");
			}else{
				init=false;
			}
		}
	}
	setTimeout("chkhistorial()",500);
}
