// FUNÇÕES UTILIZADAS PELO MOZILLA /////////////////////////////////////////////////////////////////////
	function history(fromUser) {
	  localHash = location.hash.split("#")[1];
	  if (fromUser){
	    local = localHash;
	  } else if (local != localHash){
	        requestFF(localHash);
		}
	}

	function requestFF(paginaSolicitada) {
		if (!paginaSolicitada){
			var paginaSolicitada = paginaInicial;
		}
		top.location = "#" + paginaSolicitada;
		carregaArquivo(paginaSolicitada);
		history(true);
	}	

// FUNÇÕES UTILIZADAS PELO INTERNET EXPLORER ///////////////////////////////////////////////////////////
	function iFrameFix(){
	    locator = document.frames['ajaxnav'].getLocation().split("?hash=")[1] || paginaInicial;
	    window.location.hash = locator || paginaInicial;
	    checkWhetherChanged(0);
	}

	function checkWhetherChanged(location){
	    var locator = document.frames['ajaxnav'].getLocation().split("?hash=")[1];
		var arquivo = locator.replace("&","?");
	    if (locator != location) {
			carregaArquivo(arquivo);
	        top.location = "#" + locator;
	    }
		var temp =  locator;
	    setTimeout("checkWhetherChanged('"+temp+"')", 200);
	}
	
	function requestIE(arquivo){
		var file = arquivo.replace("?","&");
		$("#ajaxnav").attr("src","iframe.php?hash=" + file);
	};

// FUNÇÕES COMPARTILHADAS //////////////////////////////////////////////////////////////////////////////
	function request(arquivo){
		if (is_ie) {
			requestIE(arquivo);
		}else{
			requestFF(arquivo);
		}
	}
	
	function aguarde(){
		$("#"+container).html(" <table width='100%' height='250'> <tr> <td align='center' valign='center'> <img src=\"imagens/aguarde.gif\"><br><br>Aguarde </td></tr> </table>");
	}
	
	function carregaArquivo(nomeArquivo){
			aguarde();
			$("#"+container).load(nomeArquivo,
				{limit: 25},
			  	function() {
					ScriptOnload($("#"+container).html());
				}
			);
	}

// VERIFICAÇÕES PARA DETERMINAR O NAVEGADOR E INICIALIZAÇÃO ////////////////////////////////////////////
	function verificaSeCarregouIframe(){
		if (document.frames['ajaxnav'].carregouIframe){
			iFrameFix();
		}else{
			setTimeout("verificaSeCarregouIframe()",100);
		}
	}

$(document).ready(function() {
	is_ie 			= (navigator.userAgent.toLowerCase().indexOf("msie") > -1) ? true : false;
	paginaInicial 	= "home.php"; //Pagina inicial
	container 		= "conteudo"; //Div de destino
	if (is_ie){
		var locator;
		var windowlocator = window.location.hash.split("#")[1] || paginaInicial;
		$("#temp").html("<iframe id=\"ajaxnav\" name=\"ajaxnav\" src=\"iframe.php?hash=" + windowlocator + "\" style=\"display: none;\"></iframe>");
		verificaSeCarregouIframe();
	} else{
		local = "";
		setInterval("history(false)", 200);
	}
});