// JavaScript Document

$(document).ready(function() {
	
	/* Images */
	if ($(".pgal").length > 0) {
		$(".pgal").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	}
	
	/* Modals */
	if ($(".iframe").length > 0) {
		$(".iframe").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	}
	
	/* Slides */
	$(".smallimg").css("overflow","hidden");
	$(".smallimg img").css({
		'position':'absolute',
		'top':'0',
		'left':'0'
	});
	$(".rollerimages").hide();
	$(".rollerimages:first").fadeIn("fast");
	var icurrent = 0;
	var inext;
	$(document).everyTime(8000, "index_slider", function() {
		inext = icurrent + 1;
		if ($(".rollerimages").is("#photo"+inext)) {
			$("#photo"+icurrent).fadeOut("slow");
			$("#photo"+inext).fadeIn("slow");
			icurrent = inext;
		} else {
			if (icurrent!=0) {
				$("#photo"+icurrent).fadeOut("slow");
				$("#photo0").fadeIn("slow");
				icurrent = 0;
			}
		}
	});
	
	/* Home */
	$(".img_cnt .pgal:not(:nth-child(3n)) img").addClass("mr9");
	
	if ($(".over").length > 0) {
		$(".over").css("opacity","0.8");
	}
});