/*
  Animacao no Menu
  @require: JQuery 1.4+
  @author: Rafael Reis - @orafaelreis
  @date:   01/02/2011
  @at:   Agencia Digital - http://www.sparkite.com.br
*/



jQuery(document).ready(function(){
  jQuery("#menu ul li").hover(function(){ anima(this) })
});

var menu_hover = 0;
anima = function(li){
  if(li.value == menu_hover)return 1;
  menu_hover = li.value;

  var x = 0;
  if( li.value == "1"){
    x = 5;
  }
  else if( li.value == "2" ){
    x = 120;
  }
  else if( li.value == "3"){
    x = 275;
  }
  else if( li.value == "4"){
    x = 435;
  }
  else if( li.value == "5"){
    x = 595;
  }
  else if( li.value == "6"){
    x = 730;
  }
  else if( li.value == "7"){
    x = 850;
  }

  jQuery("#menu_line").stop();
  jQuery("#menu_line").animate({"marginLeft": x},500,
      function(){ jQuery(this).animate({"width":30,"marginLeft": "+=20"},250,
        function(){jQuery(this).animate({"marginLeft":"-=20",width:70},500);}
      );
    });
}

function anima2(x){
  jQuery("#menu_line").stop();
  jQuery("#menu_line").animate({"marginLeft": x},500,
    function(){ jQuery(this).animate({"width":30,"marginLeft": "+=20"},250,
      function(){jQuery(this).animate({"marginLeft":"-=20",width:70},500);}
    );
  });
}
