/* Foundation v2.1.4 http://foundation.zurb.com */
$(document).ready(function () {


	/* UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE6/7/8 SUPPORT AND ARE USING .block-grids */
//	$('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'left'});
//	$('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'left'});
//	$('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'left'});
//	$('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'left'});

	/* TABS --------------------------------- */
	/* Remove if you don't need :) */

	function activateTab($tab) {
		var $activeTab = $tab.closest('dl').find('a.active'),
				contentLocation = $tab.attr("href") + 'Tab';

		//Make Tab Active
		$activeTab.removeClass('active');
		$tab.addClass('active');

    	//Show Tab Content
		$(contentLocation).closest('.tabs-content').children('li').hide();
		$(contentLocation).show();
	}

	$('dl.tabs').each(function () {
		//Get all tabs
		var tabs = $(this).children('dd').children('a');
		tabs.click(function (e) {
			activateTab($(this));
		});
	});

	if (window.location.hash) {
		activateTab($('a[href="' + window.location.hash + '"]'));
	}
	
	/* VAS code --------------------- */
	
	$('#sidemenu').visualNav({
		topPadding        : $('.menu').height(),   
		animationTime     : 500
	});
	
		
	
	var container = $('.menu ul');
	var elements = $('.menu ul li');
	var first = $('.menu ul li:first-child');
	
	container.css({backgroundPositionX: first.offset().left - container.offset().left + (first.width() / 2) - 5 + 'px'});

	/*elements.click(function (e) {
		//$.scrollTo($('#'+$(this).html().toLowerCase()+''), 500);
		container.animate({backgroundPositionX: ($(this).offset().left - $(this).parent().offset().left + ($(this).width() / 2) - 5 ) + 'px'});
	});
*/
});

