/* -------------------------------------------------
	BASE JAVASCRIPT
	(c)2007    www.elitemediacompany.com
	Created:   06.12.2008
	Author:    ELITE MEDIA COMPANY LLC
------------------------------------------------- */

$().ready(function()
{
    /* Set the SuckerFish menu */
    $("ul.nav").superfish();

	/* Display a user Flash message */
	$("#FlashNotice").hide().fadeIn();

	$("#FlashNotice a.close").click( function(e){
		e.preventDefault();
		$("#FlashNotice").hide("normal", function() {
			$("#FlashNotice").remove();
		});
	});

    // Show lightbox (Fancybox) for gallery elements
	$("#gallery a.thumbnail").fancybox({ 'hideOnContentClick': true, 'overlayShow': true, 'overlayOpacity': 0.5 });

	// Open all links with class .oulink in a new window
	$('.outlink').attr('target', '_blank');

	// Scroll to the errors if there are
	$(".error").each(function(){
		$.scrollTo('.error');
	});

	/* JS Calendar settings */
	$.datepicker.setDefaults({
		showOn: 'both',
		buttonImageOnly: true,
		buttonImage: 'public/images/calendar.gif',
		closeAtTop: false
	});

	$.datepicker.regional['fr'] = {clearText: 'Effacer', clearStatus: '',
		closeText: 'Fermer', closeStatus: '',
		prevText: '&lt;Préc', prevStatus: '',
		nextText: 'Proch&gt;', nextStatus: '',
		currentText: 'En cours', currentStatus: '',
		monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
		'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
		monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
		'Jul','Aoû','Sep','Oct','Nov','Déc'],
		monthStatus: '', yearStatus: '',
		weekHeader: 'Sm', weekStatus: '',
		dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
		dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
		dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
		dayStatus: 'DD', dateStatus: 'D, M d',
		dateFormat: 'dd/mm/yy', firstDay: 0,
		initStatus: '', isRTL: false};
	$.datepicker.setDefaults($.datepicker.regional['fr']);

    // Set JS Calendar
    $.datepicker.setDefaults( $.datepicker.regional['<?=$_lang?>'] );

    $('.birth_date').attachDatepicker({
        maxDate: -6570,
        yearRange: '-50:0'
    });

});

function showHide(elementToHide, elementToShow)
{
	$(elementToHide).toggle();
	$(elementToShow).toggle();
}