$(document).ready(function(){
  
  $("#flickr_badge_wrapper a").attr("rel","shadowbox");
  
  $('p.field input, p.field textarea').each(function() {
      var orig_val =  $(this).val(); 
      var new_val = "";
      
  		$(this).focus(function() {
  		  if($(this).val() === new_val){
  		    $(this).addClass('focused');
  		  }else{
  			$(this).val('').addClass('focused');
  			}
  		});

  		$(this).blur(function() {
  			if($(this).val() === '') {
  				$(this).val(orig_val).removeClass('focused');
  			}
  			else{
  			  new_val = $(this).val();
  			}
  		});
  	});
  
  // featured image gallery
	$('#joypad .featured_thumbs a').click(function(){
	  $('#joypad .featured_thumbs a').removeClass('active');
		$(this).toggleClass('active');	  
		$('#joypad .screenshots div').hide();
	  $('#joypad .show_' + this.id).fadeIn(1000);
	  return false;
	});
  
  // featured image gallery
	$('#ctq .featured_thumbs a').click(function(){
	  $('#ctq .featured_thumbs a').removeClass('active');
	  $(this).toggleClass('active');	  
		$('#ctq .screenshots div').hide();
	  $('#ctq .show_' + this.id).fadeIn(1000);
	  return false;
	});
	
	// featured image gallery
	$('#stg .featured_thumbs a').click(function(){
	  $('#stg .featured_thumbs a').removeClass('active');
		$(this).toggleClass('active');	  
		$('#stg .screenshots div').hide();
	  $('#stg .show_' + this.id).fadeIn(1000);
	  return false;
	});

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

});
