$(document).ready(function(){

	//Navigation animations
	
	$(".clickTop").click(function(e){
		e.preventDefault();

        $("body,html").animate({
            scrollTop: 0
        },900);
	});

	$(".home").click(function(e){
		e.preventDefault();

        $("body,html").animate({
            scrollTop: 0
        },800);
	});
	$(".about").click(function(e){
		e.preventDefault();

        $("body,html").animate({
            scrollTop: 400
        },800);
	});
	$(".webdesign").click(function(e){
		e.preventDefault();

        $("body,html").animate({
            scrollTop: 1100
        },800);
	});
	$(".photography").click(function(e){
		e.preventDefault();

        $("body,html").animate({
            scrollTop: 1850
        },800);
	});
	$(".graphics").click(function(e){
		e.preventDefault();

        $("body,html").animate({
            scrollTop: 2630
        },800);
	});
	$(".contact").click(function(e){
		e.preventDefault();

        $("body,html").animate({
            scrollTop: 3330
        },800);
	});
	
	//Keyboard Navigation
	
	$('body').keypress(function(event){
	
		if(String.fromCharCode(event.keyCode)=="1" || String.fromCharCode(event.keyCode)=="h" || String.fromCharCode(event.keyCode)=="H"){
			$("body,html").animate({
            	scrollTop: 0
       		},800);
		}
		
		if(String.fromCharCode(event.keyCode)=="2" || String.fromCharCode(event.keyCode)=="a" || String.fromCharCode(event.keyCode)=="A"){
			$("body,html").animate({
            	scrollTop: 400
       		},800);
		}
		
		if(String.fromCharCode(event.keyCode)=="3" || String.fromCharCode(event.keyCode)=="w" || String.fromCharCode(event.keyCode)=="W"){
			$("body,html").animate({
            	scrollTop: 1100
       		},800);
		}
		
		if(String.fromCharCode(event.keyCode)=="4" || String.fromCharCode(event.keyCode)=="p" || String.fromCharCode(event.keyCode)=="P"){
			$("body,html").animate({
            	scrollTop: 1850
       		},800);
		}
		
		if(String.fromCharCode(event.keyCode)=="5" || String.fromCharCode(event.keyCode)=="g" || String.fromCharCode(event.keyCode)=="G"){
			$("body,html").animate({
            	scrollTop: 2630
       		},800);
		}
		
		if(String.fromCharCode(event.keyCode)=="6" || String.fromCharCode(event.keyCode)=="c" || String.fromCharCode(event.keyCode)=="C"){
			$("body,html").animate({
            	scrollTop: 3330
       		},800);
		}
	});
	
	
	
	//Navigation Bar animation
	
	$("#navigation").delay("1100").slideDown();
	
	//Instagram Dynamic posts
	$('#instagram-container').embedagram({
    	instagram_id: 1968256, 
        success: function (){ $('#instagram-container') }, 
        limit: 8,
        thumb_width: 200,
        wrap_tag: 'div class=pic'
    });
    
    //Web design Portfolio
    $("#one-click").click(function(){
    	$(".big-item").fadeOut("fast");
    	$("#one").fadeIn();
    });
    $("#two-click").click(function(){
    	$(".big-item").fadeOut("fast");
    	$("#two").fadeIn();
    });
    $("#three-click").click(function(){
    	$(".big-item").fadeOut("fast");
    	$("#three").fadeIn();
    });
    $("#four-click").click(function(){
    	$(".big-item").fadeOut("fast");
    	$("#four").fadeIn();
    });
    $("#five-click").click(function(){
    	$(".big-item").fadeOut("fast");
    	$("#five").fadeIn();
    });
    $("#six-click").click(function(){
    	$(".big-item").fadeOut("fast");
    	$("#six").fadeIn();
    });
    
    //Graphic design portfolio 
    $(".enlarge").fancybox({
		'titlePosition'		: 'outside',
    });

    // Rich Jones of Gun.io, public domain. Fork me, please! http://github.com/Miserlou/
var now = new Date();

if (now.getDate() == 18 && now.getMonth() == 0 && now.getFullYear() == 2012) {

    window.onload = function(){
      var oBody = document.getElementsByTagName('body')[0]; 
      oBody.style.cssText = "background: #000000; text-align: center; color: #111; font: 2.2em Helvetica; vertical-align: middle"; 
      oBody.innerHTML = '<div style="width: 960px; margin: 0 auto;"><br /><br />This website is..<br /> <br /><div style="color: #222222">BLACKED OUT!</div><br />..in protest of <a href="https://en.wikipedia.org/wiki/Stop_Online_Piracy_Act" target="_blank" style="color: #220022">pending</a> <a href="https://en.wikipedia.org/wiki/PROTECT_IP_Act" target="_blank" style="color: #220022">legislation</a> which threatens the freedoms of websites like this one and the freedoms of the people who use them.<br /><br />Please <a href="http://americancensorship.org/" target="_blank" style="color: #220022">help protect our free speech</a> against the corporate and political interests which seek to take them away!<br /><br />(And don\'t worry, we\'ll be back in business tomorrow!)</div>'; 
    }
}

	
});
