var curCS;var d=document;var w=window;var t=true;var f=false;var n=null;String.prototype.computeDisplayWidth=function(b,c){var a,g,e;a=document.createTextNode(this);g=document.createElement("span");g.style.fontFamily=b;g.style.fontSize=c;g.appendChild(a);document.body.appendChild(g);e=g.offsetWidth;document.body.removeChild(g);return e};function getOffsets(c){var a=c.offsetTop;var b=c.offsetLeft;while((c=c.offsetParent)!=null){a+=c.offsetTop;b+=c.offsetLeft}return[b,a]}function iniCustomSelect(){var a=$A(d.getElementsByTagName("select"));a.each(function(b){b.style.display="none";var j=d.createElement("input");j.type="hidden";j.id="p_"+b.name;j.name="p_"+b.name;j.value="";var i=d.createElement("input");i.id="new_"+b.id;i.name="new_"+b.name;i.className="newCS";i.readOnly="readOnly";i.onclick=function(){switchOptions(this.id)};i.onmouseover=function(){curCS=this.id};i.onmouseout=function(){curCS=""};var g=d.createElement("div");g.id="opts_new_"+b.id;g.className="opts";g.style.display="none";g.setAttribute("CS",b.id);g.onmouseover=function(){curCS="new_"+this.getAttribute("CS")};g.onmouseout=function(){curCS=""};var h=new Array();var e=$A(b.getElementsByTagName("option"));e.each(function(k){var m=d.createElement("div");m.setAttribute("value",k.value);m.setAttribute("color",k.color);m.setAttribute("CS","new_"+b.id);m.onmouseover=function(){this.className="optHover"};m.onmouseout=function(){this.className="opt"};m.onclick=function(){setSelectValue(this.getAttribute("CS"),this.getAttribute("value"));$("p"+this.getAttribute("CS").substr(3)).value=this.getAttribute("value");$(this.getAttribute("CS")).value=pointsDeSuspension(this.innerHTML,$(this.getAttribute("CS")));$(this.getAttribute("CS")).style.backgroundPosition="top left";$(this.getAttribute("CS")).style.color="black";new Effect.Fade($("opts_new_"+this.getAttribute("CS")),{duration:0.3})};var l=d.createTextNode(k.innerHTML);m.appendChild(l);if(k.selected){if((i.name=="f_date"||i.name=="new_f_date")&&k.value!=""){i.value=LibelleDateFra(k.innerHTML)}else{i.value=k.innerHTML}if(k.value!=""){i.style.color="blue"}else{h.push(m)}j.value=k.value}else{h.push(m)}});h.each(function(k){g.appendChild(k)});var c=b.parentNode;c.appendChild(j);c.appendChild(i);c.appendChild(g);i.value=pointsDeSuspension(i.value,i)});Event.observe(d,"click",hideOpts,f)}function LibelleDateFra(e){var b=new Array("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");var a=e.substr(0,4);var c=e.substr(5);return b[Number(c)-1]+" "+a}function switchOptions(b){if($("opts_"+b).visible()==f){hideOpts();if(b=="new_f_ville"&&$("opts_"+b).childNodes.length==1){switchOptionsSalons(b,"ville")}else{if(b=="new_f_date"&&$("opts_"+b).childNodes.length==1){switchOptionsSalons(b,"date")}else{if(b=="new_f_salon"&&$("opts_"+b).childNodes.length==1){switchOptionsSalons(b,"nom")}else{if(b=="new_f_secteur_activite"&&$("opts_"+b).childNodes.length==1){switchOptionsSalons(b,"secteur")}}}}$(b).style.backgroundPosition="top left";var a=getOffsets($(b));$("opts_"+b).style.left=a[0]+"px";$("opts_"+b).style.top=a[1]+$(b).getHeight()+"px";new Effect.BlindDown("opts_"+b,{duration:0.3})}else{$("opts_"+b).style.display="none"}}function MetEnPlaceListe(h,a){var g=new Array();for(var e=0;e<a.length;++e){var c=d.createElement("div");c.setAttribute("value",a[e]);c.setAttribute("color",$("opts_"+h).color);c.setAttribute("CS",h);c.onmouseover=function(){this.className="optHover"};c.onmouseout=function(){this.className="opt"};c.onclick=function(){setSelectValue(this.getAttribute("CS"),this.getAttribute("value"));$("p"+this.getAttribute("CS").substr(3)).value=this.getAttribute("value");$(this.getAttribute("CS")).value=pointsDeSuspension(this.innerHTML,$(this.getAttribute("CS")));$(this.getAttribute("CS")).style.backgroundPosition="top left";$(this.getAttribute("CS")).style.color="blue";new Effect.Fade($("opts_"+this.getAttribute("CS")),{duration:0.3})};if(h=="f_date"||h=="new_f_date"){var b=d.createTextNode(LibelleDateFra(a[e]))}else{var b=d.createTextNode(a[e])}c.appendChild(b);g.push(c)}g.each(function(i){$("opts_"+h).appendChild(i)})}function pointsDeSuspension(e,h){var g=$(h).getWidth()-35;if(e.computeDisplayWidth("","10px")<g){return e}var b=0;var c=e.length;var a;do{a=Math.floor((b+c)/2);if(g>(e.substr(0,a)+"...").computeDisplayWidth("","10px")){b=a}else{c=a}}while(c>b+1);return e.substr(0,b)+"..."}function switchOptionsSalons(b,a){_adresseRecherche="/salons_feedlist.php";if(_xmlHttp&&_xmlHttp.readyState!=0){_xmlHttp.abort()}_xmlHttp=getXMLHTTP();if(_xmlHttp){_xmlHttp.open("GET",_adresseRecherche+"?liste="+a,true);_xmlHttp.onreadystatechange=function(){if(_xmlHttp.readyState==4&&_xmlHttp.responseXML){var c=traiteXmlSuggestions(_xmlHttp.responseXML);MetEnPlaceListe(b,c)}};_xmlHttp.send(null)}}function hideOpts(){var a=$A(d.getElementsByClassName("opts"));a.each(function(b){if(b.visible()&&"new_"+b.getAttribute("CS")!=curCS){$("new_"+b.getAttribute("CS")).style.backgroundPosition="top left";new Effect.Fade(b,{duration:0.3})}})}function setSelectValue(b,a){if($(b).value!=a){var e=$(b);var c=$A(e.getElementsByTagName("option"));c.each(function(g){if(g.value==a){g.selected="selected";throw $break}});if($(b).onchange!=undefined){$(b).onchange()}}if($(b).onclick!=undefined){$(b).onclick()}}function mppShowOptions(){if($("ajouterdansoptions").visible()){$("ajouterdansoptions").hide()}else{var a=$("notice_list").scrollTop;$("ajouterdans").style.backgroundPosition="top left";var b=getOffsets($("ajouterdans"));$("ajouterdansoptions").style.left=b[0]+"px";$("ajouterdansoptions").style.top=b[1]+$("ajouterdans").getHeight()-a+"px";new Effect.BlindDown("ajouterdansoptions")}}function mppHideOptions(){if($("ajouterdansoptions")!=null){$("ajouterdansoptions").hide()}}function mppPutOption(a){$("ajouterdans").innerHTML=$(a).innerHTML;$("ajouterdans").writeAttribute("destination",$(a).readAttribute("destination"));mppHideOptions()};
