// JavaScript Document
$(function() {

	Menu.init();
	
	/* MISC */
	$("input[type=text]").focus(function() {
		if(this.value != '') {
			if(this.value == this.title) this.value = '';
			
			$(this).unbind("blur").blur(function() {
				if(this.value == '') this.value = this.title;
			});
		}
	});
	
	//Banners HOME	
	var isNScape4 = (document.layers) ? true : false;
	var isIExplorer4 = (document.all && !document.getElementById) ? true : false;
	var isIExplorer5 = (document.all && document.getElementById) ? true : false;
	var isNScape6 = (!document.all && document.getElementById) ? true : false;
	var objDiv;
	if ( isNScape4 )
	{
		objDiv = document.layers["banner"];
	}
	else if ( isIExplorer4 )
	{
		objDiv = document.all("banner");
	}
	else if ( isIExplorer5 || isNScape6 ) 
	{
		objDiv = document.getElementById("banner");
	}
	
	if(possuiFlash())
	{
	    //alert('com flash');		
		
		$("#divDestaquePrincipal ").media({
			src: 'Util/Swf/BannersPersonnalite.swf',
			width: 551,
			height: 210,
			params:	{ 'wmode': 'transparent' },
			bgColor: 'transparent',
			flashvars: { 
				url_xml: "Util/Xml/BannersHome.xml"
	    	} 
		});
	}
		
	// Abas
	$(".divBoxAbas .header ul li a").click(function(e) {
		e.preventDefault();
		
		var $this = $(this);
		
		var parent = $this.parents(".divBoxAbas");
		
		var el = $($this.attr("href"));
		var atual = $("> div:visible",parent).not(".header");

		if(el.attr("id") != atual.attr("id")) {
			
			$(".header ul li",parent).removeClass("on");
			$this.parents("li").addClass("on");

			$("> div:visible",parent).not(".header").slideUp(function() {
				el.slideDown();								  
			});
		}
	});

});

