function contadorEvento() {
	
	// Obtengo la fecha actual.
	var fecha_actual = new Date();
	
	// Declaro la fecha a la que quiero llegar.
	var fecha_final = new Date("July 22 2010 21:00:00");

	// Ejecuto el script cuando la fecha actual sea menor a la esperada.
	if(fecha_final >= fecha_actual){
		
		// Operaciones para sacar los datos.
		days = (fecha_final - fecha_actual) / 1000 / 60 / 60 / 24;
		daysRound = Math.floor(days);
		hours = (fecha_final - fecha_actual) / 1000 / 60 / 60 - (24 * daysRound);
		hoursRound = Math.floor(hours);
		minutes = (fecha_final - fecha_actual) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
		minutesRound = Math.floor(minutes);
		seconds = (fecha_final - fecha_actual) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
		secondsRound = Math.round(seconds);
		
		// Contador de segundos.
		if (secondsRound <= 9) {
			document.getElementById('segundos_1').innerHTML = '<img src="img/contador/segundos/0.gif" width="14" height="26" />';
			document.getElementById('segundos_2').innerHTML = '<img src="img/contador/segundos/'+secondsRound+'.gif" width="14" height="26" />';	
		} else {
			document.getElementById('segundos_1').innerHTML = '<img src="img/contador/segundos/'+Math.floor(secondsRound/10)+'.gif" width="14" height="26" />';
			document.getElementById('segundos_2').innerHTML = '<img src="img/contador/segundos/'+(secondsRound%10)+'.gif" width="14" height="26" />';		
		}
		
		// Contador de minutos.	
		if (minutesRound <= 9) {
			document.getElementById('minutos_1').innerHTML = '<img src="img/contador/0.gif" width="14" height="26" />';
			document.getElementById('minutos_2').innerHTML = '<img src="img/contador/'+minutesRound+'.gif" width="14" height="26" />';	
		} else {
			document.getElementById('minutos_1').innerHTML = '<img src="img/contador/'+Math.floor(minutesRound/10)+'.gif" width="14" height="26" />';
			document.getElementById('minutos_2').innerHTML = '<img src="img/contador/'+(minutesRound%10)+'.gif" width="14" height="26" />';		
		}
		
		// Contador de horas.	
		if (hoursRound <= 9) {
			document.getElementById('horas_1').innerHTML = '<img src="img/contador/0.gif" width="14" height="26" />';
			document.getElementById('horas_2').innerHTML = '<img src="img/contador/'+hoursRound+'.gif" width="14" height="26" />';		
		} else {
			document.getElementById('horas_1').innerHTML = '<img src="img/contador/'+Math.floor(hoursRound/10)+'.gif" width="14" height="26" />';
			document.getElementById('horas_2').innerHTML = '<img src="img/contador/'+(hoursRound%10)+'.gif" width="14" height="26" />';	
		}
		
		// Contador de dias.		
		if (daysRound <= 9) {
			document.getElementById('dias_1').innerHTML = '<img src="img/contador/0.gif" width="14" height="26" />';
			document.getElementById('dias_2').innerHTML = '<img src="img/contador/0.gif" width="14" height="26" />';
			document.getElementById('dias_3').innerHTML = '<img src="img/contador/'+daysRound+'.gif" width="14" height="26" />';		
		}
		if (daysRound <= 99) {
			document.getElementById('dias_1').innerHTML = '<img src="img/contador/0.gif" width="14" height="26" />';
			document.getElementById('dias_2').innerHTML = '<img src="img/contador/'+Math.floor((daysRound/10)%10)+'.gif" width="14" height="26" />';
			document.getElementById('dias_3').innerHTML = '<img src="img/contador/'+Math.floor(daysRound%10)+'.gif" width="14" height="26" />';								
		}
		if (daysRound <= 999){
			document.getElementById('dias_1').innerHTML = '<img src="img/contador/'+Math.floor(daysRound/100)+'.gif" width="14" height="26" />';	
			document.getElementById('dias_2').innerHTML = '<img src="img/contador/'+Math.floor((daysRound/10)%10)+'.gif" width="14" height="26" />';
			document.getElementById('dias_3').innerHTML = '<img src="img/contador/'+Math.floor(daysRound%10)+'.gif" width="14" height="26" />';	
		}
		
		//  Ejecuto la funcion cada segundo.
		var getTime = window.setTimeout("contadorEvento();", 1000);
	
	} else {
	
		document.getElementById('segundos_2').innerHTML = '<img src="img/contador/segundos/0.gif" width="14" height="26" />';	
	
	}
		
}

/*****************************************************************************
The sIFR configuration should typically go in `sifr-config.js`, but in order to
keep the config file clean, and to give a quick overview, it's done here instead.
*****************************************************************************/
var goudy = {
  src: 'swf/goudy.swf'
};

// You probably want to switch this on, but read <http://wiki.novemberborn.net/sifr3/DetectingCSSLoad> first.
// sIFR.useStyleCheck = true;
sIFR.activate(goudy);

