jQuery.noConflict();
jQuery(document).ready(function($){
	$('.vcalendar').eventPreview();
});

(function($) {	
	$.fn.eventPreview = function(options) {
		var defaults = {
			hideDetails : 'Hide Details',
			viewDetails : 'View Details'
		},
		opts = $.extend(defaults, options);
		return this.each(function() {
			$('.view-details').live('click',function(event) {
				event.preventDefault();
				$('.share-panel').hide();
				if ($(this).parent().hasClass('active')) {
					$(this).html(opts.viewDetails).parent().removeClass('active').parent().children('.event-description').slideUp('slow', function() { 
						$(this).html(''); 
					});
				}
				else {
					var el = $(this);
					var temp = this.rel.split(':');
					$.get('/events-calendar-ajax.php', { permalink: temp[0], rssfeed: temp[1], lang: 'en', op: 'details' },function(data) { 
						el.html(opts.hideDetails).parent().addClass('active').parent().children('.event-description').hide().html(data).slideDown('slow');});
				}
			});
		});
	};
})(jQuery);
