var map;
var address;    
var gmarkers  = [];
var gmarkers_b  = [];
var gmarkers_g  = [];
var gmarkers_p  = [];
var gmarkers2  = [];
var infoTabs  = [];
var infoTabs_b  = [];
var infoTabs_g  = [];
var infoTabs_p  = [];
var infoTabs2 = [];
var infoTabs3 = [];
var markerOptions = [];
var detailmap;

var my_long = [];
var my_lat  = [];
var my_zoom = [];
var wat     = [];
var my_slideshow =[];

my_lat[0]     =  50.0;  
my_long[0]    =  -20.0;         
my_zoom[0]    =  1;
wat[0]        = 'home';

my_lat[1]     =  27.0;  
my_long[1]    =  33.0;         
my_zoom[1]    =  6;
wat[1]        = 'WAT-Egypte';
my_slideshow[1]    = 'First_egypt';

my_lat[2]    =  31.6;
my_long[2]    =  -7.98;       
my_zoom[2]    =  10;
wat[2]        = 'WAT-Maroc';
my_slideshow[2]    = '7277-3201-4666.1';

my_lat[3]     =  27.0;
my_long[3]    =  -20.0;        
my_zoom[3]    =  1;  
wat[3]        = 'WAT-EgypteMuseum';

my_lat[4]     =  46.5220;
my_long[4]    =  6.6353;    
my_zoom[4]    =  13; 
wat[4]        = 'WAT-Lausanne';
my_slideshow[4]    = 'regards_ps39.18';


my_lat[5]     =  38.0;
my_long[5]    =  14.20;    
my_zoom[5]    =  7; 
wat[5]        = 'WAT-Sicile';
my_slideshow[5]    = '7287-3251-3223.25';

my_lat[6]     =  42.13;
my_long[6]    =  13.25;    
my_zoom[6]    =  5; 
wat[6]        = 'WAT-Italie';
my_slideshow[6]    = '7099-3161-2290.1';

my_lat[7]     =  47.0;
my_long[7]    =  3.0;    
my_zoom[7]    =  5; 
wat[7]        = 'WAT-France';
my_slideshow[7]  = '6326-3041-2078.36';

my_lat[8]     =  50.6;
my_long[8]    =  10.65;    
my_zoom[8]    =  5; 
wat[8]        = 'WAT-Allemagne';
my_slideshow[8]    = '6311-3071-1882.32';

my_lat[10]     =  48.22;
my_long[10]    =  16.35;  
my_zoom[10]    =  10; 
wat[10]        = 'WAT-Austria';
my_slideshow[10]    = '6323-3042-1828.1';

my_lat[26]     =  48.22;
my_long[26]    =  16.35;  
my_zoom[26]    =  10; 
wat[26]        = 'WAT-Test';
my_slideshow[26]    = '6323-3042-1828.1';


my_lat[11]     =  49.80;
my_long[11]    =  15.20;  
my_zoom[11]    =  6; 
wat[11]        = 'WAT-Csz';
my_slideshow[11]    = '7277-3201-5027.41';


my_lat[12]     =  51.51;
my_long[12]    =  -0.14;  
my_zoom[12]    =  10; 
wat[12]        = 'WAT-England';
my_slideshow[12]    = '6326-3041-0155.1';

my_lat[9]     =  39.74;
my_long[9]    =  -8.2;  
my_zoom[9]    =  7; 
wat[9]        = 'WAT-Portugal';
my_slideshow[9]    = '8030-3192-4080.1';

my_lat[13]     =  41.0;
my_long[13]    =  -3.8;
my_zoom[13]    =  6; 
wat[13]        = 'WAT-Espagne';
my_slideshow[13]    = '7099-3161-0091.1';


my_lat[14]     =  46.9;
my_long[14]    =  8.1;
my_zoom[14]    =  6; 
wat[14]        = 'WAT-Suisse';
my_slideshow[14]    = '7277-3201-4673.1';


