$(document).ready(function(){
	
	/* Global behaviour
	-------------------------------------------------------------- */	
	
	/* Global search default term */
	
	$("input.global-search").val('Search');
	$("input.global-search").focus(function(){ $(this).val(''); });
	
	
	/* Scrolling anchors */
	anchor.init()
	
	
	/* Blog
	-------------------------------------------------------------- */
	
	/* Category anchors */
	
		
		$('a.cat-expand').toggle(
			function(){
				$(this).parent().parent().find('div.sub-categories').fadeIn();
				$(this).parent().addClass('selected');
				$(this).addClass('collapse');
				return false;				
			},
			function(){
				$(this).parent().parent().find('div.sub-categories').fadeOut();
				$(this).parent().removeClass('selected');
				$(this).removeClass('collapse');
				return false;				
			}
		);

	
	
	
});


/* Anchor scroller function
-------------------------------------------------------------- */
	
anchor = {

	init : function()  {
		$("a.anchor-link").click(function () {	
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
			return false;
		})
	}
}
