$(document).ready(function () {
	
	/*///////////////////// MAIN FUNCTIONS /////////////////////*/
	function centerObject(obj){
		var pageW = $(window).width();
		var pageH = $(window).height();
		var objW = $(obj).outerWidth();
		var objH = $(obj).outerHeight();
		$(obj).css({left: (pageW - objW)/2, top: ((pageH - objH)/2)-50});
	}
	function centerImg(obj){
		var pageW = $(window).width();
		var pageH = $(window).height();
		var objW = $(obj).outerWidth();
		var objH = $(obj).outerHeight();
		$(obj).css({left: (pageW - objW)/2, top: (pageH - objH)/2});
	}
	function sizetoWindow(obj){
		var pageW = $(document).width();
		var pageH = $(document).height();
		var objW = $(obj).outerWidth();
		var objH = $(obj).outerHeight();
		$(obj).css({width: pageW, height: pageH});
	}
	function fadeObject(obj, speed){
		$(obj).animate({opacity: 'toggle'}, {duration: (speed*1000), easing: 'easeOutQuad'});
	}
	function revealObject(obj, speed){
		$(obj).slideToggle(speed*1000);
	}
	function moveObject(obj, XPos, YPos, speed){
		$(obj).animate({left: XPos, top: YPos}, {duration: (speed*1000), easing: 'easeOutQuad'});
	}
	function highlightObject(obj, hex, speed){
		$(obj).effect("highlight", { color: hex }, (speed*1000));
	}
	
	function centerTitle(obj, parentObj){
		var parentW = $(parentObj).outerWidth();
		var parentH = $(parentObj).outerHeight();
		var objW = $(obj).outerWidth();
		var objH = $(obj).outerHeight();
		$(obj).css({left: (parentW - objW)/2, bottom: parentH - 5});
	}
	
	function loadImage (img, imgPath){
		$(img).fadeOut().hide('fast', removeContent);
		function removeContent() {
			$(img).removeAttr("height").attr({ src: imgPath }).load(imgPath,'',loadContent());
		}
		function loadContent() {
			$(img).show('fast', showContent());
		}
		function showContent() {
			$(img).show('fast').fadeIn();
		}
		return false;
	}
	
	/*///////////////////// HOVER FUNCTIONS /////////////////////*/	
	/*////////// CYCLE THROUGH BOXES //////////*/
	$('.item-box').each(function() {
		$(this).hover(function () { 
			$('a', this).css('cursor', 'pointer');
			centerTitle('.desc', this);
			//$('.desc', this).animate({opacity: 'toggle'}, {duration: (.25*1000), easing: 'easeOutQuad'});
			$('.img', this).animate({opacity: 1}, {duration: (.25*1000), easing: 'easeOutQuad'});
		}, function () {
			//$('.desc', this).hide();
			$('.img', this).animate({opacity: .5}, {duration: (.5*1000), easing: 'easeOutQuad'});
		});
	});
	
	/*///////////////////// INITIAL LOAD /////////////////////*/
	$('.item-box .img').css({opacity: .5});
	//$('.item-box .desc').hide().css('display','none');
	
	//$(window).load(function() {
		
	//});

});