// Obtención de Navegador

function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4));
    this.ie   = (agent.indexOf("msie") != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie4  = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
}

var is = new Is();

mostrar = "n"
cargar = "s"

function onerror() {
    document.location.href = "javascript:";
}

// DOCUMENT OBJECT SWITCH (Used for building cross_browser functions)

if(is.ns4) {
    doc = "document";
    sty = "";
    htm = ".document"
} else if(is.ie4) {
    doc = "document.all";
    sty = ".style";
    htm = ""
}

function init() {

   cargar = "s"
   document.onmousemove = mouseMove
   if (is.ns) document.captureEvents(Event.MOUSEMOVE)
	
   for (var i=1;i<=67;i++) {
         if (document.images) {
            eval('img'+i+' = new Image()');
	 	    eval('img'+i+'.src = "images/letrero'+i+'.gif"')
          }
	}	  

    brujulaImg = new Image()
    brujulaImg = eval(doc + '["brujulaDiv"]' + '.document');
    brujulaImg.brujula.src ="images/brujula.gif"
    brujulaObj = eval(doc + '["brujulaDiv"]' + sty);
    brujulaObj.visibility = (is.ns)? "show" : "visible";
    brujulaObj.width = brujulaImg.brujula.width
    brujulaObj.height = brujulaImg.brujula.height
	

    winW = (is.ns)? (window.innerWidth)-16 : (document.body.offsetWidth)-20
    winH = (is.ns)? (window.innerHeight)-16 : (document.body.offsetHeight)-20

    cargar = "n"	
    
    return true
}	  

function visible(imgNum) {

 	divImg = eval(doc + '["letreroDiv"]' + '.document');
    eval('divImg.letrero.src = img'+imgNum+'.src')
		
	divObj = eval(doc + '["letreroDiv"]' + sty);
    divObj.width = eval('img'+imgNum+'.width');
    divObj.height =eval('img'+imgNum+'.height');

    mostrar ="s";
    divObj.visibility = (is.ns)? "show" : "visible";

    return true
}

function oculta() {
    if (cargar=="s") return true

    mostrar ="n";
	divObj = eval(doc + '["letreroDiv"]' + sty);
    divObj.visibility = (is.ns)? "hide" : "hidden";

    return true
}


function muestra(numImg) {
    if (cargar=="s") return true
    if (is.ns && numImg>14) return true
	
    visible(numImg);
    return true
}

function mouseMove(e) {
    if (cargar=="s") return true

    brujulaObj.top = (is.ns)? 10 : 10 + document.body.scrollTop
    brujulaObj.left = (is.ns)? 10 : 10 + document.body.scrollLeft

    if (mostrar == "n") return true

    var x = (is.ns)? e.pageX : event.x
    var y = (is.ns)? e.pageY : event.y

	var xraton = ((x+parseInt(divObj.width)) > winW)?(x-parseInt(divObj.width)-10) : x+5
    var yraton = ((y+parseInt(divObj.height)) > winH)?(y-parseInt(divObj.height)-10) : y+5

    divObj.left = (is.ns)? xraton : xraton+document.body.scrollLeft
    divObj.top = (is.ns)? yraton : yraton+document.body.scrollTop

    return true
}









