$(document).ready(function() {

	$.trackPage('UA-98641-16');
	
	$('h1,h2,h3,li,p').each(
	    function(){
	        $(this).html($(this).html().replace(/\s([^\s<]{0,10})\s*$/,'&nbsp;$1'));
	    }
	);

	// Home Page
	if ($('body#home .slides img').length > 0) {
		var $cycle = $('body#home .slides').cycle({
			fx: 'fade',
			speed: 1000,
			timeout: 4000,
		    pause: true
		});
	}


	// Images within a project
	$('.imageViewer li').each(function() {
		
		if ($('.images', this).length > 0) {
			
			$(this).append('<div class="cyclethumbs"></div>');
			
			var $cyclethumbs = $('.cyclethumbs', this);
		
			var $cycle = $('.images', this).cycle({
				fx: 'fade',
				speed: 500,
				timeout: 3000,
				pager: $cyclethumbs,
				pagerEvent: 'mouseover', 
			    pauseOnPagerHover: true
			});
			
			$cyclethumbs.cycle('pause');
		}
	
	});

});



// Email Function
function dm(user,domain) {
	locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
}


	
/*
******************************
PLUGIN - Utility Functions 
Author: Jack Lukic - KNI (all plugins)
Notes: Used to extend jQuery functionality and shorten code
******************************
*/

jQuery.fn.extend({
	// test if el exists
	exists: function() {
		if(this.size() > 0) {
			return true;
		}
		else {
			return false;	
		}
	}
});