//Limpiar el value de los inputs
function formDefaultValue (elemento, defaultValue) {
	if (elemento.value==defaultValue) {
		elemento.value = "";
	}
	return true;
}
function formDefaultValueCheck (elemento,defaultValue) {
	if(elemento.value == "") {
		elemento.value = defaultValue;
	}
}

//Igualar altura
/*
function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}
*/
$(document).ready(function(){
	$('#lang li:last, #menu li:last, #accesos-home li:last, #comite li a:last, .ponentes li:last').addClass("last");
	$('#menu li:first, #marcas li:first').addClass("first");
	$(".efectoImg").fadeTo("slow", 1.0);
	$(".efectoImg").hover(function(){
		$(this).fadeTo("slow", 0.6);},function(){
		$(this).fadeTo("slow", 1.0);
	});
	$("#creditos a").mouseover(function(event) {
		$("#anfibic").slideDown();
		setTimeout('$("#anfibic").slideUp();',5000);
	});

	//Aņado el Objeto Scroller
	$jScroller.add("#comite","#comite li","left",2, true);
	//Inicializo el Autoscroller
	$jScroller.start();

	var contador = 0;
	$( "#catList li" ).each(
		function(){
			if(contador == 4){
				$(this).addClass("last");					
				contador = 0;
			}else{ 
				contador++;
			}
		}
	);
	var contador = 0;
	$( ".ponentes li" ).each(
		function(){
			if(contador == 3){
				$(this).addClass("last");					
				contador = 0;
			}else{ 
				contador++;
			}
		}
	);
	
	//Remplazo las fuentes
	cuffonReplace();
	
	//Igualamos la altura de los bloques
	//equalHeight($(".ponentes li h2"));
	
	//Iniciamos los eventos de las IMG
	cambiaIMG.rollover.init();
});

//Eventos de las IMG
cambiaIMG = {};      
  cambiaIMG.rollover =
  {
     init: function()
     {
        this.preload();
        $(".imgH").hover(
           function () { $(this).attr( 'src', cambiaIMG.rollover.newimage($(this).attr('src')) ); },
           function () { $(this).attr( 'src', cambiaIMG.rollover.oldimage($(this).attr('src')) ); }
        );
     },
     preload: function()
     {
        $(window).bind('load', function() {
           $('.imgH').each( function( key, elm ) { $('<img>').attr( 'src', cambiaIMG.rollover.newimage( $(this).attr('src') ) ); });
        });
     },
     newimage: function( src ) { return src.substring( 0, src.search(/(\.[a-z]+)/) ) + '_hover' + src.match(/(\.[a-z]+)/)[0]; },
     oldimage: function( src ){ return src.replace(/_hover/, ''); }
  };

//Fuentes
function cuffonReplace(){
	Cufon.replace('#rethink h1, #flash_rethink', {fontFamily:'Century Gothic',hover:true});
}