$(document).ready(function() { 
	$(".sh").bind('mouseover', function(e) { 
        var rel = $(this).attr('rel');
        $('.'+rel).show();
	});
	$(".sh").bind('mouseout', function(e) { 
        var rel = $(this).attr('rel');
		$('.'+rel).hide();
    });
	$(".shclick").bind('click', function(e) { 
        var rel = $(this).attr('rel');
        $('.'+rel).show(); 
	});
	$(".shClose").bind('click', function(e) { 
        var rel = $(this).attr('rel');
		$('.'+rel).hide();
    });
	
	// showhide paises
	$("#mapaPaises li div").hide();
	$("#mapaPaises li a").mouseover (function(){
		$("#mapaPaises li div").hide();
        $(this).next().animate({ opacity: "show" }, "fast");
	});
	$("#mapaPaises li a").mouseout (function(){
        $(this).next().hide();
	});
	
	$('ul.selColors a').click( function() {
		var id = this.id.substring(5); //color1
		if (!id) {			
			$('#selectedColor').empty();
		} else {
			$('#selectedColor').html($(this).children('img').clone());
		}		
		$('#idColor').val(id);
		return false;
	});
	
	$('#search').keydown(function(e) {
		if(e.which==13) this.form.submit();
	});	
	
	// Movimiento subir
    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
	if ( $('#timeline').html() != null ) {
	   $('#timeline').localScroll.hash({
		  target:'#content_history'
	   });
	}
});

// carousel home
function remove() {
	$("#hdphoto").hide();
	$(".carouselhome").show();
	$(".carouselhome .jCarouselLite").jCarouselLite({
		btnNext: ".carouselhome .next",
		btnPrev: ".carouselhome .prev",
		vertical: false,
		auto:0,
	});
}

// videos
function cambioVideo(src) {
	youtube = 	"<object width=\"270\" height=\"200\">"
	youtube += "<param name=\"movie\" value=\"" + src + "\"></param>"
	youtube += "<param name=\"wmode\" value=\"transparent\"></param>"
	youtube += "<embed src=\"" + src + "&autoplay=1\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"270\" height=\"200\"></embed>"
	youtube += "</object>"

	$("#previewImg").html(youtube)
	   return true
}