my_lat[15]     =  41.0;
my_long[15]    =  29.0;
my_zoom[15]    =  10; 
wat[15]        = 'WAT-Turquie';
my_slideshow[15]    = '7285-3251-3658.1';

my_lat[16]     =  45.8;
my_long[16]    =  25.2; 
my_zoom[16]    =  6; 
wat[16]        = 'WAT-Roumanie';
my_slideshow[16]    = '7277-3201-1075.1';

my_lat[17]     =  35.0;
my_long[17]    =  115.0; 
my_zoom[17]    =  4; 
wat[17]        = 'WAT-Chine';
my_slideshow[17]    = 'First_china';


my_lat[18]     =  50.0;
my_long[18]    =  20.0; 
my_zoom[18]    =  1; 
wat[18]        = 'WAT-WorldMuseumChine';
my_slideshow[18]    = '9185-3291-4723.1';



my_lat[19]     =  23.50;
my_long[19]    =  79.0; 
my_zoom[19]    =  4; 
wat[19]        = 'WAT-Inde';
my_slideshow[19]    = 'First_india';

my_lat[20]     =  36.10;
my_long[20]    =  135.0; 
my_zoom[20]    =  5; 
wat[20]        = 'WAT-Japon';
my_slideshow[20]    = 'First_japan';

my_lat[21]     =  27.7;
my_long[21]    =  85.3; 
my_zoom[21]    =  9; 
wat[21]        = 'WAT-Nepal';
my_slideshow[21]    = '8072-3271-0524.48';


my_lat[22]     =  -7.4;
my_long[22]    =  110.3; 
my_zoom[22]    =  6; 
wat[22]        = 'WAT-Indonesie';
my_slideshow[22]    = 'First_laos';


my_lat[23]     =  20.0;
my_long[23]    =  97.1;
my_zoom[23]    =  6; 
wat[23]        = 'WAT-Birmanie';
my_slideshow[23]    = 'First_burma';


my_lat[24]     =  39.2;
my_long[24]    =  -96.35;
my_zoom[24]    =  3; 
wat[24]        = 'WAT-USA';
my_slideshow[24]    = '6323-3042-3157.1';


my_lat[40]     =  47.0;
my_long[40]    =  6.0;
my_zoom[40]    =  4;
my_slideshow[40]    = '/regards.xml';

my_lat[41]     =  30.0;
my_long[41]    =  60.0;
my_zoom[41]    =  2; 
my_slideshow[41]    = '/voies.xml';

my_lat[42]     =  40.0;
my_long[42]    =  11.0;
my_zoom[42]    =  5; 
my_slideshow[42]    = '/enigmes.xml';

 
//var blueIcon      = new GIcon(G_DEFAULT_ICON); 
//blueIcon.image    = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";


var purpleIcon      = new GIcon(G_DEFAULT_ICON); 
purpleIcon.image    = "http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png";
purpleIcon.iconSize=new GSize(16,16);

var ltbluIcon      = new GIcon(G_DEFAULT_ICON); 
ltbluIcon.image    = "http://maps.google.com/mapfiles/ms/icons/ltblu-pushpin.png";
ltbluIcon.iconSize=new GSize(24,24);


var grnIcon      = new GIcon(G_DEFAULT_ICON); 
grnIcon.image    = "http://www.google.com/intl/en_us/mapfiles/ms/icons/grn-pushpin.png";
grnIcon.iconSize=new GSize(16,16);

var redIcon      = new GIcon(G_DEFAULT_ICON); 
redIcon.image    = "http://maps.google.com/mapfiles/ms/icons/red-pushpin.png";
redIcon.iconSize=new GSize(16,16);

var blueIcon      = new GIcon(G_DEFAULT_ICON); 
blueIcon.image    = "http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png";
blueIcon.iconSize=new GSize(24,24);


var yellowIcon    = new GIcon(G_DEFAULT_ICON); 
yellowIcon.image  =  "http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png";
yellowIcon.iconSize=new GSize(24,24);
		
