var obj = null;

function checkHover() {
	if (obj) {
		obj.find('ul').hide( );
		obj.find( 'a:first' ).removeClass( "hover" );
	} //if
} //checkHover

$(document).ready(function() {
	
	// Fonction menu horizontal
	$( '#header_menu > li' ).hover( function( ) {
		if ( obj ) {
			obj.find( 'ul' ).hide( );
			obj.find( 'a:first' ).removeClass( "hover" );
			obj = null;
		} //if
		$( this ).find( 'ul' ).show( );
		$( this ).find( 'a:first' ).addClass( "hover" );
	}, function( ) {
		obj = $( this );
		setTimeout(
			"checkHover( )",
			400 );
	});
	
	// Voir un exemple
	$( '#seeExample' ).click( function( ) {
		$( '#lat' ).val( '48.87266' );
		$( '#lng' ).val( '2.29605' );
	});
	
	// Validation formulaire Geolocalisation
	$( '#geoLocSubmit' ).click( function( ) {
		if( $( '#lat' ).val( ).length == 0 || $( '#lng' ).val( ).length == 0 ) {
			alert( '- Les champs lattitude et longitude sont obligatoires (Un exemple est disponible en dessous du formulaire)' );
			return false;
		}
		if( !Number( $( '#lat' ).val( ) ) || !Number( $( '#lng' ).val( ) ) ) {
			alert( '- Les champs lattitude et/ou longitude sont incorrects (Un exemple est disponible en dessous du formulaire)' );
			return false;
		}
		return true;
	});
	
});
