var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

function esIE(){
    nNav=navigator.appName;
    if (nNav=='Microsoft Internet Explorer') return true;
    else return false;
}
function DeterminaExplorador(){
    if (esIE() && navigator.appVersion.indexOf('MSIE 7.0')==-1 && navigator.appVersion.indexOf('MSIE 8.0')==-1 && navigator.appVersion.indexOf('MSIE 9.0')==-1)
    {
        window.alert(navigator.appVersion);
        window.alert("Para ver correctamente este sitio se requiere actualizar su navegador. (Internet Explorer 7+ o Mozilla Firefox)");
    }
    
}
// JavaScript Macromedia Functions

function MM_swapImage() { //v3.0
  	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfLayer(objName,x,newText) { //v3.0
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) { document.write(newText); document.close(); }
else  innerHTML = newText;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function MM_setClass() {//v1.0
  var i,x,a=MM_setClass.arguments;  for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null) {
  if (x.className == a[i+1]) x.className = a[i+2]; else x.className = a[i+1];  }
}

function MM_changeClass() {//v1.0
  var i,x,a=MM_changeClass.arguments; for(i=0;i<(a.length-1);i+=2) if ((x=MM_findObj(a[i]))!=null) x.className = a[i+1];
}




function poner_fecha()
{
	var today = new Date() 
	var year=today.getYear()
	if (year<1000)
	year=1900+year
	var day=today.getDay()
	var month=today.getMonth()
	var daym=today.getDate()
	if (daym<10)
	daym="0"+daym
	var dayarray=new Array("Domingo","Lunes","Martes","Mi&eacute;rcoles","Jueves","Viernes","S&aacute;bado")
	var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
	fecha = dayarray[day] + ", " + daym + " de " + montharray[month] + " del " + year
	document.write(fecha)
}


function gup( name ){
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp ( regexS );
	var tmpURL = window.location.href;
	var results = regex.exec( tmpURL );
	if( results == null )
		return"";
	else
		return results[1];
}

function RunSlideShow(pictureName,imageFiles,displaySecs,listlinks,listtargets)
{
var imageSeparator = imageFiles.indexOf("*");
var nextImage = imageFiles.substring(0,imageSeparator);
var linksSeparator = listlinks.indexOf("*");
var nextLink=listlinks.substring(0,linksSeparator);
var targetsSeparator = listtargets.indexOf("*");
var nextTarget=listtargets.substring(0,targetsSeparator);
if (document.all)
{
document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
document.getElementById(pictureName).filters.blendTrans.Apply();
}
document.getElementById(pictureName).src = nextImage;
document.getElementById("Link").href=nextLink;
document.getElementById("Link").target=nextTarget;
if (document.all)
{
document.getElementById(pictureName).filters.blendTrans.Play();
}
var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
+ '*' + nextImage;
var futureLinks=listlinks.substring(linksSeparator+1,listlinks.length)
+ '*' + nextLink;
var futureTargets=listtargets.substring(targetsSeparator+1,listtargets.length)
+ '*' + nextTarget;
setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+",'"+futureLinks+"','"+futureTargets+"')",
displaySecs*1000);
// Cache the next image to improve performance.
imageSeparator = futureImages.indexOf("*");
nextImage = futureImages.substring(0,imageSeparator);
if (slideCache[nextImage] == null) {
slideCache[nextImage] = new Image;
slideCache[nextImage].src = nextImage;
}
}

function AbreVisor(archivo)
{
	var Ruta="visor.aspx?Archivo=" + archivo;
	window.open(Ruta,'','width=600,height=500');
	
}

function AbreContactos()
{
	var Ruta="contactenos.aspx";
	window.open(Ruta,'','width=650,height=640');
	
}
 
 function AbreSuscripcion()
{
	var Ruta="suscripciones.aspx";
	window.open(Ruta,'','width=500,height=555');
	
}

function AbreComentario(Id)
{
	var Ruta="comentario.aspx?Id=" + Id;
	window.open(Ruta,'','width=500,height=520');
	
}

function AbreSugerencia()
{
	var Ruta="buzonsugerencias.aspx";
	window.open(Ruta,'','width=500,height=620');
	
}
	 function PanelesOcultar()
     {
        document.getElementById("divLista").style.display="none";
        document.getElementById("divDetalle").style.display="";
        document.getElementById("divGaleria").style.display="";
     }

    function PanelesMostrar()
     {
        document.getElementById("divLista").style.display="";
        document.getElementById("divDetalle").style.display="none";
        document.getElementById("divGaleria").style.display="none";

     }
	 
	 
	 function OpcionOcultar()
     {
        document.getElementById("divOpcCab").style.display="none";
            document.getElementById("divOpcPie").style.display="none";
            document.getElementById("divOpc").style.display="none";
     }
     
     function EncuestaOcultar()
     {
        document.getElementById("divCabEncuesta").style.display="none";
            document.getElementById("divEncuesta").style.display="none";
     }
     
     
   HMarquee=function (id, speed, pause, WidthForIE) {
	var container=document.getElementById(id);
	var subcontainer=document.getElementById("divConImaH");
	    var _timer;
	    var Width=parseInt(container.scrollWidth);
	    //window.alert(Width);
	    if (esIE()) Width=WidthForIE;
	    var scrollSpeed=(parseInt(speed)>0)?speed:30;
    	var Pause=(parseInt(pause)>0)?pause:scrollSpeed;

    Right=function() { 
     var Widthtd=parseInt(container.scrollWidth);
     //window.alert(Widthtd);
	    if(container.scrollLeft>Widthtd) {
		    //Right();
		    window.setTimeout(Right, Pause);
		    container.scrollLeft=Widthtd;
	    } 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 subcontainer=document.getElementById("divContenedor");
	    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() {
        var Heightd=parseInt(subcontainer.scrollHeight);
	    //window.alert(Heightd);
	    if(container.scrollTop>(Heightd)) {
	        
		    vstop();
		    window.setTimeout(Down, Pause);
		    container.scrollTop=Heightd;
	    } 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);
    }
}  