function open_movie_info(showtime){
	box = document.getElementById('lightbox');
	box.className = 'lightbox_bg';
	box = document.getElementById('infobox');
	box.className = 'lightbox_content';
}
function close_movie_info(){
	box = document.getElementById('lightbox');
	box.className = 'hidden';
	box = document.getElementById('infobox');
	box.className = 'hidden';
}

function schedule(i) {

	if ( !(loggedIn) ) {
		location.href='http://www.fantasiafestival.com/interactive_calendar/login';
		return;
	}

	box1 = document.getElementById('session'+i);
	box2 = document.getElementById('session'+i+'_personal');
	
//	console.log(box1.className.search(/sessao-agendado/));
	if ( box1.className.search(/sessao-agendado/) != -1 ) {
		box1.className = "sessao";
		box2.className = "sessao hidden"
		jQuery.get('http://www.fantasiafestival.com/interactive_calendar/users/deleteShowtime/'+i);
	} else {
		box1.className = "sessao sessao-agendado";
		box2.className = "sessao sessao-agendado";
		jQuery.get('http://www.fantasiafestival.com/interactive_calendar/users/addShowtime/'+i);
	}
}

$(document).ready( function() {
	
	$('#calendar_button').click( function() {
		
			// $('#calendar_total').toggle();
			if ( $('#calendar_total').css('display') == 'none' ) $('#calendar_total').show();
			else $('#calendar_total').hide();

			// $('#calendar_personal').toggle();
			if ( $('#calendar_personal').css('display') == 'none' ) $('#calendar_personal').show();
			else $('#calendar_personal').hide();
			
			$('#calendar_button').toggleClass('fantasia');
			$('#calendar_button').toggleClass('personal');

		}
	);
	
	var openInFrame = function(hash)
	{
	    var $trigger = $(hash.t);
	    var $modalWindow = $(hash.w);
	    var $modalContainer = $('iframe', $modalWindow);
	    var myUrl = $trigger.attr('href');
	    $modalContainer.html('').attr('src', myUrl);
	    $('#jqmTitleText').text('');
	    myUrl = (myUrl.lastIndexOf("#") > -1) ? myUrl.slice(0, myUrl.lastIndexOf("#")) : myUrl;
	
		$modalWindow.jqmShow();
		$modalWindow.show();
	}

	$('#modalWindow').jqm({
	    overlay: 20,
	    modal: false,
	    trigger: 'a.thickbox',
	    target: '#jqmContent',
	    onShow: openInFrame
	});


});

