$(function() {

	$(".rss-item").each(function(){
		var x = $(this);
		$("a.share-link", x).click(function(){
			$(".share-panel").hide();
			$(".share-panel",x).show();
			return false;
		});
		$(".share-close", x).click(function(){
			$(".share-panel", x).hide();
			return false;
		});
	});
	
	$("li.event").each(function(){
		var y = $(this);
		$(".event-details a",y).toggle(function(){
			var eventid = $(this).attr("href");
			eventid = eventid.substr(1);
			$(this).removeClass("show-details").addClass("hide-details");
			$.get('/direct/events-calendar-ajax.php', { permalink: eventid, /* rssfeed: temp[1],*/ lang: 'en', op: 'details' },function(data) { 
				$('.event-description',y).hide().html(data).slideDown('slow');
			});
		}, function() {
			$(this).removeClass("hide-details").addClass("show-details");
			$('.event-description',y).slideUp('fast').html('');
		});
	});

	$("#calprevmonth").html('<img src="/images/layout/calendar-prev.gif" alt="" border="0" />');
	
	$("#calnextmonth").html('<img src="/images/layout/calendar-next.gif" alt="" border="0" />');
							

});

function checkExposure() { 
	
	var exposed = $.cookie('exposed'); // reads cookie
	
	if (exposed != 'true')  { // If not exposed...
		$('#modal-wrapper').jqm({closeClass:'jqmClose'}).jqmShow();
		$.cookie('exposed', 'true'); // Mark this session as being exposed
	}
}


$(function(){
	if($('body').is('.modal')) {
		checkExposure();
	}
});