<!--
//====================================================================
//
//	Nico van Veenendaal webdesign & -development
//	www.nicovanveenendaal.nl | info@nicovanveenendaal.nl
//          
//	Project: Helios Zonwering
//	Datum:   22-12-2011
//
//====================================================================

var carouselItems = new Array;
var currentScreen = 0;
var items = 0;
var tweenSpeed = 200;
var showTime = 5000;


jQuery(document).ready(function() 
{		
	// ====================================
	// ==== CAROUSEL
	// ====================================
	
	$("#visual li").each(function()
	{
		carouselItems.push($(this));
	});

	items = carouselItems.length;
	
	carouselTweener();
	

	$('a.lightbox').facebox();
	

	
	
	$('a.youtube').each(function(i)
	{
		var href = $(this).attr('href');
		
		$(this).attr('href', '#');
		$(this).attr('video', href);
	})
	
	
	$('a.youtube').click(function()
	{
		$('html').append('<div id="tekst"class="_hidden"><p>Dit is de tekst</p></div>');
	});
	
	
	
	
	

	// ====================================
	// ==== OVERVIEW
	// ====================================
	
	// ITEM TWEEN OVERVIEW SMALL
	$("#overviewSmall li").hover(function()
	{
		$(this).find(".normal").stop().animate({ opacity: "0" }, tweenSpeed);
		},function() {
		$(this).find(".normal").stop().animate({ opacity: "1" }, tweenSpeed);
	});

	// ITEM TWEEN OVERVIEW MIDDLE
	$("#overviewMiddle li").hover(function()
	{

		$(this).find(".normal").stop().animate({ opacity: "0" }, tweenSpeed);
		},function() {
		$(this).find(".normal").stop().animate({ opacity: "1" }, tweenSpeed);
	});

	// ITEM TWEEN OVERVIEW LARGE
	$("#overviewLarge li").hover(function()
	{

		$(this).find(".normal").stop().animate({ opacity: "0" }, tweenSpeed);
		},function() {
		$(this).find(".normal").stop().animate({ opacity: "1" }, tweenSpeed);
	});

	// ITEM TWEEN OVERVIEW BOTTOM
	$(".bottomBlock").hover(function()
	{
		$(this).stop().animate({ backgroundColor: "#495159" }, tweenSpeed);
		},function() {
		$(this).stop().animate({ backgroundColor: "#3b444c" }, tweenSpeed);
	});

	// ITEM HREF
	$(".item").click(function()
	{	
		if (!$(this).find("a").attr("href")) return;
		window.location=$(this).find("a").attr("href"); return false;
	});


	$(".item").addClass("hand");



	// ====================================
	// ==== FAQ
	// ====================================

	SSS_faq = {
		init : function() {
			$('ul.faq .answer').slideToggle('fast');
			$('ul.faq .question').click(function() { SSS_faq.toggle(this) });
		},

		toggle : function(elt) {
			$(elt).toggleClass('active');
			$(elt).siblings('.answer').slideToggle('fast');
		}
	}

	$(function() { 
		SSS_faq.init();
	});


	$(function()
	{
		$('.thumbs a').lightBox();
	});


	// ====================================
	// ==== TOOLTIP
	// ====================================

	$(".tooltip").tooltip(
	{ 
		bodyHandler: function()
		{
			//alert($($(this).attr('href')).attr('src'));
			return '<div class="shadow"><div style="background:#ffffff"><img src="' + $($(this).attr('href')).attr('src') + '" /></div></div>';
		},
		track: true,
		delay: 0,
		showURL: false,
		fixPNG: true,
		fade: 0

	});

	$('.tooltip').live('mouseover', function()
	{
		$("#tooltip").find(".shadow").shadow();
	});

});


function carouselTweener()
{
	if (carouselItems.length != 1)
	{
		jQuery(carouselItems[currentScreen]).removeClass("hidden").addClass("hiddenAlpha").animate({ opacity: 1}, tweenSpeed).delay(showTime).animate({ opacity: 0}, tweenSpeed);

		if(currentScreen < items-1) currentScreen++;
		else currentScreen = 0;

		carouselTimer();
	}
}

function carouselTimer()
{
	var t=setTimeout("carouselTweener()",showTime+tweenSpeed);
}
