$(document).ready(function(){

// Loop del logo que salta
 var loop = function(){
 $(".logo").animate({marginTop: "-27px"}, 400, 'easeInOutBack').animate({marginTop: "0px"}, 800, 'easeOutBounce', setTimeout(loop, 7000));
};
 // Arma el primer loop al segundo de haber entrado
 setTimeout(loop, 2000);



setTimeout(function(){
$(".logo1").animate({marginTop: "-27px"}, 400, 'easeInOutBack').animate({marginTop: "0px"}, 800, 'easeOutBounce');
                        }, 5000 ); 

// ANIMA EL LOGO
$(".logo").hover(function(){
	$(this).stop().css({cursor: 'pointer'}).animate({marginTop: "-27px"}, 400, 'easeInOutBack'); 
},function(){
	$(this).stop().css({cursor: 'default'}).animate({marginTop: "0px"}, 800, 'easeOutBounce'); 
});
// ROLL de Imagen
$(".block img").hover(function(){ $(this).fadeTo("fast", 0.7); },function(){ $(this).fadeTo("fast", 1.0); });
$(".portfolio-thumb").hover(function(){ $(this).fadeTo("fast", 0.7); },function(){ $(this).fadeTo("fast", 1.0); });
//
// Navigation
$("#filosofia").hover(function() {
	$(this).animate({backgroundPosition: '0px 248px '}, 400);
	$(".roll1").animate({opacity: "show", top: "25"}, 700, 'easeOutBounce');
 }, function() {
	$(this).animate({backgroundPosition: '0px 0px '}, 400);
	$(".roll1").animate({opacity: "hide", top: "-35"}, 400, 'easeInBack');
 });
 
 $("#servicios").hover(function() {
	$(this).animate({backgroundPosition: '-86px 248px '}, 10);
	$(".roll2").animate({opacity: "show", top: "25"}, 700, 'easeOutBounce');
 }, function() {
	$(this).animate({backgroundPosition: '-86px 0px '}, 10);
	$(".roll2").animate({opacity: "hide", top: "-35"}, 400, 'easeInBack');
 });

 $("#portfolio").hover(function() {
	$(this).animate({backgroundPosition: '-181px 248px '}, 10);
	$(".roll3").animate({opacity: "show", top: "25"}, 700, 'easeOutBounce');
 }, function() {
	$(this).animate({backgroundPosition: '-181px 0px '}, 10);
	$(".roll3").animate({opacity: "hide", top: "-35"}, 400, 'easeInBack');
 });
 
  $("#contacto").hover(function() {
	$(this).animate({backgroundPosition: '-273px 248px '}, 10);
	$(".roll4").animate({opacity: "show", top: "25"}, 700, 'easeOutBounce');
 }, function() {
	$(this).animate({backgroundPosition: '-273px 0px '}, 10);
	$(".roll4").animate({opacity: "hide", top: "-35"}, 400, 'easeInBack');
 });



// DECLARA VARIABLES
var c=$("#contenido");
var d=1600;


	
function g(){
	c.stop().scrollTo($("#s-filosofia"),d,{axis:"x",offset:{left:0,top:0}, easing:'easeInOutBack'});
	return false
}

function f(){
	c.stop().scrollTo($("#s-servicios"),d,{axis:"x",offset:{left:0,top:0}, easing:'easeInOutBack'});
	return false
}
function e(){
	c.stop().scrollTo($("#s-portfolio"),d,{axis:"x",offset:{left:0,top:0}, easing:'easeInOutBack'});
	return false
}
function b(){
	c.stop().scrollTo($("#s-contacto"),d,{axis:"x",offset:{left:0,top:0}, easing:'easeInOutBack'});
	return false
}
function h(){
	c.stop().scrollTo($("#s-bienvenidos"),d,{axis:"x",offset:{left:0,top:0}, easing:'easeInOutBack'});
	return false
}

$(".logo").live("click",h);
$("#filosofia").live("click",g);
$("#servicios").live("click",f);
$("#portfolio").live("click",e);
$("#contacto").live("click",b);


     //To switch directions up/down and left/right just place a "-" in front of the top/left attribute  
     //Vertical Sliding  
     $('.boxgrid.captionfull').hover(function(){  
         $(".cover", this).stop().animate({top:'198px'},{queue:false,duration:300});  
     }, function() {  
         $(".cover", this).stop().animate({top:'260px'},{queue:false,duration:600});  
     });  
     $('.boxgrid.filo').hover(function(){  
         $(".cover", this).stop().animate({top:'60px'},{queue:false,duration:300});  
     }, function() {  
         $(".cover", this).stop().animate({top:'260px'},{queue:false,duration:600});  
     }); 

     
$("#slider2").easySlider({ 
	numeric: true,
	pause: 5000,
	continuous: true,
	auto:	true
});
			
// ENVIO DE FORMULARIO AJAXXXXX
 $().ajaxStart(function() {
        $('.formenviar').show();
     }).ajaxStop(function() {
        $('.formenviar').hide();
    });
    $('#form, #formulario, #fo').submit(function() {
        $.ajax({
            type: 'POST',
            url: $(this).attr('action'),
            data: $(this).serialize(),
            success: function(data) {
            alert(data);
            $('#formulario').hide();
               // $('#result').html(data);

            }
        })
        
        return false;
    }); 

//

			
			
			

});
