
$(document).ready(function(){

	// Homepage image
	$('#home').css({'display' : 'none'}).fadeIn(1500);	

	// Logo
	$("#header h1").fadeTo("fast", 1.0); // pageload
	$("#header h1, #main .service img").hover(function(){
		$(this).fadeTo("fast", 0.6); // hover
	},function(){
		$(this).fadeTo("fast", 1.0); // mouseout
	});
	
	// View Portfolio
	$("#home #view-portfolio a").hover(function(){
		$(this).fadeTo("fast", 0.8); // hover
	},function(){
		$(this).fadeTo("fast", 1.0); // mouseout
	});

	// Fade in banner
	$('#banner').css({'display' : 'none'}).fadeIn(1000);

	// Clients
	$('#clients img').css({'display' : 'none'}).fadeTo(0, 1.0); // hide all logos
	// Incrementally fade them in
	$("#clients img").each(function (i) {
		var $item = $(this);
		setTimeout(function () { $($item).css({'display' : 'none'}).fadeIn(800); }, 70 * (i + 1));
	});
	// hover effect
	$("#clients img").hover(function(){
		$(this).fadeTo("fast", 0.8); // hover
	},function(){
		$(this).fadeTo("fast", 1.0); // mouseout
	});
	
	
	// Sidebar Buttons
	$("#sidebar #button li a").hover(function(){
		$(this).fadeTo("fast", 0.9); // hover
	},function(){
		$(this).fadeTo("fast", 1.0); // mouseout
	});

	
	// Portfolio hover effect
	$("#portfolio li a").hover(function(){
		$(this).fadeTo("fast", 0.75); // hover
	},function(){
		$(this).fadeTo("fast", 1.0); // mouseout
	});
	

	// Fancybox for portfolio - with description of what we did
	$("a.portfolio-popup").fancybox({
				'hideOnContentClick': false,
				'frameWidth': 900,
				'frameHeight': 490,
				'callbackOnShow': function() {
				  $("#popup #screenshot img").reflect({
							'height':0.15,
							'opacity':0.5
					  });
				}			
	});
	
	// Fancybox for portfolio - with description of what we did
	$("a.service-popup").fancybox({
				'hideOnContentClick': false,
				'frameWidth': 700,
				'frameHeight': 500,	
	});
	
	/* portfolio reflection */
	$("#portfolio li img").reflect({
		'height':0.15,
		'opacity':0.5
	});
	
	/* portfolio showcase reflection */
	$("#slider li img").reflect({
		'height':0.15,
		'opacity':0.4
	});
	
	// Fancybox for 'team'
	$("#sidebar #team a").fancybox({
				'frameWidth': 700,
				'frameHeight': 500
	});
	
	// Fancybox for 'services'
	/*
	$("#sidebar #services a").fancybox({
				'frameWidth': 700,
				'frameHeight': 500
	});
	*/

	// Footer links
	$("#footer ul li a, #blog-social a").fadeTo("fast", 1.0); // pageload
	$("#footer ul li a").hover(function(){
		$(this).fadeTo("fast", 0.5); // hover
	},function(){
		$(this).fadeTo("fast", 1.0); // mouseout
	});

/*
	$("#fact").load("http://www.emagine.ca/includes/fact/");
	var RefreshFact = setInterval(function() {
		$("#fact").load("http://www.emagine.ca/includes/fact/");
	}, 10000);
*/
	
	// Partner links
	$("#partners a").fadeTo("fast", 1.0); // pageload
	$("#partners a").hover(function(){
		$(this).fadeTo("fast", 0.5); // hover
	},function(){
		$(this).fadeTo("fast", 1.0); // mouseout
	});
	
	// Our Process
	
	$.localScroll.hash({
		target:'#holder',
		duration:1500
	});

	$.localScroll({
		target:'#holder',
		queue:true,
		duration:1500,
		hash:true
	});
	
	
	$('.sidemenu li a').click(function()
	{
	  $('.sidemenu li a').removeClass('active');
	  $(this).addClass('active');
	});



	
 });
