//Preloader for images
function preloadImages() {
	var d = document;
	if(d.images){
		if(!d.pics)
			d.pics = new Array();
		var i ,j = d.pics.length, a=preloadImages.arguments;
		for(i = 0; i < a.length; i++)
		if (a[i].indexOf("#")!=0) {
			d.pics[j] = new Image();
			d.pics[j++].src = a[i];
		}
	}
}

$(function(){
	$('.drop').click(function() {
		$("#"+$(this).attr("rel")).slideToggle('slow');
	});
	
	if(window.is_home == true) {
		setTimeout('nextSlide()', 3000);
	}
});

if(window.is_home) {
	window.curr = 1;
	window.next = 2;
	function inc_curr() {
		window.curr++;
		window.next++;
		if(window.curr > 4) window.curr = 1;
		if(window.next > 4) window.next = 1;
	}

	function nextSlide() {
		$('#home_slide_'+window.next).css('display','block');
		$('#home_slide_'+window.curr).css('z-index','101');
		$('#home_slide_'+window.curr).fadeOut(1000, function(){
			$('#home_slide_'+window.curr).css('z-index','100');
			inc_curr();
			setTimeout('nextSlide()', 3000);
		});
	}
}
