
jQuery.fn.simpleSlide = function(a){
 
    a               = a || {};
    a.duration      = a.duration || 4000;
    a.transition    = a.transition || 1000;
    a.stopAt        = a.stopAt || false;
 
    var c   = $(this);
 
    $(c).css("position","relative");
 
    $("img",$(c))
        .css({
            'position'  : 'absolute',
            'top'       : '0px',
            'left'      : '0px',
            'z-index'   : '8'
            })
        .find(":first")
            .addClass("slide-active")
            .css('z-index','10');
 
    var cnt         = 0;
 
    var interval    = setInterval(function(){
 
            if(!isNaN(a.stopAt)){
                cnt++;
                if(cnt==a.stopAt){
                    clearTimeout(interval);
                }
            }
 
            var $active = $("img.slide-active",$(c));
 
            if($active.length == 0) $active = $("img:last",$(c));
 
            var $next   = $active.next().length ? $active.next() : $("img:first",$(c));
 
            $active
                .addClass("slide-last-active")
                .css('z-index','9');
 
            $next
                .css({opacity: 0.0})
                .addClass("slide-active")
                .css('z-index','10')
                .animate({opacity: 1.0}, a.transition, function(){
                    $active
                        .removeClass('slide-active slide-last-active')
                        .css('z-index','8');
                });
        }, a.duration);
 
}

$(document).ready(function(){
 
    $("#animacion").simpleSlide({duration:5500,transition:1200});
 
});




$(document).ready(function(){


	var tab = $('#volver');
	tab.mouseenter(function(){
		$(this).stop().animate({
			width:140,
			left:65
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			width:100,
			left:105
		}, 500);
	});


	var tab = $('#queimada');
	tab.mouseenter(function(){
		$(this).stop().animate({
			width:160,
			right:45
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			width:130,
			right:75
		}, 500);
	});




	var tab = $('#volver2');
	tab.mouseenter(function(){
		$(this).stop().animate({
			width:140,
			left:65
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			width:100,
			left:105
		}, 500);
	});




	var tab = $('#subir');
	tab.mouseenter(function(){
		$(this).stop().animate({
			height:65
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			height:50
		}, 500);
	});





	var tab = $('.fotoslados1');
	tab.mouseenter(function(){
		$(this).stop().animate({
			width:280,
			height:188,
			left:-75,
			top:48
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			width:200,
			height:133,
			left:5,
			top:90
		}, 500);
	});




	var tab = $('.fotoslados2');
	tab.mouseenter(function(){
		$(this).stop().animate({
			width:280,
			height:188,
			left:-75,
			top:258
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			width:200,
			height:133,
			left:5,
			top:270
		}, 500);
	});




	var tab = $('.fotoslados3');
	tab.mouseenter(function(){
		$(this).stop().animate({
 			width:280,
			height:188,
			right:-76,
			top:48
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			width:200,
			height:133,
			right:4,
			top:90
		}, 500);
	});



	var tab = $('.fotoslados4');
	tab.mouseenter(function(){
		$(this).stop().animate({
 			width:280,
			height:188,
			right:-76,
			top:250
		}, 250);
	});

	tab.mouseout(function(){
		$(this).stop().animate({
			width:200,
			height:133,
			right:4,
			top:270
		}, 500);
	});






	var tab = $('#idi-esp');
	tab.mouseenter(function(){
		$('#idiomas').stop().animate({
			bottom:-10
		}, 250);
		$('#capainfoidioma').stop().animate({
			bottom:55,
			opacity:1
		}, 250);
		$('.triangle-right').stop().animate({
			opacity:1
		}, 250);
	});

	tab.mouseout(function(){
		$('#capainfoidioma').stop().animate({
			bottom:25,
			opacity:0
		}, 500);
		$('#idiomas').stop().animate({
			bottom:-20
		}, 250);
		$('.triangle-right').stop().animate({
			opacity:0
		}, 250);
	});




	var tab = $('#idi-ing');
	tab.mouseenter(function(){
		$('#capainfoidioma').stop().animate({
			bottom:55,
			opacity:1
		}, 250);
		$('#idiomas').stop().animate({
			bottom:-10
		}, 250);
		$('.triangle-right').stop().animate({
			opacity:1
		}, 250);
	});

	tab.mouseout(function(){
		$('#capainfoidioma').stop().animate({
			bottom:25,
			opacity:0
		}, 650);
		$('#idiomas').stop().animate({
			bottom:-20
		}, 250);
		$('.triangle-right').stop().animate({
			opacity:0
		}, 250);
	});


	var tab = $('#idi-de');
	tab.mouseenter(function(){
		$('#capainfoidioma').stop().animate({
			bottom:55,
			opacity:1
		}, 250);
		$('#idiomas').stop().animate({
			bottom:-10
		}, 250);
		$('.triangle-right').stop().animate({
			opacity:1
		}, 250);
	});

	tab.mouseout(function(){
		$('#capainfoidioma').stop().animate({
			bottom:25,
			opacity:0
		}, 650);
		$('#idiomas').stop().animate({
			bottom:-20
		}, 250);
		$('.triangle-right').stop().animate({
			opacity:0
		}, 250);
	});

});







function cambiatxt(idioma, izquierda, visible) {



	document.getElementById("infoidioma").innerHTML="Cambiar a idioma "+idioma;
	
	document.getElementById("capainfoidioma").style.left=izquierda+"px";
	

}



var arriba;
function subir() {
	if (document.body.scrollTop != 0 || document.documentElement.scrollTop != 0) {
		window.scrollBy(0, -35);
		arriba = setTimeout("subir()", 5);
	} else {
		clearTimeout(arriba);
	}
}
