/*----------------------------------------------------------------------------//
// Javascript pour le site client  -------------------------------------------//
//----------------------------------------------------------------------------//
// Client : -
// Note   : -
// Date   : -
//----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
// Inclusion dynamique des fichiers externes javascripts
/*----------------------------------------------------------------------------*/
function importJavascript(src)
{
	document.write("<script type=\"text/javascript\" src=\"" + src + "\"></scr" + "ipt>");
}
function importCss(href, media)
{
	document.write('<link rel="stylesheet" type="text/css" media="' + media + '" href="' + href + '" />');
}

/*----------------------------------------------------------------------------*/
// Importations de fichiers
/*----------------------------------------------------------------------------*/
// importJavascript("../includes/js/plugins/jquery.plugin.js");
// importCss("../includes/js/plugins/jquery.plugin.css", "screen");
importJavascript("/includes/js/plugins/abso.labelfocus.js");
importJavascript("/includes/js/plugins/jquery.watermark.js");
importJavascript("/includes/js/plugins/abso.thickbox.js");
importCss("/includes/js/plugins/abso.thickbox.css", "screen");

/*----------------------------------------------------------------------------*/
// Declarations jQuery
/*----------------------------------------------------------------------------*/
jQuery(document).ready(function(){
	
	// Infolettre et Login
	jQuery("#Infolettre h3 a, #Login h3 a").click(function(){
		jQuery(this).toggleClass("On");
		jQuery(this).parent().next("#Infolettre .Formulaire").toggle();
		return false;
	});

	if (typeof (sUserTextboxID) != "undefined") {
	    if (jQuery("#" + sUserTextboxID)) {
	        jQuery('#' + sUserTextboxID).watermark({ watermarkText: sResourcesUserName, watermarkCssClass: "TxtBox" });
	    }
	}
	if (typeof (sPasswordTextboxID) != "undefined") {
	    if (jQuery("#" + sPasswordTextboxID)) {
	        jQuery("#" + sPasswordTextboxID).watermark({ watermarkText: sResourcesPassword, watermarkCssClass: "TxtBox" });
	    }
	}
	if (typeof (sEmailTextboxID) != "undefined") {
	    if (jQuery("#" + sEmailTextboxID)) {
	        jQuery("#" + sEmailTextboxID).watermark({ watermarkText: sResourcesYourEmail, watermarkCssClass: "TxtBox" });
	    }
	}

	// Formatage de contenu
	jQuery("#Contenu table.Tableau").each(function(){
		jQuery("tr:first-child td:last-child", this).addClass("TopLast");
		jQuery("tr:last-child td:first-child", this).addClass("BottomFirst");
		jQuery("tr:last-child td:last-child", this).addClass("BottomLast");
	});

	// Champ texte - focus
	jQuery("#Recherche input:text").watermark({});

	// Plan du site
	if(jQuery("ul#PlanSite")) {		
	
		jQuery("ul#PlanSite li:first").css("border-top","0px");
		jQuery("ul#PlanSite ul li.PlanSiteSousItem:first-child").each(function() {
			var sm_height = jQuery(this).height();
			
			if(jQuery(this).next().height() > sm_height)
				sm_height = jQuery(this).next().height();
			else
				jQuery(this).next().height(sm_height);
			
			if(jQuery(this).next().next().height() > sm_height)
				sm_height = jQuery(this).next().next().height();
			else
				jQuery(this).next().next().height(sm_height);
		});
		
		jQuery("ul#SiteMap li.SiteMapSousItem:nth-child(3n+1)").css("clear","both");
		
	}

});