function addPhotoToMap(in_js_key){ var latBox = 0.0193729; var longBox = 0.0241577; var longdec=images_array[in_js_key][photo_long_dec]; var latdec=images_array[in_js_key][photo_lat_dec]; var pre_url=images_array[in_js_key][photo_pre_th_url]; var pointSW = new GLatLng(latdec-latBox ,longdec-longBox); var pointNE = new GLatLng(latdec+latBox ,longdec+longBox); var groundOverlay = new GGroundOverlay(pre_url,new GLatLngBounds(pointSW, pointNE)); addBorderToPhoto(pointNE,pointSW,in_js_key); map.addOverlay(groundOverlay); } function addBorderToPhoto(pointNE,pointSW,in_js_key){ var topLat = pointNE.lat(); var rightLng = pointNE.lng(); var botLat = pointSW.lat(); var leftLng = pointSW.lng(); var boxPoints = []; boxPoints.push(pointSW); boxPoints.push(new GLatLng(topLat,leftLng)); boxPoints.push(pointNE); boxPoints.push(new GLatLng(botLat,rightLng)); boxPoints.push(pointSW); var linewidth = 2; var polygon = new GPolygon(boxPoints, "#ffffff", linewidth , 1, "#ffffff", 0); GEvent.addListener(polygon, "mouseover", function() { highlightPhoto(in_js_key); }); GEvent.addListener(polygon, "mouseout", function() { unHighlightPhoto(in_js_key); }); GEvent.addListener(polygon, "click", function() { goToPhoto(in_js_key); }); map.addOverlay(polygon); polygons[in_js_key] = polygon; } function goTo(Category){ centerAndZoom(new GLatLng(center_and_zoom_per_cat[Category][0],center_and_zoom_per_cat[Category][1]),center_and_zoom_per_cat[Category][2]); } function goToPhoto(in_js_key){ var longdec=images_array[in_js_key][photo_long_dec]; var latdec=images_array[in_js_key][photo_lat_dec]; var my_point = new GLatLng(latdec,longdec); centerAndZoom(my_point,9); //window.open(images_array[in_js_key][guid], images_array[in_js_key][post_title]); } function centerAndZoom(inGLatLng,inZoom){ map.setCenter(inGLatLng,inZoom); } function highlightPhoto(image_key){ showRedBorderMarker(image_key); showRedBorderBot(image_key); setPhoto(image_key); setPhotoTitle(image_key); //setPhotoCategory(image_key); } function showRedBorderMarker(image_key){ polygons[image_key].setStrokeStyle({color:"#ff0000"}); } function showRedBorderBot(image_key){ var element = document.getElementById(image_key); if (element){ element.style.border="2px solid red"; } } function setPhoto(image_key){ var cell = document.getElementById('prev_image'); if (sel_lang=='es/'){ var textdes = "Ver Detalles"; } else if (sel_lang=='ca/'){ var textdes = "Veure Detalls"; } else { var textdes = "View Details"; } var text="\""+images_array[image_key][post_title]+"\"

"+textdes+""; cell.innerHTML=text; } function setPhotoTitle(image_key){ var cell_desc_cat = document.getElementById('image_description'); cell_desc_cat.innerHTML="

"+images_array[image_key][post_title]+"

"; } function setPhotoCategory(image_key){ var cell_desc_cat = document.getElementById('image_category'); cell_desc_cat.innerHTML="

"+images_array[image_key][photo_category]+"

"; } function showPhotos(category){ var table= document.getElementById('bottable'); table.deleteRow(0); var newRow=table.insertRow(0); var tmp = photospercat[category]; for (index in tmp){ var newCell=newRow.insertCell(0); newCell.innerHTML="\""+images_array[tmp[index]][post_title]+"\""; } setPhoto(tmp[index]); setPhotoTitle(tmp[index]); //setPhotoCategory(tmp[index]); } function unHighlightPhoto(photoname){ showWhiteBorderMarker(photoname); showWhiteBorderBot(photoname); } function showWhiteBorderBot(photoname){ var element = document.getElementById(photoname); if (element){ element.style.border="2px solid white"; } } function showWhiteBorderMarker(photoname){ polygons[photoname].setStrokeStyle({color:"#ffffff"}); }