//preload images
	(function($) {
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  $.preLoadImages = function() {
		var args_len = arguments.length;
		for (var i = args_len; i--;) {
		  var cacheImage = document.createElement('img');
		  cacheImage.src = arguments[i];
		  cache.push(cacheImage);
		}
	  }
	})(jQuery)

$(document).ready(function(){
						   
	//initial animation on pageload
	setTimeout(function(){ $("#content").animate({width:'500px'}, 600);  }, 0);
	setInterval(function(){ $("#mainImage").fadeIn(400);}, 0);
	setTimeout(function(){ $("#faded").animate({width:'146px'}, 400);  }, 1300);
	setInterval(function(){ $("#nav").fadeIn(500);}, 1900);
	setTimeout(function(){ $("#mainArea, #scrollBar").fadeIn(400);  }, 1200);
	
	setTimeout(function(){  getPage(1, 500, 'home');  }, 1100);
	//end initial animation on pageload


	
	
	//page scrolling	
	$('#content').serialScroll({
		target:'#mainArea',
		items:'span',
		prev:'#scrollUp',
		next:'#scrollDown',
		axis:'y',
		step:1,
		constant:true,
		lazy:true,
		offset:0, //when scrolling to photo, stop 230 before reaching it (from the left)
		force:false,
		stop:true,
		lock:false,
		cycle:false, //don't pull back once you reach the end
		jump: false //click on the images to scroll to them
		//exclude:0
	});
	//end page scrolling

   
 

   
 });

jQuery.preLoadImages("/images/main/about-us.jpg", "/images/main/contact.jpg", "/images/main/home.jpg", "/images/main/how-we-work.jpg", "/images/main/paula.jpg", "/images/main/portfolio.jpg", "/images/main/what-we-do.jpg");

function scrollBars(){
	$('#mainArea').jScrollPane({scrollbarWidth:10, scrollbarMargin:10});	
}