sIFR.replace(goudy, {selector: '.texto_blanco' ,css: ['.sIFR-root {color: #FFFFFF; }','a { text-decoration: none; }','a:link { color: #FFFFFF; }','a:hover { color: #FFFFFF; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.texto_blanco_mediano' ,css: ['.sIFR-root {color: #FFFFFF; }','a { text-decoration: none; }','a:link { color: #FFFFFF; }','a:hover { color: #FFFFFF; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.texto_blanco_chico' ,css: ['.sIFR-root {color: #FFFFFF; }','a { text-decoration: none; }','a:link { color: #FFFFFF; }','a:hover { color: #FFFFFF; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.texto_rosa' ,css: ['.sIFR-root {color: #DD0369; }','a { text-decoration: none; }','a:link { color: #DD0369; }','a:hover { color: #DD0369; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.texto_rosa' ,css: ['.sIFR-root {color: #DD0369; }','a { text-decoration: none; }','a:link { color: #DD0369; }','a:hover { color: #DD0369; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.texto_rosa_mediano' ,css: ['.sIFR-root {color: #DD0369; }','a { text-decoration: none; }','a:link { color: #DD0369; }','a:hover { color: #DD0369; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.texto_rosa_mediano2' ,css: ['.sIFR-root {color: #DD0369; }','a { text-decoration: none; }','a:link { color: #DD0369; }','a:hover { color: #DD0369; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.texto_rosa_chico' ,css: ['.sIFR-root {color: #DD0369; }','a { text-decoration: none; }','a:link { color: #DD0369; }','a:hover { color: #DD0369; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.estilosConvocatoria h1' ,css: ['.sIFR-root {color: #DD0369; }','a { text-decoration: none; }','a:link { color: #DD0369; }','a:hover { color: #DD0369; }'], wmode: 'transparent'});
sIFR.replace(goudy, {selector: '.estilosConvocatoria h2' ,css: ['.sIFR-root {color: #FFFFFF; }','a { text-decoration: none; }','a:link { color: #FFFFFF; }','a:hover { color: #FFFFFF; }'], wmode: 'transparent'});


// Preloader de "Fotografias Belleza".
var cargaFotografias = function() {
	xajax.dom.create("img_belleza","div", "img_belleza");
  	xajax.$('img_belleza').innerHTML='<div align="center"><div id="cargando"><img src="img/loading.gif"></div><div class="msg_cargando">Cargando fotograf&iacute;a...</div></div>';
}

// Preloader de "Contacto.
var enviaFormularioContacto = function() {
	xajax.dom.create("mensaje","div", "mensaje");
	var bg_mensaje = document.getElementById("bg_mensaje").style.display = 'block';	
  	xajax.$('mensaje').innerHTML='<table width="200" border="0" cellspacing="2" cellpadding="0" align="center" id="info"><tr><td colspan="2" align="left" class="info_title_bg"><span class="info_title"><b>Enviando...</b></span></td></tr><tr><td valign="middle" height="150" align="center" class="info_content_bg"><span class="campo texto info_content"><div><img src="img/loading2.gif" width="160" height="20" /></div><br /><div class="detalles cargando">Procesando...</div></span></td></tr></table>';
}

// Preloader de "Video".
var cargaVideo = function() {
	xajax.dom.create("bg_player_location","div", "bg_player_location");
  	xajax.$('bg_player_location').innerHTML='<div align="center"><div id="cargando"><img src="img/loading.gif"></div><div class="msg_cargando">Cargando video..</div></div>';
}

// Preloader de "Imagen".
var cargaGaleria = function() {
	xajax.dom.create("imagen","div", "imagen");
  	xajax.$('imagen').innerHTML='<div align="center"><div id="cargando"><img src="img/loading.gif"></div><div class="msg_cargando">Cargando imagen..</div></div>';
}

// Funcion para cargar el video.
function createPlayerGrande(video, screenshot){

	var so = new SWFObject("swf/player.swf", "player", "500", "350", "9", "#000000");
	so.addParam("allowfullscreen ", "true");
	so.addParam('flashvars',"file=http://www.televisagdl.tv/nuestrabelleza/videos/"+ video +"&autostart=false");   
	//so.addVariable("idimagen", screenshot); <!-- cambiar por la ruta de la imagen -->
	so.write("bg_player_location");	

};

// Funciones para eliminar espacios en blanco en cadenas.
function lTrim(sStr){
	while (sStr.charAt(0) == " ")
	sStr = sStr.substr(1, sStr.length - 1);
	return sStr;
}

function rTrim(sStr){
	while (sStr.charAt(sStr.length - 1) == " ")
	sStr = sStr.substr(0, sStr.length - 1);
	return sStr;
}

function allTrim(sStr){
	return rTrim(lTrim(sStr));
}

// Funcion para cargar las imagenes.
function preload(images) {
    if (document.images) {
        var i = 0;
		var imagenes = '';
        var imageArray = new Array();
        imageArray = images.split(',');
        var imageObj = new Image();
        for(i=0; i<=imageArray.length-1; i++) {	
            imagenes += '<img src="img/bellezas/reinas/' + allTrim(imageArray[i]) + '" width="300" height="470" border="0"  class="corner iradius10" />';
        }
		document.getElementById("image_rotate").innerHTML = imagenes;
		// Oculto los banners.
		$("#image_rotate").find("img").css({"display" : "none"}).animate({opacity: "show"}, 2000);
		
		// Inicializo el plugin de rotacion de banners.
		$("#image_rotate").innerfade({ speed: 2000, timeout: 5000, type: 'random', containerheight: '285px'});		
    }
}
