// JavaScript Document
$(document).ready(function() {
$(".hideMePlease").hide(); // hide divs inside initially
$('.desc').css({opacity: 0});


<!-- billboard cycle -->
$(function() {
	$('.billboard ul').cycle({ 
  		fx: 'fade', 
   		timeout: 8000 
	});
});


<!-- hover for project thumbnails -->
$(".desc").hover( 
function() {
$(this).stop().animate({"opacity": "0.85"}, "normal");
},
function() {
$(this).stop().animate({"opacity": "0"}, "normal");
});



<!-- shows carousel now that everything should be loaded to avoid ugly flash.... -->
$(".gallery").css("visibility","visible"); 

<!-- gallery cycle -->
$(function() {
	$('.gallery ul').cycle({ 
  		fx: 'fade',
		timeout: 0,
		next: '#next',
		prev: '#prev',
		before: onBefore,
		after: onAfter

        });
});

<!-- function animating content below the slides -->
function onBefore() {

	//get the height of the current slide
		var $ht = $(this).height();
		//set the container's height to that of the current slide
		// $(this).parent().css("height", $ht);
		$(this).parent().animate({height: $ht});
} 


<!-- function for current and total slides -->
function onAfter(curr,next,opts) {
        var caption1 = '[ '+ (opts.currSlide + 1) + ' of ' + opts.slideCount + ' ]';
        $('.count').html(caption1);
} 




<!-- search box -->
  $('input.searchMe').focus(function(){
    $(this).css({borderColor:"#333333"});
  });
   $('input.searchMe').blur(function(){
    $(this).css({borderColor:"#686868"});
  });


<!-- contact form validation -->
$(function() {
  $('.error').hide();
  $('input.text-input').css({backgroundColor:"#424242"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#333333"});
  });
   $('.footer textarea').focus(function(){
    $(this).css({backgroundColor:"#333333"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#424242"});
  });
   $('.footer textarea').blur(function(){
    $(this).css({backgroundColor:"#424242"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  var name = $("input#name").val();
		if (name == "" || name == "your name") {
      $("label#name_error").show();
      $("input#name").focus();
      return false;
    }
		var emailAddress= $("input#emailAddress").val();
		if (emailAddress== "" || emailAddress=="your email address (never shared)") {
      $("label#email_error").show();
      $("input#emailAddress").focus();
      return false;
    }
	
	/* 
	var company = $("input#company").val();*/
	
		var theMessage = $("textarea#theMessage").val();
		if (theMessage == "" || theMessage =="your message") {
      $("label#theMessage_error").show();
      return false;
    } 
	
		
	var dataString = 'name='+ name + '&emailAddress=' + emailAddress+ '&theMessage=' + theMessage;
		//alert (dataString);return false;
		
	  $.ajax({
      type: "POST",
      url: "/bin/process_new.php",
      data: dataString,
      success: function() {
        $('#contact_form').html("<div id='message'></div>");
        $('#message').html("<h3 class=\"contactMe\">Success!</h3>")
        .append("<p>Thank you for contacting me. If your message requires a response, I'll be in touch soon.</p>")
        .hide()
        .fadeIn(1500, function() {
          $('#message').append("");
        });
      }
     });
    return false;
	});
});


}); 