// JavaScript Document
var intval = '';
function Right(s, n){
	var t=s.length;
	if(n>t)
		n=t;
	return s.substring(t-n, t);
}

function verNoticia(strDir, iIntervalo) {
  if (strDir == 'adelante') {
    var seMuestra = document.getElementById('noticia_primaria0').style.display;
    if (seMuestra == '' || seMuestra == 'block') {
      document.getElementById('noticia_primaria0').style.display = 'none';
      document.getElementById('noticia_primaria1').style.display = 'block';
      document.getElementById('noticia_primaria2').style.display = 'none';
      return;
    }
    var seMuestra = document.getElementById('noticia_primaria1').style.display;
    if (seMuestra == 'block') {
      document.getElementById('noticia_primaria0').style.display = 'none';
      document.getElementById('noticia_primaria1').style.display = 'none';
      document.getElementById('noticia_primaria2').style.display = 'block';
      return;
    }
    var seMuestra = document.getElementById('noticia_primaria2').style.display;
    if (seMuestra == 'block') {
      document.getElementById('noticia_primaria0').style.display = 'block';
      document.getElementById('noticia_primaria1').style.display = 'none';
      document.getElementById('noticia_primaria2').style.display = 'none';
      return;
    }
  }
  if (strDir == 'atras') {
    var seMuestra = document.getElementById('noticia_primaria2').style.display;
    if (seMuestra == 'block') {
      document.getElementById('noticia_primaria0').style.display = 'block';
      document.getElementById('noticia_primaria1').style.display = 'none';
      document.getElementById('noticia_primaria2').style.display = 'none';
      return;
    }
    var seMuestra = document.getElementById('noticia_primaria1').style.display;
    if (seMuestra == 'block') {
      document.getElementById('noticia_primaria0').style.display = 'none';
      document.getElementById('noticia_primaria1').style.display = 'none';
      document.getElementById('noticia_primaria2').style.display = 'block';
      return;
    }
    var seMuestra = document.getElementById('noticia_primaria0').style.display;
    if (seMuestra == '' || seMuestra == 'block') {
      document.getElementById('noticia_primaria0').style.display = 'none';
      document.getElementById('noticia_primaria1').style.display = 'block';
      document.getElementById('noticia_primaria2').style.display = 'none';
      return;
    }
  }
}

function autoNoticia(iIntervalo) {
  var strImg = Right(document.getElementById('play').src,9);
  if(strImg == 'play1.png' || strImg == 'play2.png') {
    document.getElementById('play').src = 'templates/css/img/pause.png';
    if(intval==""){
          intval=window.setInterval("verNoticia('adelante')", iIntervalo)
    }
  }
  if(strImg == 'pause.png' || strImg == 'pausa.png') {
    document.getElementById('play').src = 'templates/css/img/play1.png';
    stop_Int();
  }

}

function stop_Int(){
  if(intval!=""){
    window.clearInterval(intval);
    intval="";
  }
}

function Cambiar_Imagen(strAccion) {
  var strImg = Right(document.getElementById('play').src,9);
  if (strAccion == 'over') {
    if(strImg == 'play1.png') {
      document.getElementById('play').src = 'templates/css/img/play2.png';
    }
    if(strImg == 'pause.png') {
      document.getElementById('play').src = 'templates/css/img/pausa.png';
    }
  }
  if (strAccion == 'out') {
    if(strImg == 'play2.png') {
      document.getElementById('play').src = 'templates/css/img/play1.png';
    }
    if(strImg == 'pausa.png') {
      document.getElementById('play').src = 'templates/css/img/pause.png';
    }
  }
}

function SWFDelegate(url,width,height,caption) {
	var objLink = document.createElement("a");
	objLink.setAttribute("href",url);
	objLink.setAttribute("rel","lightbox");
	objLink.setAttribute("title",caption);
	if(typeof width != "undefined") {
		objLink.setAttribute("width",width);
	}
	if(typeof height != "undefined") {
		objLink.setAttribute("height",height);
	}
		Lightbox.prototype.start(objLink);
}
function GroupDelegate(id) {
	var objLink = document.getElementById(id);
	Lightbox.prototype.start(objLink);
}