$(function() {
		$('.gallery').each(function() {
			classes = $(this).attr('class');
			$('.' + classes.replace(' ', '.') + ' a').lightBox();
		});
		
		$('#menu>ul>li>a, .sidebar>ul>li>a').click(function() {
			if ('#' == $(this).attr('href').charAt(0)) {
				$('li.active').removeClass('active');
				$(this).parent().addClass('active');
				
				$('.tab').hide();
				$($(this).attr('href')).fadeIn();
				
				if ('#home' != $(this).attr('href')) {
					window.location.href = 'http://' + window.location.host + '/#+' + $(this).attr('href').replace('#', '');
				}
				else {
					window.location.href = 'http://' + window.location.host + '/#';
				}
				
				return false;
			}
		});
		
		var anchor = window.location.href.split('#');
		var or_anchor = window.location.href.split('#+');
		if (('undefined' != typeof(anchor[1]) && '' != anchor[1]) || ('undefined' != typeof(or_anchor[1]) && '' != or_anchor[1])) {
			anchor = ('undefined' == typeof(or_anchor[1]) ? anchor[1] : or_anchor[1]);

			$('li.active').removeClass('active');
			$('a[href="#' + anchor + '"]').parent().addClass('active');
			$('#home').hide();
			$('#' + anchor).show();
		}
});
