﻿		function checkIE() {
		var userAgent = navigator.userAgent.toLowerCase();
		if (document.all && userAgent.indexOf('msie')!=-1) {
			return true;
		}
		else {
			return false;
		}
	}
		
		function inicial(){
			
			this.ieFrame = document.createElement("iframe");
			this.ieFrame.id = "historyFrame";
			this.ieFrame.style.display = "none";
			document.body.appendChild(this.ieFrame);
			
		if (checkIE()==true){
			
		makeNewHash();
		recorrerhrefie();
		chklocation();
		}else{
		recorrerhref();
		}
		}
		
		function onFrameLoaded(hash) {
        //document.getElementById("currentHash").innerHTML = hash;
        location.hash = hash;
    }
    
    function makeNewHash(pagina) {
    
    if (pagina==undefined){
    pagina="";
    }
	
        window.location.hash = pagina;
		
		/*var ifrmhistoryFrame = document.createElement("IFRAME");
 ifrmhistoryFrame.id = "historyFrame6";

 document.body.appendChild(ifrmhistoryFrame);
		*/
       var doc = document.getElementById("historyFrame").contentWindow.document;
       //var doc=this.ieFrame.contentWindow.document;
		doc.open("javascript:'<html></html>'");
       
	    doc.write("<html><head><scri" + "pt type=\"text/javascript\">parent.onFrameLoaded('"+ pagina + "');</scri" + "pt></head><body></body></html>");
        
	    doc.close();
		
		
    }
		
			function chklocation(){
				setTimeout("gethash()",100);			
			}
			function gethash(){
				//document.getElementById("lbl").innerHTML=window.location.hash;
				document.title=window.location.hash;
				setTimeout("gethash()",100);
			}
			function ira(pagina){
			if (checkIE()==true){
				
		makeNewHash(pagina);
		}else{
		window.location.hash=pagina;
		}
			 
			 	
			}
			
			function recorrerhref(){
				arr = document.getElementsByTagName("a");
				
				for (i = 0; i < arr.length; i++) {
					/*if (arr[i].getAttribute("onclick")) {
						if (arr[i].getAttribute("onclick").indexOf("(") > -1) {*/
						
						arr[i].setAttribute("onclick","ira(this.id);return false;");
						/*}
					}*/
				}
				chklocation();
			}
			
			function ir(obj){
				
				alert(obj.id);
			}
			
			function recorrerhrefie(){
				arr = document.getElementsByTagName("a");
				
				for (i = 0; i < arr.length; i++) {
					/*if (arr[i].getAttribute("onclick")) {
						alert(arr[i].attributes("onclick").nodeValue);*/
			arr[i].onclick=function(){ira('p'+this.id);return false};
					
				}
			/*a1=document.getElementById("lnk0");
			a1.onclick=function(){return false};*/
						 /* a1onClick = document.createAttribute('onClick');
			     a1onClick.nodeValue = "a;";
			     a1.setAttributeNode(a1onClick);*/
			}
			window.onload =inicial;


