//<![CDATA[
function getWindowSize(){	var e = new Object(); 		if(window.self && self.innerWidth){ 				e.width = self.innerWidth; 				e.height = self.innerHeight; 		}else if(document.documentElement && document.documentElement.clientHeight){		e.width = document.documentElement.clientWidth; 				e.height = document.documentElement.clientHeight; 		}else{ 				e.width = document.body.clientWidth; 				e.height = document.body.clientHeight; 		} 		return e; }  var xmlHttp;function GetXmlHttpObject(handler){	var objXMLHttp=null;	if (window.XMLHttpRequest){		objXMLHttp=new XMLHttpRequest();	}	else if (window.ActiveXObject){		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");	}	return objXMLHttp;}function preloadImages() { 	var d=document;  	if(d.images){  				if(!d.p) d.p=new Array(); 				var i,j=d.p.length,a=preloadImages.arguments;  				for(i=0; i<a.length; i++)     						if (a[i].indexOf("#")!=0){				d.p[j]=new Image;  								d.p[j++].src=a[i]; 						} 		} }function showBoxFromIframe(id,b){	}function showBox(id,b){	if (b){		document.getElementById('boxContainerId').style.display="block";		document.getElementById(id).style.display="block";	}	else{		document.getElementById('boxContainerId').style.display="none";		document.getElementById(id).style.display="none";	}}var idArray=new Array(new Array("start","create","share","collaborate","explore"),new Array("review","picture","video"));function welcomeBoxOngletSwitch(index,id){		for (var i=0; i<idArray[index].length; i++)		if(idArray[index][i]==id){			document.getElementById(idArray[index][i]+"Id").style.display="block";					}		else{			document.getElementById(idArray[index][i]+"Id").style.display="none";								}}


      function ELabel(point, html, classname, pixelOffset, percentOpacity, overlap) {

        this.point = point;
        this.html = html;
        

        this.classname = classname||"";
        this.pixelOffset = pixelOffset||new GSize(0,0);
        if (percentOpacity) {
          if(percentOpacity<0){percentOpacity=0;}
          if(percentOpacity>100){percentOpacity=100;}
        }        
        this.percentOpacity = percentOpacity;
        this.overlap=overlap||false;
      } 
      
      ELabel.prototype = new GOverlay();

      ELabel.prototype.initialize = function(map) {
        var div = document.createElement("div");
        div.style.position = "absolute";
        div.innerHTML = '<div class="' + this.classname + '">' + this.html + '</div>' ;
        map.getPane(G_MAP_FLOAT_SHADOW_PANE).appendChild(div);
        this.map_ = map;
        this.div_ = div;
        if (this.percentOpacity) {        
          if(typeof(div.style.filter)=='string'){div.style.filter='alpha(opacity:'+this.percentOpacity+')';}
          if(typeof(div.style.KHTMLOpacity)=='string'){div.style.KHTMLOpacity=this.percentOpacity/100;}
          if(typeof(div.style.MozOpacity)=='string'){div.style.MozOpacity=this.percentOpacity/100;}
          if(typeof(div.style.opacity)=='string'){div.style.opacity=this.percentOpacity/100;}
        }
        if (this.overlap) {
          var z = GOverlay.getZIndex(this.point.lat());
          this.div_.style.zIndex = z;
        }
      }

      ELabel.prototype.remove = function() {
        this.div_.parentNode.removeChild(this.div_);
      }

      ELabel.prototype.copy = function() {
        return new ELabel(this.point, this.html, this.classname, this.pixelOffset, this.percentOpacity, this.overlap);
      }

      ELabel.prototype.redraw = function(force) {
        var p = this.map_.fromLatLngToDivPixel(this.point);
        var h = parseInt(this.div_.clientHeight);
        this.div_.style.left = (p.x + this.pixelOffset.width) + "px";
        this.div_.style.top = (p.y +this.pixelOffset.height - h) + "px";
      }

      ELabel.prototype.show = function() {
        this.div_.style.display="";
      }
      
      ELabel.prototype.hide = function() {
        this.div_.style.display="none";
      }
      
      ELabel.prototype.setContents = function(html) {
        this.html = html;
        this.div_.innerHTML = '<div class="' + this.classname + '">' + this.html + '</div>' ;
        this.redraw(true);
      }
      
      ELabel.prototype.setPoint = function(point) {
        this.point = point;
        if (this.overlap) {
          var z = GOverlay.getZIndex(this.point.lat());
          this.div_.style.zIndex = z;
        }
        this.redraw(true);
      }
      
      ELabel.prototype.setOpacity = function(percentOpacity) {
        if (percentOpacity) {
          if(percentOpacity<0){percentOpacity=0;}
          if(percentOpacity>100){percentOpacity=100;}
        }        
        this.percentOpacity = percentOpacity;
        if (this.percentOpacity) {        
          if(typeof(this.div_.style.filter)=='string'){this.div_.style.filter='alpha(opacity:'+this.percentOpacity+')';}
          if(typeof(this.div_.style.KHTMLOpacity)=='string'){this.div_.style.KHTMLOpacity=this.percentOpacity/100;}
          if(typeof(this.div_.style.MozOpacity)=='string'){this.div_.style.MozOpacity=this.percentOpacity/100;}
          if(typeof(this.div_.style.opacity)=='string'){this.div_.style.opacity=this.percentOpacity/100;}
        }
      }

      ELabel.prototype.getPoint = function() {
        return this.point;
      }
      ELabel.prototype.U = function() {
        return this.point;
      }
      ELabel.prototype.V = function() {
        return this.point;
      }
      ELabel.prototype.W = function() {
        return this.point;
      }
      ELabel.prototype.X = function() {
        return this.point;
      }
      ELabel.prototype.Y = function() {
        return this.point;
      }
      ELabel.prototype.Z = function() {
        return this.point;
      }

 var mapOffSet=4;   	     function isBusy(b){	if(b){		document.getElementById("busyBoxId").style.display="block";			}	else		document.getElementById("busyBoxId").style.display="none"; }  function setNewListeners(){     	window.onresize = function(){ 				sizeMapDiv(mapOffSet);     	}; }  var wS;var successSubmissionBoxWidth=300;var successSubmissionBoxHeight=170;function sizeMapDiv(offset){ 		wS = getWindowSize(); 		document.getElementById("mapId").style.height = (wS.height - offset) + 'px';	document.getElementById("mapId").style.width = (wS.width - 185) + 'px';	document.getElementById("leftBand").style.height = (wS.height - offset) + 'px';		document.getElementById("controlContainerId").style.height = (wS.height-360) + 'px';	document.getElementById("placesOfInterestId").style.height = (wS.height-360) + 'px';	document.getElementById("searchResultId").style.height = (wS.height-460) + 'px';			document.getElementById("successPlaceSubmissionBoxId").style.width=successSubmissionBoxWidth+'px';	document.getElementById("successPlaceSubmissionBoxId").style.height=successSubmissionBoxHeight+'px';	document.getElementById("successPlaceSubmissionBoxId").style.left=(wS.width-successSubmissionBoxWidth)/ 2+'px';	document.getElementById("successPlaceSubmissionBoxId").style.top=(wS.height-successSubmissionBoxHeight) / 2.5+'px';				document.getElementById("successRouteSubmissionBoxId").style.width=successSubmissionBoxWidth+'px';	document.getElementById("successRouteSubmissionBoxId").style.height=successSubmissionBoxHeight+'px';	document.getElementById("successRouteSubmissionBoxId").style.left=(wS.width-successSubmissionBoxWidth)/ 2+'px';	document.getElementById("successRouteSubmissionBoxId").style.top=(wS.height-successSubmissionBoxHeight) / 2.5+'px';				document.getElementById("boxContainerId").style.height=wS.height+ 'px';	document.getElementById("boxContainerId").style.width=wS.width+ 'px';		document.getElementById("bigBoxId").style.left=((wS.width)/2-185)+'px';	document.getElementById("bigBoxId").style.height=wS.height-130+"px";}   var controlIdArray=new Array("poi","search","edit");function ongletSwitch(controlId){	for (var i=0; i<controlIdArray.length; i++)		if(controlIdArray[i]==controlId){			document.getElementById(controlIdArray[i]+"ControlId").style.display="block";			document.getElementById(controlIdArray[i]+"OngletId").className="ongletHover";		}		else{			document.getElementById(controlIdArray[i]+"ControlId").style.display="none";			document.getElementById(controlIdArray[i]+"OngletId").className="onglet";		}}var myMap;  function initImages(){	preloadImages(			'pics/buttonHover.png', 							'pics/buttonHoverLarge.png',		'pics/buttonHoverMiddle.png', 			'pics/ongletHover.png',		'pics/button.png',		'pics/buttonHoverGreen.png',		'pics/buttonLarge.png',		'pics/buttonMiddle.png',		'pics/buttonSubmit.png',		'pics/okButton.png',		'icones/voteFor.png'	); } 	  var routeHide=true;function updateRouteHideLabelId(b){	if (b)		document.getElementById("routeHideLabelId").innerHTML="Hide";	else		document.getElementById("routeHideLabelId").innerHTML="Show";	routeHide=b;}function displayRoute(b){	if (b){		hideAllLines();	}	else{		loadInitialLines();			}}		function load(){ 		sizeMapDiv(mapOffSet); 		setNewListeners(); 		initImages(); 			if (GBrowserIsCompatible()){		 	 				myMap = new GMap2(document.getElementById("mapId"));					myMap.addControl(new GLargeMapControl());		myMap.addControl(new GScaleControl());		myMap.addControl(new GMapTypeControl());				myMap.setCenter(new GLatLng(parseFloat(mapPointLng),parseFloat(mapPointLat)), zoomLevel,G_SATELLITE_MAP); 		myMap.enableContinuousZoom();		myMap.enableScrollWheelZoom();		myMap.enableDoubleClickZoom();		showDistricts();		loadInitialLines();	    		GEvent.addListener(myMap, "zoomend", function(oldzoom,zoom){			if (zoom<=13)				displayDistrictBoxLine(false);			else 				displayDistrictBoxLine(true);		});			}	} function isDefined(variable){    return (typeof(window[variable]) == "undefined")?  false: true;}var builtLines = new Array(); var displayedLines = new Array(); var polylines = new Array(); var eLabels= new Array(new Array()); var initialLines=new Array();var lineBoxInterval=12;var linesCategoryWidth={"subway":7,"tram":5,"bus":3,"other":6};function loadLine(line,center){	if (builtLines[line]==undefined){		isBusy(true);		GDownloadUrl("route.php?routeNum="+lines[line]+"&valid=true", function(data, responseCode){			var xml=GXml.parse(data);			var markers=xml.documentElement.getElementsByTagName("marker");			var points=[];			var j=0;			eLabels[line]=new Array();			for (var i=0; i<markers.length; i++){				points.push(new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")))); 							if((i%lineBoxInterval==0) || (i==(markers.length-1))){										eLabels[line].push(new ELabel(points[i] ,"<div onclick=javascript:hideLine('"+line+"'); class=\"bulleLine\" style=\"border-color:"+linesColor[line]+";\">"+line+"</div>")); 								j++;				}			}						builtLines[line]=new GLatLng(parseFloat(markers[0].getAttribute("lat")), parseFloat(markers[0].getAttribute("lng"))); 			polylines[line]=new GPolyline(points,linesColor[line],linesCategoryWidth[linesCategory[line]],1);			 						displayedLines[line]=true; 						myMap.addOverlay(polylines[line]); 			 									if(center) 								myMap.setCenter(builtLines[line]); 							for(var k=0;k<eLabels[line].length;k++)				myMap.addOverlay(eLabels[line][k]); 			isBusy(false);		}); 				}else{ 			isBusy(true);		myMap.addOverlay(polylines[line]); 		  						if(center) 						myMap.setCenter(builtLines[line]); 						if (eLabels[line]!=undefined && displayedLines[line]==false) 						for(var k=0;k<eLabels[line].length;k++)				myMap.addOverlay(eLabels[line][k]); 					displayedLines[line]=true; 			isBusy(false);	}	updateRouteHideLabelId(true);	showPlaces(line, true);} function printSQL(){ 		var content="";  		for(var i in lines){ 				content+="insert into route (route, color, points) values('"+i+"','"+lines[i]+"','"; 				GDownloadUrl("lines/"+i+".xml", function(data, responseCode){ 						var xml=GXml.parse(data); 						var markers=xml.documentElement.getElementsByTagName("marker"); 						var points=[];			 						for (var j=0; j<markers.length; j++)  								content+="("+markers[j].getAttribute("lat")+","+markers[j].getAttribute("lng")+")";			 				}); 				content+="');\n\n"; 		} 		document.getElementById("sqlId").innerText=content; }  function loadBetaLineFromDb(line){		GDownloadUrl("route.php?routeNum="+line, function(data, responseCode){ 			var xml=GXml.parse(data);		var markers=xml.documentElement.getElementsByTagName("marker");		var points=[];		for (var i=0; i<markers.length; i++) {			points.push(new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")))); 				} 				myMap.addOverlay(new GPolyline(points,"#FF0000",4,1));		myMap.setCenter(points[0]);	}) }  function hideAllLines(){ 		for(var i in polylines){		 				myMap.removeOverlay(polylines[i]); 			for(var k=0;k<eLabels[i].length;k++)			myMap.removeOverlay(eLabels[i][k]); 								displayedLines[i]=false; 			hidePlaces(i);	}		initSelectRouteForm(); 	updateRouteHideLabelId(false);} 	 function hideLine(line){ 		if (line!="choose"){ 				myMap.removeOverlay(polylines[line]); 				for(var k=0;k<eLabels[line].length;k++)			myMap.removeOverlay(eLabels[line][k]); 					displayedLines[line]=false; 		} 	var found=false;		for(var i in polylines)		if(displayedLines[i]==true){			found=true;			break;		}	if (!found)		updateRouteHideLabelId(false);	hidePlaces(line);}  var listLines=new Array();for (var l in lines)	listLines.push(l);maxDLines=2;function findLine(myLines,j){	var found=false;	for (var i=0; i<myLines.length; i++)		if (myLines[i]==j){			found=true;			break;		}	return found;}	function loadInitialLines(){		var dLines=(listLines.length<maxDLines)?listLines.length:maxDLines;		var pLines=new Array();	for(var i=0; i<dLines; i++){		var j=Math.round(Math.random()*(listLines.length-1));		while (findLine(pLines,j)!=false)			j=Math.round(Math.random()*(listLines.length-1));		pLines.push(j);					loadLine(listLines[j],false);		}	initSelectRouteForm();	 }  var selectRouteFormLoaded=false;  function initSelectRouteForm(){	if (selectRouteFormLoaded){		for(var i=0;i<4;i++)			if (document.routeForm.elements['selectRouteForm'+i]!=undefined)				document.routeForm.elements['selectRouteForm'+i].selectedIndex=0;	}}function displayLine(line){ 		if (line!="choose") 				loadLine(line,true); }  function showPhotoId(b,img){	if (b){		document.getElementById('photoImgId').src="photos/"+img+".jpg";			document.getElementById('photoImgId').style.display="block";	}}function showVideoId(b,video){	if (b){		document.getElementById('videoObId').innerHTML="<object width=425 height=350><param name=movie value=http://www.youtube.com/v/"+video+"></param><param name=wmode value=transparent></param><embed src=http://www.youtube.com/v/"+video+" type=application/x-shockwave-flash wmode=transparent width=425 height=350></embed></object>";		document.getElementById('videoObId').style.height="350px";			}}function displayBoxLine(i,b){	if(districtHide){	if (b)		document.getElementById("districtBoxLine"+i+"Id").style.display="block";	else		document.getElementById("districtBoxLine"+i+"Id").style.display="none";			nDistrictDisplay[i]=b;}}	  function autoHideBoxLine(i){	if (nDistrictDisplay[i]==true)		document.getElementById("districtBoxLine"+i+"Id").style.display="none";	else		document.getElementById("districtBoxLine"+i+"Id").style.display="block";	nDistrictDisplay[i]=!nDistrictDisplay[i];}function hideDistricts(){	if (districtBoxes.displayed==true){		districtBoxes.displayed=false;		for(var i=0; i<districtBoxes.length; i++) 					myMap.removeOverlay(districtBoxes[i]); 			}}  var districtHide=true;function displayDistrict(b){	if (b){		hideDistricts();		document.getElementById("districtHideLabelId").innerHTML="Show";	}	else{		showDistricts();		document.getElementById("districtHideLabelId").innerHTML="Hide";	}	districtHide=!districtHide;}var allDistrictBoxLine=true;function displayDistrictBoxLine(b){	if (b!=allDistrictBoxLine){		for(var i=0;i<nDistrict;i++)			displayBoxLine(i,b);			allDistrictBoxLine=b;	}}var districtBoxes= new Array(); var nDistrict=0;var nDistrictDisplay=new Array();function showDistricts(){			if (isDefined(districtBoxes)==false){				GDownloadUrl("districts.php?valid=true&mapNum="+mapNum+"&districts=true"+mapExterneNumGet, function(data, responseCode){								var xml=GXml.parse(data); 						var districts=xml.documentElement.getElementsByTagName("district");			nDistrict=districts.length;			if (nDistrict>0)				isBusy(true);			for (var i=0; i<districts.length; i++){				nDistrictDisplay[i]=true;				var districtBoxesContent="<div class=districtBox><div class=districtBoxLabel onclick=javascript:autoHideBoxLine("				+i+");>"+districts[i].getAttribute("label")+"</div><div class=districtBoxLine id=districtBoxLine"+i+"Id>";		 								var linesString=districts[i].getAttribute("lines"); 												var contentLineType={"subway":"","tram":"","bus":"","other":""};				var nContentLineType={"tram":0,"bus":0,"subway":0,"other":0};								if (linesString!=""){					var districtLines=linesString.split(" ");									for (var j=0; j<districtLines.length; j++){							contentLineType[linesCategory[districtLines[j]]]+="<a href=\"javascript:loadLine('"						+districtLines[j]+"',false);\">&nbsp;"+districtLines[j]+"</a>"; 						nContentLineType[linesCategory[districtLines[j]]]++;												if (nContentLineType[linesCategory[districtLines[j]]]!=0 && nContentLineType[linesCategory[districtLines[j]]]%10==0)							contentLineType[linesCategory[districtLines[j]]]+="<br>";																	}				}								for(var key in nContentLineType)					if(nContentLineType[key]>0)						districtBoxesContent+="<div style=\"border:3px solid "+routeCategoryColor[key]+";\"><div style=\"padding:1px;background-color:white;\">"+key.toUpperCase()+":"+contentLineType[key]+"</div></div>";														districtBoxesContent+="</div></div>";					districtBoxes[i] = new ELabel(new GLatLng(parseFloat(districts[i].getAttribute("lat")),				parseFloat(districts[i].getAttribute("lng"))), districtBoxesContent); 												myMap.addOverlay(districtBoxes[i]);						districtBoxes.displayed=true;				isBusy(false);				}		});	}else{		isBusy(true);		if(districtBoxes.displayed==false){			for(var i=0; i<districtBoxes.length; i++)				myMap.addOverlay(districtBoxes[i]);						districtBoxes.displayed=true;			isBusy(false);			}	}		}function showCategoryPlaces(categoryNum){	if(placesBoxes[categoryNum]==undefined || placesBoxes[categoryNum].displayed==false){		showPlaces(categoryNum);		document.getElementById("categoryIcon"+categoryNum+"id").style.borderColor="#ff481f";	}	else{		hidePlaces(categoryNum)==true;		document.getElementById("categoryIcon"+categoryNum+"id").style.borderColor="white";	}}function createMarker(point,placeNum,categoryNum, i, myIcon){    var marker = new GMarker(point,myIcon);      GEvent.addListener(marker,"mouseover", function() {		showPlaceBox(categoryNum,i,true);    });                		GEvent.addListener(marker,"mouseout", function() {		showPlaceBox(categoryNum,i,false);    });                    GEvent.addListener(marker,"click", function() {		showPlaceDetailBox(placeNum);    });                	return marker;}function showPlaceDetailBox(placeNum){	xmlHttp=GetXmlHttpObject();	if (xmlHttp==null){		alert ("Browser does not support HTTP Request");		return;	} 			var url="placeDetail.php?placeNum="+placeNum+"&map="+map;	xmlHttp.onreadystatechange=displayPlaceDetailBox; 	xmlHttp.open("GET",url,true);	xmlHttp.send(null);}function displayPlaceDetailBox(){	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){				document.getElementById('bigBoxId').innerHTML=xmlHttp.responseText;		showBox('bigBoxId',true);	}}function showPlaceBox(categoryNum,id,b){	if (b)			document.getElementById("placeBox"+categoryNum+"_"+id+"Id").className="placeBoxVisible";	else		document.getElementById("placeBox"+categoryNum+"_"+id+"Id").className="placeBoxHidden";}var placesBoxes=new Array(new Array());var placeIcons= new Array(new Array()); function hidePlaces(categoryNum){		if (placesBoxes[categoryNum].displayed==true){		for(var i=0; i<placesBoxes[categoryNum].nPlace; i++){					myMap.removeOverlay(placesBoxes[categoryNum][i]);						myMap.removeOverlay(placeIcons[categoryNum][i]); 				placesBoxes[categoryNum][i].displayed=false;		}		placesBoxes[categoryNum].displayed=false;     }} function buildPlaces(categoryNum, filtreNum, valid, route){	if (typeof route == 'undefined') 				route="false";		routeFiltre="&route="+route;			isBusy(true);	placeIcons[categoryNum]=new Array();	placesBoxes[categoryNum]=new Array();					GDownloadUrl("districts.php?valid="+valid+"&mapNum="+mapNum+"&categoryNum="+categoryNum+routeFiltre+mapExterneNumGet, function(data, responseCode){						var xml=GXml.parse(data); 		var places=xml.documentElement.getElementsByTagName("district");							placesBoxes[categoryNum].nPlace=places.length;				for (var i=0; i<places.length; i++){						newPoint=new GLatLng(parseFloat(places[i].getAttribute("lat")),parseFloat(places[i].getAttribute("lng")));						placeIcons[categoryNum][i]=createMarker(newPoint,places[i].getAttribute("num"),categoryNum,i,gicons[gicons[places[i].getAttribute("categoryNum")]!=undefined?places[i].getAttribute("categoryNum"):"default"]);			placesBoxes[categoryNum][i] = new ELabel(newPoint, "<div class=placeBoxHidden id=placeBox"+categoryNum+"_"+i+"Id><b>"+						places[i].getAttribute("label")+"</b><br>Click on icon for more detail</div>");											placesBoxes[categoryNum][i].displayed=false;			placesBoxes[categoryNum][i].num=places[i].getAttribute("num");		}		placesBoxes[categoryNum].displayed=false;						if(filtreNum!=0)			displaySearchPlace(categoryNum, filtreNum);										else{			for (var i=0; i<placesBoxes[categoryNum].nPlace; i++)				displayPlace(categoryNum,i,false);			placesBoxes[categoryNum].displayed=true;		}						isBusy(false);			});			}  function displaySearchPlace(categoryNum, placeNum){	for (var i=0; i<placesBoxes[categoryNum].nPlace; i++)				if (placesBoxes[categoryNum][i].num==placeNum)			displayPlace(categoryNum,i,true);	 } function displayPlace(categoryNum, num, zoom){	if (placesBoxes[categoryNum][num].displayed==false){		myMap.addOverlay(placeIcons[categoryNum][num]);			myMap.addOverlay(placesBoxes[categoryNum][num]);		placesBoxes[categoryNum][num].displayed=true;			}	if (zoom)		myMap.setCenter(placeIcons[categoryNum][num].getPoint(),18);}function showPlaces(categoryNum, route){	if (typeof route=='undefined')		route = 'false';			if (route=='true')		categoryNum=route;			if (placesBoxes[categoryNum]==undefined){				buildPlaces(categoryNum,0,true,route);				}	else{		if (placesBoxes[categoryNum].displayed==false)			for(var i=0; i<placesBoxes[categoryNum].nPlace; i++)				displayPlace(categoryNum,i,false);		placesBoxes[categoryNum].displayed=true;	}} function showPlace(categoryNum, num,b){			if (placesBoxes[categoryNum]==undefined || placesBoxes[categoryNum].length==0){				buildPlaces(categoryNum, num,b);	}else		displaySearchPlace(categoryNum, num,b);	}var point;var linePoints = new Array();var drawnPoints = 0;var lineColor="#FF0000";var lineWidth=4;var lineOpacity=1;var polyline;var editListenerHandle;var startPoint;	function submitBusRoute(){	var trouble=false;	if (linePoints.length<=2){		alert("No bus route drawn");		trouble=true;	}else if (document.selectDistrictForm.editBusRouteName.value==""){		alert("No name entered for bus route name");		document.selectDistrictForm.editBusRouteName.focus();		trouble=true;	}	if(!trouble && confirm("Submit bus route?")==true){		var hiddenInputs="<input type=hidden name=newRoutePoints value='";		for (var i=0; i<linePoints.length; i++)			hiddenInputs+=linePoints[i];		hiddenInputs+="'>";		if(document.selectDistrictForm.newSelectDistricts.options.length>0){			hiddenInputs+="<input type=hidden name=newRouteDistrict value='";			for (var j=0; j<document.selectDistrictForm.newSelectDistricts.options.length-1;j++)				hiddenInputs+=document.selectDistrictForm.newSelectDistricts.options[j].value.replace(/ /g,"_")+",";			hiddenInputs+=document.selectDistrictForm.newSelectDistricts.options[document.selectDistrictForm.newSelectDistricts.options.length-1].value.replace(/ /g,"_")+"'>";		}		document.getElementById("hiddenInputsId").innerHTML=hiddenInputs;				showBox('successRouteSubmissionBoxId',true);					stopEdit(false);		return true;	}else return false;}function showSuccessSubmissionBox(b){	if(b){		document.getElementById("boxContainerId").style.display="block";					document.getElementById("successSubmissionBoxId").style.display="block";		}else{		document.getElementById("successSubmissionBoxId").style.display="none";		document.getElementById("boxContainerId").style.display="none";	}}function removeNewSelectDistrict(){	if(document.selectDistrictForm.newSelectDistricts.options.length>0)		document.selectDistrictForm.newSelectDistricts.options[document.selectDistrictForm.newSelectDistricts.selectedIndex]=null;}function addNewSelectDistrict(){	var val=document.selectDistrictForm.selectDistricts.options[document.selectDistrictForm.selectDistricts.selectedIndex].value;	var found=false;	for(var i=0; i<document.selectDistrictForm.newSelectDistricts.options.length; i++)		if(document.selectDistrictForm.newSelectDistricts.options[i].value==val)			found=true;	if (!found)		document.selectDistrictForm.newSelectDistricts.options[document.selectDistrictForm.newSelectDistricts.options.length]=new Option(val,val);}function showEditBlock(){		document.getElementById("startEditingId").style.display="none";	document.getElementById("editRouteControlId").style.display="block";	document.selectDistrictForm.editBusRouteName.value="";	document.getElementById("mapId").firstChild.firstChild.style.cursor = "crosshair";	document.selectDistrictForm.newSelectDistricts.options.length=0;}function startEdit(){	showEditBlock();	editListenerHandle=GEvent.addListener(myMap, 'click', function(overlay, point) {		if (point) {			linePoints[drawnPoints] = point;			if (document.getElementById("removeLastPointId").style.display!="block");			document.getElementById("removeLastPointId").style.display="block";			draw();			var latLngStr = 'Long, Lat: ' + point;			drawnPoints++;			document.getElementById("mapId").firstChild.firstChild.style.cursor = "crosshair";		}	});}function insertRoute(updated){	if (updated){		var Insert="Update";		var inserted="updated";	}else{		var Insert="Insert";		var inserted="inserted";	}	if (confirm(Insert+" Route?")==true){		var insertDistricts="";		for (var i=0; i<document.selectDistrictForm.newSelectDistricts.options.length; i++){			var val=document.selectDistrictForm.newSelectDistricts.options[i].value;			insertDistricts+=val.replace(/ /g,'_')+" ";		}		document.insertRouteForm.route.value=document.selectDistrictForm.editBusRouteName.value;				document.insertRouteForm.routeCategoryNum.value=document.selectDistrictForm.routeCategoryNum.value;		document.insertRouteForm.districts.value=insertDistricts;				var returnUrl=document.insertRouteForm.map.value;		document.insertRouteForm.submit();		alert("Route "+inserted+" successfully");		window.location.href=returnUrl;		parent.frames["left"].location="admin/manager.php";	}}function rejectRoute(deleted){	if (deleted){		var Reject="Delete";		var rejected="deleted";	}	else{		var	Reject="Reject";		var rejected="rejected";	}	if(confirm(Reject+" route?")==true){		document.selectDistrictForm.submit();		alert("Route "+rejected+" successfuly");		var returnUrl=document.insertRouteForm.map.value;		window.location.href=returnUrl;		parent.frames["left"].location="admin/manager.php";	}}function stopEdit(confirmation){	if (!confirmation || confirmation &&confirm("Cancel route?\n(You will lose your current work)")==true){				document.getElementById("editRouteControlId").style.display="none";		document.getElementById("removeLastPointId").style.display="none";		document.getElementById("startEditingId").style.display="block";		removeAllPoints(false);		GEvent.removeListener(editListenerHandle);				document.getElementById("mapId").firstChild.firstChild.style.cursor = "hand";	}}function draw(){	myMap.removeOverlay(startPoint);	myMap.removeOverlay(polyline);	polyline=new GPolyline(linePoints, lineColor, lineWidth, lineOpacity);	myMap.addOverlay(polyline);	startPoint=new ELabel( linePoints[0],"<div class=\"bulleLine\" style=\"border-color:red;\">Start</div>");	myMap.addOverlay(startPoint);}function removeLastPoint(){	if (drawnPoints>0){		if (drawnPoints==1){			myMap.removeOverlay(startPoint);			document.getElementById("removeLastPointId").style.display="none";		}		myMap.removeOverlay(polyline);		drawnPoints--;		linePoints.splice(drawnPoints,1);		polyline = new GPolyline(linePoints, lineColor, lineWidth, lineOpacity);		myMap.addOverlay(polyline);	}}function removeAllPoints(confirmation){	if (confirmation==false || confirmation==true && confirm("Remove all points?")==true){		myMap.removeOverlay(startPoint);		drawnPoints=0;		linePoints.length = 0;		myMap.removeOverlay(polyline);	}}function getCookie(c_name){	if (document.cookie.length>0){		c_start=document.cookie.indexOf(c_name + "=");		if (c_start!=-1){			c_start=c_start + c_name.length+1;			c_end=document.cookie.indexOf(";",c_start);			if (c_end==-1) c_end=document.cookie.length;				return unescape(document.cookie.substring(c_start,c_end));		} 	}	return "";}function setCookie(c_name,value,expiredays){	var exdate=new Date();	exdate.setDate(exdate.getDate()+expiredays);	document.cookie=c_name+ "=" +escape(value)+	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());}function checkCookie(){	var firstVisit=getCookie('mkmap');	if (firstVisit==null || firstVisit=="" || firstVisit=="true"){		if (firstVisit!="true")			setCookie('mkmap','true',365);		showBox('bigBoxId',true);		getWelcomeBoxContent();	}}var welcomeXmlHttp;function getWelcomeBoxContent(){	welcomeXmlHttp=GetXmlHttpObject();	if (welcomeXmlHttp==null){		alert ("Browser does not support HTTP Request");		return;	} 			var url="welcomeBox.php";	welcomeXmlHttp.onreadystatechange=displayWelcomeBoxContent; 	welcomeXmlHttp.open("GET",url,true);	welcomeXmlHttp.send(null);}function displayWelcomeBoxContent(){		if (welcomeXmlHttp.readyState==4 || welcomeXmlHttp.readyState=="complete"){		document.getElementById('bigBoxId').innerHTML=welcomeXmlHttp.responseText;		welcomeBoxOngletSwitch(0,'start');	}}function checkReview(placeNum){	var alreadyReviewed=getCookie(placeNum);	if (alreadyReviewed==null || alreadyReviewed=="")		return false;	else		return true;	}var editDistrictListenerHandle;var districtPoint=0;function submitDistrict(){	var trouble=false;	if (districtPoint==0){		alert("No new place located\nYou may locate a new place by clicking on the map");		trouble=true;	}else if (document.newDistrictForm.editDistrictName.value==""){		alert("No name entered for the place");		document.newDistrictForm.editDistrictName.focus();		trouble=true;	}	if(!trouble && confirm("Submit place?")==true){		var hiddenInputs="<input type=hidden name=newDistrictPoint value='"+districtPoint+"'>";				if(document.newDistrictForm.newSelectRoutes.options.length>0){			hiddenInputs+="<input type=hidden name=newDistrictRoutes value='";			for (var j=0; j<document.newDistrictForm.newSelectRoutes.options.length-1;j++)				if (document.newDistrictForm.newSelectRoutes.options[j].value!="")					hiddenInputs+=document.newDistrictForm.newSelectRoutes.options[j].value+" ";			hiddenInputs+=document.newDistrictForm.newSelectRoutes.options[document.newDistrictForm.newSelectRoutes.options.length-1].value+"'>";		}		document.getElementById("hiddenDistrictInputsId").innerHTML=hiddenInputs;		showBox('successPlaceSubmissionBoxId',true);		stopDistrictEdit(false);		return true;	}else return false;}function removeNewSelectRoute(){	if(document.newDistrictForm.newSelectRoutes.options.length>0)		document.newDistrictForm.newSelectRoutes.options[document.newDistrictForm.newSelectRoutes.selectedIndex]=null;}function addNewSelectRoute(){		var val=document.newDistrictForm.selectRoutes.options[document.newDistrictForm.selectRoutes.selectedIndex].value;		var found=false;	for(var i=0; i<document.newDistrictForm.newSelectRoutes.options.length; i++)		if(document.newDistrictForm.newSelectRoutes.options[i].value==val)			found=true;	if (!found)		document.newDistrictForm.newSelectRoutes.options[document.newDistrictForm.newSelectRoutes.options.length]=new Option(val,val);}function removeMarker(){	if(districtPoint!=0)		myMap.removeOverlay(myMarker);	}function showDistrictEditBlock(districtEditing){	var nbLabels=5;	var label1="district";	var label2="place";	document.newDistrictForm.editDistrictName.value="";		if(districtEditing){		document.getElementById("selectCategoryId").style.display="none";					document.newDistrictForm.submittedPlace.value="false";	}else{		label1="place";		label2="district";		document.getElementById("selectCategoryId").style.display="block";		document.newDistrictForm.selectCategory.selectedIndex=0;		document.newDistrictForm.submittedPlace.value="true";	}	for(var i=1; i<=nbLabels; i++){		document.getElementById(label1+"Label"+i+"Id").style.display="block";		document.getElementById(label2+"Label"+i+"Id").style.display="none";	}	document.getElementById("editDistrictControlId").style.display="block";	document.getElementById("startEditingId").style.display="none";		document.getElementById("mapId").firstChild.firstChild.style.cursor = "crosshair";	document.newDistrictForm.newSelectRoutes.options.length=0;		}var myMarker;var baseIcon = new GIcon();baseIcon.iconSize = new GSize(32, 32);  baseIcon.iconAnchor = new GPoint(6, 32);baseIcon.infoWindowAnchor = new GPoint(9, 2);baseIcon.infoShadowAnchor = new GPoint(18, 25);var myMarkerIcon = new GIcon(baseIcon);myMarkerIcon.image = "icones/40.png";function startDistrictEdit(districtEditing){	showDistrictEditBlock(districtEditing);		editDistrictListenerHandle=GEvent.addListener(myMap, 'click', function(overlay, point) {		if (point) {			if(districtPoint==0){				districtPoint=point;				myMarker = new GMarker(districtPoint,myMarkerIcon);								myMap.addOverlay(myMarker);			}			else{				districtPoint=point;				myMarker.setPoint(districtPoint);			}			document.getElementById("mapId").firstChild.firstChild.style.cursor = "crosshair";		}	});	}function insertDistrict(updated){	if (updated){		var Insert="Update";		var inserted="updated";	}else{		var Insert="Insert";		var inserted="inserted";	}	if (confirm(Insert+" district?")==true){		var insertRoutes="";		for (var i=0; i<document.newDistrictForm.newSelectRoutes.options.length; i++){			var val=document.newDistrictForm.newSelectRoutes.options[i].value;			if (val!="")				insertRoutes+=val.replace(' ','_')+" ";		}		document.insertDistrictForm.district.value=document.newDistrictForm.editDistrictName.value;		document.insertDistrictForm.routes.value=insertRoutes;				if (document.newDistrictForm.selectCategory.value!="0")			document.insertDistrictForm.categoryNum.value=document.newDistrictForm.selectCategory.value;							document.insertDistrictForm.submit();		var returnUrl=document.insertDistrictForm.map.value;		alert("District "+inserted+" successfully");		window.location.href=returnUrl;		parent.frames["left"].location="admin/manager.php";	}}function rejectDistrict(deleted){	if (deleted){		var Reject="Delete";		var rejected="deleted";	}	else{		var	Reject="Reject";		var rejected="rejected";	}	if(confirm(Reject+" district?")==true){		document.newDistrictForm.submit();		alert("District "+rejected+" successfuly");		var returnUrl=document.newDistrictForm.map.value;		window.location.href=returnUrl;		parent.frames["left"].location="admin/manager.php";	}}function stopDistrictEdit(confirmation){	if (!confirmation || confirmation && confirm("Cancel editing?\n(You will lose your current work)")==true){			document.getElementById("editDistrictControlId").style.display="none";					document.getElementById("startEditingId").style.display="block";				removeMarker();		districtPoint=0;		GEvent.removeListener(editDistrictListenerHandle);				document.getElementById("mapId").firstChild.firstChild.style.cursor = "hand";	}}function GetXmlHttpObject(handler){	var objXMLHttp=null;	if (window.XMLHttpRequest){		objXMLHttp=new XMLHttpRequest();	}	else if (window.ActiveXObject){		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");	}	return objXMLHttp}function searchKeywords(){	if (document.getElementById("searchBoxId").value!=""){		var str=document.getElementById("searchBoxId").value;		str=str.replace(/(^\s*)|(\s*$)/g,'');				search("keywords="+str.replace(/(\s)/g,"-"));	}else alert('Please enter keywords');	}function searchSelect(){		search("categoryNum="+document.getElementById("searchSelectId").value);		}function search(filtre){	xmlHttp=GetXmlHttpObject();	if (xmlHttp==null){		alert ("Browser does not support HTTP Request");		return;	} 	var url="search.php?map="+map+"&"+filtre;	xmlHttp.onreadystatechange=displaySearchResult; 		xmlHttp.open("GET",url,true);		xmlHttp.send(null);	}function displaySearchResult(){	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")		document.getElementById("searchResultId").innerHTML=xmlHttp.responseText;} var geocoder = new GClientGeocoder();function searchAddress() {  var address=document.getElementById("streetSearch1Id").value+","+document.getElementById("streetSearch2Id").value;  geocoder.getLatLng(    address,    function(point) {      if (!point) {        alert(address + " not found");      } else {        myMap.setCenter(point, 17);        var marker = new GMarker(point);        myMap.addOverlay(marker);        marker.openInfoWindowHtml(document.getElementById("streetSearch1Id").value);      }    }  );}var updateMapZoomListenerHandle;var updateMapListenerHandle;var newMapPoint=0;function updateMapCenterZoom(){	alert('you may start updating the default map center and zoom level\n by clicking on the map and set the new zoom level');	document.getElementById("mapId").firstChild.firstChild.style.cursor = "crosshair";	updateMapZoomListenerHandle=GEvent.addListener(myMap, "zoomend", function(oldzoom,zoom){		parent.left.document.centerZoomForm.zoomLevel.value=zoom;			});	parent.left.document.centerZoomForm.zoomLevel.value=myMap.getZoom();			updateMapListenerHandle=GEvent.addListener(myMap, 'click', function(overlay, point) {		if (point) {			if(newMapPoint==0){				newMapPoint=point;								myMarker = new GMarker(newMapPoint,myMarkerIcon);								myMap.addOverlay(myMarker);			}			else{				newMapPoint=point;				myMarker.setPoint(newMapPoint);			}			document.getElementById("mapId").firstChild.firstChild.style.cursor = "crosshair";						parent.left.document.centerZoomForm.mapPoint.value=point;				parent.left.document.getElementById("updateCenterZoomSubmitId").style.display="block";		}	});}function stopUpdatingMapCenterZoom(){	parent.left.document.getElementById("updateCenterZoomSubmitId").style.display="none";	newMapPoint=0;	myMap.removeOverlay(myMarker);		GEvent.removeListener(updateMapListenerHandle);	GEvent.removeListener(updateMapZoomListenerHandle);	document.getElementById("mapId").firstChild.firstChild.style.cursor = "hand";		parent.frames["main"].location="../map.php?map="+map;	}function submitReview(placeNum){	var trouble=false;		if(document.submitReviewForm.note.value=='0' && document.submitReviewForm.comment.value==''){		trouble=true;		alert('Please rate this place by clicking on a star or/and write a comment');	}		if(checkReview(placeNum)){		trouble=true;		alert('You have already reviewed this place!');	}	if(!trouble){		document.submitReviewForm.submit();				document.submitReviewForm.note.value='0';		document.submitReviewForm.comment.value='';		setCookie(placeNum,'true',365);		changeStar(0);			document.getElementById('reviewSubmissionResultId').innerHTML="review submitted with success";	}		}function submitPicture(){	var trouble=false;	if(document.submitPictureForm.imgfile.value==''){		trouble=true;		alert('Please click on browse to select your picture');	}	if(!trouble){		document.submitPictureForm.submit();		document.submitPictureForm.reset();		document.getElementById('pictureSubmissionResultId').innerHTML="picture uploaded with success";	}}function submitVideo(){	var trouble=false;	if(document.submitVideoForm.video.value==''){		trouble=true;		alert('Please enter id of the youtube video, e.g. g-k1gOJp9Ww');		document.submitVideoForm.video.setFocus();	}	if(!trouble){		document.submitVideoForm.submit();		document.submitVideoForm.video.value='';		document.getElementById('videoSubmissionResultId').innerHTML="youtube video submitted with success";	}}function changeStar(index){	for(var i=1; i<=index; i++)		document.getElementById('vote'+i+'Id').src='icones/voteFor.png';	for(var i=(index+1); i<6; i++)		document.getElementById('vote'+i+'Id').src='icones/voteAgainst.png';	document.submitReviewForm.note.value=index;}
//]]>