/* GESTION DU MENU */

$(function(){

//	$.ifixpng('_images/pixel.gif');
	$('img[src$=.png]').ifixpng();
	popIn.init();
	//console.log('yop');
	$('a.gPop').live('hover',function(){
		var popop = $(this).parents('.content').find('.gDef');
		$('#contenuDep > div').append(popop);
		popIn.init();
	},function(){ /* */ });

    $('#rubrique h1 span').css('left',$('#rubrique h1 img').width());

});


var popIn = function()
{
	var curr;

	function init()
	{
		var winX = (document.body.clientWidth);
		$('.gDef').css("left", (winX/2) - (546/2));
		$('.gDef').draggable({handle: '.top'});
		$('.gPop').click(function(){
			curr = setId($(this));
			var cPop = $(".gDef[alt$='"+curr+"']");
			cPop.show();
			return false;
		});
		$('.gClose').click(function(){
			close(curr);
			return false;
		});
	}

	function setId(ptr)
	{
		var _tmp;

		_tmp = ptr.attr('alt');
		if (curr == _tmp)
			return curr;
		close(curr);
		return _tmp;
	}

	function close(id)
	{
		$(".gDef[alt$='"+id+"']").hide();
		curr = '';
	}
	return {init:init, close:close, setId:setId};
}();

var rubrique="";
function over(elt,rub)
{
   if ( (rubrique!=rub) && (rub!="som") && (rub!="leg") && (rub!="new"))
	{

		if ($(elt).attr('src') == "_js/blank.gif")
			$(elt).iunfixpng().attr('src',$(elt).attr('src').replace("menuoff","menuon")).ifixpng().css('s-index','6');
		else
			$(elt).attr('src',$(elt).attr('src').replace("menuoff","menuon")).css('s-index','6');


	}
}
function out(elt,rub)
{
	if(rubrique!=rub)
	{
		if ($(elt).attr('src') == "_js/blank.gif")
			$(elt).iunfixpng().attr('src',$(elt).attr('src').replace("menuon","menuoff")).ifixpng().css('s-index','6');
		else
			$(elt).attr('src',$(elt).attr('src').replace("menuon","menuoff")).css('s-index','6');

	}

}

/* VERIF DU CHAMP RECHERCHE AVOCATS SUR LA PAGE EQUIPE */

function isInputEmpty(inputObj) {
	return (inputObj.value.length == 0);
}
function verifForm() {
	if (isInputEmpty(document.form1.textfield)) return false;
	return true;
}

/* page contact */

function linked(formulaire)
{
	location.href = formulaire.bureau.value;
}

function isEmail(eml)
{

	a = eml.value.search(/^[-a-z0-9_]+([-._]+[-a-z0-9_]+)*@[a-z0-9]([.-]?[a-z0-9])*\.[a-z]{2,4}$/i);
	if(a!=-1)
		return true
	else
		return false
}



/*
function champsok()
{
	if (document.forms["fcontact"].nom.value.length == 0)
	{
		alert("Vous n'avez pas rempli le champs Nom.");
		return false;
	}

	if (document.forms["fcontact"].prenom.value.length == 0)
	{
		alert("Vous n'avez pas rempli le champ Prénom.");
		return false;
	}

	if (!isEmail(document.forms["fcontact"].mail)){
		alert("le champs Email a mal été saisi.");
		return false;
	}

	if (document.forms["fcontact"].commentaire.value.length == 0)
	{
		alert("Vous n'avez pas rempli le champ commentaire.");
		return false;
	}
	document.forms["fcontact"].submit();
}
*/
