function protected_mail(email) {
	var pattern = '!SPAM!';
	goodmail = email.replace(pattern, "@");
	window.open("mailto:"+goodmail);
}

function checkMail(strEmail) {
	var error;
		re = new RegExp("^([0-9a-zA-Z-_.]+)(@{1})([0-9a-zA-Z-_.]+)([.]{1})([a-zA-Z]{2,4})$");
	if (!re.test(strEmail)) { //expression régulière qui check si tous les caractères saisis sont valides pour un email
		return false;
	} else {
		var cpt = 0;
		var arob = strEmail.indexOf("@", cpt);
		while (strEmail.indexOf(".", cpt) != -1) {
			strTemp = strEmail.indexOf(".", cpt);
			if ((strTemp == 0) || (strTemp == cpt) || (strTemp == arob -1) || (strTemp == arob +1)) {
				error = "erreur";
				break;
			}
			cpt = strTemp + 1;
		}
	
		if (error){
			return false;
		}
		else{
			return true;
		}
	}
}

/* Pop Up Window */
function popitup(strURL,strType,strHeight,strWidth, strWinName) {
	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	if (strType=="consolescroll") strOptions="scrollbars,resizable,height="+strHeight+",width="+strWidth;
	newWin = window.open(strURL, 'newWin'+strWinName, strOptions);
	newWin.focus();
}

/* Ajax */
function Autocomplete_onShow(element, update){ 
  if(!update.style.position || update.style.position=='absolute') {
    update.style.position = 'absolute';
    Position.clone(element, update, {
      setHeight: false,
      setWidth: false,
      offsetTop: element.offsetHeight
    });
  }
  Effect.Appear(update,{duration:0.15});
};

/* Zebra Auto pour Contenu */
ZebraAutoTable = function(el) {
	var lastclickednode;
	var i=1;
	var rows = el.getElementsByTagName('tr');
	var nodes = $A(rows);
	nodes.each(function(node){
		if (node.parentNode == $(el)){
			if (i % 2 == 0) Element.addClassName(node,'fonce'); else Element.addClassName(node,'clair');
			Event.observe(node, 'mouseover', function(e){ Element.addClassName(node,'over'); });
			Event.observe(node, 'mouseout', function(e){ Element.removeClassName(node,'over'); });
			Event.observe(node, 'click', function(e){
				if (lastclickednode) Element.removeClassName(lastclickednode,'selected');
				Element.addClassName(node,'selected');
				lastclickednode = node;
			});
			i++;
		}
	});
}

/* Zebra Admin 
var ZebraTable = {
	stripe: function(el) {
		if (!$(el)) return;
		var lastclickednode;
		var i=1;
		var rows = $(el).getElementsByTagName('tr');

		var nodes = $A(rows);

		nodes.each(function(node){
				if (node.parentNode == $(el)){
					if (i % 2 == 0) Element.addClassName(node,'alt');
					Event.observe(node, 'mouseover', function(e){ Element.addClassName(node,'over'); });
					Event.observe(node, 'mouseout', function(e){ Element.removeClassName(node,'over'); });
					Event.observe(node, 'click', function(e){
						if (lastclickednode) Element.removeClassName(lastclickednode,'selected');
						Element.addClassName(node,'selected');
						lastclickednode = node;
					});
					i++;
				}
			});
	}
}
*/

function doZebra(){
	$$('tbody#zebra').each(function(element) {
    new ZebraAutoTable($(element));
  });
};

/* womAdd('doZebra()'); */

/* OverlayMessage */
OverlayMessage=function(_1){var _2=_1.parentNode;var _3=document.createElement("div");_3.style.cssText=_1.style.cssText;_2.insertBefore(_3,_1);_2.removeChild(_1);_3.appendChild(_1);_1.style.cssText="position: relative; width: 100%; height: 100%;";this.overlay=document.createElement("div");_3.appendChild(this.overlay);this.visibleStyle="position: relative; top: -55%; background-color: "+OverlayMessage.backgroundColor+"; width: 40%; text-align: center; margin-left: auto; margin-right: auto; padding: 2em; border: 0.08in ridge "+OverlayMessage.borderColor+"; z-index: 100; opacity: .75; filter: alpha(opacity=75);";this.invisibleStyle="display: none;";this.overlay.style.cssText=this.invisibleStyle;};OverlayMessage.backgroundColor="#9999cc";OverlayMessage.borderColor="#666699";OverlayMessage.prototype.Set=function(_4){this.overlay.innerHTML=_4;this.overlay.style.cssText=this.visibleStyle;};OverlayMessage.prototype.Clear=function(){this.overlay.style.cssText=this.invisibleStyle;};OverlayMessage.SetBackgroundColor=function(_5){OverlayMessage.backgroundColor=_5;};OverlayMessage.SetBorderColor=function(_6){OverlayMessage.borderColor=_6;};

/* Meme hauteurs */
function P7_colH2(){var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom="";}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;document.p7eqth=document.body.offsetHeight;document.p7eqtw=document.body.offsetWidth;}}function P7_eqT2(){if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}}function P7_equalCols2(){var c,e,el;if(document.getElementById){document.p7eqc=new Array();document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el;}}setInterval("P7_eqT2()",10);}}function P7_eqA2(el,p,pt){var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;g.style.paddingBottom=np+"px";if(np<pt){np+=inc;setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}}
