// JavaScript Document

$(document).ready(function() {
	
	//History functie
 function load(num) {
            $('#Sites').load(num +".php");
        }

        $.history.init(function(url) {
                load(url == "" ? "2012" : url);
            });

        $('.Navaside a').live('click', function(e) {
                var url = $(this).attr('href');
                url = url.replace(/^.*#/, '');
                $.history.load(url);
                return false;
            });

	
	/* Contacformulier Button
	-----------------------------*/

	$("a.Contactformulier").click(function(event) {
	$('#ContactformHouder').animate({'height': '280px', 'top': '0px'}, 100);
	$('#wrapper').animate({'top': '280px'}, 100);});
	$("a#CloseContact, a.Portfolio, a.Home").click(function(event) {
		$('#wrapper').animate({'top': '0px'}, 100);
	$('#ContactformHouder').animate({'height': '0px', 'top': '-280px'}, 100);});

	/*
Smooth scroll declaration
--------------------------------*/
	$('a').smoothScroll();
		/*
Body fade in and out function
--------------------------------*/
    $("body").css("display", "none");
    $("body").fadeIn(2000);
	
/*
Nivoslider 
-------------------------------------------*/
       $("#featuredslider").nivoSlider(
         {design:"cold", pauseTime:5000}
       );
/*
Image hover function
--------------------------------*/
function imghover(){
$("a.zoom img,a.video img").mouseover(function(){
	$(this).stop(true,true);
	$(this).fadeTo(300, 0.6);
});
$("a.zoom img,a.video img").mouseout(function(){
	$(this).fadeTo(400, 1.0);
});
}
/*
fancy function
------------------------*/
function fancy(){
$("a.video").fancybox({
'titleShow'     : false,
'showCloseButton': true,
'transitionIn'	: 'elastic',
'transitionOut'	: 'elastic',
'easingIn'      : 'easeOutBack',
'easingOut'     : 'easeInBack'
}); 
}

/*Fancy youtube function */
$(".maltese").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'easingIn'      : 'easeOutBounce',
		'easingOut'     : 'easeOutBack',
		'titleShow'     : true,
			'title'			: this.title,
			'titlePosition'  : 'outside',
			'width'		: 420,
			'height'		: 345,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'false'
			}
		});

	return false;
});

/*Fancy iFrame function */
$(".iframe").fancybox({
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titleShow'     : true,
			'title'			: this.title,
			'titlePosition'  : 'outside',
		'type'				: 'iframe'
	});
/*
Carousel - Nieuwe sites - Home function
--------------------------------*/
$(function(){
	 $('#carousel ul').bxSlider({
	controls: true,
	infiniteLoop: true,
	displaySlideQty: 5,
	moveSlideQty: 1, 
	auto: false,
	auto: true,
	pause: 6000
});
});	
	/*
Animatie services navigatie homepage en links footer
-------------------------------------------*/
$('#navigation ul li a, .links ul li a').hover(function(){
	$(this).animate({
		paddingLeft : '17px'
	},200);	
},function(){
	$(this).animate({
		paddingLeft : '12px'
	},200);
	
},200);
});

/*
Carousel - Services - Homepage - Slides function
-------------------------------------------*/  
	 $(function(){
	$("#w_slides").wslide({
		width:620,
		height:250,
		horiz: true,
		autolink: false,
		effect: 'easeOutBounce',
		duration :1500
	}); 
	});
	
/*
sliding panel 
------------------------*/
$(function(){
	$("div.panel_button").click(function(){
		$("div#panel").animate({
			right: "0px"
		}, "fast");
		$(".panel_button").animate({
			right: "198px"
		}, "fast");
		$("div.panel_button").toggle();
});	
	
$("div.hide_button").click(function(){
	$("div#panel").animate({
		right: "-200px"
	}, "fast");
	$(".panel_button").animate({
		right: "0px"
	}, "fast");
});
// Button Project 1
$("a.Portfolio").click(function(event) {
										 event.preventDefault();
										 $('body, html').css('overflow','hidden')
										 								 
			 $("#apDiv1").show();
			 
		$("#apDiv1").delay(450).animate({'left': '0px'}, 700, 'easeInCirc');
			  $('#Overlay').delay(450).css('visibility','visible')
		$('#NieuwsItemEen').delay(850).animate({ 
      visibility: 'show',
      height: 'show'
    }, 650, 'easeInCirc');  		
		
});
// Close Portfolio
$("#closeNieuwsItem1").click(function(event) {
										
										 $('#NieuwsItemEen').animate({ 
      opacity: 'hide',
      height: 'hide'
    }, 650, 'easeOutCirc'); 
										 $("#apDiv1").delay(350).animate({'left': '-560px'}, 1100, 'easeOutCirc');
										$('#Overlay').delay(450).css('visibility','hidden')
										 $('body, html').css('overflow','')	
		
		
});
// Close Overlay
$("#Overlay").click(function(event) {
										
										 $('#Overlay').css('visibility','hidden')
										
										 $('#NieuwsItemEen').animate({ 
      opacity: 'hide',
      height: 'hide'
    }, 650, 'easeOutCirc'); 
										 $("#apDiv1").delay(350).animate({'left': '-560px'}, 1100, 'easeOutCirc');
										 $('body, html').css('overflow','')
});  
});


