$(document).ready(function() {
	$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError){
		console.log("AJAX ERROR");
		console.log("event", event);
		console.log("jqXHR", jqXHR);
		console.log("ajaxSettings", ajaxSettings);
		console.log("thrownError", thrownError);
	});
	
	$('UL.upcoming LI A').each(function(index, element){		
		var element_href = $(element).attr("href");
		var element_html = $(element).html();
		var element_parent = $(element).parent();
		
		$(element).click(function() { return false; });
		$(element).qtip({
			content: {
				title: {
					text: element_html,
					button: "Close"
				},
				ajax: {
					url: element_href
				},
				text: "Loading..."
			},
			hide: {
				fixed: true,
				delay: 750
			},
			show: {
				solo: true
			},
			position: {
				container: $('#content'),
				target: element_parent,
				viewport: true,
				my: "left top",
				at: "right top"
			},
			style: {
				width: 650,
				classes: 'ui-tooltip-light ui-tooltip-shadow'
			}
		});
		
	});
});

/*

{
			content: {
				url: $(this).attr('href'),
				method: 'get',
			 	title: { 
			 		text: $(this).html(), 
			 		button: 'Close'
			 	}
			},
			hide: { 
			 	fixed: true, 
			 	delay: 750 
		 	},
		 	show: {
		 		solo: true
	 		},
		 	position: {
		 		target: $(this).parent(),
		 		adjust: {
		 			screen: true,
		 			x: 30,
		 			y: -50
		 		}
	 		},
	 		style: { width: 300 }
	 	}

{
	content: {
		title: {
			text: "test",
			button: "Close"
		},
		ajax: {
			url: $(this).attr('href'),
			type: "get"
		}
	},
	hide: {
		fixed: true,
		delay: 750
	},
	show: {
		solo: true
	},
	position: {
		target: "mouse",
		adjust: {
			x: 30,
			y: -50
		},
		viewport: $(window)
	}
}

*/

