function initEvents() {

// botones animado
	$(".menuItem")
		.css( {backgroundPosition: "0px 0px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0px 44px)"}, {duration:300})
	 }) 			

	$(".menuItem").mouseout(function(){ 
		$(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:300})
	})


// social links animado

    $("#social5")
      .css( {backgroundPosition: "0px 0px"} )
      .mouseover(function(){
        $("#social5 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px -10px)"}, {duration:200});
        $("#social5 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 8px)"}, {duration:200})
     })

    $("#social5").mouseout(function(){ 
      $("#social5 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
      $("#social5 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
    })
    
// ------- Social4 --------

    $("#social4")
      .css( {backgroundPosition: "0px 0px"} )
      .mouseover(function(){
        $("#social4 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px -10px)"}, {duration:200});
        $("#social4 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 8px)"}, {duration:200})
     }) 			

    $("#social4").mouseout(function(){ 
      $("#social4 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
      $("#social4 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
    })
    

// ------- Social3--------

    $("#social3")
      .css( {backgroundPosition: "0px 0px"} )
      .mouseover(function(){
        $("#social3 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px -10px)"}, {duration:200});
        $("#social3 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 8px)"}, {duration:200})
     })

    $("#social3").mouseout(function(){ 
      $("#social3 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
      $("#social3 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
    })

// ------- Social2 --------

    $("#social2")
      .css( {backgroundPosition: "0px 0px"} )
      .mouseover(function(){
        $("#social2 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px -10px)"}, {duration:200});
        $("#social2 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 8px)"}, {duration:200})
     })

    $("#social2").mouseout(function(){ 
      $("#social2 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
      $("#social2 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
    })

// ------- Social1 --------

    $("#social1")
      .css( {backgroundPosition: "0px 0px"} )
      .mouseover(function(){
        $("#social1 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px -10px)"}, {duration:200});
        $("#social1 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 8px)"}, {duration:200})
     })

    $("#social1").mouseout(function(){ 
      $("#social1 > .botonEnlaceSocialIcon").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
      $("#social1 > .botonEnlaceSocialReflejo").stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200})
    })


    
    if (controlador == 'trabajos') { var posicionar = setTimeout("posicionar()",500); }
    
}


function posicionar() {
  
    //location.href="#posicionador";
    //alert('nanana');
    
    $('html, body').animate({scrollTop:330}, 250);
    
}





function displace(posicion,objeto) {

    $("#"+ objeto)
        .stop()
        .animate(
            {left: posicion +"px"}, {duration:600}
        );

}
  


function setCookie(c_name,value,expiredays)
{
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  document.cookie=c_name+ "=" +escape(value)+
  ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}


function getCookie(c_name)
{
  if (document.cookie.length>0)
    {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
      {
      c_start=c_start + c_name.length+1;
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
      return unescape(document.cookie.substring(c_start,c_end));
      }
    }
  return "";
}



function apagaMensajes() {
  $('#mailOk').css({display : 'none'});
  $('#enviandoMail').css({display : 'none'});
  $('#mailError').css({display : 'none'});
}


function enviarConsulta(subject) {

  var nombre=$('#nombre').val();
  var email=$('#email').val();
  var consulta=$('#consulta').val();
  
  if ((nombre != '') && (email != ''))  {
    $.ajax({
          type: "POST",
          url: "/js/sendform.php",
          data: "nombre="+ nombre +"&email="+ email +"&consulta="+ consulta +"&subject="+ subject,
          
          success: function(datos){
          if (datos == 'sendOK')  {
            $('#enviandoMail').css({display : 'none'});
            $('#mailOk').css({display : 'block'});
            msgTO = setTimeout('apagaMensajes()',3000);
            } else {
            $('#enviandoMail').css({display : 'none'});
            $('#mailError').css({display : 'block'});
            msgTO = setTimeout('apagaMensajes()',3000);
            }
          },
          beforeSend: function(){
            $('#enviandoMail').css({display : 'block'});
          }
    });
  } else { 
    $('.obligatorio').css({color: 'red'});
    $('.obligatorio').css({fontWeight: 'bold'});
    alert('Completar los campos obligatorios!'); }

} 





