English: FAV_ICON : ICONS[type]); icon.shadow =ICONS["Shadow"]; icon.iconSize.width =37; icon.iconSize.height =30 icon.shadowSize.width =37; icon.shadowSize.height =24; point.Marker =marker; _MAP.Locations.push(point); _MAP.addOverlay(marker); GEvent.addListener(marker, "click", function() { var p=this.getPoint(); this.openInfoWindowHtml(getLocationContent(p)); }); } function isPointAdded(id) { var rtn=false; for (var i=0;i!=_MAP.Locations.length && !rtn;i++) { rtn=(String(id)==String(_MAP.Locations[i].ID)) } return rtn; } function getLocationContent(p) { return getPointHTML(p.x,p.y,p.ID,p.Name,p.Type,p.Address,p.HoursOfOperation,(Math.round(p.distanceFrom(_MAP.Home)/100)/10),p.Description,p.IMadeThis,p.IsFavorite) } function editForm(x,y,point) { var frm=document.getElementById("NewParkForm"); var lat=document.getElementById("Latitude"); var lon=document.getElementById("Longtitude"); var f=document.getElementById("saveform"); f.reset(); if (point) { var p=null; var mypoint=new GPoint(x,y); for (var i=0;i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].x==x && _MAP.Locations[i].y==y) { mypoint=_MAP.Locations[i]; } } var name =document.getElementById("Name"); var addr =document.getElementById("Address"); var type =document.getElementById("LocationTypeID"); var id =document.getElementById("LocationID"); lat.value =mypoint.y; lon.value =mypoint.x; id.value =mypoint.ID; name.value=mypoint.Name; addr.value=mypoint.Address; }else { lat.value=y; lon.value=x; } frm.style.display="inline"; } function toggleFavorite(link,ID) { var p=null; for (var i=0;p==null && i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].ID==ID) { p=_MAP.Locations[i]; } } //do something to change the icon for P... var frame=document.getElementById("saveframe"); if (link==null || link.innerHTML.toLowerCase().indexOf("remove")>=0) { if (link!=null) { link.innerHTML="Add As Favorite" } p.Marker.setImage(p.Icon); p.IsFavorite=false; frame.src="/facebook/remove_favorite/"+escape(ID)+"?s=95929ea3-ef39-4498-922f-766458c2cac8"; }else { link.innerHTML="Remove From Favorites" p.Marker.setImage(FAV_ICON); p.IsFavorite=true; changeOldFavIcon(p) frame.src="/facebook/add_favorite/"+escape(ID)+"?s=95929ea3-ef39-4498-922f-766458c2cac8"; } displayFaves(); } function displayFaves() { var faveNum=1; for (var i=0;i!=_MAP.Locations.length;i++) { var loc=_MAP.Locations[i]; if (loc.IsFavorite) { var tr =document.getElementById("faveTr"+faveNum); var lbl =tr.cells[0]; var go =tr.cells[1]; var del =tr.cells[2]; var delfunc =null; var gofunc =null; eval("delfunc =function (){toggleFavorite(null,'"+loc.ID+"');}"); eval("gofunc =function (){showInfoWindow('"+loc.ID+"');}"); lbl.innerHTML =loc.Name; go.onclick =gofunc; del.onclick =delfunc; tr.style.display=""; faveNum++; } } while (faveNum!=4) { var tr=document.getElementById("faveTr"+faveNum); tr.style.display="none"; faveNum++; } } function showInfoWindow(id) { var p=null; for (var i=0;i!=_MAP.Locations.length;i++) { if (String(id)==_MAP.Locations[i].ID) { p=_MAP.Locations[i]; } } p.Marker.openInfoWindowHtml(getLocationContent(p)); } function changeOldFavIcon(newPoint) { var otherfavorites=[]; for (var i=0;i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].IsFavorite && !newPoint.equals(_MAP.Locations[i])) { otherfavorites.push(_MAP.Locations[i]); } } if (otherfavorites.length>=3) { var point=otherfavorites[otherfavorites.length-1]; //grab the furthest one away from the user's point of origin point.Marker.setImage(REG_ICON); point.IsFavorite=false; } } function form_submit(form) { if (!validate(form)) { return false; }else if (form.LocationID.value.length==0) { create_map_point(form.Latitude.value.replace(/\./gi,"_")+"/"+form.Longtitude.value.replace(/\./gi,"_"), form.Latitude.value, form.Longtitude.value, form.Name.value, form.LocationTypeID.options[form.LocationTypeID.selectedIndex].text, form.LocationTypeID.options[form.LocationTypeID.selectedIndex].value, form.Address.value, form.HoursOfOperation.value, form.Description.value, true, false, true) }return true; } function findOrCreatePoint(id,x,y,name,type,typeid,addr,fav) { var point=new GPoint(x,y); for (var i=0;i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].x==point.x && _MAP.Locations[i].y==point.y) { return _MAP.Locations[i]; } } point.x =x; point.y =y; point.ID =id; point.Name =name; point.Type =type; point.LocationTypeID =typeid point.Address =addr; point.IsFavorite =fav; _MAP.Locations.push(point); return point; } function validate(form) { var req=['Name','Address']; var nam=['Nom','Adresse']; nam=req; var erMsg=[ "The [fieldname] field is required, and cannot be left blank. ", "The [fieldname] contains words that may be offensive to some people.
French: FAV_ICON : ICONS[type]); icon.shadow =ICONS["Shadow"]; icon.iconSize.width =37; icon.iconSize.height =30 icon.shadowSize.width =37; icon.shadowSize.height =24; point.Marker =marker; _MAP.Locations.push(point); _MAP.addOverlay(marker); GEvent.addListener(marker, "click", function() { var p=this.getPoint(); this.openInfoWindowHtml(getLocationContent(p)); }); } function isPointAdded(id) { var rtn=false; for (var i=0;i!=_MAP.Locations.length && !rtn;i++) { rtn=(String(id)==String(_MAP.Locations[i].ID)) } return rtn; } function getLocationContent(p) { return getPointHTML(p.x,p.y,p.ID,p.Name,p.Type,p.Address,p.HoursOfOperation,(Math.round(p.distanceFrom(_MAP.Home)/100)/10),p.Description,p.IMadeThis,p.IsFavorite) } function editForm(x,y,point) { var frm=document.getElementById("NewParkForm"); var lat=document.getElementById("Latitude"); var lon=document.getElementById("Longtitude"); var f=document.getElementById("saveform"); f.reset(); if (point) { var p=null; var mypoint=new GPoint(x,y); for (var i=0;i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].x==x && _MAP.Locations[i].y==y) { mypoint=_MAP.Locations[i]; } } var name =document.getElementById("Name"); var addr =document.getElementById("Address"); var type =document.getElementById("LocationTypeID"); var id =document.getElementById("LocationID"); lat.value =mypoint.y; lon.value =mypoint.x; id.value =mypoint.ID; name.value=mypoint.Name; addr.value=mypoint.Address; }else { lat.value=y; lon.value=x; } frm.style.display="inline"; } function toggleFavorite(link,ID) { var p=null; for (var i=0;p==null && i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].ID==ID) { p=_MAP.Locations[i]; } } //do something to change the icon for P... var frame=document.getElementById("saveframe"); if (link==null || link.innerHTML.toLowerCase().indexOf("remove")>=0) { if (link!=null) { link.innerHTML="Add As Favorite" } p.Marker.setImage(p.Icon); p.IsFavorite=false; frame.src="/facebook/remove_favorite/"+escape(ID)+"?s=95929ea3-ef39-4498-922f-766458c2cac8"; }else { link.innerHTML="Remove From Favorites" p.Marker.setImage(FAV_ICON); p.IsFavorite=true; changeOldFavIcon(p) frame.src="/facebook/add_favorite/"+escape(ID)+"?s=95929ea3-ef39-4498-922f-766458c2cac8"; } displayFaves(); } function displayFaves() { var faveNum=1; for (var i=0;i!=_MAP.Locations.length;i++) { var loc=_MAP.Locations[i]; if (loc.IsFavorite) { var tr =document.getElementById("faveTr"+faveNum); var lbl =tr.cells[0]; var go =tr.cells[1]; var del =tr.cells[2]; var delfunc =null; var gofunc =null; eval("delfunc =function (){toggleFavorite(null,'"+loc.ID+"');}"); eval("gofunc =function (){showInfoWindow('"+loc.ID+"');}"); lbl.innerHTML =loc.Name; go.onclick =gofunc; del.onclick =delfunc; tr.style.display=""; faveNum++; } } while (faveNum!=4) { var tr=document.getElementById("faveTr"+faveNum); tr.style.display="none"; faveNum++; } } function showInfoWindow(id) { var p=null; for (var i=0;i!=_MAP.Locations.length;i++) { if (String(id)==_MAP.Locations[i].ID) { p=_MAP.Locations[i]; } } p.Marker.openInfoWindowHtml(getLocationContent(p)); } function changeOldFavIcon(newPoint) { var otherfavorites=[]; for (var i=0;i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].IsFavorite && !newPoint.equals(_MAP.Locations[i])) { otherfavorites.push(_MAP.Locations[i]); } } if (otherfavorites.length>=3) { var point=otherfavorites[otherfavorites.length-1]; //grab the furthest one away from the user's point of origin point.Marker.setImage(REG_ICON); point.IsFavorite=false; } } function form_submit(form) { if (!validate(form)) { return false; }else if (form.LocationID.value.length==0) { create_map_point(form.Latitude.value.replace(/\./gi,"_")+"/"+form.Longtitude.value.replace(/\./gi,"_"), form.Latitude.value, form.Longtitude.value, form.Name.value, form.LocationTypeID.options[form.LocationTypeID.selectedIndex].text, form.LocationTypeID.options[form.LocationTypeID.selectedIndex].value, form.Address.value, form.HoursOfOperation.value, form.Description.value, true, false, true) }return true; } function findOrCreatePoint(id,x,y,name,type,typeid,addr,fav) { var point=new GPoint(x,y); for (var i=0;i!=_MAP.Locations.length;i++) { if (_MAP.Locations[i].x==point.x && _MAP.Locations[i].y==point.y) { return _MAP.Locations[i]; } } point.x =x; point.y =y; point.ID =id; point.Name =name; point.Type =type; point.LocationTypeID =typeid point.Address =addr; point.IsFavorite =fav; _MAP.Locations.push(point); return point; } function validate(form) { var req=['Name','Address']; var nam=['Nom','Adresse']; var erMsg=[ "Le [fieldname] est exigé et ne peut être laissé blanc", "Le [fieldname] contient des mots qui sont suceptibles de blesser certaines personnes.