$(document).ready(function() {
	
	// Fancy Box
	$("a#single_image").fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: false,
		'zoomSpeedIn'			: 500,
		'zoomSpeedOut'			: 500
 	});
	
	$("a.group").fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: false,
		'zoomSpeedIn'			: 500,
		'zoomSpeedOut'			: 500
 	});
	
	// Open Portfolio links in a new window
	$('div.project a.new').click(function(){
        window.open(this.href);
        return false;
    });
	
	$('#home_feature a').click(function(){
        window.open(this.href);
        return false;
    });
	
	// Scroll to content
	$('p.skip a').click(function(){
		$.scrollTo('#content', 1500);
		return false;
	});
	
	
	$("a.to_the_top").click(function(){
		$("html, body").animate( { scrollTop: 0 }, 'slow' ); return false;
	});
	
	
	// Homepage Feature
	$("div.scrollable").scrollable({ 
		size:1,
		autoplay:true,
		loop:true,
		clickable:false
	}).autoscroll({interval:5000, speed:4000, autoplay:true, steps:1 }).circular().navigator({ 
	
		// select #flowtabs to be used as navigator 
        navi: "#poster_nav", 
 
        // select A tags inside the navigator to work as items (not direct children) 
        naviItem: 'a', 
 
        // assign "current" class name for the active A tag inside navigator 
        activeClass: 'current'
	});
	
	
	// If the window height is < 1024 set smaller homepage margins
	var height = $(window).height();
		
		if (height < 800) {
			//$('#oh, #haii').hide();
			$('#logo a, #biggiesmalls, #nav, #home_feature, #adpanels, #about, #why, #designdev, #work, #approach').addClass('lowres');
		}
		
	$(window).resize(function(){
		var height = $(window).height();
		
		if (height < 800) {
			//$('#oh, #haii').hide();
			$('#logo a, #biggiesmalls, #nav, #home_feature, #adpanels, #about, #why, #designdev, #work, #approach').addClass('lowres');
		}
		if (height >= 800) {
			//$('#oh, #haii').show();
			$('#logo a, #biggiesmalls, #nav, #home_feature, #adpanels, #about, #why, #designdev, #work, #approach').removeClass('lowres');
		}
	});

	
});
