jQuery(document).ready(function() {
	if (jQuery('#webcastEvents').length) { fetch(); }
});

function fetch() {
	jQuery.get('/webcast.action', {numEvents: 4}, function(data) {onComplete(data)});
}

function onComplete(data) {
	var events = data.webcastEvents;
	var html = '';
	
	jQuery.each(events, function() {
		html+= '<p><strong>' + this.company + '</strong><br/><a href="' + this.link +'">' + this.title + '</a><br/>' + this.eventStart + '</p>';
	});
	
	jQuery('#webcastEvents').html(html);
}
