if (REQUIRE_ONCE == null)
{
    // Execution une seule fois
    var REQUIRE_ONCE = true;

    var wrestMsg = "";
    var wrestFld = null;
    var wrestFldDefaultColor = "f5ffff";
    var wrestFldBackColor = "ffe4e1";
    var arrAttr  = new Array ("required", "trim", "minlength", "email", "nospace");

    // subject attribution return, s'il n'y a pas, envoie le Nom du Tag
    function wrestItemname(fld)
    {
        var itemname = fld.getAttribute("itemname");
        if (itemname != null && itemname != "")
            return itemname;
        else
            return fld.name;
    }

    // Supprimer les espaces avant et arriere
    function wrestTrim(fld) 
    {
        var pattern = /(^\s*)|(\s*$)/g; // \s lettre d'espace
        fld.value = fld.value.replace(pattern, "");
        return fld.value;
    }

    // Controle des elements obligatoire
    function wrestRequired(fld)
    {
        if (wrestTrim(fld) == "") {
            if (wrestFld == null) {
								if(fld.type == "select-one")
                	wrestMsg = "Veillez choisir ["+ wrestItemname(fld) + "]\n";
								else
                	wrestMsg = "Le choix [" + wrestItemname(fld) + "], est obligatoire.\n";
                wrestFld = fld;
            }
        }
    }

    // Longuer de lettre minimale
    function wrestMinlength(fld)
    {
        var len = fld.getAttribute("minlength");
        if (fld.value.length < len) {
            if (wrestFld == null) {
                wrestMsg = "Veillez saisir [" + wrestItemname(fld) + "], au moins " + len + " lettres.\n";
                wrestFld = fld;
            }
        }
    }

    // Controle de l'adresse e-Mail
    function wrestEmail(fld) 
    {
        if (!wrestTrim(fld)) return;

        //var pattern = /(\S+)@(\S+)\.(\S+)/; Langage coreen
        var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
        if (!pattern.test(fld.value)) {
            if (wrestFld == null) {
                wrestMsg = "[" + wrestItemname(fld) + "] n\'est pas une adresse e-Mail.\n";
                wrestFld = fld;
            }
        }
    }

    // Controle d'espace et transformation -> ""
    function wrestNospace(fld)
    {
        var pattern = /(\s)/g; // \s, est un Lettre d'espace
        if (pattern.test(fld.value)) {
            if (wrestFld == null) {
                wrestMsg = "Veillez saisir [" + wrestItemname(fld) + "] sans espace.\n";
                wrestFld = fld;
            }
        }
    }

    // Controle de caracteur au moment de submit
    function wrestSubmit()
    {
        wrestMsg = "";
        wrestFld = null;

        var attr = null;

        // Repeter jusqu'a nombre d'element de formulaire conserne
        for (var i = 0; i < this.elements.length; i++) {
            // Input tag type de Tag est, text, file, password 
            if (this.elements[i].type == "text" || 
                this.elements[i].type == "file" || 
                this.elements[i].type == "password" ||
				this.elements[i].type == "select-one" || 
                this.elements[i].type == "textarea") {
                // Repeter jusqu'au longueur de rongee
                for (var j = 0; j < arrAttr.length; j++) {
                    // S'il y d'attributions ou de valeurs
                    if (this.elements[i].getAttribute(arrAttr[j]) != null) {
                        // Defaut couleur
                        // this.elements[i].style.backgroundColor = wrestFldDefaultColor;
                        switch (arrAttr[j]) {
                            case "required"  : wrestRequired(this.elements[i]); break;
                            case "trim"      : wrestRequired(this.elements[i]); break;
                            case "minlength" : wrestMinlength(this.elements[i]); break;
                            case "email"     : wrestEmail(this.elements[i]); break;
                            case "nospace"   : wrestNospace(this.elements[i]); break;
                            default : break;
                        }
                    }
                }
            }
        }

        // Champs erreurs changent le couleur.
        if (wrestFld != null) {
            alert(wrestMsg);
//            wrestFld.style.backgroundColor = wrestFldBackColor;
            wrestFld.focus();
            return false;
        }

        if (this.oldsubmit && this.oldsubmit() == false)  {
            return false;
        }

        return true;
    }

    // Execute 'onsubmit' au debut.
    function wrestInitialized()
    {
        for (var i = 0; i < document.forms.length; i++) {
            // S'il y a 'onsubmit event', on le conserve.
            if (document.forms[i].onsubmit) document.forms[i].oldsubmit = document.forms[i].onsubmit;
            document.forms[i].onsubmit = wrestSubmit;
            for (var j = 0; j < document.forms[i].elements.length; j++) {
                // Champs obligatoires(required), parution de '*'.
                if (document.forms[i].elements[j].getAttribute("required") != null) {
//                    document.forms[i].elements[j].style.backgroundColor = wrestFldDefaultColor;
                    /*
                    document.forms[i].elements[j].className = "wrest_required";
                    document.forms[i].elements[j].style.backgroundPosition = "top right";
                    document.forms[i].elements[j].style.backgroundRepeat = "no-repeat";
                    */
                }
            }
        }
    }

	/* // Controle numero de securite sociale
	function jumin_check(j1, j2) 
	{
			if (j1.value.length < 6 || j2.value.length < 7)
					return false;
	
			var sum_1 = 0;
			var sum_2 = 0;
			var at=0;
			var juminno= j1.value + j2.value;
			sum_1 = (juminno.charAt(0)*2)+
							(juminno.charAt(1)*3)+
							(juminno.charAt(2)*4)+
							(juminno.charAt(3)*5)+
							(juminno.charAt(4)*6)+
							(juminno.charAt(5)*7)+
							(juminno.charAt(6)*8)+
							(juminno.charAt(7)*9)+
							(juminno.charAt(8)*2)+
							(juminno.charAt(9)*3)+
							(juminno.charAt(10)*4)+
							(juminno.charAt(11)*5);
			sum_2=sum_1 % 11;
	
			if (sum_2 == 0) {
					at = 10;
			} else {
					if (sum_2 == 1) 
							at = 11;
					else 
							at = sum_2;
			}
			att = 11 - at;
			if (juminno.charAt(12) != att) {
					return false;
			}
	
			return true
	}  *********************************/

	// Controle double identification
	function popup_id(frm_name, dir, frm_id, id)
	{		
			if( id.value == '' ) {
				alert("Entrez un Identification.")
				id.focus();
				return false;
			}
			url = dir+'confirm_id.php?frm_name='+frm_name+'&frm_id='+frm_id+'&id='+id.value;
			opt = 'scrollbars=no,width=355,height=200';
			window.open(url, "mbid", opt);
	}

	// Controle double nick name
	function popup_nick(frm_name, dir, frm_nick, nick)
	{	
			if( nick.value == '' ) {
				alert("Entez un nick.")
				nick.focus();
				return false;
			}
			url = dir+'confirm_nick.php?frm_name='+frm_name+'&frm_nick='+frm_nick+'&nick='+nick.value;
			opt = 'scrollbars=no,width=355,height=200';
			window.open(url, "mbwriter", opt);
	}
	
	// Code postale
	function popup_zip(frm_name, dir, frm_zip1, frm_zip2, frm_addr1, frm_addr2)
	{
			url = dir+'confirm_zip.php?frm_name='+frm_name+'&frm_zip1='+frm_zip1+'&frm_zip2='+frm_zip2+'&frm_addr1='+frm_addr1+'&frm_addr2='+frm_addr2;
			opt = 'scrollbars=yes,width=500,height=300';
			window.open(url, "mbzip", opt);
	}
		
	// Liste d'ID de membre
	function popup_mb_list(frm_name, dir, frm_id, frm_num, key, multi)
	{		
			if(!multi) multi=1
			if(!key) key=''
			url = dir+'popup_member_list.php?frm_name='+frm_name+'&frm_id='+frm_id+'&frm_num='+frm_num+'&key='+key+'&multi='+multi;
			opt = 'scrollbars=yes,width=450,height=500';
			window.open(url, "popup_mb_list", opt);
	}

	// Fenetre d'envoie de mot de passe
	function popup_passwd(dir)
	{	
			url = dir+'send_passwd.php';
			opt = 'scrollbars=no,width=450,height=380';
			window.open(url, "mbpasswd", opt);
	}
	
	// Confirmation de suppression
	function del(href) 
	{
			if(confirm("Vous êtes sur de le supprier?")) 
					document.location.href = href;
	}

	// Message d'alerte
	function warning_msg(type)
	{	
		switch(type) {
			case 'login' : alert("Vous devez être identifié .")
				break;
			}
		return;			
	}

	// Message de login
	function before_login(dir)
	{	
		alert("Vous devez être identifié .");
		location.href=dir+'login.php?url='+location.href;
	}

	// Vrai; s'il y a au moins un checkbox coche
	function list_checkbox(form,fname) {
		var Check_List=false;
		for(i=0;i<form.length;i++) {
			if(form[i].type=="checkbox" && form[i].name==fname) {
				if(form[i].checked) Check_List=true;
			}
		}
		return Check_List;
	}

  // Liaison Rangee de chekbox par ','.
	function list_checkbox_value(form,fname) {
		var _reslut='';
		for(i=0;i<form.length;i++) {
			if(form[i].type=="checkbox" && form[i].name==fname) {
				if(form[i].checked) {
					if(_reslut=='')
						_reslut = form[i].value
					else
						_reslut = _reslut + ','+form[i].value
				}
			}
		}
		return _reslut;
	}
	
////////// AQ Layer ////////////////////
	var layername = 'aq_layer_div'

	function aq_layer_action(name, status)
	{
		var obj = document.all[name];

		if (typeof(obj) == 'undefined') {
			return;
		}

		if (status) {
			obj.style.visibility = status;
		} else {
			if(obj.style.visibility == 'visible')
				obj.style.visibility='hidden';
			else
				obj.style.visibility='visible';
		}
	}

	function aq_layer(dir,bbs_id, id, name, email,homepage,profile,skin_url)
	{

		var obj = document.all[layername];
		var x, y;
		var body = "";
		var height = 0;

		x = event.clientX + document.body.scrollLeft - 150;
		y = event.clientY + document.body.scrollTop - 30;
		obj.style.posLeft = x;
		obj.style.posTop = y;

		if (id) {
			body += "<tr onmouseover=this.style.backgroundColor='#E1EFEE' onmouseout=this.style.backgroundColor='#B2D1D4' onmousedown=\"window.open('"+dir+"memo.php?mode=write&mo_recv_mb_id="+id+"', 'mbmemo', 'left=50,top=50,width=500,height=400,scrollbars=1');\"><td height=20><font class=l_list1>&nbsp; <IMG src="+skin_url+"img/memo_icon.gif border=0 width='12' height='12'> &nbsp;Envoyer un message&nbsp;&nbsp;</td></tr>";
			height += 20;
		}

		if (name && bbs_id) {
			body += "<tr onmouseover=this.style.backgroundColor='#E1EFEE' onmouseout=this.style.backgroundColor='#B2D1D4' onmousedown=\"location.href='"+dir+"list.php?bbs_id="+bbs_id+"&ss[sn]=1&ss[kw]="+name+"';\"><td height=20><font class=l_list1>&nbsp; <IMG src="+skin_url+"img/namesearch_icon.gif border=0 width='12' height='12'>&nbsp;Voir ses articles&nbsp;&nbsp;</td></tr>";
			height += 20;
		}
		
		if (email) {
			body += "<tr onmouseover=this.style.backgroundColor='#E1EFEE' onmouseout=this.style.backgroundColor='#B2D1D4' onmousedown=\"location.href='mailto:"+email+"'\"><td height=20><font class=l_list1>&nbsp; <IMG src="+skin_url+"img/mail_icon.gif border=0 width='12' height='12'> &nbsp;Evoyer un E-mail&nbsp;&nbsp;</td></tr>";
			height += 20;
		}

		if (homepage) {
			body += "<tr onmouseover=this.style.backgroundColor='#E1EFEE' onmouseout=this.style.backgroundColor='#B2D1D4' onmousedown=\"window.open('"+homepage+"');\"><td height=20><font class=l_list1>&nbsp; <IMG src="+skin_url+"img/home_icon.gif border=0 width='12' height='12'> &nbsp;Site-web&nbsp;&nbsp;</td></tr>";
			height += 20;
		}

		if (parseInt(profile)) {
			body += "<tr onmouseover=this.style.backgroundColor='#E1EFEE' onmouseout=this.style.backgroundColor='#B2D1D4' onmousedown=\"window.open('"+dir+"mb_profile.php?mb_id="+id+"', 'profile', 'left=50,top=50,width=500,height=400,scrollbars=1');\"><td height=20><font class=l_list1>&nbsp; <IMG src="+skin_url+"img/me_icon.gif border=0 width='12' height='12'> &nbsp;Profile&nbsp;&nbsp;</td></tr>";
			height += 20;
		}

		if (body) {
			var layer_body = "<table border=0 width=100%><tr><td colspan=3 height=10></td></tr><tr><td width=5></td><td bgcolor=000000 style='cursor:hand'><table border=0 cellspacing=0 cellpadding=3 width=100% height=100% bgcolor=B2D1D4>"+body+"</table></td><td width=10></td></tr><tr><td colspan=3 height=10></td></tr></table>";
			obj.innerHTML = layer_body;
			obj.style.width = 185;
			obj.style.height = height;
			obj.style.visibility='visible';
		}
	}

	function aq_init_layer(layername)
	{
		document.writeln("<div id="+layername+" style='position:absolute; left:1px; top:1px; width:1px; height:1px; z-index:1; visibility: hidden' onmousedown=\"aq_layer_action('"+layername+"', 'hidden')\" onmouseout=\"aq_layer_action('"+layername+"', 'hidden')\" onmouseover=\"aq_layer_action('"+layername+"', 'visible')\">");
		document.writeln("</div>");
	}
	
	aq_init_layer('aq_layer_div');
  wrestInitialized();
}

