// remap jQuery to $
(function($){})(window.jQuery);

$(document).ready(function (){

	$('.menu .page-item-12 a').each(function(){
		$(this).attr('href','#');
	})
	
	// Calendar
	$('body.page-id-15 #Gigs a').each(function(index){
		$(this).click(function(){
			$('#Text').show();
			$('#Gigs a').removeClass('active');
			$(this).addClass('active');
			$('#Text .texts:visible').fadeOut('fast', function(){
				$('#Text .texts:eq('+(index)+')').fadeIn();
			})
			return false;
		})
	})
	
	// About us
	$('body.page-id-17 #Links a').each(function(index){
		$(this).click(function(){
			$('.members .member:visible').fadeOut('fast', function(){
				$('.members .member:eq('+(index)+')').fadeIn();
			})
			return false;
		})
	})
	
	// Guestbook
	if($('body.page-id-10').length) {
		if(checkLang() == 'sv') {
			$('.sk-rowname td:first').text('namn:');
			$('.sk-rowemail td:first').text('e-post:');
			$('.sk-box-text').html('E-post kommer inte publiceras<br />(men &auml;r n&ouml;dv&auml;ndig)');
			$('input[type="button"].sk-button').val('skicka');
		}
	}
	
	// Gallery
	if($('body.page-id-8').length) {
		$('.ngg-galleryoverview').next().remove();
		$('.ngg-gallery-thumbnail-box').css('width','100%');
	}
	
	
	function checkLang() {
		var href = $(location).attr('href');
		if(href.indexOf('/en/')!=-1)
			return 'en';
		else
			return 'sv';
	}
});


// invoked from plugins/nextgen-gallery/shutter/shutter-reloaded.js
function closeShutter() {
	$('#shShutter, #shDisplay').click(function(e){
		if(!$(e.target).is('#nextpic, #prevpic, #shName, #shCount')) {
			shutterReloaded.hideShutter();
		}
	});
}
