jQuery(function($) {
	$('#MainMenu > ul > li:last').addClass('last');
	
	function fancyboxTitleFormat(title, currentArray, currentIndex, currentOpts) {
	    return '<div id="tip7-title">' + (title && title.length ? '<b>' + title + '</b>' : '' ) + '<br /><br /><em style="font-weight: normal;">' + (currentIndex + 1) + ' - ' + currentArray.length + '</em></div>';
	}
	
	function fancyboxVideoTitleFormat(title, currentArray, currentIndex, currentOpts) {
	    return '<div id="tip7-title">' + (title && title.length ? '<strong>' + title + '</strong>' : '' ) + '<br /><br /><em style="font-weight: normal;">' + (currentIndex + 1) + ' - ' + currentArray.length + '</em></div>';
	}
	
	$('a.lightbox').fancybox({
		titlePosition: 'inside',
		overlayOpacity: 0.8,
		overlayColor: '#000',
		titleFormat: fancyboxTitleFormat,
		cyclic: true

	});
	$('a.lightbox-video').each(function() {
		var th = $(this);
		th.fancybox({
			titlePosition: 'inside',
			type: 'iframe',
			overlayOpacity: 0.8,
			overlayColor: '#000',
			titleFormat: fancyboxVideoTitleFormat,
			width: parseInt($(this).attr('vwidth'))+20,
			height: parseInt($(this).attr('vheight'))+20,
			cyclic: true
		});
	});
	
	if(!$('#SubMenu ul li').length) {
		$('#SubMenu').remove();
	}
	
	$('#header-navigation li:last').addClass('last');
});
