window.onload=function(){criaElementos(); verificaInt=setInterval("verifica()", 100);}
page=""; prefix="[page]"; index="homeBackState"; is_ie=(navigator.userAgent.toLowerCase().indexOf("msie")!=-1)?true:false;

function criaElementos()
    {var theBody=document.getElementsByTagName("body")[0];
    var iframe=document.createElement("iframe");
        iframe.setAttribute("src", "control.htm?id="+prefix+index);
        iframe.setAttribute("id", "bmr-ajaxControl");
        iframe.style.display="none";
    theBody.appendChild(iframe);}

function volta_index(){
	location="http://"+location.host+location.pathname+"#"; 
	location.reload();
}
    
function ajax(pag){
	var iframe=document.getElementById('bmr-ajaxControl');
    if(is_ie){
		iframe.src="control.htm?id="+prefix+pag;
	}else{
		if(pag!=index){
			location.hash=prefix+pag;
		}else{
			volta_index();
		}
	}
	document.title = 'Alinfo Network Solutions';
}
    
function verifica(){
	var hash=(typeof((hash=location.href.split("#")[1]))!="undefined"?hash:"");
    if(hash!=page){
		if(hash!="" && hash.indexOf(prefix)!=-1){
			carregaConteudo(hash.replace(prefix,""), 'ajax', true);
            page=hash; ajax(hash.replace(prefix,""));
		}else {
			clearInterval(verificaInt);
            location.hash=page; //Index
            ajax(index);
		}
	}
	document.title = 'Alinfo Network Solutions';
}
