// JavaScript Document



// menu top initialisation

var timeOut = setTimeout ('',0);

var lastMenu = null;

var interval = 900;



$.fn.clearField = function (settings) {

    settings = jQuery.extend(

		{

			initText:    ''

		}, settings

	);



	return this.each ( function () {

        $field = $(this);



        $field.focus ( function () {

            if ( this.value == settings.initText )

                this.value = '';

        });



        $field.blur ( function () {

            if ( this.value == '' )

                this.value = settings.initText;

        });

    });

}



function init () {

	clearTimeout(timeOut);

	if (lastMenu) {

		$(lastMenu).find("ul").eq(0).hide ("fast");

		$(lastMenu).find("a").eq(0).removeClass("active");

	}

}



$( function () {

    //on load

	$("#menu > ul > li").hover  ( function () {

		if (lastMenu != this)

			init();

		$(this).find("ul").eq(0).show("slow");

		$(this).find("a").eq(0).addClass("active");

		lastMenu = this;

	}, function(){ 	});



	$("#menu > ul > li").find("a").hover  ( function () {

		clearTimeout(timeOut);

	}, function () {

		timeOut = setTimeout ( function () {

			init ();

		}, interval );

	});



	// target blank

	$('.target-blank').each(

		function()

		{

			$(this).click(

				function()

				{

					var lien = $(this).attr('href');

					window.open(lien);



					return false;

				}

			);

		}

	);



});




