$(document).ready(function () {
  $(".tweet").tweet({
    count: 3,
    avatar_size: 25,
    query: "#FP from:derekmaxson OR from:nedsud"

}).bind("empty", function() { $(this).append("No matching tweets found"); });; });

jQuery(function () {
  $('div#menu p.nav-box').hover(function () {
    $(this).children('span').toggle();
    $(this).css('cursor', 'pointer');
    return false;
  });

  var next_tweet = 1;

  var tweet_timer = setInterval(function () {
    slide_tweets(next_tweet);
  }, 21000);

  function slide_tweets(position) {

    if (position == 1) {
      $('li.tweet_odd').fadeOut();
      $('li.tweet_even').fadeOut();
      $('li.tweet_first').fadeIn();
      next_tweet = 2;
    }
    else if (position == 2) {
      $('li.tweet_odd').fadeOut();
      $('li.tweet_even').fadeIn();
      next_tweet = 3;
    }
    else if (position == 3) {
      $('li.tweet_even').fadeOut();
      $('li.tweet_odd').fadeOut();
      $('li.tweet_first').fadeIn();
      next_tweet = 1;
    }
  }

  var timer = setInterval(function () {
    slide($('a.right').attr('id'));
  }, 10000);
  function slide(position) {
    if (position == 1) {
      $('img#img1, div#c1').animate({ left: "0px" }, 1500);
      $('img#img2, div#c2').animate({ left: "980px" }, 1500);
      $('img#img3, div#c3').animate({ left: "1920px" }, 1500);
      $('a.left').attr('id', '3');
      $('a.right').attr('id', '2');
      $('div#content div.content-block').animate({ height: "1030px" }, 1500);
    }
    else if (position == 2) {
      $('img#img1, div#c1').animate({ left: "-980px" }, 1500);
      $('img#img2, div#c2').animate({ left: "0px" }, 1500);
      $('img#img3, div#c3').animate({ left: "980px" }, 1500);
      $('a.left').attr('id', '1');
      $('a.right').attr('id', '3');
      $('div#content div.content-block').animate({ height: "2660px" }, 1500);
    }
    else if (position == 3) {
      $('img#img1, div#c1').animate({ left: "-1920px" }, 1500);
      $('img#img2, div#c2').animate({ left: "-980px" }, 1500);
      $('img#img3, div#c3').animate({ left: "0px" }, 1500);
      $('a.left').attr('id', '2');
      $('a.right').attr('id', '1');
      $('div#content div.content-block').animate({ height: "1500px" }, 1500);
    }
    $('div#positions').attr('class', 'pos' + position);
  }

  $('div#positions a.l1, div#positions a.l2, div#positions a.l3').click(function () {
    clearInterval(timer);
    slide($(this).attr('id'));
    return false;
  });

  $('a.arrow').click(function () {
    clearInterval(timer);
    slide($(this).attr('id'));
    return false;
  });

  $('input#name').focus(function () { if ($('input#name').val() == 'Name') { $('input#name').val(''); } });
  $('input#name').blur(function () { if ($('input#name').val() == '') { $('input#name').val('Name'); } });

  $('input#email').focus(function () { if ($('input#email').val() == 'Email') { $('input#email').val(''); } });
  $('input#email').blur(function () { if ($('input#email').val() == '') { $('input#email').val('Email'); } });

  $('textarea#desired-info').focus(function () { if ($('textarea#desired-info').val() == 'Desired Information') { $('textarea#desired-info').val(''); } });
  $('textarea#desired-info').blur(function () { if ($('textarea#desired-info').val() == '') { $('textarea#desired-info').val('Desired Information'); } });

  $('input#company').focus(function () { if ($('input#company').val() == 'Company') { $('input#company').val(''); } });
  $('input#company').blur(function () { if ($('input#company').val() == '') { $('input#company').val('Company'); } });

  $('input#request').click(function () {
    var msg = "";
    if ($('input#name').val() == '' || $('input#name').val() == 'Name') {
      msg += "-Name Required\n";
      $("input#name").css("border", "solid #cc0000 1px").css("background-color", "#ffebe8");
    }
    else
      $("input#name").css("border", "solid #ddd 1px").css("background-color", "#fff");

    if ($('input#email').val() == '' || $('input#email').val() == 'Email') {
      msg += "-Email Required\n";
      $("input#email").css("border", "solid #cc0000 1px").css("background-color", "#ffebe8");
    }
    else
      $("input#email").css("border", "solid #ddd 1px").css("background-color", "#fff");

    if ($('input#company').val() == '' || $('input#company').val() == 'Company') {
      msg += "-Company Required\n";
      $("input#company").css("border", "solid #cc0000 1px").css("background-color", "#ffebe8");
    }
    else
      $("input#company").css("border", "solid #ddd 1px").css("background-color", "#fff");

    if ($('textarea#desired-info').val() == '' || $('textarea#desired-info').val() == 'Desired Information') {
      msg += "-Desired Information Required";
      $("textarea#desired-info").css("border", "solid #cc0000 1px").css("background-color", "#ffebe8");
    }
    else
      $("textarea#desired-info").css("border", "solid #ddd 1px").css("background-color", "#fff");

    if (msg != "") {
      alert(msg);
      return false;
    }
    else
      return true;
  });
});