// Set up our GMarkerOptions object
markerOptions[0] = { icon:redIcon };
markerOptions[1] = { icon:yellowIcon }; 
markerOptions[2] = { icon:blueIcon };      
markerOptions[3] = { icon:ltbluIcon }; 
markerOptions[4] = { icon:purpleIcon }; 
markerOptions[5] = { icon:grnIcon };    


function createMarker_grn(point,infoT,type) {	
	var marker= new GMarker(point,markerOptions[type]);	     	
        GEvent.addListener(marker, "click", function() {
             marker.openInfoWindowTabsHtml(infoT);	     	     	        	     	        	     
        }); 	       
        return marker;
}    

function createMarker(point,infoT,type) {	
	var marker= new GMarker(point,markerOptions[type]);	     	
        GEvent.addListener(marker, "click", function() {
             marker.openInfoWindowTabsHtml(infoT);	     
	     var dMapDiv = document.getElementById("detailmap");
	     detailmap = new GMap2(dMapDiv);
	     detailmap.setCenter(point , 15);	    	     	     
	     detailmap.addControl(new GSmallMapControl());           
	     
	     detailmap.addOverlay(new GMarker(point));
	     	        
	     var CopyrightDiv = dMapDiv.firstChild.nextSibling;
	     var CopyrightImg = dMapDiv.firstChild.nextSibling.nextSibling;
	     CopyrightDiv.style.display = "none"; 
	     CopyrightImg.style.display = "none"; 	     
        }); 
	       
        return marker;
}


function blue_mark(map,markers) {
var side_bar2_html ='';  
for (var i = 0; i < markers.length; i++) {
    point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                            parseFloat(markers[i].getAttribute("lng")));			    
    var html =  markers[i].getAttribute("html");
    var label =  markers[i].getAttribute("label");         
    infoTabs_b[i] = [
                new GInfoWindowTab("aa", '<div style="width:250px">' +  html +  '</div>' )		                           	      
	      ];  	                   
    var marker = createMarker(point, infoTabs_b[i],2);                     
    gmarkers_b[i] = marker;  
    map.addOverlay(marker);        
    side_bar2_html += '<a href="javascript:myclick_b(' + i + ')">' + label + '</a><br>';   
}
return  side_bar2_html;
}



function myclick_b(i) {
        gmarkers_b[i].openInfoWindowTabsHtml(infoTabs_b[i]);
}

