$(document).ready(function() {
	
	/**
	var screenHeight	=	$(window).height() - 768;
	screenHeight		=	screenHeight / 2;
	$.ajax({
		type		:	'GET',
		url			:	'includes/request.php?margin=' + screenHeight,
		success		:	function(response) {
			if(response == 'set') {
				$('#site').css({
					marginTop	:	screenHeight + 'px'
				});
			}
		}
	});
	**/
	(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)
	//	Image preloader
	jQuery.preLoadImages("images/slideshow/intro.jpg", "images/slideshow/slide2.jpg", "images/slideshow/slide3.jpg", "images/slideshow/slide4.jpg", "images/slideshow/slide5.jpg", "images/slideshow/slide6.jpg", "images/slideshow/slide7.jpg", "images/slideshow/slide8.jpg", "images/slideshow/slide9.jpg", "images/slideshow/slide10.jpg", "images/slideshow/slide11.jpg");
	
	window.setTimeout(function() {
		$('#logo_intro').fadeIn(500, function() {
			$('#slideshow').fadeIn(500);
			window.setTimeout(function() {
				$('#logo_intro').hide();
			   	$('#logo').show();
			   	$('#menu').fadeIn(1000);
			   	$('#footer').fadeIn(1000);
			}, 2500);
		});
	}, 250);
	
	$('#slideshow').cycle({ 
		fx:     'fade', 
		speed:   1500, 
		timeout: 5000, 
		next:   '#slideshow', 
		pause:   7
	});
	
	$('.scroll .next').click(function() {
		$('.scroll').animate({left:'-660px'}, 500);
	});
	$('.scroll .prev').click(function() {
		$('.scroll').animate({left:'0px'}, 500);
	});
	
    $('#menu .item a').dropShadow({left: 0, top: 0, opacity: 0.5, blur: 1, color: "#000"});
	$('#menu .item a.active').removeShadow();
	
    $('#footer #center #copy').dropShadow({left: 0, top: 0, opacity: 0.5, blur: 1, color: "#000"});
    $('#footer #center #links a').dropShadow({left: 0, top: 0, opacity: 0.5, blur: 1, color: "#000"});
	
});

$(window).unload( function () {
	$.ajax({
		url : 'request.php'
	});
} );


