$(document).ready(function(){
	
	$('a.now').click(function(){
		$('#now').fadeIn();
		$('#timetable').fadeOut();
		$('#coming').fadeOut();
	});
	$('a.timetable').click(function(){
		$('#timetable').fadeIn();
		$('#now').fadeOut();
		$('#coming').fadeOut();
	});
	$('a.coming').click(function(){
		$('#coming').fadeIn();
		$('#timetable').fadeOut();
		$('#now').fadeOut();
	});
	
	$("div.misc article").hover(function(){
		$(".what_will_you_do",this).fadeIn();
	});
	$("div.misc article").mouseleave(function(){
		$(".what_will_you_do",this).fadeOut();
	});
	
	$('#push').codaSlider({
		autoSlide: true,
		autoSlideInterval: 4000,
		dynamicTabs: false,
		dynamicArrows: false,
		autoSlideStopWhenClicked: false
	});
	
	$('#meet_slider').codaSlider({
		autoSlide: true,
		autoSlideInterval: 3500,
		dynamicTabs: false,
		dynamicArrows: false,
		autoSlideStopWhenClicked: false
	});
	
	$('#theater div:last-child').addClass('last');
	
	$("a.trailer").click(function() {
		$.fancybox({
				'padding'		: 0,
				'overlayOpacity': 0.4,
				'overlayColor'	: '#000',
				'autoScale'		: true,
				'width'	 		: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
				'wmode'			: 'transparent',
			 	'allowfullscreen'	: 'true'
				}
			});

		return false;
	});
	
	$(function(){
		$(document).ready(function(){
			if($.cookie('readability') != null ){
				$("head").append('<link class="read_css" href="http://www.folketshus-lidkoping.se/readability.css" media="all" rel="stylesheet" />');
				if ( $.browser.msie ) {
					$('a.readability').css({paddingTop:10+'px'});
				}
			}else{
				$("link.read_css").remove();
			}
		});
		$("a.readability").click(function() { 
			if($.cookie('readability') == null ){
				$.cookie('readability', 'readability', {path: '/', expires: 1});
				$("head").append('<link class="read_css" href="" media="all" rel="stylesheet" />');
				$("link.read_css").attr("href",$(this).attr('rel'));
				$('a.readability').css({paddingTop:10+'px'});
				return false;
			}else{
				$.cookie('readability', null, {path: '/', expires: 1});
				$("link.read_css").remove();
				if ( $.browser.msie ) {
					$('a.readability').css({paddingTop:9+'px'});
				}
				return false;
			}
		});					
	});	
});
