var xmlEncoding="<?xml version='1.0' encoding='iso-8859-1' ?>";

function traerObjetoPorNombre(mName)
    {
    if (navigator.appName.indexOf('Microsoft')!=-1)
    return window[mName];
    else
    return document.getElementById(mName);
    }

function ChequeoVersion()
    {   
    this.version=navigator.appVersion;
    this.agente=navigator.userAgent;
    this.dom=document.getElementById?1:0;
    this.ns6=(this.dom && parseInt(this.version) >= 5) ?1:0;
    this.opera5=this.agente.indexOf('Opera')>-1;
    if (this.opera5) this.ns6 = 0;
    this.ie5=(this.version.indexOf('MSIE 5')>-1 && this.dom && !this.opera5)?1:0;
    this.ie6=(this.version.indexOf('MSIE 6')>-1 && this.dom && !this.opera5)?1:0;
    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.soporta=(this.ie6 || this.ie5 || this.ie4 || this.ns6);
    return this;
    }

var flashMode = false;

var navegador=new ChequeoVersion()
    if (navegador.ns4)
        {
        scrX= innerWidth;
        scrY= innerHeight;
        onresize= function()
        {
        if(scrX!= innerWidth || scrY!= innerHeight)
        history.go(0);
        }
    }
var curpage=0;
var timer=null;
var imagesWidth=null;
var imagesHeight=null;
var slideHeight=0;
var stopped = false;
var numpages = 0;
var arraySlides;
var obj;

function test()
    {}


function fnc_next()
    {
    if (curpage > numpages-1)
        {
        curpage=0;
        }
        obj=arraySlides[curpage];
        obj.style.visibility = "hidden";
        obj.style.display = "none";
        obj.style.height = "1px";
        curpage++;
    if (curpage>numpages - 1)
        {
        curpage = 0;
        }
        obj=arraySlides[curpage];
        obj.style.visibility = "visible";
        obj.style.display = "block";
        obj.style.height = slideHeight + "px";
    if(!stopped)
        {
        clearTimeout(timer);
        start();
        }
    }

function fnc_prev()
    {
    if (curpage>numpages)curpage = 0;

    //Obtengo la nota Actual
    obj= arraySlides[curpage];

    if(obj)
        {
        obj.style.visibility = "hidden";
        obj.style.display = "none";
        obj.style.height = "1px";
        }

    curpage--;
    if (curpage<0)curpage = numpages-1;

    //Obtengo la nota Anterior
    obj=arraySlides[curpage];
    if(obj)
        {
        obj.style.visibility = "visible";
        obj.style.display = "block";
        obj.style.height = slideHeight + "px";
        }

    if(!stopped)
        {
        clearTimeout(timer);
        start();
        }
    }

function stopstart(img)
    {
    if (stopped) {
        img.src="/imgs/varios/"+img.id+".gif";
        img.onmouseover="sgppnov(this);";
        img.onmouseout="sgppnou(this);";
        start();
    } else {
        img.src="/imgs/varios/"+img.id+"_over.gif";
        img.onmouseover="";
        img.onmouseout="";
        stop();
    }
    }

function stop()
    {
    if (!(stopped))
        {
        clearTimeout(timer);
        stopped=true;
        }
    }
function start()
    {
    timer=setTimeout('fnc_next()',10000);
    stopped=false;
    }

function firsthideImgs()
    {
    arraySlides = document.getElementsByName("rota");

    numpages = arraySlides.length;
    //Oculto cada una de las imagenes
    for (i=0;i <= numpages;i++)
        {
        var obj=arraySlides[i];
        if(obj)
            {
            if(i==0)
                {
                imagesWidth = document.getElementById('imgSlide').width;
                imagesHeight = document.getElementById('imgSlide').height;
                }

            slideHeight = imagesHeight + ((muestraTitulo==0)?88:0);
            //slideHeight = imagesHeight;
            obj.style.visibility="hidden";
            obj.style.display = "none";
            obj.style.height = "1px";
            obj.style.overflow ="hidden";
            obj.style.top = "0px";
            obj.style.position = "relative";
            obj.style.border = "0px solid";
            obj.style.zIndex = 1;
            }
        }

    //Ubico la botonera segun el alto de la primer imagen
    //Muestro la primer imagen
    curpage = 0;
    var firstSlide = arraySlides[0];
    if(firstSlide)
        {
    //    firstSlide.style.visibility = "visible";
    //    firstSlide.style.display = "block";
    //    firstSlide.style.height = imagesHeight + "px";
    //    slideHeight = imagesHeight;
        start();
        }
    }


function firsthide()
    {

    arraySlides = document.getElementsByName("rota");
    numpages = arraySlides.length;

    //Oculto cada una de las imagenes

    for (i=0;i < numpages ;  i ++)
        {
        obj=arraySlides[i];
        if(obj)
            {
            if(i==0)
                {
                imagesWidth = document.getElementById('imgSlide').width;
                imagesHeight = document.getElementById('imgSlide').height;
                }

            slideHeight = imagesHeight + 2;
            obj.style.visibility="hidden";
            obj.style.display = "none";
            obj.style.height = "1px";
            obj.style.overflow ="hidden";
            obj.style.top = "0px";
            obj.style.position = "relative";
            obj.style.border = "0px solid";
            obj.style.zIndex = 1;
            }
        }

    //Ubico la botonera segun el alto de la primer imagen
    if (numpages > 1)
        {
        var botonera=document.getElementById('botoneraSlide');
        if(botonera)
            {
            var top = imagesHeight - 18;
            var left = imagesWidth - 95;
            botonera.style.visibility = "visible";
            botonera.style.display = "block";
            botonera.style.top = top + "px";
            botonera.style.left = left+ "px";
            botonera.style.zIndex = "5";
            }
        }

    //Muestro la primer imagen
    curpage = 0;
    var firstSlide = arraySlides[0];
    if(firstSlide)
        {
        firstSlide.style.visibility = "visible";
        firstSlide.style.display = "block";
        firstSlide.style.height = slideHeight + "px";
        start();
        }
    }

function sgppnov(img)
    {
    img.src='/media/html/img/'+img.id+'_over.gif';
    }
function sgppnou(img)
    {
    img.src='/media/html/img/'+img.id+'.gif';
    }