function showLocation(address) {     
   map.setCenter(new GLatLng(20.0,-20.0),1);       
   map.addControl(new GSmallMapControl());
   map.addControl(new GMapTypeControl());
  	  	 	  
   map.clearOverlays(); 	 	 	  
   var randomnumber  = Math.floor(Math.random()*1001);
   var url = '/cgi-bin/xml.pl?name=' + address + '&foo=' + randomnumber;	 	  
	  
   GDownloadUrl(url , function(data, responseCode) {  
             var xml = GXml.parse(data);
             var markers = xml.documentElement.getElementsByTagName("marker");
             yellow_mark(map,markers);    
   });			 	  	            
} 
 
 
function yellow_mark(map,markers) {
   for (var i = 0; i < markers.length; i++) {
    point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                            parseFloat(markers[i].getAttribute("lng")));			      
    var label   =  markers[i].getAttribute("label");
    label       =  label.replace(/Durer/,"Dürer ");
    label       =  label.replace(/Fussli/,"Füssli ");
    var img     =  markers[i].getAttribute("img");
    var lieu    =  markers[i].getAttribute("lieu");
    var museum  =  markers[i].getAttribute("museum");
    var pays    =  markers[i].getAttribute("pays");
    var ville   =  markers[i].getAttribute("ville");
    var note    =  markers[i].getAttribute("note");
    var note2   =  markers[i].getAttribute("note2");
    var url     =  markers[i].getAttribute("url");
    
    var born    =  markers[i].getAttribute("born");
    var died    =  markers[i].getAttribute("died");
    var dborn   =  markers[i].getAttribute("dborn");
    var ddied   =  markers[i].getAttribute("ddied");	
                   
    note = note.replace(/&amp;/g,"&");
    note = note.replace(/&#38;/g,"&");
    note = note.replace(/&lt;/g,"<");
    note = note.replace(/&gt;/g,">");
    note = note.replace(/&quot;/g,"\"");
    
    note2 = note2.replace(/&amp;/g,"&");
    note2 = note2.replace(/&#38;/g,"&");
    note2 = note2.replace(/&lt;/g,"<");
    note2 = note2.replace(/&gt;/g,">");
    note2 = note2.replace(/&quot;/g,"\"");
   
    url = url.replace(/&amp;/g,"&");
    url = url.replace(/&#38;/g,"&");
    
    museum = museum.replace(/'/g,"\\'");
  
     
    var html;
    var pattern = /http/;
    if ( pattern.test(img)  ) { 
     
     img = img.replace(/&#38;/g,"&");
     img = img.replace(/&amp;/g,"&");
     img = img.replace(/&quot;/g,"\"");  
     img = img.replace(/&lt;/g,"<");
     img = img.replace(/&gt;/g,">");
         
     html = "<b>" + label + ' (' + born +  ' ' + dborn +  ' - ' + died + ' ' + ddied + ')</b><br><a href="javascript:site(\''  + museum + '\')">' + lieu + '</a>&nbsp;-&nbsp;' + ville + '/' + pays + '<p>';
     html +=   img ;
     html +=  '<p>' + note;      
    } else {    
    if ( img == 'no'  ) {         
     html = "<b>" + label + ' (' + born + ' ' + dborn + ' -'  + died + ' ' + ddied + ')</b><br><a href="javascript:site(\''  + museum + '\')">' + lieu + '</a>&nbsp;-&nbsp;' + ville + '/' + pays + '<p>';
     html +=  note; 
     
     if ( pattern.test(url)  ) {    
       html +=  '<p><a href="javascript:site(\'' + url +  '\')">Wikipedia</a>';     
     }    
         
    } else { 
     img = img.replace(/ /g,"");
     url = url.replace(/ /g,"+");
     html = "<b>" + label + ' (' + born + ' ' + dborn + ' - ' + died + ' ' + ddied + ')</b><br><a href="javascript:site(\''  + museum + '\')">'  + lieu + '</a>&nbsp;-&nbsp;' + ville + '/' + pays + '<p>';
     html +=  '<a href="javascript:popLegend(\'' + img + '\')">';   
     html +=  '<img  style="float:left;padding:5px;" src="/cgi-bin/slideshow2.pl?ref=' + img + '&ico=80" border="0"></a><p>' + note;                
    }
    }
           
    infoTabs2[i] = [
                new GInfoWindowTab("Museum", '<div style="width:300px; height: 380px;  border:0px solid red; font-size:12px;  text-align:justify;">' +  html +  '</div>' ),      
                new GInfoWindowTab("Location", '<div id="detailmap" style="width: 250px; height: 350px;  border: 0px solid black; margin:0 0 0 0px;">' +  '</div>'),
                new GInfoWindowTab("Notes", '<div style="width:250px; height: 350px;  border:0px solid red; font-size:0.8em;  text-align:justify;">' + note2 +  '</div>' )             	      
	      ];  	      
          
    var marker = createMarker(point, infoTabs2[i],1 );                         
    gmarkers2[i] = marker;  
    map.addOverlay(marker);
          
 }
}  



function map_mark(map,markers) {
 var image,museum,museum_url,ville,note,note2,note3,url,ref,lat,long,html,point,tab,periods,marker; 
 var pattern  = /^http/;
 var pattern2 = /^WAT-Egypte/;     
 for (var i = 0; i < markers.length; i++) {
    lat  = markers[i].getAttribute("lat");
    long = markers[i].getAttribute("lng");
    point = new GLatLng(parseFloat(lat),parseFloat(long));			      
    
    image       =  markers[i].getAttribute("image");    
    museum      =  markers[i].getAttribute("museum");
    museum_url  =  markers[i].getAttribute("museum_url");
    ville       =  markers[i].getAttribute("ville");
    note        =  markers[i].getAttribute("note");
    note2       =  markers[i].getAttribute("note2");
    note3       =  markers[i].getAttribute("note3");
    url         =  markers[i].getAttribute("url");
    ref         =  markers[i].getAttribute("ref");  
              
    note = note.replace(/&amp;/g,"&");
    note = note.replace(/&#38;/g,"&");
    note = note.replace(/&lt;/g,"<");
    note = note.replace(/&gt;/g,">");
    note = note.replace(/&quot;/g,"\"");  
      
    note2 = note2.replace(/&amp;/g,"&");
    note2 = note2.replace(/&#38;/g,"&");
    note2 = note2.replace(/&lt;/g,"<");
    note2 = note2.replace(/&gt;/g,">");
    note2 = note2.replace(/&quot;/g,"\""); 
    
    note3 = note3.replace(/&amp;/g,"&");
    note3 = note3.replace(/&#38;/g,"&");
    note3 = note3.replace(/&lt;/g,"<");
    note3 = note3.replace(/&gt;/g,">");
    note3 = note3.replace(/&quot;/g,"\""); 
                          
    url = url.replace(/&amp;/g,"&");
    url = url.replace(/&#38;/g,"&");    
    
    museum_url = museum_url.replace(/&amp;/g,"&");
    museum_url = museum_url.replace(/&#38;/g,"&"); 
                        
    if ( pattern2.test(ref)  ) { 
     tab  ='(Lat:' + lat + ' Long:' + long +' - <a href="javascript:site(\'/cgi-protected/kml_editor2?id=' + url + '\')">Edit</a>)<hr>';
              
     if ( pattern.test(museum_url)  ) {  
        html = ville + ' - ' + '<a href="javascript:site(\'' + museum_url + '\')">' +  museum + '</a> - ' + tab;
     } else {
        html = ville + ' - ' + museum + ' - ' + tab;
     }
     
     html +=  '<a href="javascript:add(\'' + url + '\')"><img  class="floatLeft" title=\'Slideshow\' src="/cgi-bin/slideshow2.pl?ref=' + image + '&ico=80" border="0"></a>' +note;   
                  
     periods = '<ul><li><a href="javascript:add(\'8205-3241-2624.20\')">Predynastic</a></li>';
     periods += '<li><a href="javascript:add(\'8205-3241-2624.57\')">Old Kingdom</a></li>';
     periods += '<li><a href="javascript:add(\'8205-3241-2626.1\')">Moyen Empire</a></li>';
     periods += '<li><a href="javascript:add(\'8205-3241-3719.1\')">New Kingdom</a></li>';
     periods += '<li><a href="javascript:add(\'8205-3241-2638.1\')">Late Period</a></li>';
     periods += '<li><a href="javascript:add(\'8205-3241-1153.1\')">Greek</a></li>';
     periods += '<li><a href="javascript:add(\'8205-3241-1153.56\')">Roman</a></li>';
     periods += '<li><a href="javascript:add(\'8205-3241-1120.1\')">Copte</a></li></ul>';
     periods += '<hr><a href="javascript:d.o(21);d.o(27);">Museums with major collections of Egyptian antiquities</a> ';
        
     infoTabs3[i] = [
          new GInfoWindowTab("Site", '<div class="sitenote">' +  html +  '</div>' ),      
          new GInfoWindowTab("Notes", '<div class="sitenote">' + note2 +  '</div>' ),
	  new GInfoWindowTab("Periods", '<div class="sitenote">' + periods  +  '</div>' )             	      
	  ];  	      
    } else {    
     tab  ='(Lat:' + lat + ' Long:' + long +' - <a href="javascript:site(\'/cgi-protected/kml_editor2?id=' + url + '\')">Edit</a>)';   
    
     if ( note3.length > 0 ) {
         tab += ' -  <a href="javascript:film(\'/wat1/slideshow333.pl?ref=' + url + '\',\'legende\');">Major Holdings</a><hr>';
     } else {
         tab += '<hr>';
     }
     
     if ( pattern.test(museum_url)  ) {  
        html = ville + ' - ' + '<a href="javascript:site(\'' + museum_url + '\')">' +  museum + '</a> - ' + tab;
     } else {
        html = ville + ' - ' + museum + ' - ' + tab;
     }
          
     html +=  '<a href="javascript:add(\'' + url + '\')"><img class="floatLeft" title=\'Slideshow\' src="/cgi-bin/slideshow2.pl?ref=' + image + '&ico=80" border="0"></a>' + note;            
     
     infoTabs3[i] = [
           new GInfoWindowTab("Site", '<div class="sitenote">' +  html +  '</div>' ),      
           new GInfoWindowTab("Notes",'<div class="sitenote">' + note2 +  '</div>' )
     ];      
    }      
    marker =  createMarker_grn(point, infoTabs3[i],3);                               
    map.addOverlay(marker);          
 }
}

function toggleZoom(isChecked) {
      if (isChecked) {
        map.enableScrollWheelZoom();
      } else {
        map.disableScrollWheelZoom();
      }
} 



function  my_map(num) {     

if (GBrowserIsCompatible()) {
  map.clearOverlays(); 
  	
  map = new GMap2(document.getElementById("map")); 
  map.setCenter(new GLatLng(my_lat[num],my_long[num]),my_zoom[num]); 
      
   map.addMapType(G_PHYSICAL_MAP); 
   var mapControl = new GHierarchicalMapTypeControl();
    
   map.addControl(mapControl);
   map.addControl(new GSmallMapControl());  
  
   map.setMapType(G_PHYSICAL_MAP);
   map.enableScrollWheelZoom();
   
  if ( wat[num] != 'home' ) {
  GDownloadUrl("/cgi-bin/xml22.pl?ref=" + wat[num], function(data, responseCode) {  
    var xml = GXml.parse(data);   
    markers = xml.documentElement.getElementsByTagName("marker");    
    map_mark(map,markers);    
  }); 
  }
  
} else {
        alert("Sorry, the Google Maps API is not compatible with this browser");
}   
}


function  my_map2(lat,long,wat) {     

if (GBrowserIsCompatible()) {
  map.clearOverlays();     
  map = new GMap2(document.getElementById("map")); 
  map.setCenter(new GLatLng(lat,long),14); 

   map.addMapType(G_PHYSICAL_MAP); 
   var mapControl = new GHierarchicalMapTypeControl();
    
   map.addControl(mapControl);
   map.addControl(new GSmallMapControl());  
  
   map.setMapType(G_HYBRID_MAP);
   map.enableScrollWheelZoom();
 
  GDownloadUrl("/cgi-bin/xml222.pl?ref=" + wat, function(data, responseCode) {  
    var xml = GXml.parse(data);
    markers = xml.documentElement.getElementsByTagName("marker");
    map_mark(map,markers);    
  }); 
  
  
} else {
        alert("Sorry, the Google Maps API is not compatible with this browser");
}   
} 


function  my_map3(zoom,lat,long,num) { 
if (GBrowserIsCompatible()) {
  map.clearOverlays();     
  map = new GMap2(document.getElementById("map")); 
   
  map.setCenter(new GLatLng(lat,long),zoom); 
      
   map.addMapType(G_PHYSICAL_MAP); 
   var mapControl = new GHierarchicalMapTypeControl();
    
   map.addControl(mapControl);
   map.addControl(new GSmallMapControl());  
  
   map.setMapType(G_PHYSICAL_MAP);
   map.enableScrollWheelZoom();
   
   url = my_slideshow[num]; 
   
  GDownloadUrl(url , function(data, responseCode) {  
    var xml = GXml.parse(data);
    markers = xml.documentElement.getElementsByTagName("marker");
   blue_mark(map,markers);   
  }); 
  
  
} else {
        alert("Sorry, the Google Maps API is not compatible with this browser");
}   
}

function getText(url,id,ref,type,mudac) {
  dojo.xhrGet({
    url: url + "?ref=" + ref + "&type=" + type + "&mudac=" +  mudac,
    load: function(response, ioArgs){
      dojo.byId(id).innerHTML = response;
      return response;
    },
    error: function(response, ioArgs){
      dojo.byId(id).innerHTML = 
        "An error occurred, with response: " + response;
      return response;
    },
    handleAs: "text"
  });
}


function popLegend(ref) {
var console = document.getElementById('my_root');

var pop  = document.createElement('DIV');
pop.id               = 'popImg';
pop.style.position   = 'absolute';
pop.style.border     =  '0px solid black';
pop.style.padding    =  '10px 10px 10px 10px';
pop.style.background = 'white';
console.appendChild(pop);
pop.style.top        = '10px';
pop.style.left       = '10px';
pop.style.width      = '1200px';
pop.style.height     = '1200px';
pop.style.display    = 'block';
//pop.style.text-align = 'center';

dojo.xhrGet({
    url: "/wat1/slideshow33.pl?ref=" + ref ,
    load: function(response, ioArgs){ 
       var myBoolean=new Boolean(true);
       
       var img  = '<center><a href="javascript:delpopImg()"><img border="0" style="text-align:center;" src="/wat1/get_picture?ref=' + ref + '&type=medium"/></a>';
       var img2 =    " <br><a href=\"javascript:delpopImg()\">Close Window</a> - <a href=\"javascript:getText('/wat1/puzzle2','popImg','" + ref + "','no','no');\">Puzzle</a>";
       img2    +=    " - <a href=\"javascript:site('/cgi-protected/img_editor?id=" + ref + "');\">edit</a></center>";

       
       dojo.byId(pop).innerHTML = img  + '<div style="width:600px; text-align:justify;">' + response + '</div><br>' + img2;                           
      return response;
    },
    error: function(response, ioArgs){
      dojo.byId('thumbarea').innerHTML = 
        "An error occurred, with response: " + response;
      return response;
    },
    handleAs: "text"
  });
}


function popImg(ref,del) {

 if ( del  ){
  delpopImg();
 }

 var console = document.getElementById('my_root');
 var img = '<a href="javascript:delpopImg()"><img border="0" class="popimg" src="/wat1/get_picture?ref=' + ref + '&type=medium"/></a><br><a href="javascript:delpopImg()">Close Window</a>';
 img +=    " - <a href=\"javascript:getText('/wat1/puzzle2','popImg','" + ref + "','no','no');\">Puzzle</a>";
 img +=    " - <a href=\"javascript:site('/cgi-protected/img_editor?id=" + ref + "');\">edit</a>";

 var pop  = document.createElement('DIV');
 
 pop.id   = 'popImg';
 pop.className = 'popimg'; 
 console.appendChild(pop);
 pop.innerHTML = img;

}

function delpopImg() {
  var console = document.getElementById('my_root');
  var popImg  = document.getElementById('popImg');
  var removed = console.removeChild(popImg);   
}

function my_location(wat) {
dojo.xhrGet({
    url: "/wat1/slideshow4.pl?wat=" + wat,
    load: function(response, ioArgs){       
       var mySplitResult = response.split(",");
       my_map2(mySplitResult[0],mySplitResult[1],wat);      
       return response;      
    },
    error: function(response, ioArgs){
      dojo.byId('thumbarea').innerHTML = 
        "An error occurred, with response: " + response;
      return response;
    },
    handleAs: "text"
  });
}

       
function site(url) {
     window.open(url,'mywindow','width=1024,height=780,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes')
}
