$(document).ready(function(){

/***** POSTS *****/

$('.content .hentry:last').addClass('last-post');

$('.commentlist .comment').each(function(){
	$(this).addClass('clearfix');
});



/***** GET STARTED FORM MOD *****/

	$('.right-bar .gform_wrapper form input[type="text"]').each(function(){
	
		var inputVal = $(this).attr('value');
	
		$(this).focus(function(){
			if($(this).val() == inputVal){
				$(this).attr('value','');
				$(this).css('opacity','.75');
			}
		});
		
		$(this).keypress(function(){
			$(this).css('opacity','1');
		});
	
		$(this).blur(function(){
			if($(this).val().length == 0){
				$(this).attr('value',inputVal);
				$(this).css('opacity','1');
			}
		});
	});


	var textareaVal = $('.right-bar .gform_wrapper form textarea').attr('value');

	$('.right-bar .gform_wrapper form textarea').focus(function(){
		if($(this).val() == textareaVal){
			$(this).attr('value','');
			$(this).css('opacity','.75');
		}
	});
	
	$('.right-bar .gform_wrapper form textarea').keypress(function(){
			$(this).css('opacity','1');
		});

	$('.right-bar .gform_wrapper form textarea').blur(function(){
		if($(this).val().length == 0){
			$(this).attr('value',textareaVal);
			$(this).css('opacity','1');
		}
	});
	
	
	/***** Remove TAB Index on Contact Page *****/
	
	if($('.content .gform_wrapper').length > 0){
		$('.sidebar .gform_wrapper input, .sidebar .gform_wrapper textarea').each(function(){
			$(this).removeAttr('tabindex');
		});
	}


	/***** DROP DOWN *****/
	
	$('.mainNav ul.menu li').hover(function(){
		if($('ul',this).length > 0){
			$('ul',this).show();
			$(this).addClass('active');
		}
	}, function(){
		if($('ul',this).length > 0){
			$('ul',this).hide();
			$(this).removeClass('active');
		}
	});


	/************************************************************************ 
	Create a slide show;
	************************************************************************/
	$('.coda-slider-wrapper').each(function() { 
		$('.coda-slider .panel').hide();
		$('.coda-nav li a').eq(0).addClass('current');
		$('.coda-slider .panel').eq(0).show();
		$('.loading',slider).hide();
		
		var slider = $(this);
		
		$('.coda-nav li a', slider).click(function() { 
			$('a',slider).removeClass('current');
			$(this).addClass('current');
			counter = $(this).attr('href').replace('#','');
			$('.coda-slider .panel',slider).hide();
			
			$('.coda-slider .panel',slider).eq(counter-1).show();
			return false;
		});
		
	});


});




