function label(d,b,c,a){xmlhttp("GET","/xhr.label.php?i="+d,function(e){map0.label.label.innerHTML=e});if(a==true){map0.shift(b,c)}map0.label.show(b,c)}var cur_leg=null;function legend(a){if($("left_content2").style.display=="none"||cur_leg!=a){cur_leg=a;xmlhttp("GET","/xhr.legend.php?T="+a,function(b){$("left_content2").innerHTML=b;$("left_content").style.display="none";$("left_content2").style.display=""})}else{cur_leg=null;$("left_content2").style.display="none";$("left_content").style.display=""}}var workspace=new Array();function wor(c,d,b){if(b==true){workspace=new Array()}if(d==true){if(typeof(c)=="object"&&(c instanceof Array)){for(var a=0;a<c.length;a++){if(jQuery.inArray(c[a],workspace)==-1){workspace.push(c[a])}}}else{if(jQuery.inArray(c,workspace)==-1){workspace.push(c)}}}else{if(typeof(c)=="object"&&(c instanceof Array)){for(var a=0;a<c.length;a++){workspace.remove(c[a])}}else{workspace.remove(c)}}xmlhttp("GET","/xhr.wor.php?wor="+workspace.join(";"),function(e){map0.redraw()})}function worAll(d){var b=new Array();var a=document.getElementsByName("wor[]");for(var c=0;c<a.length;c++){b.push(a[c].value);a[c].checked=(d?"checked":"")}wor(b,d)}function map_select(a,c){a=Math.round(a*1000)/1000;c=Math.round(c*1000)/1000;r=Math.round(map0.IRS*1000)/1000;var b=xmlhttp("GET","/xhr.snap.php?x="+a+"&y="+c+"&r="+r,function(d){if(d!=""){map_select_do(d)}})}function map_select_do(b){var a=b.split("|");if(a[0]=="Q"){loadQuartier(parseInt(a[1]),a[5],a[4],a[2],a[3])}else{if(a[0]=="POI"){map0.info.info.innerHTML=a[3];map0.info.show(a[1],a[2])}else{if(a[0]=="C"){selmap(parseInt(a[4]),0);info(parseInt(a[1]),"i",a[2],a[3],a[4],a[5])}}}}function selmap(c,b,a,d){if(typeof c=="undefined"){c=0}if(typeof b=="undefined"){b=0}if(typeof d=="undefined"){d=0}if(typeof a=="undefined"){a=false}xmlhttp("GET","/xhr.selmap.php?q="+parseInt(c)+"&t="+parseInt(b)+"&p="+parseInt(d)+"&spe="+a,function(e){},false)};Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return a}}return -1};Array.prototype.remove=function(a){var d=null;for(var c=0,b=this.length;c<b;c++){if(this[c]==a){d={id:c,value:this[c]}}}if(d!=null){for(var c=d.id;c<this.length;c++){this[c]=this[c+1]}this.pop();return d.value}return null};function $(b){var a=document.getElementById(b);if(a!==null){return a}a=document.getElementsByName(b).item(0);if(a!==undefined){return a}return null}function load(d,a){if(typeof a=="undefined"||a===true){back_set("load('"+d+"');")}startRow=0;$("menu_info").innerHTML="";map0.label.hide();map0.pin.hide();if(d.substr(0,16)=="xhr.search.n.php"){xmlhttp("GET","/"+d,function(e){$("left_content").innerHTML=e;initAutoComplete($("enseigne"),$("name_result"),"xhr.search.n2.php")})}else{if(d.substr(0,16)=="xhr.search.q.php"||d.substr(0,16)=="xhr.search.t.php"||d.substr(0,14)=="xhr.result.php"){var c=extractUrlParams(d);if(typeof c.q=="undefined"){c.q=0}if(typeof c.t=="undefined"){c.t=0}if(typeof c.p=="undefined"){c.p=0}var b=(typeof c.spe!="undefined");selmap(c.q,c.t,b,c.p);xmlhttp("GET","/"+d,function(e){$("left_content").innerHTML=e});if(b===true){map0.redraw()}else{if(c.p>0){xmlhttp("GET","/xhr.partner.php?p="+c.p,function(e){if(e.length>0){var f=e.split(";");map0.zoom.nearest(f[2],f[0],f[1]);map0.redraw()}})}}if(_gaq&&d.substr(0,14)!="xhr.result.php"){if(c.q!=0){if(typeof(ga_qua[c.q])!="undefined"){qtxt=ga_qua[c.q]}else{qtxt="?"}_gaq.push(["_trackEvent","Recherche","Recherche par Quartier",c.q+":"+qtxt])}if(c.t!=0){if(typeof(ga_typ[c.t])!="undefined"){ttxt=ga_typ[c.t]}else{ttxt="?"}_gaq.push(["_trackEvent","Recherche","Recherche par Categorie",c.t+":"+ttxt])}}}else{curpic=0;if(d!="xhr.locate.php"&&d!="xhr.about.php"){loadMenuMain(0)}xmlhttp("GET","/"+d,function(f){$("left_content").innerHTML=f;var e="http://s7.addthis.com/js/250/addthis_widget.js#domready=1";if(window.addthis){window.addthis=null}jQuery.getScript(e)})}}document.getElementById("left_content2").style.display="none";document.getElementById("left_content").style.display="";if(d.substr(0,14)!="xhr.info.s.php"&&d.substr(0,17)!="xhr.qmobility.php"&&workspace.length>0){wor(new Array(),false,true)}if(_gaq){_gaq.push(["_trackPageview",d])}}function createXhrObject(){if(window.XMLHttpRequest){return new XMLHttpRequest()}if(window.ActiveXObject){var c=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(var a in c){try{return new ActiveXObject(c[a])}catch(b){}}}throw new Error("XMLHttpRequest is not available.");return null}var l_result=null;function xmlhttp(c,f,i,e){if(typeof e=="undefined"){e=true}var a=createXhrObject();l_result=null;if(e===true){document.getElementById("ajax-load").style.display=""}if(c=="post"||c=="POST"){var h=f.split("?");var b=h[0];var g=h[1];a.open("POST",b,e);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");if(!/MSIE (6\.\d+);/.test(navigator.userAgent)){a.setRequestHeader("Content-length",g.length);a.setRequestHeader("Connection","close")}a.onreadystatechange=function(){if(a.readyState==4){document.getElementById("ajax-load").style.display="none";i(a.responseText)}};a.send(g)}else{a.open("GET",f,e);a.setRequestHeader("Content-Type","text/html; charset=UTF-8");a.onreadystatechange=function(){if(a.readyState==4){document.getElementById("ajax-load").style.display="none";i(a.responseText)}};a.send(null)}}function escapeURI(a){if(encodeURIComponent){return encodeURIComponent(a)}if(escape){return escape(a)}}function setTitle(a){if(typeof a=="undefined"||a==""){a="Shop In Brussels"}document.title=a}var back_array=new Array();function back_set(a){if(back_array.length>=25){back_array.shift()}if(back_array[(back_array.length-1)]!=a){back_array.push(a)}}function back_get(){if(document.getElementById("left_content2").style.display!="none"){document.getElementById("left_content2").style.display="none";document.getElementById("left_content").style.display=""}else{if(back_array.length==0){loadHome()}else{back_array.pop();var back_do=back_array.pop();eval(back_do);map0.redraw()}}}function extractUrlParams(b){var e=b.split("?");var d=e[1].split("&");var g=[];for(var c=0;c<d.length;c++){var a=d[c].split("=");g[a[0]]=a[1]}return g};var prevType=null;var curType=null;function typeSelect(c,b){prevType=curType;curType=c;var e=0;var d=$("mixtype").getElementsByTagName("div");if(c%100000==0){for(var a=0;a<d.length;a++){if(d[a].id=="partners"){continue}if(d[a].id.substr(0,9)!="mixhandle"){d[a].style.display="none"}}$("mix"+curType).style.display=($("mix"+curType).style.display=="none"?"":"none")}else{if(c%1000==0){for(a=0;a<d.length;a++){if(d[a].id=="partners"){continue}e=parseInt(d[a].id.substr(3));if(e%1000==0&&e%100000!=0){d[a].style.display="none"}}$("mix"+curType).style.display=($("mix"+curType).style.display=="none"?"":"none")}}if(prevType!==null){$("mixhandle"+prevType).style.fontWeight="normal"}$("t").value=curType;$("mixhandle"+curType).style.fontWeight="bold";$("button").src="/Common/img/design/go-"+b+".png";$("button").onmouseover=function(){$("button").src="/Common/img/design/go_on-"+b+".png"};$("button").onmouseout=function(){$("button").src="/Common/img/design/go-"+b+".png"};$("button").onclick=function(){if($("lQuartier")==null){load("xhr.search.q.php?t="+$("t").value);map0.redraw()}else{load("xhr.result.php?t="+$("t").value);map0.redraw()}}}var startRow=0;var loading=false;function getData(a){if(!loading){loading=true;xmlhttp("GET","/xhr.list.php?s="+startRow,function(b){if(b!=""){a.innerHTML=a.innerHTML+b}});loading=false}}function f_onscroll(a){if(!loading){if(a.scrollTop+a.clientHeight==a.scrollHeight){startRow=parseInt(startRow)+10;getData(a)}}}function info(f,b,a,e,c,d){if(b=="s"){wor(new Array("RS_RailwayStation","STIB-Metro","STIB-Tram","STIB-Bus","TA_Taxi","HAN_Handicap","CPK_Parking"),true)}map0.zoom.nearest((b=="s"?2:0.25),a,e);if(b=="h"){load("xhr.info.h.php?i="+f,false)}else{if(b=="p"){load("xhr.info.p.php?i="+f,false);curpic=0}else{if(b=="s"){load("xhr.info.s.php?i="+f,false)}else{load("xhr.info.php?i="+f,false)}}}if(typeof d!="undefined"){setTitle(d)}loadMenuInfo(f,b,a,e);if(b!="s"){map0.pin.hide();label(f,a,e)}else{map0.pin.show(a,e)}d=(d+"").replace(/([\\"'])/g,"\\$1").replace(/\u0000/g,"\\0");back_set("info("+f+", '"+b+"', "+a+", "+e+", "+c+", '"+d+"')");if(typeof c!="undefined"&&c!=null){headQuartier(c);colorQuartier(c)}if(_gaq){if(b=="h"){_gaq.push(["_trackEvent","Fiche","Fiche Commerce Horaires",f])}else{if(b=="p"){_gaq.push(["_trackEvent","Fiche","Fiche Commerce Photos",f])}else{if(b=="s"){_gaq.push(["_trackEvent","Fiche","Fiche Commerce Mobilite",f])}}}_gaq.push(["_trackEvent","Fiche","Fiche Commerce",f])}}function more(a){document.getElementById(a+"_more_link").style.display="none";document.getElementById(a+"_less_link").style.display="";document.getElementById(a+"_more").style.display=""}function less(a){document.getElementById(a+"_less_link").style.display="none";document.getElementById(a+"_more_link").style.display="";document.getElementById(a+"_more").style.display="none"};function headQuartier(a){jQuery.post("/xhr.header.php",{q:a},function(b){$("right_header").innerHTML=b})}function pinQuartier(a,b){if(a==0||b==0||map0.IRS<=16){map0.pin.hide()}else{map0.pin.show(a,b)}}function colorQuartier(a){setActiveStyleSheet("q"+a)}function resetQuartier(){headQuartier(0);pinQuartier(0,0)}function loadQuartier(e,c,b,a,d){load("xhr.quartier.php?q="+e,false);headQuartier(e);colorQuartier(e);setTitle(c);selmap(e,0);if(e>0){map0.zoom.nearest(b,a,d)}back_set("loadQuartier("+e+", '"+c+"', "+b+", "+a+", "+d+")");if(_gaq){if(typeof(ga_qua[e])!="undefined"){qtxt=ga_qua[e]}else{qtxt="?"}_gaq.push(["_trackEvent","Fiche","Fiche Quartier",e+":"+qtxt])}}function loadMenuMain(b){var c=$("menu").getElementsByTagName("div");for(var a=0;a<c.length;a++){if(a==b){c.item(a).className="menu menu_"+a+"_current"}else{if(c.item(a).id!="menu_info"){c.item(a).className="menu menu_"+a}}}setTitle()}function loadMenuInfo(d,b,a,c){if(typeof d=="undefined"){$("menu_info").innerHTML=""}else{xmlhttp("GET","/xhr.info.m.php?i="+d+"&m="+b+"&x="+a+"&y="+c,function(e){$("menu_info").innerHTML=e})}}function loadHome(){load("xhr.search.t.php?clear",false);loadMenuMain(0);loadMenuInfo();headQuartier(0);colorQuartier(0);selmap();map0.zoom.nearest(17.1367,148846,170236);setTitle();back_set("loadHome()")}function loadLocate(){load("xhr.locate.php",false);loadMenuMain(1);loadMenuInfo();back_set("loadLocate()");if(_gaq){_gaq.push(["_trackEvent","Divers","Recherche d'adresse"])}}function loadAbout(){load("xhr.about.php",false);loadMenuMain(2);loadMenuInfo();back_set("loadAbout()");if(_gaq){_gaq.push(["_trackEvent","Divers","Foire Aux Questions"])}}function loadBack(){back_get()}var curpic=0;function diapo(c,b,a){if(a<=0){$("p_prev").style.visibility="hidden";$("p_next").style.visibility="visible";a=0}else{if(a>=(b.length-1)){$("p_next").style.visibility="hidden";$("p_prev").style.visibility="visible";a=(b.length-1)}else{$("p_prev").style.visibility="visible";$("p_next").style.visibility="visible"}}curpic=a;$(c).src=b[a]}function setActiveStyleSheet(f){var d;var c;var b;var e=false;for(d=0;(c=document.getElementsByTagName("link").item(d));d++){if(c.getAttribute("rel").indexOf("style")!=-1&&c.getAttribute("title")&&c.getAttribute("title").substr(0,1)=="q"){c.disabled=true;if(c.getAttribute("title")==f){c.disabled=false;e=true}}}if(e==false){setActiveStyleSheet("q0")}};function getXMLHTTP(){var c=null;if(window.XMLHttpRequest){c=new XMLHttpRequest()}else{if(window.ActiveXObject){try{c=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){c=null}}}else{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...")}}return c}var _inputField=null;var _oldInputFieldValue="";var _currentInputFieldValue="";var _resultCache=new Object();var _xmlHttp=null;var _adresseRecherche="";function initAutoComplete(c,a,b){_listResults=document.createElement("ul");_listResults.setAttribute("id","completeList");a.appendChild(_listResults);_adresseRecherche=b;_inputField=c;_inputField.autocomplete="off";_currentInputFieldValue=_inputField.value;_oldInputFieldValue=_currentInputFieldValue;cacheResults("",new Array());document.onkeydown=onKeyDownHandler;_inputField.onkeyup=onKeyUpHandler;setTimeout("mainLoop()",200)}function mainLoop(){if(_oldInputFieldValue!=_currentInputFieldValue&&_currentInputFieldValue.length>=2){var b=escapeURI(_currentInputFieldValue);if(_gaq){_gaq.push(["_trackEvent","Recherche","Recherche par Nom",_currentInputFieldValue])}var a=_resultCache[_currentInputFieldValue];if(a){loadResults(a)}else{callSuggestions(b)}_inputField.focus()}_oldInputFieldValue=_currentInputFieldValue;setTimeout("mainLoop()",200);return true}function escapeURI(a){if(encodeURIComponent){return encodeURIComponent(a)}if(escape){return escape(a)}}function callSuggestions(a){if(_xmlHttp&&_xmlHttp.readyState!=0){_xmlHttp.abort()}_xmlHttp=getXMLHTTP();if(_xmlHttp){_xmlHttp.open("GET","/"+_adresseRecherche+"?v="+a,true);_xmlHttp.onreadystatechange=function(){if(_xmlHttp.readyState==4&&_xmlHttp.responseText){var b=traiteSuggestions(_xmlHttp.responseText);cacheResults(a,b);loadResults(b)}else{while(_listResults.childNodes.length>0){_listResults.removeChild(_listResults.childNodes.item(0))}}};_xmlHttp.send(null)}}function cacheResults(b,a){_resultCache[b]=a}function traiteSuggestions(c){var e=new Array();var a=c.split("\r\n");for(var b=0;b<a.length;b++){var d=a[b];e.push(d.split("|"))}return e}function loadResults(c){while(_listResults.childNodes.length>0){_listResults.removeChild(_listResults.childNodes.item(0))}for(var b=0;b<(c.length-1);b++){var a=document.createElement("li");a.innerHTML='<a href="javascript:info('+c[b][0]+",'i',"+c[b][2]+","+c[b][3]+","+c[b][4]+",'"+c[b][7]+"');\">"+c[b][1]+'</a> (<span style="color: '+c[b][6]+';">'+c[b][5]+"</span>)";_listResults.appendChild(a)}}var _lastKeyCode=null;var _eventKeycode=null;var onKeyDownHandler=function(a){if(!a&&window.event){a=window.event}if(a){_lastKeyCode=a.keyCode}};var onKeyUpHandler=function(e){if(!e&&window.event){e=window.event}_eventKeycode=e.keyCode;if(_eventKeycode==40||_eventKeycode==38){blurThenGetFocus()}var g=rangeSize(_inputField);var b=beforeRangeSize(_inputField);var a=_inputField.value;if(_eventKeycode!=0){if(g>0&&b!=-1){a=a.substring(0,b)}if(_eventKeycode==13||_eventKeycode==3){var f=_inputField;if(_inputField.createTextRange){var c=_inputField.createTextRange();c.moveStart("character",_inputField.value.length);_inputField.select()}else{if(f.setSelectionRange){_inputField.setSelectionRange(_inputField.value.length,_inputField.value.length)}}}else{if(_inputField.value!=a){_inputField.value=a}}}if(_eventKeycode!=40&&_eventKeycode!=38){_currentInputFieldValue=a}if(handleCursorUpDownEnter(_eventKeycode)&&_eventKeycode!=0){}};function handleCursorUpDownEnter(a){if(a==40){highlightNewValue(_highlightedSuggestionIndex+1);return false}else{if(a==38){highlightNewValue(_highlightedSuggestionIndex-1);return false}else{if(a==13||a==3){return false}}}return true}var _completeDivRows=0;var _completeDivDivList=null;var _highlightedSuggestionIndex=-1;var _highlightedSuggestionDiv=null;function PressAction(){_highlightedSuggestionIndex=-1;var a=_completeDiv.getElementsByTagName("div");var f=a.length;_completeDivRows=f;_completeDivDivList=a;if(_currentInputFieldValue==""||f==0){}else{}var b=false;if(_currentInputFieldValue.length>0){var h;for(h=0;h<f;h++){if(getSuggestion(a.item(h)).toUpperCase().indexOf(_currentInputFieldValue.toUpperCase())==0){b=true;break}}}for(var e=0;e<f;e++){}if(b){_highlightedSuggestionIndex=h;_highlightedSuggestionDiv=a.item(_highlightedSuggestionIndex)}else{_highlightedSuggestionIndex=-1;_highlightedSuggestionDiv=null}var c=false;switch(_eventKeycode){case 8:case 33:case 34:case 35:case 35:case 36:case 37:case 39:case 45:case 46:c=true;break;default:break}if(!c&&_highlightedSuggestionDiv){var g;if(b){g=getSuggestion(_highlightedSuggestionDiv).substr(0)}else{g=_currentInputFieldValue}if(g!=_inputField.value){if(_inputField.value!=_currentInputFieldValue){return}if(_inputField.createTextRange||_inputField.setSelectionRange){_inputField.value=g}if(_inputField.createTextRange){var d=_inputField.createTextRange();d.moveStart("character",_currentInputFieldValue.length);d.select()}else{if(_inputField.setSelectionRange){_inputField.setSelectionRange(_currentInputFieldValue.length,_inputField.value.length)}}}}else{_highlightedSuggestionIndex=-1}}var _cursorUpDownPressed=null;function blurThenGetFocus(){_cursorUpDownPressed=true;_inputField.blur();setTimeout("_inputField.focus();",10);return}function rangeSize(c){var b=-1;if(c.createTextRange){var a=document.selection.createRange().duplicate();b=a.text.length}else{if(c.setSelectionRange){b=c.selectionEnd-c.selectionStart}}return b}function beforeRangeSize(c){var a=0;if(c.createTextRange){var b=document.selection.createRange().duplicate();b.moveEnd("textedit",1);a=c.value.length-b.text.length}else{if(c.setSelectionRange){a=c.selectionStart}else{a=-1}}return a}function cursorAfterValue(b){if(b.createTextRange){var a=b.createTextRange();a.moveStart("character",b.value.length);a.select()}else{if(b.setSelectionRange){b.setSelectionRange(b.value.length,b.value.length)}}}function getSuggestion(a){if(!a){return null}return trimCR(a.getElementsByTagName("span")[0].firstChild.data)}function trimCR(a){for(var d=0,b="",c="\n\r";d<a.length;d++){if(c.indexOf(a.charAt(d))==-1){b+=a.charAt(d)}}return b}function highlightNewValue(a){if(!_completeDivDivList||_completeDivRows<=0){return}if(a>=_completeDivRows){a=_completeDivRows-1}if(_highlightedSuggestionIndex!=-1&&a!=_highlightedSuggestionIndex){_highlightedSuggestionIndex=-1}if(a<0){_highlightedSuggestionIndex=-1;_inputField.focus();return}_highlightedSuggestionIndex=a;_highlightedSuggestionDiv=_completeDivDivList.item(a);_inputField.value=getSuggestion(_highlightedSuggestionDiv)}var onBlurHandler=function(a){if(!_cursorUpDownPressed){if(_lastKeyCode==9){_lastKeyCode=-1}}_cursorUpDownPressed=false};var g_search_delay=null;function DoSearchDelay(a){if(g_search_delay){window.clearTimeout(g_search_delay)}g_search_delay=window.setTimeout("DoSearch("+a+")",200)}function DoSearch(d){$("snap").innerHTML="";var c=$("str").value;var a=$("num").value;if(d===true&&a==""){a=1}var b=$("zon").value;if(c===""){$("locate").innerHTML="";return false}xmlhttp("GET","/xhr.locate2.php?str="+c+"&num="+a+"&zon="+b,function(e){$("locate").innerHTML=e})}function go(a,b){xmlhttp("GET","/xhr.locate3.php?x="+a+"&y="+b,function(c){xhr_go(c)});map0.zoom.nearest(1,a,b);map0.locate.show(a,b)}function xhr_go(c){var a=c.split("\r\n");if(a.length==1){var d=a[0].split(",");var e=d[1];e+="<br />";e+="<a href=\"javascript:load('xhr.quartier.php?q="+d[0]+"');\">"+d[2]+"</a>";headQuartier(d[0]);colorQuartier(d[0]);$("snap").innerHTML=e}else{var e=a[0];for(var b=1;b<a.length-1;b++){var d=a[b].split(",");e+="<br />&bull;&nbsp;";e+='<a href="javascript:loadQuartier('+d[0]+",'"+d[1]+"',"+d[5]+","+d[3]+","+d[4]+');" style="color: '+d[2]+';">';e+=d[1];e+="</a>";e+=" ("+d[6]+" m.)"}$("snap").innerHTML=e}};
