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;
    } 
}


HMarquee1=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;

    Right1=function() { 
	    if(container.scrollLeft>Width) { window.setTimeout(Right, Pause);
		    container.scrollLeft=Width;
	    } else container.scrollLeft+=1;}
	Left1=function() { 
	    if(container.scrollLeft<=0) {
		    //Left();
		    window.setTimeout(Left, Pause);
		    container.scrollLeft=1;
	    } else container.scrollLeft-=1;}
    goLeft1=function() {
	    _timer=window.setInterval(Left1, scrollSpeed); }
	goRight1=function() {
	    _timer=window.setInterval(Right1, scrollSpeed);}
    stop1=function() { 
	    if (_timer) window.clearInterval(_timer);}
}

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) { 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);}
}

      VMarquee=function (id, speed, pause, HeightForIE) {
	var container=document.getElementById(id);
	//if (container.offsetWidth<parseInt(container.scrollWidth)){
	    var _timer;
	    var Height=parseInt(container.scrollHeight);
	    if (esIE()) Height=HeightForIE;
	    //container.innerHTML=container.innerHTML+container.innerHTML; 
	    var scrollSpeed=(parseInt(speed)>0)?speed:30;
    	var Pause=(parseInt(pause)>0)?pause:scrollSpeed;
	//}    	
    Down=function() { 
	    if(container.scrollTop>Height) {
		    stop();
		    window.setTimeout(Down, Pause);
		    container.scrollTop=0;
	    } else container.scrollTop+=1;
    }
	Up=function() { 
	    if(container.scrollTop<=0) {
		    stop();
		    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);
    }
}


      VMarquee1=function (id, speed, pause, HeightForIE) { 
	var container=document.getElementById(id);
	//if (container.offsetWidth<parseInt(container.scrollWidth)){
	    var _timer;
	    var Height=parseInt(container.scrollHeight);
	    if (esIE()) Height=HeightForIE;
	    //container.innerHTML=container.innerHTML+container.innerHTML; 
	    var scrollSpeed=(parseInt(speed)>0)?speed:30;
    	var Pause=(parseInt(pause)>0)?pause:scrollSpeed;
	//}    	
    Down1=function() { 
	    if(container.scrollTop>Height) {
		   vstop1();
		    window.setTimeout(Down1, Pause);
		    container.scrollTop=0;
	    } else container.scrollTop+=1;
    }
	Up1=function() { 
	    if(container.scrollTop<=0) {
		    vstop1();
		    window.setTimeout(Up1, Pause);
		    container.scrollTop=1;
	    } else container.scrollTop-=1;
    }
    goUp1=function() {
	    _timer=window.setInterval(Up1, scrollSpeed); 
    }
	goDown1=function() {
	    _timer=window.setInterval(Down1, scrollSpeed);
    }
    vstop1=function() { 
	    if (_timer) window.clearInterval(_timer);
    }
}

//
function ObtenerExt(Arch){
  arrArch=Arch.split(".");
  Ext=arrArch[arrArch.length - 1];
  return Ext=Ext.toUpperCase();
}

function esArchBanner(oSrc, args){
  args.IsValid=false;
  Ext=ObtenerExt(args.Value);
  if (Ext=="SWF"||Ext=="GIF"||Ext=="JPG"||Ext=="PNG") args.IsValid=true;
  return args.IsValid;  
}

function esArchImagen(oSrc, args){
  args.IsValid=false;
  Ext=ObtenerExt(args.Value);
  if (Ext=="JPG"||Ext=="GIF"||Ext=="PNG") args.IsValid=true;
  return args.IsValid;
}

function esArchDeProyecto(oSrc, args){
  args.IsValid=false;
  Ext=ObtenerExt(args.Value);
  if (Ext=="ZIP"||Ext=="PDF"||Ext=="DOC") args.IsValid=true;
  return args.IsValid;
}

function esArchVideo(oSrc, args){
  args.IsValid=false;
  Ext=ObtenerExt(args.Value);
  if (Ext=="MPG"||Ext=="AVI"||Ext=="WMV") args.IsValid=true;
  return args.IsValid;
}

function esIE(){
    nNav=navigator.appName;
    if (nNav=='Microsoft Internet Explorer') return true;
    else return false;
}
//-----------------------------
function ConfirmarEliminar(){ 
	return (confirm('Se van a eliminar los elementos seleccionados. ¿Continuar?\n(Se eliminará toda la información dependiente. No se podrán restaurar datos eliminados)'));
}

function CerrarVentana(){
    if (!esIE())
        alert('Si no se cierra automáticamente esta ventana utilice el botón Cerrar');
    window.close();
}

function Cargar(Foto)
{
      
  var im = document.getElementById("FotoGrande");    
    im.src=Foto;
}
function Cargar1(Id)
{
      
  var im = document.getElementById(Id);    
    im.src="imagenes/blanco.gif";
}

function Cargar2(Id)
{
      
  var im = document.getElementById(Id);    
    im.src="imagenes/durbola1.gif";
}


function VerMenu()
{  
 toggle1('divMenu');
  
}
function Ocultar()
{
   toggle1('divMenu');
}

function VerMaga()
{
    toggle1('divSubm');
    toggle2('divMenu');

}

  var ie4 = false; if(document.all) { ie4 = true; }
  var ultimodiv=null
  var ultimosubdiv=null
   
  function getObject(id) { 
    if (ie4) { 
      return document.all[id]; 
    }else { 
      return document.getElementById(id); 
    }
  }
   function toggle1(divId) {

    
            var oDivX = document.getElementById("dMnuL3").offsetTop;
            var oDivY = document.getElementById("dMnuL3").offsetLeft;
          
        var d = getObject(divId);
           
	    
        if (d.style.display == 'none'){
                            d.style.display = 'block';    
                                        
                  
        }else{
	              d.style.display = 'none';
	              
        } 
        
        
        
//          if (!esIE()) {
//           d.style.top = oDivY+125+'px';
//                            d.style.left = oDivX+4+'px';
//                          }else{
//         d.style.top = oDivY+125;
//                            d.style.left = 240;
//        }
//         d.style.top = oDivY+125;
//         d.style.left = oDivX+3;
    ListarCategorias();
}

function ListarCategorias(){
    el=document.getElementById('divMenu');
//    el.style.display=(el.style.display=='none')?'block':'none';
    
    //alert(screen.width  + "* ancho " + screen.availHeight);posicionar menu alert(screen.availWidth + "* avail " + screen.availHeight); 
       
       
       vAncho= screen.width ;
       
       vDis= (vAncho-1090)/2;
       vDis= vDis+238+5+45+46;
     
    if (!esIE()) {
        vleft=(window.innerWidth/2);
        vTop=91;//(window.innerHeight/2);
//        if(vleft<353) vleft=353;

//       if(vTop<170) vTop=170;
        
        el.style.left=vDis+'px';
        el.style.top=vTop+'px';
        
    }else{
        vleft=(document.body.parentNode.offsetWidth/2);
        vTop=102;//(document.body.parentNode.offsetHeight/2);
     
//        if(vleft<353) vleft=353;

//       if(vTop<170) vTop=170;
        el.style.left=vDis;
        el.style.top=vTop; 
           
    }
}