// JavaScript Document
/****************************************************************
  Carousel de imágenes 2008 1.0. 30-Jul-08
  Autor tunait http://javascript.tunait.com/
  Script de libre uso mientras se mantengan intactos los créditos de autor.
****************************************************************/

//Inicialicia el/los carousel/es

var carousel1 
var contador=1
function mueveCarousel(){
	carousel1.mueve();
	contador++;
	
	primero=0;
	segundo=0;
	tercero=0;
	cuarto=0;
	
	num=0;
	
	if(window.document.getElementById('img1')){
		num=num+1;
		var d1 = window.document.getElementById("col1poemas");
		d1.className='col1destacados';
		primero=d1;
	};			
	if(window.document.getElementById('img2')){
		num=num+1;
		var d2 = window.document.getElementById("col1pintura");
		d2.className='col1destacados';
		if(primero==0){
			primero=d2;
		}else{
			segundo=d2;
		}
	};
	if(window.document.getElementById('img3')){
		num=num+1;
		var d3 = window.document.getElementById("col1pasarela");
		d3.className='col1destacados';
		if(primero==0){
			primero=d3;
		}else if(segundo==0){
			segundo=d3;
		}else{
			tercero=d3;
		}		
	};	
	if(window.document.getElementById('img4')){
		num=num+1;
		var d4 = window.document.getElementById("col1photo");
		d4.className='col1destacados';
		if(primero==0){
			primero=d4;
		}else if(segundo==0){
			segundo=d4;
		}else if(tercero==0){
			tercero=d4;
		}else{
			cuarto=d4;
		}				
	};
	


if(contador==1){
	primero.className='col1resaltado'
}
if(contador==2){
	primero.className='col1destacados'
	segundo.className='col1resaltado'
}
if(contador==3){
	segundo.className='col1destacados'
	tercero.className='col1resaltado'
}
if(contador==4){
	tercero.className='col1destacados'
	cuarto.className='col1resaltado'
}
//alert(contador);
if(contador==num)contador=0;
//alert("pos2:"+pos1+" min1:"+min1+" max1:"+max1+" min2"+min2+" max2:"+max2);
}


onload = function(){
	carousel1 = new tunaCarousel('micarousel',552, 'rtl')
	//--
	carousel1.ima_pausa = 'Pausar.jpeg' //Imagen para el botón de pausa
	carousel1.ima_plei = 'Reanudar.jpeg' //Imagen para el botón de Play
	//--
	//carousel1.controlesCarousel()
	tiempo = setInterval(mueveCarousel, 6000)//6 segundos
}

function iniciar(){
	carousel1 = new tunaCarousel('micarousel',552, 'rtl')
	//--
	carousel1.ima_pausa = 'Pausar.jpeg' //Imagen para el botón de pausa
	carousel1.ima_plei = 'Reanudar.jpeg' //Imagen para el botón de Play
	//--
	//carousel1.controlesCarousel()
	tiempo = setInterval(mueveCarousel, 6000)//6
	
}

//--
function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1)
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }
//----------------
  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
