function esIE(){
    nNav=navigator.appName;
    if (nNav=='Microsoft Internet Explorer') return true;
    else return false;
}

//Ajuste: Espacio que se debe restar para que no sobrepase la altura de la ventana del navegador 
//(solo para IE).
function FullHeight(NombreTabla, Ajuste){
    var h=0;
    var tabla=document.getElementById(NombreTabla);
    if (!esIE()){
        h=window.innerHeight+'px';
        tabla.style.height=h;
    }else{ 
        h=document.body.parentNode.offsetHeight-Ajuste;
        tabla.height=h;
    } 
}

function ListarCategorias(){
    el=document.getElementById('divCategorias');
    el.style.display=(el.style.display=='none')?'block':'none';
    
    //posicionar menu
    if (!esIE()) {
        vleft=(window.innerWidth/2)-124;
        vTop=(window.innerHeight/2)-270;
        if(vleft<353) vleft=353;
        if(vTop<70) vTop=70;
        el.style.left=vleft+'px';
        el.style.top=vTop+'px';
    }else{
        vleft=(document.body.parentNode.offsetWidth/2)-134;
        vTop=(document.body.parentNode.offsetHeight/2)-270;
        if(vleft<353) vleft=353;
        if(vTop<70) vTop=70;
        el.style.left=vleft;
        el.style.top=vTop;
    }
}

HMarquee=function (id, speed, pause, WidthForIE) {
	var container=document.getElementById(id);
	    var _timer;
	    var Width=parseInt(container.scrollWidth);
	    if (esIE()) Width=WidthForIE;
	    var scrollSpeed=(parseInt(speed)>0)?speed:30;
    	var Pause=(parseInt(pause)>0)?pause:scrollSpeed;

    Right=function() { 
	    if(container.scrollLeft>Width) {
		    //Right();
		    window.setTimeout(Right, Pause);
		    container.scrollLeft=Width;
	    } else container.scrollLeft+=1;
    }
	Left=function() { 
	    if(container.scrollLeft<=0) {
		    //Left();
		    window.setTimeout(Left, Pause);
		    container.scrollLeft=1;
	    } else container.scrollLeft-=1;
    }
    goLeft=function() {
	    _timer=window.setInterval(Left, scrollSpeed); 
    }
	goRight=function() {
	    _timer=window.setInterval(Right, scrollSpeed);
    }
    stop=function() { 
	    if (_timer) window.clearInterval(_timer);
    }
}

//scroll con stop al final
//para hacer un scroll continuo deshabilitar vstop() 
//y poner container.scrollTop=0 en Down
//y container.scrollTop=Height en Up
VMarquee=function (id, speed, pause, HeightForIE) {
	var container=document.getElementById(id);
	    var _timer;
	    var Height=parseInt(container.scrollHeight);
	    if (esIE()) Height=HeightForIE;
	    var scrollSpeed=(parseInt(speed)>0)?speed:30;
    	var Pause=(parseInt(pause)>0)?pause:scrollSpeed;
    Down=function() { 
	    if(container.scrollTop>Height) {
		    vstop();
		    window.setTimeout(Down, Pause);
		    container.scrollTop=Height;
	    } else container.scrollTop+=1;
    }
	Up=function() { 
	    if(container.scrollTop<=0) {
		    vstop();
		    window.setTimeout(Up, Pause);
		    container.scrollTop=1;
	    } else container.scrollTop-=1;
    }
    goUp=function() {
	    _timer=window.setInterval(Up, scrollSpeed); 
    }
	goDown=function() {
	    _timer=window.setInterval(Down, scrollSpeed);
    }
    vstop=function() { 
	    if (_timer) window.clearInterval(_timer);
    }
}