﻿// constantes
var t;          // el timer
var stay=12000;       // demora ms
var n=1;        // la imagen que se muestra
var numImgs=3;  // numero de imagenes

function loadNav(){ 

$(document).ready(function() { //cuando el DOM este listo

    rotateAds();    //inicia el rotador de images
    // MouseOver y MouseOut para las imagenes boton
    $("#ds-mov").find("img").each(function(i){
        $(this).hover(function(){clearTimeout(t);t=setTimeout("rotateAd_n("+(i+1)+")",300);}, function(){t=setTimeout("rotateAds()",2000);})
    });
     //set visible el panel    
});
}

function rotateAds(){ // rota infinitamente
    if(n>3){n=1}
    rotateAd_n(n);
    t=setTimeout("rotateAds()",stay);
    n=n+1;
}

function rotateAd_n(k){ //muestra el elemento correspondiente en orden

$(".container:visible").fadeOut('fast'); //oculta el panel grande
for (kk=1;kk<=numImgs;kk++){ //cambia imagenes de boton
    if(kk!=k){document.getElementById("ib_0"+kk+"A").src ="images/im_btn_0"+kk+"B.png"; 
    }
}
document.getElementById("ib_0"+k+"A").src ="images/im_btn_0"+k+"A.png";  //el boton activo
$("#mov"+k).css("visibility","visible");
$("#mov"+k).fadeIn('slow'); // muestra el panel grande correspondiente
   
}
function setActiva(aa,bb){
    $("#"+aa).find("div").hide();
    $("#"+bb).removeClass('nvsble');
    $("#"+bb).fadeIn('fast');
} 

/***********/
function fillEvn(pa){ 
    xmlhttp = window.ActiveXObject? new ActiveXObject('Microsoft.XMLHTTP'): new XMLHttpRequest();
    if(xmlhttp!=null){aux=pa; xmlhttp.onreadystatechange= enRespuestaC; xmlhttp.open('GET','dx_not.xml',true); xmlhttp.send(null);}  
    
}
function enRespuestaC(){
    if(xmlhttp.readyState!=4){return}
    if(xmlhttp.status!=200){alert(xmlhttp.statusText); return}
    W=xmlhttp.responseXML.documentElement.getElementsByTagName("ev"); 

    listEven();   
}
function listEven() {    

     var txt='',H=0,xu,xv,xw,xx,xy,xz,anio=2010;    
        
     for(H=0;H<W.length;H++){
        xt=W[H].getElementsByTagName("s");
        xu=W[H].getElementsByTagName("an");
        xv=W[H].getElementsByTagName("ms");
        xw=W[H].getElementsByTagName("di");
        xx=W[H].getElementsByTagName("titulo");
        xy=W[H].getElementsByTagName("conten");
        xz=W[H].getElementsByTagName("img");
        if(xt[0].firstChild.nodeValue==aux && xu[0].firstChild.nodeValue==anio){
         try{ txt+='<div> <h4>'+xx[0].firstChild.nodeValue+'</h4><p class="ds-fech">'+xw[0].firstChild.nodeValue+' / ' +xv[0].firstChild.nodeValue+' / '+xu[0].firstChild.nodeValue+'</p></div><table><tr><td style="vertical-align:top;"><img src="../images/'+xz[0].firstChild.nodeValue+'"/></td><td>'+xy[0].firstChild.nodeValue+'</td></tr></table>';                
            } catch(er){}
        }
     } 
   document.getElementById("ds-evn-pan").innerHTML=txt;
   aux='';
    
}
/***********/
function fillVideo(nom)
{     
		if (AC_FL_RunContent == 0) {
		alert("Esta página requiere el archivo AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '600',
			'height', '450',
			'src', nom,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'false',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', nom,
			'bgcolor', '#ffffff',
			'name', nom,
			'menu', 'true',
			'allowFullScreen', 'true',
			'allowScriptAccess','sameDomain',
			'movie', nom,
			'salign', ''
			); //end AC code
	}
	var texto='<noscript><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="600" height="450" id="'+nom+'" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+nom+'.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="'+nom+'.swf" quality="high" bgcolor="#ffffff" width="600" height="450" name="'+nom+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></noscript>';
	document.getElementById("ds-nor-int").innerHTML=texto;

}
	

