$(function() {
    $('form').each(function() {
        $('input').keypress(function(e) {
            // Enter pressed?
            if(e.which == 10 || e.which == 13) {
                this.form.submit();
            }
        });
        $('.hiddensubmit').hide();
    });
});


/*
 * Rotating Quotation Effects
 */
$(document).ready(function() {
	$("#quotes-rotater li:gt(0)").animate({opacity: 0},0);
 
	var slideSwitch = function () {
		var $active = $('#quotes-rotater li.active');
	
		if ( $active.length == 0 ) $active = $('#quotes-rotater li:last');
		
		var $next =  $active.next().length ? $active.next()
			: $('#quotes-rotater li:first');
	
		$active.addClass('last-active');
		$active.animate({opacity: 0}, 2000);
	
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 2000, function() {
				$active.removeClass('active last-active');
			});
	}
	$(function() {
		setInterval( slideSwitch, 7000 );
	});
});


/*
 * i don't remember what site this is for
 */
$(document).ready(function(){
	$("#icons img").hover(function(){
		$(this).stop().animate({opacity: 0.75, marginTop: -10}, 400);
	},function(){
		$(this).stop().animate({opacity: 1.0, marginTop: 0}, 400);
	});
});

/*
 * i don't remember if this is necessary
 */
$(document).ready(function(){
	// Portfolio captions
	$(".tn-caption").animate({opacity: 0.05}, 1);
	$(".tn-caption").hover(function() {
	  $(this).animate({opacity: 0.7}, 200);
	}, function() {
	  $(this).animate({opacity: 0.05}, 200);
	});
	
	// Lightbox zoom icon
	$("a[rel^=lightbox]").hover(function() {
		$(".zoom").animate({opacity: 0.6}, 50);
	}, function() {
		$(".zoom").animate({opacity: 0.2}, 50);
	});
});


/*
 * Form UI Effects
 */
$(document).ready(function(){
	//global vars  
	var searchBoxes = $(".wpcf7-text, .comment-input, textarea, .search-form-input, .mailing-list-input");  
	var submitButtons = $(".wpcf7-submit, .search-form-submit, .comment-submit, .mailing-list-submit");  
	
	//Effects for inputs, textareas  
	searchBoxes.focus(function(e){  
	    $(this).addClass("activeInput");  
	});  
	searchBoxes.blur(function(e){  
	    $(this).removeClass("activeInput");  
	});  
	
	//Effects for submit buttons
	submitButtons.mouseover(function(e){  
	    $(this).addClass("activeSubmit");  
	});
	submitButtons.mouseout(function(e){  
	    $(this).removeClass("activeSubmit");  
	});
	
	
});

