/*
Theme Name: Red Sky
Theme URI: http://www.redyskypr.com/
Author: Ryan Lascano (Carew Co., Inc.) | Kevin Powell (Snake River Technology)
Author URI: http://www.carewco.net/ | http://www.snakerivertechnology.com/

Global JavaScript functions.
*/

// Functions that load when the doc is ready.
jQuery(document).ready(function() {

	// Homepage slides
	jQuery('body#home #main').slides({
		preload: true,
		generateNextPrev: true,
		next: 'slide-next',
		prev: 'slide-prev',
		generatePagination: false,
		play: 5000,
		pause: 2500,
		hoverPause: true
	});
	
	// Superfish drop down menus
	jQuery('ul.sf-menu').superfish({
		autoArrows: false,
    	dropShadows: false					   
	}); 

});

// Functions that load after the rest of the page loads.
jQuery(window).load(function() {
	
	// Clears form fields on click
	jQuery('.newsletter-form input.text, .contact-form input.text, .comment-form input.text').each(function() { 
		jQuery(this).focus(function() {
		  if(jQuery(this).val() == this.defaultValue)
			jQuery(this).val("");
		  });
		  jQuery(this).blur(function() {
			if(jQuery(this).val() == "")
			  jQuery(this).val(this.defaultValue);
		  });
		});

	// Removes jump links from anchors that aren't links
	jQuery('#values ul.values-list a').click(function () {return false;});
	
	// Tooltip
	/*jQuery('#values ul.values-list a').mouseover(function(e) { 
		var tip = jQuery(this).attr('title');
		jQuery(this).attr('title','');
		jQuery(this).append('<div class="tooltip"><div class="tip-content">' + tip + '</div></div>'); 
	}).mouseout(function() {
		//Put back the title attribute's value
		jQuery(this).attr('title',jQuery('.tip-content').html());
		//Remove the appended tooltip template
		jQuery(this).children('.tooltip').remove();
	});*/
	
	jQuery('#clients .client-categories').masonry({
		singleMode: true,
		itemSelector: '.client-list' 
	});
	
	jQuery('#case-studies .case-categories').masonry({
		singleMode: true,
		itemSelector: '.case-list' 
	});
	
	jQuery('.tweet').tweet({
		username: 'redskypr',
		join_text: "auto",
		avatar_size: 0,
		count: 1,
		/*auto_join_text_default: "we said,", 
		auto_join_text_ed: "we",
		auto_join_text_ing: "we were",
		auto_join_text_reply: "we replied to",
		auto_join_text_url: "we were checking out",*/
		loading_text: 'loading tweets...'
	});
	
	//jQuery('.comment-author img, #case #sidebar img').corner('10px');

});
