﻿/* ---------------------------------------------------------------------------------- */
/* ----- Functies: onLoad ----------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

$(document).ready(function() {
	$('#popup-overlay').height($('body').height());
	
	$('.address').click(function() {
		showPopup('adres.html');
    });
	
	$('.contact').click(function() {
		showPopup('contact.php');
    });
	
	$('#close').click(function() {
        $('#popup-content').hide();
        $('#popup-overlay').fadeOut();

        return false;
    });
	
    $('.buttons li a').click(function() {
		$(this).parents('ul').find('li').removeClass('active');
		$(this).parent('li').addClass('active');
		
		$('.items li.active').removeClass('active').fadeOut();
		$($(this).attr('href')).addClass('active').fadeIn();
				
        return false;
    }).filter(':first').click();
	
	$(window).scroll(function() {
		if ($(window).scrollTop() > 120) {
			if ($('body').height()-($(window).scrollTop()+$('.portfolio-inner .items').height()+20) > 240) {
				$('.portfolio-inner .items').css({'top': $(window).scrollTop()+20}, 'fast');
			}
		} else if ($(window).scrollTop() < 120) {
			$('.portfolio-inner .items').css({'top': 120}, 'fast');
		}
		
		
		
		//alert(screen.height-$('.portfolio-inner .items').height()-$('.footer').height()-$('.copyright-height').height()-$(window).scrollTop());
	});
});

/* ---------------------------------------------------------------------------------- */
/* ----- Functies: Algemeen --------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

function showPopup(url) {
	$('html, body').animate({scrollTop:0}, 'fast');
	$('#popup-overlay').fadeIn();

	setTimeout(function() {
		$('#popup-content iframe').attr('src', url);
		$('#popup-content').show();
	}, 500);

	return false;
}
