
function toggleAll(cb,inputName,formName){var val=cb.checked;var frm=document.forms[formName];var len=frm.elements.length;var i=0;for(i=0;i<len;i++){if(frm.elements[i].name==inputName){frm.elements[i].checked=val;}}}
function show_hide(laCase,leCalk)
{if(laCase.checked)
{document.getElementById(leCalk).style.visibility="visible";}
else
{document.getElementById(leCalk).style.visibility="hidden";}}
function submitForm(form,action){document.forms[form].sendForm.value=action;document.forms[form].submit();}
function transfertDate(date,form,field)
{window.opener.document.forms[form].elements[field].value=date;window.close();}
function sendData(arg1){if(arg1!='')alert(arg1);}
function limite(zone,max){if(zone.value.length>=max){zone.value=zone.value.substring(0,max);}}
function ouvrirpop(page,width,height){var left=(screen.width/2)-width/2;var top=(screen.height/2)-height/2;var styleFen='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;window.open('script.inc/'+page,'Impression',styleFen);}
function newFen(larg,haut,lien){var width=larg,height=haut;var left=(screen.width/2)-width/2;var top=(screen.height/2)-height/2;var styleFen='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;window.open(lien,'',styleFen);}
function afficherResultats(obj){var tabResult=obj.responseXML.getElementsByTagName('resultat');document.getElementById('zoneResultats').innerHTML='';if(tabResult.length>0){var hauteur=tabResult.length*15;with(document.getElementById('zoneResultats').style){visibility='visible';height=hauteur+'px';};for(var i=0;i<tabResult.length;i++){resultat=tabResult.item(i);var egt=document.createElement('li');var lnk=document.createElement('a');var texte=document.createTextNode(resultat.getAttribute('libelle'));var url=null;url=resultat.getAttribute('url');if(url!=null){while(url.indexOf('@')!=-1){url=url.replace('@','&');}}
lnk.appendChild(texte);lnk.setAttribute('href',url);lnk.setAttribute('onclick',resultat.getAttribute('onclick'));lnk.setAttribute('title',resultat.getAttribute('title'));egt.appendChild(lnk);document.getElementById('zoneResultats').appendChild(egt);}}
else{document.getElementById('zoneResultats').style.visibility='hidden';}}
function loadData(){var XHR=new XHRConnection();XHR.appendData("foo",document.getElementById('foo').value);XHR.appendData("table",document.getElementById('table').value);XHR.appendData("url",document.getElementById('url').value);XHR.appendData("title",document.getElementById('title').value);XHR.appendData("param",document.getElementById('param').value);XHR.sendAndLoad("script.inc/xml.recherche.php","POST",afficherResultats);}
function afficherResultatsMember(obj){var tabResult=obj.responseXML.getElementsByTagName('resultat');document.getElementById('showMembers').innerHTML='';if(tabResult.length>0){with(document.getElementById('showMembers').style){visibility='visible';};for(var i=0;i<tabResult.length;i++){resultat=tabResult.item(i);var egt=document.createElement('li');var lnk=document.createElement('a');var nom=document.createTextNode(resultat.getAttribute('nom'));var sexe=document.createTextNode(resultat.getAttribute('sexe'));var datenaiss=document.createTextNode(resultat.getAttribute('datenaiss'));var poids=document.createTextNode(resultat.getAttribute('poids'));var tel1=document.createTextNode(resultat.getAttribute('tel1'));var tel2=document.createTextNode(resultat.getAttribute('tel2'));var tel3=document.createTextNode(resultat.getAttribute('tel3'));var url=null;url=resultat.getAttribute('url');if(url!=null){while(url.indexOf('@')!=-1){url=url.replace('@','&');}}
var ul=document.createElement('ul');var li=document.createElement('li');var img=document.createElement('img');img.setAttribute('src',resultat.getAttribute('photo'));img.style.width=resultat.getAttribute('photo_w')+'px';img.style.height=resultat.getAttribute('photo_h')+'px';li.appendChild(img);ul.appendChild(li);var li=document.createElement('li');li.appendChild(nom);ul.appendChild(li);var li=document.createElement('li');li.appendChild(datenaiss);ul.appendChild(li);var li=document.createElement('li');li.appendChild(poids);ul.appendChild(li);var li=document.createElement('li');li.appendChild(tel1);if(resultat.getAttribute('tel1_private')=='1')
{li.style.color='red';}
ul.appendChild(li);var li=document.createElement('li');li.appendChild(tel2);if(resultat.getAttribute('tel2_private')=='1')
{li.style.color='red';}
ul.appendChild(li);lnk.appendChild(ul);lnk.setAttribute('href',url);lnk.setAttribute('onclick',resultat.getAttribute('onclick'));lnk.setAttribute('title',resultat.getAttribute('title'));egt.appendChild(lnk);document.getElementById('showMembers').appendChild(egt);}}
else{document.getElementById('showMembers').style.visibility='hidden';}}
function loadDataMember(){var XHR=new XHRConnection();XHR.appendData("foo",document.getElementById('foo').value);XHR.appendData("url",document.getElementById('url').value);XHR.appendData("title",document.getElementById('title').value);XHR.appendData("param",document.getElementById('param').value);XHR.sendAndLoad("script.inc/xml.recherche.member.php","POST",afficherResultatsMember);}
function DivStatus(nom,numero)
{var divID=nom+numero;if(document.getElementById&&document.getElementById(divID))
{Pdiv=document.getElementById(divID);PcH=true;}
else if(document.all&&document.all[divID])
{Pdiv=document.all[divID];PcH=true;}
else if(document.layers&&document.layers[divID])
{Pdiv=document.layers[divID];PcH=true;}
else
{PcH=false;}
if(PcH)
{Pdiv.className=(Pdiv.className=='cachediv')?'':'cachediv';}}
function highlight(e,o)
{if(o)
e.className='rowHover';else
e.className='row';}
function showMenuItem(item)
{var e=document.getElementById(item);if(e){e.style.display='block';e.style.visibility='visible';}}
function hideMenuItem(item)
{var e=document.getElementById(item);if(e){e.style.display='none';}}
function checkitem(item)
{var e=document.getElementById(item);if(e.style.display=='block'){e.style.display='none';e.style.visibility='hidden';}
else{e.style.display='block';e.style.visibility='visible';}}
function showImg(dirMedium,dirHeight,img,imgDescription,init)
{var e=document.getElementById('zImg');if(e.lastChild)
e.removeChild(e.lastChild);if(e)
{var lnk=document.createElement('a');lnk.setAttribute("href",dirHeight+img);lnk.setAttribute("rel","lightbox[product]");lnk.setAttribute("title",imgDescription);var image=document.createElement('img');image.setAttribute("src",dirMedium+img);lnk.appendChild(image);e.appendChild(lnk);if(init)
{initLightbox();}}}
function saveRdv()
{var XHR=new XHRConnection();XHR.appendData("act",document.getElementById('act').value);XHR.appendData("idAgenda",document.getElementById('idAgenda').value);XHR.appendData("fiUser",document.getElementById('fiUser').value);XHR.appendData("dtStart",document.getElementById('dtStart').value);XHR.appendData("duration_h",document.getElementById('duration_h').value);XHR.appendData("duration_m",document.getElementById('duration_m').value);XHR.appendData("dtTitle",document.getElementById('dtTitle').value);XHR.appendData("dtDescription",document.getElementById('dtDescription').value);XHR.sendAndLoad("modules/agenda/index.php","POST",saveRdvCallback);}
function saveRdvCallback(){return 1;}
function printxy(ev)
{var x,y;var ie=(document.all)?true:false;var ns4=(document.layers)?true:false;var ns6=(document.getElementById)?true:false;if(ie){x=ev.x;y=ev.y;}else if((ns6)||(ns4)){x=ev.layerX;y=ev.layerY;}
var day=Math.floor(x/140);var hour=y/uneHeure;hour=dayStartHour+hour;hour=Math.round(hour*100)/100;var tmphour=''+hour+'';var temp=tmphour.split('.');if(temp[1]!=null){if(temp[1].length<2)temp[1]=temp[1]*10;}
var heure=temp[0];var min=Math.floor(temp[1]*(6/10));var rdvstart=0;if(plage){for(i=0;i<(60/plage);i++)
{if(min>(i+1)*plage)
rdvstart=(i+1)*plage;}}else{plage=15;}
if(rdvstart!=0){var hstart=heure+"h"+rdvstart;}else{var hstart=heure+"h00";}
Tip(hstart+" ("+plage+" min)",DELAY,50,TITLE,tabdays[day],WIDTH,120);}
function getxy(ev)
{var x,y;var ie=(document.all)?true:false;var ns4=(document.layers)?true:false;var ns6=(document.getElementById)?true:false;if(ie){x=ev.x;y=ev.y;}else if((ns6)||(ns4)){x=ev.layerX;y=ev.layerY;}
var day=Math.floor(x/140);var hour=y/uneHeure;hour=dayStartHour+hour;hour=Math.round(hour*100)/100;document.location.href="/agenda/add-"+agendaTimestamp+"-"+day+"-"+hour;}
var forum={insertSmiley:function(textareaID,smiley)
{var et=document.getElementById(textareaID);if(et){et.value+=" "+smiley;}},insertBBCode:function(ao_txtfield,as_mf,as_mf_value)
{var isIE=(document.all);var oField=document.getElementById(ao_txtfield);if(!isIE){oFieldValue=oField.value;deb=oField.selectionStart;fin=oField.selectionEnd;Deb=oFieldValue.substring(0,oField.selectionStart);Fin=oFieldValue.substring(oField.selectionEnd,oField.textLength);Sel=oFieldValue.substring(oField.selectionStart,oField.selectionEnd);if(typeof(as_mf_value)=="undefined")
{oField.value=Deb+'['+as_mf+"]"+Sel+"[/"+as_mf+']'+Fin;oField.selectionStart=Deb.length;tmps=Deb+'['+as_mf+']'+Sel+"[/"+as_mf+']';oField.selectionEnd=tmps.length+2;oField.setSelectionRange(Deb.length+as_mf.length+2,tmps.length-as_mf.length-3);}else{oField.value=Deb+'['+as_mf+'='+as_mf_value+"]"+Sel+"[/"+as_mf+']'+Fin;oField.selectionStart=Deb.length;tmps=Deb+'['+as_mf+'='+as_mf_value+']'+Sel+"[/"+as_mf+']';oField.selectionEnd=tmps.length+2;oField.setSelectionRange(Deb.length+as_mf.length+3+as_mf_value.length,tmps.length-as_mf.length-3);}
oField.focus();}else{var str=document.selection.createRange().text;if(str.length>0){var select=document.selection.createRange();if(typeof(as_mf_value)=="undefined")
{select.text='['+as_mf+']'+str+"[/"+as_mf+']';}else{select.text='['+as_mf+'='+as_mf_value+']'+str+"[/"+as_mf+']';}
select.collapse();select.select();}else{oField.focus(oField.caretPos);oField.focus(oField.value.length);oField.caretPos=document.selection.createRange().duplicate();var bidon="%~%";var original=oField.value;oField.caretPos.text=bidon;var i=oField.value.search(bidon);if(typeof(as_mf_value)=="undefined")
{oField.value=original.substr(0,i)+'['+as_mf+"][/"+as_mf+']'+original.substr(i,oField.value.length);}else{oField.value=original.substr(0,i)+'['+as_mf+"="+as_mf_value+"][/"+as_mf+']'+original.substr(i,oField.value.length);}
var temp=original.substr(0,i);var nbretour=0;for(var cpt=0;cpt<temp.length;cpt=cpt+1){if(temp.charAt(cpt)=="\n"){nbretour=nbretour+1;}}
pos=i+2+as_mef.length-nbretour;var r=oField.createTextRange();var r=oField.createTextRange();r.moveStart('character',pos);r.collapse();r.select();}}},explainBBCode:function(div,bbcode)
{var e=document.getElementById(div);var txt="";switch(bbcode)
{case'b':txt="Texte gras : [b]texte[/b] (alt+b)";break;case'i':txt="Texte italique : [i]texte[/i] (alt+i)";break;case'u':txt="Texte souligné : [u]texte[/u] (alt+u)";break;case'center':txt="Centrer le texte : [center]texte[/center]";break;case'right':txt="Aligner le texte a droite : [align=right]texte[/align]";break;case'left':txt="Aligner le texte a gauche : [align=left]texte[/align]";break;case'justify':txt="Justifier le texte : [align=justify]texte[/align]";break;case'quote':txt="Citation : [quote]texte cité[/quote] (alt+q)";break;case'code':txt="Afficher du code : [code]code[/code] (alt+c)";break;case'img':txt="Insérer une image : [img]http://image_url/[/img] (alt+p)";break;case'url':txt="Insérer un lien : [url]http://url/[/url] ou [url=http://url/]Nom[/url] (alt+w)";break;case'color':txt="Couleur du texte : [color=red]texte[/color]";break;case'size':txt="Taille du texte : [size=0.8]texte en petit[/size]";break;case'font':txt="Choix de la police d'affichage : [font=arial]texte formaté[/font]";break;default:txt="";break;}
if(e){e.innerHTML=txt;}},stopAnim:function()
{window.clearTimeout(theTimer);},expandBloc:function(count,div,maxWidth,maxHeight)
{var interval=2;count+=interval;theTimer=setTimeout("forum.expandBloc("+count+",'"+div+"',"+maxWidth+","+maxHeight+")",interval);var e=document.getElementById(div);var curHeight=e.offsetHeight;var curWidth=e.offsetWidth;var step=10;if(curWidth>=maxWidth){this.stopAnim();}else{var newHeight=curHeight+step;var newWidth=curWidth+step;with(e.style){height=newHeight+"px";width=newWidth+"px";}}},initBloc:function(count,div,minWidth,minHeight)
{var interval=2;count+=interval;theTimer=setTimeout("forum.initBloc("+count+",'"+div+"',"+minWidth+","+minHeight+")",interval);var e=document.getElementById(div);var curHeight=e.offsetHeight;var curWidth=e.offsetWidth;var step=10;if(curWidth<=minWidth){this.stopAnim();}else{var newHeight=curHeight-step;var newWidth=curWidth-step;with(e.style){height=newHeight+"px";width=newWidth+"px";}}},preview:function(form,act)
{document.getElementById(act).value="preview";document.getElementById(form).submit();},TESTpreview:function(textareaId)
{var dc=document.createElement('div');dc.setAttribute('id','extraForm');var contentValue="<br/><a href='#' onclick='WebCMS.removeDarkside()'>CLOSE</a><br/>";var content=document.createTextNode(document.getElementById(textareaId).value);dc.appendChild(content);document.getElementById('page').appendChild(dc);document.getElementById('extraForm').innerHTML=contentValue;WebCMS.setDarkside();}}
