// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully
// ------------------------------------------------------------------------- //

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000;
// Agent sniffer shamelessly 'stolen' from the excellent X library from cross-browser.com
var xOp7=false,xOp5or6=false,xIE4Up=false,xNN4=false,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
  xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1);
  if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1);
}
else if(document.layers) xNN4=true;
else {xIE4Up=document.all && xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;};

// Duration of crossfade (seconds)
var crossFadeDuration = 3;

// Specify the image files
var Pic = new Array(); // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
Pic[ 0]   = 'C-0009Cmp.jpg';
Pic[ 1]   = 'C-0020Cmp.jpg';
Pic[ 2]   = 'C-0043Cmp.jpg';
Pic[ 3]   = 'C-0069Cmp.jpg';
Pic[ 4]   = 'REM-0496Cmp.jpg';
Pic[ 5]   = 'SH-0030Cmp.jpg';
Pic[ 6]   = 'SK-0159Cmp.jpg';
Pic[ 7]   = 'SP-0012Cmp.jpg';
Pic[ 8]   = 'X-0185Cmp.jpg';
Pic[ 9]   = 'X-0189Cmp.jpg';
Pic[10]   = 'X-0289Cmp.jpg';
Pic[11]   = 'X-0338Cmp.jpg';


var idTimeout;
var j = 0;
var p = Pic.length;
var pos = j;

var preLoad = new Array();
// Arreglo con los botones para controlar la galería de imagenes
var objBoton = null;

function preLoadPic(index)
{

	if (Pic[index] != '')
		{
			window.status='Cargando : '+Pic[index];
			preLoad[index] = new Image();
			preLoad[index].src = Pic[index];
			Pic[index] = '';
			window.status='';
        };
};

function runSlideShow(){
	
   if (xIE4Up)
	{	document.images.SlideShow.style.filter="blendTrans(duration=2)";
      document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)";
      document.images.SlideShow.filters.blendTrans.Apply();
   };

	document.images.SlideShow.src = preLoad[j].src;
	
// alert( "function runSlideShow()\n" + String( this.j ) + preLoad[j].src  );

	if (xIE4Up){
	  document.images.SlideShow.filters.blendTrans.Play();
	};

	pos = j;
	
	j = j + 1;
	if ( j > (p-1) ) {	j=0;	};
	
	idTimeout = setTimeout('runSlideShow()', slideShowSpeed);
	preLoadPic(j);

};	//	fin de function runSlideShow()...

function endSlideShow(){
	clearTimeout( idTimeout );	
	CambiarEvento();
};

//	Terminar la galería
function EjecutarGaleria() {
	runSlideShow();
	CambiarEvento();
};		//	fin de function EjecutarGaleria()...

//	Mostrar y ocultar los Botones
function CambiarEvento( )
{
	var strTexto = objBoton.childNodes[ 0 ].nodeValue;
	
	if ( strTexto == "Detener la galería" )
		{ 	objBoton.childNodes[ 0 ].nodeValue = "Ver la galería" 
			objBoton.onclick = this.EjecutarGaleria;		
		}
	else if ( strTexto == "Ver la galería" )
		{ 	objBoton.childNodes[ 0 ].nodeValue = "Detener la galería" 
			objBoton.onclick = this.endSlideShow;		
		};
		
};	//	fin de function CambiarVisibilidad...

function Iniciando( )
{
	runSlideShow();

	objBoton = document.getElementById( "btnEjecutar" );
	objBoton.childNodes[ 0 ].nodeValue = "Ver la galería";
	CambiarEvento( );

};	// fin de function Iniciando...

preLoadPic( j );

window.onload = function() { if( document.getElementById ) { Iniciando( ) }; };


	

