$(function() {

	invitation();

	$("a[rel^='prettyPopin']").prettyPopin({
		modal : false, /* true/false */
		width : 600, /* false/integer */
		height: 500, /* false/integer */
		opacity: 0.5, /* value from 0 to 1 */
		animationSpeed: 'fast', /* slow/medium/fast/integer */
		followScroll: true, /* true/false */
		loader_path: 'assets/images/prettyPopin/loader.gif', /* path to your loading image */
		callback: function(){} /* callback called when closing the popin */
	});
	
});

function invitation()
{
	var currentTime = new Date(),
		month = currentTime.getMonth() + 1,
		day = currentTime.getDate(),
		year = currentTime.getFullYear();
	
	if (parseFloat(year) == 2009 && parseFloat(month) < 10)
	{
		var flyer = $('div#advertisment > div.grid_12 > div'),
			url = window.location.href,
			parameters = url.split('/'),
			max_id_param = (parameters.length - 1),
			page = parameters[max_id_param];
		
		if (page == 'index.php')
		{
			page = '';
		}
		
		if (page == '')
		{
			flyer.html('<a href="http://www.ibs.ie/docx/invitation" rel="prettyPopin" class="no-anchor"><img alt="" src="assets/images/flyer_home.jpg"/></a>');
		}
		else
		{
			flyer.html('<img alt="" src="assets/images/flyer_' + page + '.jpg"/>');
		}
	}
	else
	{
		return;
	}
}
