$(document).ready(function() {
  $("input[type='text']:first", document.forms[0]).focus();

  $(".send-btn").click(function() {
    var errors='';
    $.each($(".req"),function(i,e){
      if(e.value=='') {
        errors=1;
        alert('You must complete all required fields.');
        return false;
      }
    });
    if(errors=='') {
      $("#contact").submit();
    }
  });

  var sel='';

  $(".titlerow").hover(function() {
    if($(this).hasClass("titlerowsel")) {
      sel=1;
    }
    $(this).addClass("titlerowsel");
  }, function() {
    if(sel!=1) {
      $(this).removeClass("titlerowsel");
    }
  })

  $(".titlerow").click(function() {
    $(".titlerow").removeClass("titlerowsel");
    $(".titlerow").css("border-bottom","0px #cccccc solid");
    $(this).css("border-bottom","1px #cccccc solid");

    $(".contentrow").hide(0);
    $(".contentrow_"+$(this).attr("alt")).slideDown("medium");
    $(this).addClass("titlerowsel");
  });

});

$(window).load(function() {
  $('#slider').nivoSlider({
    effect: "fade",
    pauseTime:5000,
    controlNav:false,
    controlNavThumbs:false,
    prevText:'',
    nextText:''
  });
});
