﻿var arrPanoramio;
var latitut,longitut;
function initExtImages(latitutIn,longitutIn){latitut=latitutIn;longitut=longitutIn;}
function LoadPanoramioGallery() {
try {
var B = document.createElement("script");
var rang = 0.02;
B.src = "http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=public&from=0&to=30&minx=" + (longitut - rang) + "&miny=" + (latitut - rang) + "&maxx=" + (longitut + rang) + "&maxy=" + (latitut + rang) + "&size=square&callback=storePhotosB";
B.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(B);
}catch (err){}
}
function PanoramioZoomImage(nImage, DIVimage) {
var p = arrPanoramio[nImage];
var image_url = p.photo_file_url.replace("square", "small");    
var htmlImage = "<img src=\"" + image_url + "\">";
htmlImage = htmlImage + "<img src=\"/imgs/panoramio-logo.png\">";
htmlImage = htmlImage + "<br/>Image by <a href=\"" + p.photo_url + "\" target=\"_blank\">" + p.owner_name + "</a>";
htmlImage = htmlImage + "<br/>Photos provided by <a href=\"http://www.panoramio.com/\" target=\"_blank\">Panoramio</a> are under the copyright of their owners."
document.getElementById(DIVimage).innerHTML = htmlImage;
}
function storePhotosB(panoramio) {
pan = "";
panImage = "";
maxWidth = 180;
maxHeigth = 180;
imgWith=44;
imgHeight=44;
arrPanoramio = panoramio.photos;
for (var i = 0; i < arrPanoramio.length; i++) {
var p = panoramio.photos[i];
panImage = panImage + "<div style='float:left; margin:5px;'  id='galPanoramio" + i + "'>" +
"<a href='javascript:PanoramioZoomImage(" + i + ", \"panSmallImgB\")'><img width='" + imgWith + "' height='" + imgHeight + "' src='" + p.photo_file_url + "' alt='' ></a>" +
"</div>";
}
var htmlCode = "<div class=\"blleft\"><div id=\"panSmallImgB\" style=\"font-size:11px; font-weight:normal;\"></div></div>";
htmlCode = htmlCode + "<div class=\"blright\" style=\"padding-bottom:180px;\">" + panImage + "</div>";
document.getElementById("destinationExternalImagesB").innerHTML = htmlCode;
PanoramioZoomImage(0, "panSmallImgB");
}