// JQUERY START
$(document).ready( function() {

	// JQUERY SMOOTH SCROLLING
	$.localScroll();

	// JQUERY LIGHTBOX
	$(function() {
		$('.jquery-lightbox').lightBox({fixedNavigation:false});
	});

	// JQUERY DROPDOWN MENU
	var timer = 0;

	$('#nav a:eq(4)').hover(function() { $('#photos_dropdown_menu').slideDown( 200 ); }, function() { timer = window.setTimeout(function () { $('#photos_dropdown_menu').slideUp( 200 ); }, 500); });
	$('#nav a:eq(0)').hover(function() { $('#accueil_dropdown_menu').slideDown( 200 ); }, function() { timer = window.setTimeout(function () { $('#accueil_dropdown_menu').slideUp( 200 ); }, 500); });
	$('#photos_dropdown_menu').hover( function() { if (timer) { window.clearTimeout(timer); timer = null; }	}, function() { $(this).slideUp( 200 ); } );
	$('#accueil_dropdown_menu').hover( function() { if (timer) { window.clearTimeout(timer); timer = null; } }, function() { $(this).slideUp( 200 ); } ); 

});
// JQUERY END


function toggleVisibility() {
 if( document.getElementById("login_zone").style.visibility == "hidden" ) {
    document.getElementById("login_zone").style.visibility = "visible";
  } else {
    document.getElementById("login_zone").style.visibility = "hidden";
  }
}


// Hide all divs with the name : nom
function HideAllElementsNamed(nom){
  var NumDiv = 1;
  while (document.getElementById(nom+NumDiv)){
	  document.getElementById(nom+NumDiv).style.display = "none";
	  NumDiv++;
  }
}


// Show the specified element
function ShowThisElement(id) {
	if( document.getElementById(id).style.display == "block" ) {
	document.getElementById(id).style.display = "none";
	} else {
	document.getElementById(id).style.display = "block"; }	
}


// Display today's date
function get_date(format) {
	navvers = navigator.appVersion.substring(0,1);
	if (navvers > 3) navok = true;
	else navok = false;
	today = new Date;
	mois = today.getMonth();

	jour = today.getDay();
	numero = today.getDate();
	if (navok) annee = today.getFullYear();
	else annee = today.getYear();

	if (format=='default') {
		if (numero==1) numero = numero+"st";
		else if (numero==2) numero = numero+"nd";
		else if (numero==3) numero = numero+"rd";
		else if (numero==21) numero = numero+"st";
		else if (numero==22) numero = numero+"nd";
		else if (numero==23) numero = numero+"rd";
		else if (numero==31) numero = numero+"st";
		else numero = numero+"th";
		TabJour = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
		TabMois = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
		messageDate = TabMois[mois] + " " + numero + ", " + annee;
		document.write(messageDate)
	}
	else if (format=='db') {
		TabMois = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
		if (numero<10) numero = "0"+numero;
		messageDate = annee + "-" + TabMois[mois] + "-" + numero;
		document.write(messageDate)
	}
}

// Open a customizable popup window
function popup(url) {
	properties = "top=0,left=0,resizable=yes, toolbar=no, scrollbars=yes, menubar=no, location=no, statusbar=no"
	properties += ",width=" + screen.width + ",height=" + screen.height;
	win = window.open(url,'',properties);
}

