var tID='';

if(navigator.appName =="Microsoft Internet Explorer") {
	if(navigator.userAgent.indexOf("Mac") == -1 && navigator.appVersion.indexOf("MSIE 5.0")<0) window.onresize = preload;
	else if(navigator.appVersion.indexOf("MSIE 5.0")>0) window.onresize = preload;
}

function preload() {
	checkRecherche();
}

window.onresize = new Function("preload();");


function viewInfo(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)+10+"px";
	x.style.top = getAbsoluteTop(y.obj)+10+"px";
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
}
function viewInfo_Left(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)-150+"px";
	x.style.top = getAbsoluteTop(y.obj)+20+"px";
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
}
function viewFormule(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)-25+"px";
	x.style.top = getAbsoluteTop(y.obj)+20+"px";
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
}
function viewDispo(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)-35+"px";
	x.style.top = getAbsoluteTop(y.obj)+20+"px";
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
}
function viewCond(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)-75+"px";
	x.style.top = getAbsoluteTop(y.obj)+15+"px";
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
}
function viewCond_Left(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)-200+"px";
	x.style.top = getAbsoluteTop(y.obj)+15+"px";
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
}
function viewDetail(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);

	if(getAbsoluteLeft(y.obj) + 210>document.body.clientWidth)
		x.style.left = getAbsoluteLeft(y.obj)-150+"px";
	else
		x.style.left = getAbsoluteLeft(y.obj)+"px";
	x.style.top = getAbsoluteTop(y.obj)+75+"px";

	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
}

function viewNote(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)-20+"px";
	x.style.top = getAbsoluteTop(y.obj)+12+"px";
	(x.style.visibility != "visible") ? x.style.visibility="visible" : x.style.visibility="hidden";
	clearTimeout(tID);
}
function deViewNote(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.visibility="hidden";
}

function viewSelection(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
	if ($('selectionLay').style.visibility == "hidden")
	{
	  if ($('criteres') != undefined)
	    $('criteres').style.display = 'block';
	}
	else
	{
	  if ($('criteres') != undefined)
	    $('criteres').style.display = 'none';
	}
}

function viewTxt(objImg,id){
	x = new getObj(id);
	y = new getObj(objImg);
	x.style.left = getAbsoluteLeft(y.obj)+10+"px";
	x.style.top = getAbsoluteTop(y.obj)+20+"px";
	x.style.visibility="visible";
}
function maskTxt(objImg,id){
	x = new getObj(id);
	x.style.visibility="hidden";
}
function viewRecherche(){
	x = new getObj("moteurLay");
	y = new getObj("recherche");
	(x.style.visibility == "visible") ? x.style.visibility="hidden" : x.style.visibility="visible";
	x.style.left = getAbsoluteLeft(y.obj)-849+"px";

}
function checkRecherche(){
	x = new getObj("moteurLay");
	if(x.obj){
		y = new getObj("recherche");
		x.style.left = getAbsoluteLeft(y.obj)-849+"px";
	}
}

function validemail(item)
{
	if (!(item.length >= 5)) return(false);
	if (item.indexOf ('@', 0) == -1) return(false);
	if (item.indexOf ('.', 0) == -1) return(false);
	interdit = "~&#'(){}[]|`/çàäâéèëêïîöôùüû?;:;,!§$£+=°%¤*µ\"\\ ";
	for (i=0;i<item.length;i++) { for (j=0;j<interdit.length;j++) { if (item.substr(i,1) == interdit.substr(j,1)) { return(false); } } }
	return true;
}

function rv(el)
{
	if ( el.value == wrd_txt_votre_email ) { el.value = ''; }
}

function rvOnclick(el)
{
	if ( el.value == $('email_default_value').value) { el.value = ''; };
}
function rvOnblur(el)
{
	if ((el.value == '') && ($('email_default_value') != undefined))
	{
	  el.value = $('email_default_value').value;
	}
}

function go(nom_form,nom_champs)
{
  return goAction(nom_form,nom_champs, "recueil_popup.php");
}

function goAction(nom_form,nom_champs, actionPhp)
{
	var lemail = document.forms[nom_form].elements[nom_champs].value;
	if (lemail == "")
	{
		alert(wrd_email_invalide);
		document.forms[nom_form].elements[nom_champs].focus;
		return false;
	}
	else
	{
		if (!validemail(lemail))
		{
			alert(wrd_email_invalide);
			document.forms[nom_form].elements[nom_champs].focus;
			return false;
		}
		else
		{
			var url = path_position + 'scripts/' + actionPhp + '?email_pers=' + lemail;
			popup(url,'target',650,500,0,0,'yes','yes');
		}
	}
}
