// JavaScript Document

/* document ready container */
$(document).ready(function(){
	// init
	loadImage(); // load footer div with images
	$("#content_contact").hide(); // hide contact formulier
	$("#content_brochure").hide(); // hide brochure formulier
	$("#content_onze_klanten").hide(); // hide pagina 	
	
	// load twitter div (jason)
	$("#twitter").getTwitter({
		userName: "itchdezign",
		numTweets: 3,
		loaderText: "Tweets laden ...",
		slideIn: true,
		slideDuration: 750,
		showHeading: true,
		headingText: "Laatste tweets",
		showProfileLink: false,
		showTimestamp: false
	});
	
	// load menu
	//Fix Errors - http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup/	
	//Remove outline from links
	$("a").click(function(){
		$(this).blur();
	});	
	//When mouse rolls over
	$("li").mouseover(function(){
		$(this).stop().animate({height:'150px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});	
	//When mouse is removed
	$("li").mouseout(function(){
		$(this).stop().animate({height:'26px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});
	
	// logo slideshow
  $('.slideshow').cycle({
		fx: 'shuffle' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
	// contactformulier popup fancybox
	$("#various1").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});
	
	// portfolio webdesign popup fancybox
	$("#various2").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});
	
	// contactformulier popup fancybox
	$("#various3").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});
	
	// contactformulier popup fancybox
	$("#various4").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});
})

/* functions */
// load images functie tbv footer foto's
function loadImage(){    
	$(".comment-background").fadeTo(0,0.55);
	// getimage.php is the php file that gets my images from the images folder
	$.post("getImage.php", function(data){
			if(data.length >0) { 
			// evaluate the string to a group of objects
			myObject = eval(data);
			// create a slideshow with the image objects and drop them in the placeholder
			$('#imgcontainer').crossSlide({sleep:5,fade:2},myObject);
			}
	});
}
// laad de pagina content
function loadContent(id) {
	// pagina content
	$("#content").slideUp().fadeOut();
	$("#content").load("getPage.php?o="+id+"");
	$("#content").slideDown();
	// logo slideshow
	if (id == 0) {
		$("#content_logo").slideDown();
	}/* else if (id == 7) {
		$ ("#content_logo").slideDown();
	} */ else {
		$("#content_logo").fadeOut();
	}
	// link naar contactformulier
	if (id == 4) {
		$("#content_contact").slideDown();
	} else  {
		$("#content_contact").slideUp();
	}
	// link naar portfolio
	if (id == 1) {
		$("#content_brochure").slideDown();
	} else  {
		$("#content_brochure").slideUp();
	}
	// link naar portfolio
	if (id == 7) {
		$("#content_onze_klanten").slideDown();
	} else  {
		$("#content_onze_klanten").slideUp();
	}
	//break;
}
