$(function() {
	var bkHref = "imgs/background.png";
	
	$.preLoadImages([bkHref], function() {
		$("#siteBackground").fadeIn(2000);
	});
	
	$("#twentytwo_banner ul").cycle({
		pager: "#banner_navigation"
	});
	
	/* MODAL TRIGGERS */
	$("#twentytwo_galleryList ul:eq(0) li a").fancybox({
		overlayColor: '#000',
		titleShow: false,
		autoDimensions: true,
		width: 551,
		scrolling: 'no',
		padding: 0,	
		showCloseButton: false
	});
	
	$("#twentytwo_footer a[title='Contact'], li#true10 a, div#twentytwo_hometabs a[href='book.html']").fancybox({
	overlayColor: '#000',
	titleShow: false,
	autoDimensions: true,
	width: 551,
	scrolling: 'no',
	padding: 0
	});
	
	$("#twentytwo_socialnetwork a").mouseenter(function() {
		$(this).stop().animate({ marginLeft: 0});
	});
	$("#twentytwo_socialnetwork a").mouseleave(function() {
		$(this).stop().animate({ marginLeft: -25});
	});
	
	/* BACKGROUND COLOR CHANGING */
	
	spectrum();
	
	function spectrum(){
		var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
		$('#siteBackground .colorChanger').animate( { backgroundColor: hue }, 6000);
		spectrum();
	}
 
});


