$(document).ready(function(){

/*INITIALS*/

	var
	top = "#8fffeb",
	publications = "#a2ff79",
	blog = "#d5fc80",
	contact_open = "#feec51", 
	contact_close = "#ff9d3d",
	links_open = "#fabfbf", 
	links_close = "#feec51";

	$("ul.contact, ul.links").hide();

/*COLORS & SCROLLING*/

	$("a.top").click(function() {
		$("html:not(:animated)").scrollTo(0, 500);
		$("body").animate({ backgroundColor: top },500);
		$("ul.contact:visible, ul.links:visible").slideToggle();
	});
	$(".pubScroll").click(function() {
		$("html:not(:animated)").scrollTo($("div.publications"), 500, {offset:-72});
		$("body").animate({ backgroundColor: publications },500);
		$("ul.contact:visible, ul.links:visible").slideToggle();
	});
	$(".blogScroll").click(function() {
		$("html:not(:animated)").scrollTo($("div.blog"), 500, {offset:-72});
		$("body").animate({ backgroundColor: blog },500);
		$("ul.contact:visible, ul.links:visible").slideToggle();
	});
	
	function bgC(color_open, color_close){
	     var $link = $("body");
	     $(this).is(":visible") ? $link.animate({ backgroundColor: color_open },500) : $link.animate({ backgroundColor: color_close },500);
	}
	$(".contactScroll").click(function() {
		$("ul.contact").slideToggle(500, bgC(contact_open, contact_close));
		$("ul.links:visible").slideToggle();
	});
	$(".linksScroll").click(function() {
		$("ul.links").slideToggle(500, bgC(links_open, links_close));
		$("ul.contact:visible").slideToggle();
	});

/*INFINITE SCROLL*/

	/*var str= $("div.prevNav a.prevLink").attr("href");
	alert(str);*/

	$('#blogBox').infinitescroll({
		navSelector  : "div.prevNav",
		nextSelector : "div.prevNav a.prevLink",
		itemSelector : "#blogBox div.blogEntry"
	});
	
});
