$(document).ready(function() {
  
  $('#myForm').ajaxForm(function(data) {
    //create the recaptcha form on AJAX submit
      
    if (data==1){
      $('#success').fadeIn("slow");
      $('#myForm').resetForm();
    }
    else if (data==2){
      $('#badserver').fadeIn("slow");
    }
    else if (data==3)
    {
      $('#bademail').fadeIn("slow");
    }
  });
});







var theInt = null;
var $crosslink, $navthumb;
var curclicked = 0;

theInterval = function(cur){
  clearInterval(theInt);

  if( typeof cur != 'undefined' )
  curclicked = cur;

  $crosslink.removeClass("active-thumb");
  $navthumb.eq(curclicked).parent().addClass("active-thumb");
  $(".stripNav ul li a").eq(curclicked).trigger('click');

  theInt = setInterval(function(){
    $crosslink.removeClass("active-thumb");
    $navthumb.eq(curclicked).parent().addClass("active-thumb");
    $(".stripNav ul li a").eq(curclicked).trigger('click');
    curclicked++;
    if( 6 == curclicked )
    curclicked = 0;
  }, 1000000);
};

$(function(){
  $("#main-photo-slider").codaSlider();

  $navthumb = $(".nav-thumb");
  $crosslink = $(".cross-link");

  $navthumb
    .click(function() {
      var $this = $(this);
      theInterval($this.parent().attr('href').slice(1) - 1);
      return false;
  });
  theInterval();
});






//Fading of the partner thumbs
$(document).ready(function(){
  $(".thumbs img").fadeTo("slow", 0.5); // The opacity of the thumbs on load

  $(".thumbs img").hover(function(){
    $(this).fadeTo("slow", 1.0); // The opacity of the thumbs on hover
  },function(){
    $(this).fadeTo("slow", 0.5); // The opacity of the thumbs on mouseout
  });

  //Fading of the gallery thumbs
  $(".galleryWrapper img").fadeTo("slow", 0.4); // The opacity of the thumbs on load

  $(".galleryWrapper img").hover(function(){
    $(this).fadeTo("slow", 1.0); // The opacity of the thumbs on hover
  },function(){
    $(this).fadeTo("slow", 0.4); // The opacity of the thumbs on mouseout
  });
});