
$(document).ready(function() {

  $('ul#portfolio').innerfade({
    speed:1000,
    timeout:5000,
    type:'random_start',
    containerheight:'360px'
  });

  $('a.top').click(function(){
    $.scrollTo('body',800);
    return false;
  });

  $('.send_form').click(function() {
    $('#'+$(this).parents("form").attr("id")).submit();
  });

  $('.check_form').click(function(evento) {
    if(check_form()) {
      $('#'+$(this).parents("form").attr("id")).submit();
    } else {
      evento.preventDefault();
    }
  });

  $('.delete_form').click(function(evento) {
    delete_form();
    evento.preventDefault();
  });

  $('.select_change').change(function(evento) {
    $('#'+$(this).parents("form").attr("id")).submit();
    evento.preventDefault();
  });

  $("a[rel='colorbox']").colorbox({});
  $("a[rel='colorbox-gal']").colorbox({});
  $("a[rel='colorbox-html']").colorbox({fixedWidth:"910",fixedHeight:"520", iframe:true});

  $("#slider").easySlider({
    controlsBefore: "<p id='controls'>",
    controlsAfter: "<\/p>",
    auto: false,
    continuous: false
  });

  $('.print').click(function(evento) {    
    window.print();
    evento.preventDefault();
  });

  // Tooltip
  $('a.tooltip').qtip({
    position: {
      corner: {
        target: 'topMiddle',
        tooltip: 'bottomMiddle'
      },
      adjust: {
        y:7
      }
    },
    style: {
      name: 'dark',
      background: '#303030',
      padding: '10px 10px',
      width: {
        max: 210,
        min: 0
      },
      tip: true
    }
  });

});
