//TravelMapia Javascript Code Compilation
//By Iv
//Latest Build : MAY 21st 2009
//These variables will collect the html which will eventually be placed in the side_bar
var side_bar_html = "";
var legend_window = "";
var markerindex;
var xmlfileused = "english/countries.xml"; //The xml file currently loaded this one at start of page.
var point;
var language = "english";   //Set default language  
var xmlfilename = "countries.xml"; //Set default country xml file for loading
var xmlfilenamex;
var jscriptads = 'http://www.travelmapia.com/googletextads.html';
//Arrays to hold copies of the markers and html used by the side_bar because the function closure trick doesnt work there.
//Global Variables Declared here. 
var gmarkers = [];
var htmls = [];
var youtubevideos = [];
var pictures =[];
var i = 0;
var map;
var tooltip = document.createElement("div");
var letter ="";
var jlabels = [];
//var folder;
var placename;
var thecountrycode = "";
var theadmin;
var imagefilename;
var pointofinterest;
var iconfilename;
var imagevalue;
var iconvalue;
var uploadedimagevalue;
var uploadediconvalue;
var editcategory;
var editlat;
var editlng;
var editplacename;
var editplacenametags;
var editaddress;
var edithtml;
var editphone;
var editvideo;
var editimage;
var editcountrycode;
var editdistrict;
var editplaceid;
var thecountry;
var chosencountry;
var countrydistricts = "";
var editmarker;
var foundx;
var foundxx;
var thexmlfile;
var district;



function geocodezcountry(address) { 

var zoom = '16';
map.clearOverlays();
document.getElementById("sidebarwrapper").innerHTML = '<div id="letterbar"><ul><li><A title="A" onclick="find(\'A\'); return false;" href="http://www.travelmapia.com/sitemap.html">A</A></li><li><A title="B" onclick="find(\'B\'); return false;" href="http://www.travelmapia.com/sitemap.html">B</A></li><li><A title="C" onclick="find(\'C\'); return false;" href="http://www.travelmapia.com/sitemap.html">C</A><li><A title="D" onclick="find(\'D\'); return false;" href="http://www.travelmapia.com/sitemap.html">D</A></li></li><li><A title="E" onclick="find(\'E\'); return false;" href="http://www.travelmapia.com/sitemap.html">E</A></li><li><A title="F" onclick="find(\'F\'); return false;" href="http://www.travelmapia.com/sitemap.html">F</A></li><li><A title="G" onclick="find(\'G\'); return false;" href="http://www.travelmapia.com/sitemap.html">G</A></li><li><A title="H" onclick="find(\'H\'); return false;" href="http://www.travelmapia.com/sitemap.html">H</A></li><li><A title="I" onclick="find(\'I\'); return false;" href="http://www.travelmapia.com/sitemap.html">I</A></li><li><A title="J" onclick="find(\'J\'); return false;" href="http://www.travelmapia.com/sitemap.html">J</A></li><li><A title="K" onclick="find(\'K\'); return false;" href="http://www.travelmapia.com/sitemap.html">K</A></li><li><A title="L" onclick="find(\'L\'); return false;" href="http://www.travelmapia.com/sitemap.html">L</A></li><li><A title="M" onclick="find(\'M\'); return false;" href="http://www.travelmapia.com/sitemap.html">M</A></li><li><A title="N" onclick="find(\'N\'); return false;" href="http://www.travelmapia.com/sitemap.html">N</A></li><li><A title="O" onclick="find(\'O\'); return false;" href="http://www.travelmapia.com/sitemap.html">O</A></li><li><A title="P" onclick="find(\'P\'); return false;" href="http://www.travelmapia.com/sitemap.html">P</A></li><li><A title="Q" onclick="find(\'Q\'); return false;" href="http://www.travelmapia.com/sitemap.html">Q</A></li><li><A title="R" onclick="find(\'R\'); return false;" href="http://www.travelmapia.com/sitemap.html">R</A></li><li><A title="S" onclick="find(\'S\'); return false;" href="http://www.travelmapia.com/sitemap.html">S</A></li><li><A title="T" onclick="find(\'T\'); return false;" href="http://www.travelmapia.com/sitemap.html">T</A></li><li><A title="U" onclick="find(\'U\'); return false;" href="http://www.travelmapia.com/sitemap.html">U</A></li><li><A title="V" onclick="find(\'V\'); return false;" href="http://www.travelmapia.com/sitemap.html">V</A></li><li><A title="W" onclick="find(\'W\'); return false;" href="http://www.travelmapia.com/sitemap.html">W</A></li><li><A title="X" onclick="find(\'X\'); return false;" href="http://www.travelmapia.com/sitemap.html">X</A></li><li><A title="Y" onclick="find(\'Y\'); return false;" href="http://www.travelmapia.com/sitemap.html">Y</A></li><li><A title="Z" onclick="find(\'Z\'); return false;" href="http://www.travelmapia.com/sitemap.html">Z</A></li></ul></div><!--END LETTERBAR--><div id="sidebarcontainer"><div id="side_bartop"> Search Reults</div><div id="side_bar"></div><!-- END side_bar--></div>';

clearxml();

var geocoder = new GClientGeocoder(); 

 document.getElementById("mapwindow").innerHTML =  '';
 document.getElementById("adminwindow").innerHTML =  '';
 
   geocoder.getLatLng( 
    address,
    function(point) { 
      if (!point) { 
        alert(address + " not found"); 
        document.getElementById("side_bartop").innerHTML = 'Address Not Found';
          
        
      } else { 
            var icon = new GIcon();
            icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
            icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
            icon.iconSize = new GSize(12, 20);
            icon.shadowSize = new GSize(22, 20);
            icon.iconAnchor = new GPoint(6, 20);
            icon.infoWindowAnchor = new GPoint(5, 1);
        
            map.setCenter(point, 3); 
            var marker = new GMarker(point,{icon:icon, draggable: false}); 
            map.addOverlay(marker); 
        
            var latpoint = point.y;
            var lngpoint = point.x;
  
            var geocodertext = '<div id="addresswrapper" style="width:250px;float:left"/><div id="address" style="margin-bottom:9px;text-align:center;float:left;width:250px; height:auto; font-size:14px; font-family:helvetica,verdana,arial;"/>Your Search Found : ' + address + '</div><div id="zoomtoaddress" style="width:250px;height:auto;text-align:center;font-family:helvetica,verdana,lucinda;font-size:12px"/><a href="javascript:setZM(' + zoom + ',' + latpoint + ',' + lngpoint + ');"/>Zoom View Into Address</a></div></div>';

            marker.openInfoWindowHtml(geocodertext);
                  
            GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(geocodertext);});
            document.getElementById("side_bartop").innerHTML = 'Results Found';
          

      } 
    } 
  ); 
 

} 


function showAddress(point) { 



var geocoder = new GClientGeocoder(); 

  geocoder.getLocations(point, function (result)
  { 
    if (result.Status.code == G_GEO_SUCCESS) 
    { 
      // Loop through the results, looking for the one with Accuracy = 1 
      for (var i=0; i<result.Placemark.length; i++)
      { 
        var accuracy = result.Placemark[i].AddressDetails.Accuracy; 
                              
          if (accuracy == 3) { 
          var north = result.Placemark[i].ExtendedData.LatLonBox.north; 
          var south = result.Placemark[i].ExtendedData.LatLonBox.south; 
          var east = result.Placemark[i].ExtendedData.LatLonBox.east; 
          var west = result.Placemark[i].ExtendedData.LatLonBox.west; 
            
          var countrybounds = new GLatLngBounds(new GLatLng(south,west), new GLatLng(north,east)); 
                            } 
          thecountrycode = result.Placemark[i].AddressDetails.Country.CountryNameCode;
      } 
            
    }
    else{ 
      thecountrycode="00";
      } 
    
    parent.document.getElementById("country_codebx").value = thecountrycode;
    
    var thecountryflagname = thecountrycode.toLowerCase();
    
    parent.document.getElementById("countryflag").innerHTML = '<img border="0" height="11" width="16" src="http://www.travelmapia.com/images/flags/' + thecountryflagname +  '.gif">';

    getdistricts();
    
    
    
    
  }); 


} 




function load(){

if (GBrowserIsCompatible()) //Main Code
{ 
var docpath = new String(window.location);//Convert document location to a string
var docpathlength = docpath.length;
var firstslash = docpath.lastIndexOf('/');
pointofinterest = docpath.substring(firstslash+1,docpathlength-5);

var getxmlfile = docpath.substring(0,firstslash);
var secondslash = getxmlfile.lastIndexOf('/');
 thexmlfile = docpath.substring(secondslash+1,firstslash);



var districtpath = docpath.substring(0,secondslash);
var thirdslash = districtpath.lastIndexOf('/');
 district = docpath.substring(thirdslash+1,secondslash);

var countrypath = docpath.substring(0,thirdslash);
var fourthslash = countrypath.lastIndexOf('/');
 thecountry = docpath.substring(fourthslash+1,thirdslash);

var domainpath = docpath.substring(0,fourthslash);
var fifthslash = countrypath.lastIndexOf('/');
var thedomain = docpath.substring(fifthslash+1,fourthslash);


map = new GMap2(document.getElementById("map"));//Create Map


//Create Zoom control and set it on right hand side of map. 80px from top

function mapuserControl() { }
 
 mapuserControl.prototype = new GControl();
 mapuserControl.prototype.initialize = function(map) {
 
 var container = document.createElement("div");
 container.setAttribute("id","iframediv");
 container.setAttribute("margin","0");
 container.setAttribute("border","0");
 container.setAttribute("height", "100%");
 container.setAttribute("width", "100%");
 container.setAttribute("overflow", "auto");
 //container.setAttribute("background-color", "transparent");
 //container.setAttribute("style", "background-image:url(http://www.travelmapia.com/images/Scroll.png)");

 var hyperlink = document.createElement('iframe');
 
 hyperlink.setAttribute('id', 'useriframe');
 hyperlink.setAttribute('name', 'useriframe');
 
 hyperlink.setAttribute('src', 'http://www.travelmapia.com/php/login.php');
 hyperlink.setAttribute('frameBorder', '0');
 hyperlink.setAttribute('width', '800px');
 hyperlink.setAttribute('height', '39px'); 
 hyperlink.setAttribute('marginheight', '0px');
 hyperlink.setAttribute('marginwidth', '800px');
 hyperlink.setAttribute('scrolling', 'no');
 hyperlink.setAttribute('allowTransparency', 'true');
 
 //hyperlink.setAttribute("overflow", "auto"); 
 //element = document.createElement("img");
 //element.setAttribute("src", "http://www.travelmapia.com/searchmapia.gif");
 //element.setAttribute("valign", "bottom");
    
 container.appendChild(hyperlink);
  
 map.getContainer().appendChild(container);
  return container;
  }

  // By default, the control will appear in the top left corner of the
  // map with 7 pixels of padding.
  mapuserControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, 0));
  }

 
function mapuserwindowControl() { }
 
 mapuserwindowControl.prototype = new GControl();
 mapuserwindowControl.prototype.initialize = function(map) {
 
 
 var mapwindow = document.createElement("div");
 mapwindow.setAttribute("id","mapwindow");
 mapwindow.setAttribute("margin","0");
 mapwindow.setAttribute("border","0");
 mapwindow.setAttribute("height", "100%");
 mapwindow.setAttribute("width", "100%");
 mapwindow.setAttribute("overflow", "auto");
 mapwindow.setAttribute("background-color", "transparent");
 mapwindow.setAttribute("visibility", "hidden");
 //container.setAttribute("style", "background-image:url(http://www.travelmapia.com/images/Scroll.png)");


 map.getContainer().appendChild(mapwindow);
  return mapwindow;
  }

  // By default, the control will appear in the top left corner of the
  // map with 7 pixels of padding.
  mapuserwindowControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, 0));
  }

function adminuserwindowControl() { }
 
 adminuserwindowControl.prototype = new GControl();
 adminuserwindowControl.prototype.initialize = function(map) {
 
 
 var adminwindow = document.createElement("div");
 adminwindow.setAttribute("id","adminwindow");
 adminwindow.setAttribute("margin","0");
 adminwindow.setAttribute("border","0");
 adminwindow.setAttribute("height", "100%");
 adminwindow.setAttribute("width", "100%");
 adminwindow.setAttribute("overflow", "auto");
 adminwindow.setAttribute("background-color", "transparent");
 adminwindow.setAttribute("visibility", "hidden");
//container.setAttribute("style", "background-image:url(http://www.travelmapia.com/images/Scroll.png)");



 map.getContainer().appendChild(adminwindow);
  return adminwindow;
  }

  // By default, the control will appear in the top left corner of the
  // map with 7 pixels of padding.
  adminuserwindowControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, 0));
  }





function minilegendwindowControl() { }
 
 minilegendwindowControl.prototype = new GControl();
 minilegendwindowControl.prototype.initialize = function(map) {
 
 
 var minilegendwindow = document.createElement("div");
 minilegendwindow.setAttribute("id","minilegendwindow");
 minilegendwindow.setAttribute("margin","0");
 minilegendwindow.setAttribute("border","0");
 minilegendwindow.setAttribute("height", "100%");
 minilegendwindow.setAttribute("width", "100%");
 minilegendwindow.setAttribute("overflow", "auto");
 minilegendwindow.setAttribute("background-color", "transparent");
 minilegendwindow.setAttribute("visibility", "hidden");
//container.setAttribute("style", "background-image:url(http://www.travelmapia.com/images/Scroll.png)");



 map.getContainer().appendChild(minilegendwindow);
  return minilegendwindow;
  }

  // By default, the control will appear in the top left corner of the
  // map with 7 pixels of padding.
  minilegendwindowControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, 0));
  }


function mapsearchControl() { }
 
 mapsearchControl.prototype = new GControl();
 mapsearchControl.prototype.initialize = function(map) {
var container = document.createElement("div");


 element = document.createElement("img");
 element.setAttribute("src", "http://www.travelmapia.com/searchmapia.gif");
 element.setAttribute("valign", "bottom");
    
 container.appendChild(element);
  
  
  var mapinputbx = document.createElement("input");
  mapinputbx.setAttribute("id", "searchinputbox");
  mapinputbx.setAttribute("valign", "top");
  mapinputbx.setAttribute("name", "inputbox");
  mapinputbx.setAttribute("type", "Text");
  mapinputbx.setAttribute("size", "15");
  mapinputbx.setAttribute("value","Find Address");
  mapinputbx.onfocus=function() {this.value="";};
  
  container.appendChild(mapinputbx);
 
  var searchbtn = document.createElement("input");
  searchbtn.setAttribute("type", "button");
  searchbtn.setAttribute("value", "Search");
  
  container.appendChild(searchbtn);
  
  GEvent.addDomListener(searchbtn, "click", function() { geocodezcountry(document.getElementById('searchinputbox').value);}); // Listen for Button Click
 
 map.getContainer().appendChild(container);
  return container;
  }

  // By default, the control will appear in the top left corner of the map with 7 pixels of padding.
  mapsearchControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 30));
  }
  
  function switchControl() { }
  switchControl.prototype = new GControl();
  switchControl.prototype.initialize = function(map) {
 
  var container = document.createElement("div");
  container.setAttribute("id","countrynav");  
    
  imageelement = document.createElement("img");
 
  imageelement.setAttribute("src", "http://www.travelmapia.com/selectview.gif");
  imageelement.setAttribute("valign", "bottom");
  imageelement.setAttribute("align", "left");
    
  container.appendChild(imageelement);
 
   var myform = document.createElement("form");
   myform.setAttribute("name","switchformx");
   myform.setAttribute("id","placeswitch");
     
   var oSelect=document.createElement("select");
   oSelect.setAttribute("name", "switchviewx");
     
   oSelect.onchange = function() { moveMap(oSelect.value); };
    
   myform.appendChild(oSelect);
    
   var oOption = document.createElement("option");
   var t0 = document.createTextNode("World");
   oOption.setAttribute("value", 0);
   oOption.appendChild(t0);
   oSelect.appendChild(oOption);

	var oOption1 = document.createElement("option");
	var t1 = document.createTextNode("North America");
	oOption1.setAttribute("value", 1);
	oOption1.appendChild(t1);
	oSelect.appendChild(oOption1);

    
    var oOption2 = document.createElement("option");
	var t2 = document.createTextNode("South America");
	oOption2.setAttribute("value", 2);
	oOption2.appendChild(t2);
	oSelect.appendChild(oOption2);
     
    var oOption3 = document.createElement("option");
	var t3 = document.createTextNode("Antartica");
	oOption3.setAttribute("value", 3);
	oOption3.appendChild(t3);
	oSelect.appendChild(oOption3);
	
     
    var oOption4 = document.createElement("option");
	var t4 = document.createTextNode("Africa");
	oOption4.setAttribute("value", 4);
	oOption4.appendChild(t4);
	oSelect.appendChild(oOption4);
     
    var oOption5 = document.createElement("option");
	var t5 = document.createTextNode("Europe");
	oOption5.setAttribute("value", 5);
	oOption5.appendChild(t5);
	oSelect.appendChild(oOption5);
	
	var oOption6 = document.createElement("option");
	var t6 = document.createTextNode("Asia");
	oOption6.setAttribute("value", 6);
	oOption6.appendChild(t6);
	oSelect.appendChild(oOption6);
     
    var oOption7 = document.createElement("option");
	var t7 = document.createTextNode("Australia");
	oOption7.setAttribute("value", 7);
	oOption7.appendChild(t7);
	oSelect.appendChild(oOption7);
    
  
    container.appendChild(myform);
    map.getContainer().appendChild(container);
    return container;
    }

    // By default, the control will appear in the top left corner of the
    // map with 7 pixels of padding.
    switchControl.prototype.getDefaultPosition = function() {
      return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,65));
    }

    var mapTypeControl = new GLargeMapControl();
    var topRight = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(40,140));
    
    //Create Custom Map Control Input Box and Button
    map.addControl(new mapuserwindowControl()); // Add User Controls
    map.addControl(new adminuserwindowControl()); //Add Admin Window COntrol
     map.addControl(new minilegendwindowControl());
    map.addControl(new mapuserControl());
    map.addControl(new mapsearchControl());
    map.addControl(new switchControl());
    map.addControl(mapTypeControl,topRight);
  //  map.addControl(new GMapTypeControl());
    new GKeyboardHandler(map);
    
    
    
    
        var publisher_id = 'pub-7028995736219467';
        var adsManagerOptions = {  
        maxAdsOnMap : 4,
        style: 'adunit',  
        // The channel field is optional - replace this field with a channel number   
        // for Google AdSense tracking  
        channel: '6380560096'  };
        adsManager = new GAdsManager(map, publisher_id, adsManagerOptions);
        adsManager.enable();
    
    
      
   // map.addControl(new GOverviewMapControl(new GSize(150,150)));
    
          
//alert( "Domain:" + thedomain + " " + "Country:"  + thecountry +" "+ "District:" + district +" "+ "XMLFILE:" + thexmlfile +" "+ "HTML:" + pointofinterest);              
   
     
if(pointofinterest==".com/" || thexmlfile=="www.travelmapia.com" || thecountry=="http:" )
{
   // alert(thexmlfile);
    movemaptocountry(thexmlfile);      
    loadcountryxmlfile("english/countries.xml");
    
}
    
else if(district=="www.travelmapia.com")
{
    // alert("Loading Country:"+thexmlfile);
    movemaptocountry(thexmlfile);
    loadxmlfile("english/" + thexmlfile + "_attractions.xml");
    getcountrydistricts(thexmlfile+"_districts_view.xml");
    
    showminilegend();
    
}
     
else
   {
         
     movemaptodistrict(thedomain,thecountry,district,thexmlfile,pointofinterest);
     
     var thevalue;
  
     switch(thexmlfile){
     
     case "attractions":
      xmlfileused = "english/"+ thecountry + "_attractions.xml"; 
      getcountrydistricts(thecountry+"_districts_view.xml");
      searchforpoix(thexmlfile);
 
      thevalue = getvaluex();
      
      if(thevalue == true){
     
      break;
      }
      
      else if(thevalue == false || thevalue == undefined){  
      loadxmlfile(xmlfileused);
      break; 
      }
     
      case "lodging":
        
      xmlfileused = "english/"+ thecountry + "_lodging.xml"; 
      getcountrydistricts(thecountry+"_districts_view.xml");
      searchforpoix(thexmlfile);
      thevalue = getvaluex();
         
      if(thevalue == true){
      
      break;
      }
      
      else if(thevalue == false || thevalue == undefined){  
      
      loadxmlfile(xmlfileused);
      break; 
      }
      
      
      case "directory":
      xmlfileused = "english/"+ thecountry + "_directory.xml"; 
      getcountrydistricts(thecountry+"_districts_view.xml");
      searchforpoix(thexmlfile);
      
      thevalue = getvaluex();
      
      if( thevalue == true){
      break;
      }
      else if(thevalue == false){  
      
      loadxmlfile(xmlfileused);
      break; 
      }
 
     case "restaurant":
      xmlfileused = "english/"+ thecountry + "_restaurant.xml"; 
      getcountrydistricts(thecountry+"_districts_view.xml");
      searchforpoix(thexmlfile);
      
      thevalue = getvaluex();
      
      if( thevalue == true){
      break;
      }
      else if(thevalue == false){  
      
      loadxmlfile(xmlfileused);
      break; 
      }
       
      case "realestate":
      xmlfileused = "english/"+ thecountry + "_realestate.xml"; 
      getcountrydistricts(thecountry+"_districts_view.xml");
      searchforpoix(thexmlfile);
      
      thevalue = getvaluex();
      
      if( thevalue == true){
      
      break;
      }
      
      else if(thevalue == false || thevalue == undefined){  
      
      loadxmlfile(xmlfileused);
      break; 
      }
           
      default:
      

     
      xmlfileused = "english/"+ district + "_attractions.xml";
      getcountrydistricts(district+"_districts_view.xml"); 
      chosencountry = district;
      
      searchforpoix(thexmlfile);
      thevalue = getvaluex();
     

            
      if( thevalue == true){
      break;
      }
      else if(thevalue == false || thevalue == undefined){ 
     // alert("Loading XMLFILE:" +xmlfileused); 
      loadxmlfile(xmlfileused);
      break; 
      }
      
     
     }
     
         
 
    }//END ELSE
  
     //setTimeout("positionOverview(558,254)",1);
     //Open Message Box for Showing text.  // ====== set up marker mouseover tooltip div ======
      document.getElementById("map").appendChild(tooltip);
      tooltip.style.visibility="hidden";

     // Remove to add quick points    
     // var point = new GLatLng(18.380378280213566,-88.39820623397827);
     // var marker = createMarker(point,'Corozal BayInn','<div style="padding-left:140px; padding-top:3px; font-size:14px; font-weight: bolder; color:#996633">Corozal Bay Inn Resort</DIV> <br><table border=0 cellPadding=6><tr><td><div style="width:150px; height:100px;border:thin solid; border-width:3px;border-color: #CC9E47"><img src="images/CBI-AirW.jpg" align="left" width=150 height=100></div></td><td width="300" valign=top>Corozal Bay Inn is the location of choice for upscale budget travelers visiting Corozal Town. It is the only hotel in town that has a swimming pool, long sandy beach, 27-inch TVs with cable and free wireless internet for those traveling with their laptops.</td></table><br><table border=1 cellPadding=2><tr><td width="150"><input type="button" value="See a close up view" onClick="setZM(18)"></td><td width="300" valign=top><a href="http://www.corozalbayinn.com">Link</a></td></table><br>',iconObj,"Overview","Video")
     // map.addOverlay(marker);
  
    }//END BROWSER COMPATIBLE IF
       
    else 
    {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
    
   //  map.openInfoWindowHtml(new GLatLng(18.379411035538346,-88.41341972351074), '<table border=0 cellPadding=6><tr><td><div style="width:200px; height:200px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="200" height="200"><param name="movie" value="flash/intro.swf"><param name="quality" value="High"><param name="salign" value="T"><embed src="flash/intro.swf" quality="High" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="200" salign="T"></embed></object></div>');
     
     
     
     
     markerindex = i;
}





function searchforpoix(thexmlfile){


//alert("THE XMLFILE:" + thexmlfile);
//alert("XMLFILEUSED:" + xmlfileused);



var foundx;

     var request = GXmlHttp.create();
     request.open("GET", "http://www.travelmapia.com/files/" + xmlfileused , false);   
     request.onreadystatechange = function() 
     {
     
     
       if(request.readyState == 1){
        document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
   
        }
     
     
     
     else if (request.readyState == 4) 
     { //Removed for IE documentElement error.//var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          
          for (var i = 0; i < markers.length; i++)  // obtain the array of markers and loop through it
          {  // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var categoryx = markers[i].getAttribute("category");
            var placename = markers[i].getAttribute("placename");
            var placeid = markers[i].getAttribute("placeid");
            var addressx = markers[i].getAttribute("address");
            var phonex = markers[i].getAttribute("phone");
            var username = markers[i].getAttribute("username");
            var countrycode = markers[i].getAttribute("countrycode");
            var placename = markers[i].getAttribute("placename");   
            var image = markers[i].getAttribute("image");     
            var video = markers[i].getAttribute("video");
            var url = markers[i].getAttribute("url");
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            var iconObj = new GIcon();
            var html = markers[i].getAttribute("html");
            iconObj.image = markers[i].getAttribute("icon");
            iconObj.iconSize = new GSize(23,33);
            iconObj.iconAnchor = new GPoint(5,33);
            iconObj.infoWindowAnchor = new GPoint(9, 2);
                 
            //ASSIGN RANDOM AD HTML FILE WITH AD SCRIPTS
            var rand_no = Math.ceil(3*Math.random());
            if(rand_no == 1){
            jscriptads='http://www.travelmapia.com/adbrite.html';
            }
            else if(rand_no == 2){
            jscriptads='http://www.travelmapia.com/googletextandbannerads.html';
            }
            else{
            jscriptads='http://www.travelmapia.com/googlebannerads.html';
            }

            var htmlx;
            var stripwhitespace = placename.replace(/\s/g, "-");
            var labelnamelowercase = stripwhitespace.toLowerCase();
            var RegularExpression  =  new RegExp(pointofinterest); //convert label to lowercase, fix for loop done thanks
            var found = labelnamelowercase.search(RegularExpression)
            
          if (found != -1)
          {  
          
             //alert("Found")     
             categoryx = categoryx.toLowerCase();
             countrycode = countrycode.toLowerCase();   
             if(theadmin == undefined || theadmin == "")
             {
              
               if(video=="No Video Code")
               {
               htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
               }
               else
               {
               htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
               }       
             }                       
              else if(theadmin == "admin" )
              { //*******Needs to be session user fix!************
               if(video=="No Video Code")
               {
               htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
               }
               else
               {
               htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
               }
              }  
             else if(theadmin == username )
             { //Need to Match Country Admin - Country == Admin Country IsCOuntry Admin in XML file.    
              if(video=="No Video Code")
              {
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
              else
              {    
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';            
              } 
             }  
             
             else
             {
              if(video=="No Video Code")
              { 
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';             
              }
              else
              {     
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';         
              }           
             }

         
           //alert(pointofinterest + "FOUND-creating marker");
           var marker =  createMarkerx(lat,lng,zoom,point,countrycode,placename,categoryx,image,htmlx,iconObj,video)
           map.addOverlay(marker);
             
           foundx = true;
           setvaluex(foundx);
           break;
           
         
          }
      
         else
        {
         
         
         foundx = false;
         setvaluex(foundx);
        

        }
          
     
       }//END FOR LOOP
         
    
          // put the assembled side_bar_html contents into the side_bar div
        document.getElementById("side_bar").innerHTML = side_bar_html;
        
       
        
        
                
      }//END REQUEST IF
      
       
                    
  }//END FUNCTION
      
      
     
      
      
      request.send(null);



      
}




function setvaluex(foundx){


foundxx = foundx;

//alert("Set:"+foundxx);

//alert(foundx);

//return foundxx;
}

function getvaluex(){

//alert("Returning:" + foundxx);
return foundxx;

}



function getcountrydistricts(countrydistricts){


var districtstring="";
var districtarray=[];
var districthtmlcode="";
var request = GXmlHttp.create();


//var cattype = categorysubmitted.toLowerCase();
//var stripedcattype = cattype.replace(/\s/g, "");
var districtxmlfile = countrydistricts;

//alert(districtxmlfile);
 
if(language=='english'){
request.open("GET", "http://www.travelmapia.com/files/" + "english/" + districtxmlfile, true);   
}else if(language=='espanol'){
request.open("GET", "http://www.travelmapia.com/files/" + "espanol/" + "icons.xml", true);   
}
 
request.onreadystatechange = function() 
 {
   
   if(request.readyState==1){ 
   
   document.getElementById("countrynav").innerHTML = '<img align="center" src=http://www.travelmapia.com/images/loadingview.gif></img>';
        
   
   }
   
   
   else if (request.readyState==4) 
   {      //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
           
          for (var i = 0; i < markers.length; i++) 
          {  // obtain the attribues of each marker
            districtstring = markers[i].getAttribute("district");
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            
            districtarray[i]=districtstring;
            districthtmlcode += '<option value="' + districtarray[i] + '">' + districtarray[i] + '</option>';
          
          }
                       
            districttexthtml = '<img valign=bottom align=left src="http://www.travelmapia.com/selectview.gif"></img><FORM style="margin:0" name="districtselectform"><select style="font-family: Helvetica,Verdana, Arial, sans-serif;font-size:10px;text-align:left" name="thedistrict" id="thedistrict" onChange="countrydistrictview(document.districtselectform.thedistrict.options[document.districtselectform.thedistrict.selectedIndex].value);" >'+ districthtmlcode +'</select></form>';
            
            //alert(districttexthtml);
            
            document.getElementById("countrynav").innerHTML = districttexthtml;
             
    }
                     
 }

   
request.send(null); 
//return subcategorytexthtml;
}


function movemaptocountry(thexmlfile){

   var request = GXmlHttp.create();
   request.open("GET", "http://www.travelmapia.com/files/english/countries.xml", true);   
   request.onreadystatechange = function() 
      {
           
         if(request.readyState == 1){
        document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
   
        }
            
        else if (request.readyState == 4) 
        { //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          
          for (var i = 0; i < markers.length; i++) 
          {  // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var label = markers[i].getAttribute("label");   
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            var cc = markers[i].getAttribute("cc");
            
             var stripwhitespace = label.replace(/\s/g, "");
             label = stripwhitespace.toLowerCase();
          
            //alert(thexmlfile + label);          
           
                      
            if(thexmlfile==label)
            {
                         
             chosencountry=label;
                          
         //   alert("Now Viewing(default)Country:" + thexmlfile);
             loadcountry(zoom,lat,lng);
             
              break;

            }
                  
            else{
                        
            moveMap(0);
            
            }
             
          }

       }
      }
      request.send(null); 

}

function movemaptodistrict(thedomain,thecountry,district,thexmlfile,pointofinterest){



 //  alert( "Domain:"+thedomain+ " " + "Country:"  + thecountry +" "+ "District:" + district +" "+ "XMLFILE:" + thexmlfile +" "+ "HTML:" + pointofinterest);
    

   thecountry = thecountry.toLowerCase();
   district = district.toLowerCase();
   
     
   var request = GXmlHttp.create();
   
   
   if(thecountry=="www.travelmapia.com"){
 
   
   request.open("GET", "http://www.travelmapia.com/files/english/" +district+ "_districts.xml", true);   
   
   
   
    request.onreadystatechange = function() 
      {
      
       if(request.readyState == 1){
        document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
   
      
        }
      
      
      
      
       else if (request.readyState == 4) 
        { //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          
          for (var i = 1; i < markers.length; i++) 
          {  // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var label = markers[i].getAttribute("district");   
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            var cc = markers[i].getAttribute("cc");
            
            label = label.replace(/\s/g, "");
            label = label.toLowerCase();
            
            thexmlfile = thexmlfile.replace(/\s/g, "");
            thexmlfile = thexmlfile.toLowerCase();
           
            // alert(thexmlfile + " " + label + " " + zoom);
                       
            if(thexmlfile==label)
            {
          
                 
             loadcountry(zoom,lat,lng); break;

            }
            
         
            else{
            
              moveMap(0);
            
            }
                   
          }
                          
       }
      }
      request.send(null); 
   
   }
   
   else{
   
    request.open("GET", "http://www.travelmapia.com/files/english/" +thecountry+ "_districts.xml", true);   
   

    request.onreadystatechange = function() 
      {
           
        if(request.readyState == 1){
        document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
   
        }
         
        else if (request.readyState == 4) 
        { //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          
          for (var i = 1; i < markers.length; i++) 
          {  // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var label = markers[i].getAttribute("district");   
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            var cc = markers[i].getAttribute("cc");
                        
            label = label.toLowerCase();
            label = label.replace(/\s/g, "");
          
             district = district.toLowerCase();
            district = district.replace(/\s/g, "");
           

     
                        
            if(district==label)
            {
          
             loadcountry(zoom,lat,lng); break;
                          
            }
            
         
            else{
             moveMap(0);
       
            }
            
            
     
          
          }
          
                

       }
      }
      request.send(null); 
   
   
   
   }
   
   
   
  

}



function loadcountry(zoom,lat,lng){



setZM(zoom,lat,lng);



}


function loadcountryview(zoom,i,lat,lng){

setZM(zoom,lat,lng);

chosencountry = jlabels[i].toLowerCase();

chosencountry = chosencountry.replace(/\s/g, "");
document.getElementById("sidebarwrapper").innerHTML = '<div id="letterbar"><ul><li><A title="A" onclick="find(\'A\'); return false;" href="http://www.travelmapia.com/sitemap.html">A</A></li><li><A title="B" onclick="find(\'B\'); return false;" href="http://www.travelmapia.com/sitemap.html">B</A></li><li><A title="C" onclick="find(\'C\'); return false;" href="http://www.travelmapia.com/sitemap.html">C</A><li><A title="D" onclick="find(\'D\'); return false;" href="http://www.travelmapia.com/sitemap.html">D</A></li></li><li><A title="E" onclick="find(\'E\'); return false;" href="http://www.travelmapia.com/sitemap.html">E</A></li><li><A title="F" onclick="find(\'F\'); return false;" href="http://www.travelmapia.com/sitemap.html">F</A></li><li><A title="G" onclick="find(\'G\'); return false;" href="http://www.travelmapia.com/sitemap.html">G</A></li><li><A title="H" onclick="find(\'H\'); return false;" href="http://www.travelmapia.com/sitemap.html">H</A></li><li><A title="I" onclick="find(\'I\'); return false;" href="http://www.travelmapia.com/sitemap.html">I</A></li><li><A title="J" onclick="find(\'J\'); return false;" href="http://www.travelmapia.com/sitemap.html">J</A></li><li><A title="K" onclick="find(\'K\'); return false;" href="http://www.travelmapia.com/sitemap.html">K</A></li><li><A title="L" onclick="find(\'L\'); return false;" href="http://www.travelmapia.com/sitemap.html">L</A></li><li><A title="M" onclick="find(\'M\'); return false;" href="http://www.travelmapia.com/sitemap.html">M</A></li><li><A title="N" onclick="find(\'N\'); return false;" href="http://www.travelmapia.com/sitemap.html">N</A></li><li><A title="O" onclick="find(\'O\'); return false;" href="http://www.travelmapia.com/sitemap.html">O</A></li><li><A title="P" onclick="find(\'P\'); return false;" href="http://www.travelmapia.com/sitemap.html">P</A></li><li><A title="Q" onclick="find(\'Q\'); return false;" href="http://www.travelmapia.com/sitemap.html">Q</A></li><li><A title="R" onclick="find(\'R\'); return false;" href="http://www.travelmapia.com/sitemap.html">R</A></li><li><A title="S" onclick="find(\'S\'); return false;" href="http://www.travelmapia.com/sitemap.html">S</A></li><li><A title="T" onclick="find(\'T\'); return false;" href="http://www.travelmapia.com/sitemap.html">T</A></li><li><A title="U" onclick="find(\'U\'); return false;" href="http://www.travelmapia.com/sitemap.html">U</A></li><li><A title="V" onclick="find(\'V\'); return false;" href="http://www.travelmapia.com/sitemap.html">V</A></li><li><A title="W" onclick="find(\'W\'); return false;" href="http://www.travelmapia.com/sitemap.html">W</A></li><li><A title="X" onclick="find(\'X\'); return false;" href="http://www.travelmapia.com/sitemap.html">X</A></li><li><A title="Y" onclick="find(\'Y\'); return false;" href="http://www.travelmapia.com/sitemap.html">Y</A></li><li><A title="Z" onclick="find(\'Z\'); return false;" href="http://www.travelmapia.com/sitemap.html">Z</A></li></ul></div><!--END LETTERBAR--><div id="sidebarcontainer"><div id="side_bartop"> <a rel="category" style="border:0" href="">'+chosencountry+' Attractions</a> </div><div id="side_bar"></div><!-- END side_bar--></div>';

loadxmlfile("english/" + chosencountry +"_attractions.xml");



getcountrydistricts(chosencountry+"_districts_view.xml");

}


// ====== This function displays the tooltip ======
// it can be called from an icon mousover or a side_bar mouseover
function showTooltip(marker) 
       {
           
      	tooltip.innerHTML = marker.tooltip;
	    var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom());
	    var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
	    var anchor=marker.getIcon().iconAnchor;
	    var width=marker.getIcon().iconSize.width;
	    var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x - anchor.x + width,- offset.y + point.y +anchor.y)); 
        pos.apply(tooltip);
	    tooltip.style.visibility="visible";
       }
         
function mymouseover(i) 
       { // ===== This function is invoked when the mouse goes over an entry in the side_bar =====
        // It launches the tooltip on the icon  
        showTooltip(gmarkers[i])
       }
         
function mymouseout() 
      {  // ===== This function is invoked when the mouse leaves an entry in the side_bar =====
        // It hides the tooltip 
	   tooltip.style.visibility="hidden";
      }
      // This function picks up the click and opens the corresponding info window    
      //Zooms in and closes Info window
      
      
function setZM(zoom,lat,lng) 
      {
      

        map.closeInfoWindow();
        map.setCenter(new GLatLng(lat, lng), zoom, G_HYBRID_MAP);      
             
      }
      

function closeIW() 
      { 
        map.closeInfoWindow();
      } 
      //<input type="Button" value="Bay Inn" onClick="moveMap(18.380378280213566,-88.39820623397827)">
      //USe to move to spot
      
      
//Switch box fucntions to move on different sections of the map of Belize.      
      
function moveMap(section)
{ 
   if (section == "0") 
   {
   //Set map to World View  
   map.setCenter(new GLatLng(29.84064389983441, -2.109375), 2, G_HYBRID_MAP);
   //loadcountryxmlfile("english/countries.xml");

   } 
   else if (section == "1") 
   {
    //Set map to North America 
     map.setCenter(new GLatLng(48.3416461723746,-100.1953125), 3, G_HYBRID_MAP);
    //Can Load Corozal Attractions
    // loadhotels()
    // document.getElementByName("placeswitch").innerHTML = '</div><FORM name="switchformx"></FORM></div>'
    //<SELECT name="switchviewx" onChange="moveMap(oSelect.value);"> <OPTION SELECTED value="1">Country View<OPTION value="2">Corozal Town<OPTION value="3">Corozal Free Zone<OPTION value="4">Consejo<OPTION value="5">San Pedro/Ambergris<OPTION value="6">Belize City<OPTION value="7">Ladyville<OPTION value="8">Placencia</SELECT></FORM>' ;  
   } 
   else if (section == "2")
   {
    //Set Map to South America
   map.setCenter(new GLatLng(-10.14193168613103,-60.99609375), 3, G_HYBRID_MAP);
   } 
      else if (section == "3")
   {
    //Set map to Antartica
   map.setCenter(new GLatLng(-52.696361078274464,22.5), 2, G_HYBRID_MAP);
   } 
   else if (section == "4")
   {
    //Set map to Africa
   map.setCenter(new GLatLng(17.97873309555617,20.21484375), 3, G_HYBRID_MAP);
   } 
    else if (section == "5")
   {
    //Set map to Europe
   map.setCenter(new GLatLng(52.32191088594773,19.16015625), 3, G_HYBRID_MAP);
   } 
     
   else if (section == "6")
   {
    //Set map to Asia
   map.setCenter(new GLatLng(35.31736632923787,112.1484375), 3, G_HYBRID_MAP);
   }  
   else if (section == "7")
   {
    //Set map to Australia
   map.setCenter(new GLatLng(-22.431340156360594,135.3515625), 4, G_HYBRID_MAP);
   } 
   
   
//  return error;
}


function createCountryMarker(label,zoom,lat,lng,point,name,image,html,iconObj,video) 
{
 
 
 
  
  var stripwhitespace = label.replace(/\s/g, "");
  var thenewlabel = stripwhitespace.toLowerCase();
          
 
  
  

  
  var flagname = iconObj.image;
  
  
   
   var jscriptadsvideo = 'adbritevideozone.html'
   var youtubevideoformat = '<table border=0 cellPadding=0><tr><td align="left" ><div><object width="380" height="300"><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="380" height="300"></embed></object></div></td><td vAlign="Top" width="0"></td></table>'
   //<IFRAME SRC='+jscriptads+' WIDTH=469 HEIGHT=115 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME>'
   
   var imagepath = xmlfileused; 
   var counttodelimeter = xmlfileused.lastIndexOf('/'); //Count to delimeter
   
  // var newimagepath = xmlfileused.substring(0, counttodelimeter); //Get Language
   
   xmlfilenamex = xmlfileused.substring(counttodelimeter + 1,xmlfileused.length-4);
  
   var marker = new GMarker(point,iconObj); 
   // === store the name so that the tooltip function can use it ===
   // alert(xmlfilenamex);
   marker.tooltip = '<div class="tooltip"><img style="border:3px #ffc61d solid;" src="http://www.travelmapia.com/images/' + xmlfilenamex + '/' +image+ '" width="50" height="50"><br><div id="tooltiptext">' +name+'</div></div>';
   GEvent.addListener(marker, "click", function() 
   {
    document.getElementById("mapwindow").innerHTML = '';
    document.getElementById("adminwindow").innerHTML = '';
    
  //marker.openInfoWindowTabsHtml([new GInfoWindowTab("Overview",html), new GInfoWindowTab("Video",youtubevideoformat)],{suppressMapPan:false});
	   
	 map.savePosition();
	 
	 loadcountry(zoom,lat,lng);
	 
	 
	  thecountry = thenewlabel;
    chosencountry = thenewlabel;
    

    
	 
	 loadxmlfile("english/" +thenewlabel+"_attractions.xml");
	 
	 getcountrydistricts(thenewlabel+"_districts_view.xml");
	   
	 
	 }
	 

	);
             
      GEvent.addListener(map, "infowindowclose", function(){map.returnToSavedPosition()}); 
       // save the info we need to use later for the side_bar
       jlabels[i] = name;
       gmarkers[i] = marker;
	   htmls[i] = html;
	   youtubevideos[i] = youtubevideoformat;
	   
   
	  if (video =="")
      {   side_bar_html += '<a href="javascript:loadcountryview(' + zoom + ',' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + name + '</a><br>';
	 
	  }
	  else
	  {   side_bar_html += '<a href="javascript:loadcountryview('  + zoom + ',' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + name + " " + '<img width=16 height=11 border=0 valign=center src="'+flagname+'"></img></a><br>';
	  }
	

      i++;
      //  ======  The new marker "mouseover" and "mouseout" listeners  ======
      GEvent.addListener(marker,"mouseover", function() {showTooltip(marker);});        
      GEvent.addListener(marker,"mouseout", function() {tooltip.style.visibility="hidden"});  
      return marker;
       
}














           
function createMarker(lat,lng,point,name,image,html,iconObj,video) 
{

   var jscriptadsvideo = 'adbritevideozone.html'
   var youtubevideoformat = '<table border=0 cellPadding=0><tr><td align="left" ><div><object width="380" height="300"><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="380" height="300"></embed></object></div></td><td vAlign="Top" width="0"></td></table>'
    //<IFRAME SRC='+jscriptads+' WIDTH=469 HEIGHT=115 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME>'
   
   var imagepath = xmlfileused; 
   
 // var newimagepath = xmlfileused.substring(0, counttodelimeter); //Get Language
  
  var counttofirstdelimeter = xmlfileused.lastIndexOf('_');
  
  var counttodelimeter = xmlfileused.lastIndexOf('/'); //Count to delimeter
   
  var catname = xmlfileused.substring(counttofirstdelimeter + 1,xmlfileused.length-4);
  
   xmlfilenamex = xmlfileused.substring(counttodelimeter + 1,xmlfileused.length-4);
 
//  alert(catname);


   var marker = new GMarker(point,iconObj); 
   // === store the name so that the tooltip function can use it ===
   // alert(xmlfilenamex);
  // marker.tooltip = '<div class="tooltip"><img style="border:3px #ffc61d solid;" src="http://www.travelmapia.com/images/' + xmlfilenamex + '/' +image+ '" width="50" height="50"><br><div id="tooltiptext">' +name+'</div></div>';
  
//if(catname==""){
  // marker.tooltip = '<div class="tooltip"><img style="border:3px #ffc61d solid;" src="http://www.travelmapia.com/images/' + xmlfilenamex + '/' +image+ '" width="50" height="50"><br><div id="tooltiptext">' +name+'</div></div>';
  
  
 // }
  
 // else{
   marker.tooltip = '<div class="tooltip"><img style="border:3px #ffc61d solid;" src="http://www.travelmapia.com/images/' + catname + '/' +image+ '" width="50" height="50"><br><div id="tooltiptext">' +name+'</div></div>';
  
 // }


  GEvent.addListener(marker, "click", function() 
   {
    document.getElementById("mapwindow").innerHTML =  '';
    document.getElementById("adminwindow").innerHTML =  '';
    
    marker.openInfoWindowTabsHtml([new GInfoWindowTab("Overview",html), new GInfoWindowTab("Video",youtubevideoformat)],{suppressMapPan:false});
	   
	 map.savePosition();
//	 function subGPoints(a,b) 
//	 { //returns the distance in pixels between point a and b 
  //   return new GPoint(a.x-b.x, a.y-b.y); 
 //    } 
     //Pixel distance to the center of the map 
//     var CDivPixel = map.fromLatLngToDivPixel(map.getCenter()); 
 //    //Pixel distance from the marker point    
 //    var pointDivPixel = map.fromLatLngToDivPixel(point); 
     //Difference between the above mentioned distances 
 //    var fromCenter = subGPoints(pointDivPixel, CDivPixel); 
     //Pan to the corrected location (the -40 and +215 sizes are the distances from my marker to the center of the infowindow 
 //    map.panBy(new GSize(-fromCenter.x+6,-fromCenter.y+225)) 
     }
	);
             
      GEvent.addListener(map, "infowindowclose", function(){map.returnToSavedPosition()}); 
       // save the info we need to use later for the side_bar
       jlabels[i] = name;
       gmarkers[i] = marker;
	   htmls[i] = html;
	   youtubevideos[i] = youtubevideoformat;
	   
	  if (video =="")
      {   side_bar_html += '<a href="javascript:myclick(' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + name + '</a><br>';
	 
 }
	  else
	  {   side_bar_html += '<a href="javascript:myclick(' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + name + " " + '<img border=0 valign=center src="http://www.travelmapia.com/images/youtube.gif"></img></a><br>';
	  
	  }
	

      i++;
      //  ======  The new marker "mouseover" and "mouseout" listeners  ======
      GEvent.addListener(marker,"mouseover", function() {showTooltip(marker);});        
      GEvent.addListener(marker,"mouseout", function() {tooltip.style.visibility="hidden"});  
      return marker;
       
}

function subGPointsx(a,b) 
	 { 
     //returns the distance in pixels between point a and b 
     return new GPoint(a.x-b.x, a.y-b.y); 
     } 

function myclick(i,lat,lng) 
{
 document.getElementById("mapwindow").innerHTML =  '';
 document.getElementById("adminwindow").innerHTML =  '';
 urchinTracker(jlabels[i]);
 
 
 var zoomlevel = map.getZoom();
 


 if (zoomlevel<= 8) 
 {
    map.savePosition();
    gmarkers[i].openInfoWindowTabsHtml([new GInfoWindowTab("Overview",htmls[i]), new GInfoWindowTab("Video",youtubevideos[i])],{suppressMapPan:false});
 // var xpoint = new GLatLng(lat,lng);
  //Pixel distance to the center of the map 
  //var CDivPixel = map.fromLatLngToDivPixel(map.getCenter()); 
  //Pixel distance from the marker point 
 // var pointDivPixel = map.fromLatLngToDivPixel(xpoint); 
  //Difference between the above mentioned distances 
 // var fromCenter = subGPointsx(pointDivPixel, CDivPixel); 
   //Pan to the corrected location (the -40 and +215 sizes are the distances from my marker to the center of the infowindow 
   //gmarkers[i].openInfoWindowHtml(htmls[i]);
  //map.panBy(new GSize(-fromCenter.x-6,-fromCenter.y+225)) 
     
}
 else{
    map.savePosition();
    map.setCenter(new GLatLng(lat, lng), 14); 
    // gmarkers[i].openInfoWindowTabsHtml([new GInfoWindowTab("Overview",htmls[i]), new GInfoWindowTab("Video",youtubevideos[i])]);
   
     }   
}  



function loadcountryxmlfile(xmlfile)
{ 
   
 
   i=0;
   xmlfileused = xmlfile;
   var newxml = xmlfile; 
   var counttodelimeter = xmlfile.lastIndexOf('/'); //Count to delimeter
   
   language = xmlfileused.substring(0, counttodelimeter); //Get Language

   xmlfilename = xmlfile.substring(counttodelimeter + 1,xmlfile.length);
   var newxmlfilelenght = xmlfilename.length;
   var stripxmlfile = newxmlfilelenght-4;
    
   map.clearOverlays();
   //document.getElementById("attractionsbutton").innerHTML = '<A title="See Belize Attractions" onclick="loadattractions(); return false;" href="#">Attractions</A>'; 
   //Clear Side Bar then populate with hotel info. 
   
   
   
   clearxml();
   
   //document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
   
   
 //  alert("Changing Side Bar Wrapper");
   document.getElementById("sidebarwrapper").innerHTML = '<div id="letterbar"><ul><li><A title="A" onclick="findcountry(\'A\'); return false;" href="http://www.travelmapia.com/index.html">A</A></li><li><A title="B" onclick="findcountry(\'B\'); return false;" href="http://www.travelmapia.com/index.html">B</A></li><li><A title="C" onclick="findcountry(\'C\'); return false;" href="http://www.travelmapia.com/index.html">C</A><li><A title="D" onclick="findcountry(\'D\'); return false;" href="http://www.travelmapia.com/index.html">D</A></li></li><li><A title="E" onclick="findcountry(\'E\'); return false;" href="http://www.travelmapia.com/index.html">E</A></li><li><A title="F" onclick="findcountry(\'F\'); return false;" href="http://www.travelmapia.com/index.html">F</A></li><li><A title="G" onclick="findcountry(\'G\'); return false;" href="http://www.travelmapia.com/index.html">G</A></li><li><A title="H" onclick="findcountry(\'H\'); return false;" href="http://www.travelmapia.com/index.html">H</A></li><li><A title="I" onclick="findcountry(\'I\'); return false;" href="http://www.travelmapia.com/index.html">I</A></li><li><A title="J" onclick="findcountry(\'J\'); return false;" href="http://www.travelmapia.com/index.html">J</A></li><li><A title="K" onclick="findcountry(\'K\'); return false;" href="http://www.travelmapia.com/index.html">K</A></li><li><A title="L" onclick="findcountry(\'L\'); return false;" href="http://www.travelmapia.com/index.html">L</A></li><li><A title="M" onclick="findcountry(\'M\'); return false;" href="http://www.travelmapia.com/index.html">M</A></li><li><A title="N" onclick="findcountry(\'N\'); return false;" href="http://www.travelmapia.com/index.html">N</A></li><li><A title="O" onclick="findcountry(\'O\'); return false;" href="http://www.travelmapia.com/index.html">O</A></li><li><A title="P" onclick="findcountry(\'P\'); return false;" href="http://www.travelmapia.com/index.html">P</A></li><li><A title="Q" onclick="findcountry(\'Q\'); return false;" href="http://www.travelmapia.com/index.html">Q</A></li><li><A title="R" onclick="findcountry(\'R\'); return false;" href="http://www.travelmapia.com/index.html">R</A></li><li><A title="S" onclick="findcountry(\'S\'); return false;" href="http://www.travelmapia.com/index.html">S</A></li><li><A title="T" onclick="findcountry(\'T\'); return false;" href="http://www.travelmapia.com/index.html">T</A></li><li><A title="U" onclick="findcountry(\'U\'); return false;" href="http://www.travelmapia.com/index.html">U</A></li><li><A title="V" onclick="findcountry(\'V\'); return false;" href="http://www.travelmapia.com/index.html">V</A></li><li><A title="W" onclick="findcountry(\'W\'); return false;" href="http://www.travelmapia.com/index.html">W</A></li><li><A title="X" onclick="findcountry(\'X\'); return false;" href="http://www.travelmapia.com/index.html">X</A></li><li><A title="Y" onclick="findcountry(\'Y\'); return false;" href="http://www.travelmapia.com/index.html">Y</A></li><li><A title="Z" onclick="findcountry(\'Z\'); return false;" href="http://www.travelmapia.com/index.html">Z</A></li></ul></div><!--END LETTERBAR--><div id="sidebarcontainer"><div id="side_bartop"> <a href="#">Attractions</a></div><div id="side_bar"></div><!-- END side_bar--></div>';

   
   
   if(language=='english'){
   
   language='english';
   
   document.getElementById("side_bartop").innerHTML =  xmlfilename.substring(0,stripxmlfile);
   urchinTracker(xmlfilename.substring(0,stripxmlfile));
   
   }
   else if(language=='espanol'){
    
   var translatedxml = translate(xmlfilename.substring(0,stripxmlfile));
   document.getElementById("side_bartop").innerHTML = translatedxml ;
   
   } 
         
   var request = GXmlHttp.create();
   request.open("GET", "http://www.travelmapia.com/files/" + xmlfile, true);   
   request.onreadystatechange = function() 
      {
      
        if(request.readyState == 1){
        document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
   
      
        }
      
      
        else if(request.readyState == 4) 
        { //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          
          for (var i = 0; i < markers.length; i++) 
          {  // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var label = markers[i].getAttribute("label");   
            var image = markers[i].getAttribute("image"); 
            var video = markers[i].getAttribute("video");
            var url = markers[i].getAttribute("url");
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            var iconObj = new GIcon();
            iconObj.image = markers[i].getAttribute("icon");
            iconObj.iconSize = new GSize(16,11);
            iconObj.iconAnchor = new GPoint(16,11);
            iconObj.infoWindowAnchor = new GPoint(9, 2);
            
            
    
            
           var  jscriptads='http://www.travelmapia.com/googletextads.html';

           var html = markers[i].getAttribute("html");
            //var htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div style="font-size:14px; font-weight: bolder; color:#996633">' + label + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;<a href="' + url + '" target="_blank"><IMG alt="Web Link" src="images/icons/weblink.gif"> Web Link</a></div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="images/attractions/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="text-align:justify;font-size:11px">' + html + '</div></td></table></div>'  
            //var htmlx = '<div style="font-size:14px; font-weight: bolder; color:#996633">' + label + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;<a href="' + url + '" target="_blank"><IMG alt="Web Link" src="images/icons/weblink.gif"> Web Link</a>&nbsp;&nbsp;&nbsp;<IMG alt="Web Link" src="images/youtube.gif"><a href="#" onclick="see_video_click();"> See Video</a></div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="images/' + xmlfilename.substring(0,stripxmlfile) + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="text-align:justify;font-size:11px">' + html + '</div></td></table></div>'  
            //var marker = createMarker(lat,lng,point,label,htmlx,iconObj,video); // create the marker           
           
            if(newxml==language + '/' + 'videos.xml'){
          
            var htmlx = '<div style="padding-left:1px; padding-top:3px; font-size:14px; font-weight: bolder; color:#996633">' + label + '</DIV><table border=0 cellPadding=0><tr><td width="280" valign=top>' + html + '</td><tr></table>' 
            var marker = createvideoMarker(point,label,htmlx,iconObj,video);// create the marker
            }
            else if(newxml==language + '/' + 'pictures.xml'){
                
            var htmlx = '<div style="padding-left:1px; padding-top:3px; font-size:14px; font-weight: bolder; color:#996633">' + label + '</DIV><div style="width:370px; height:250px;border:thin solid; border-width:1px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/pictures/' + image + '" align="left" width=370 height=250></div>' 
            var marker = createpictureMarker(point,label,htmlx,iconObj);
            }else{
            
            var htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div style="font-size:14px; font-weight: bolder; color:#996633">' + label + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG border=0 alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif"> Zoom In</a>&nbsp;&nbsp;&nbsp;<a href="' + url + '" target="_blank"><IMG border=0 alt="Web Link" src="http://www.travelmapia.com/images/icons/weblink.gif"> Web Link</a>&nbsp;&nbsp;&nbsp;<IMG border=0 alt="Web Link" src="http://www.travelmapia.com/images/youtube.gif"><a href="#" onclick="see_video_click();"> Video</a></div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/' + xmlfilename.substring(0,stripxmlfile) + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></table></div>'  
            // var htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div style="font-size:14px; font-weight: bolder; color:#996633">' + label + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;<a href="' + url + '" target="_blank"><IMG alt="Web Link" src="images/icons/weblink.gif"> Web Link</a>&nbsp;&nbsp;&nbsp;<IMG alt="Web Link" src="images/youtube.gif"><a href="#" onclick="see_video_click();">  Video</a></div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="images/' + xmlfilename.substring(0,stripxmlfile) + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="text-align:justify;font-size:11px">' + html + '</div></td></table></div>'  
            var marker = createCountryMarker(label,zoom,lat,lng,point,label,image,htmlx,iconObj,video);// create the marker
            }
         
            map.addOverlay(marker);
          }
          // put the assembled side_bar_html contents into the side_bar div

          document.getElementById("side_bar").innerHTML = side_bar_html;
        

        }
      }
      request.send(null);   
         
}











function loadxmlfile(xmlfile)
{ 
   
   
   
  // alert(xmlfile);
   
   var cnamex;
   i=0;
   xmlfileused = xmlfile;
   var newxml = xmlfile; 
   var counttodelimeter = xmlfile.lastIndexOf('/'); //Count to delimeter
   
   language = xmlfileused.substring(0, counttodelimeter); //Get Language

   xmlfilename = xmlfile.substring(counttodelimeter+1,xmlfile.length);
   var newxmlfilelenght = xmlfilename.length;
   var stripxmlfile = newxmlfilelenght-4;
   
   cnamex=xmlfilename.substring(0,stripxmlfile);
   cnamex = cnamex.replace(/_/g," ");
    
   map.clearOverlays();
   clearxml();
   
   if(language=='english'){
   
   language='english';
     
   document.getElementById("side_bartop").innerHTML =  cnamex;
   urchinTracker(xmlfilename.substring(0,stripxmlfile));
   
   }
   else if(language=='espanol'){
    
   var translatedxml = translate(xmlfilename.substring(0,stripxmlfile));
   document.getElementById("side_bartop").innerHTML = translatedxml ;
   
   } 
         

         
   var request = GXmlHttp.create();
   request.open("GET", "http://www.travelmapia.com/files/" + xmlfile, true);   
   request.onreadystatechange = function() 
      {
      
      
        if(request.readyState == 1){
        
        
       
        document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
         
      
        }
      
      
      
        else if (request.readyState == 4) 
        { //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          
          for (var i = 0; i < markers.length; i++) 
          {  // obtain the attribues of each marker
          
            var categoryx = markers[i].getAttribute("category");
            var placename = markers[i].getAttribute("placename");
            var placeid = markers[i].getAttribute("placeid");
            
            var addressx = markers[i].getAttribute("address");
            var phonex = markers[i].getAttribute("phone");
            var countrycode = markers[i].getAttribute("countrycode");
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var username = markers[i].getAttribute("username");
            var userlevel = markers[i].getAttribute("userlevel"); 
            var image = markers[i].getAttribute("image"); 
            var video = markers[i].getAttribute("video");
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));

            var iconObj = new GIcon();
            iconObj.image = markers[i].getAttribute("icon");
            iconObj.iconSize = new GSize(23,33);
            iconObj.iconAnchor = new GPoint(5,33);
            iconObj.infoWindowAnchor = new GPoint(9, 2);
           
            var  jscriptads='http://www.travelmapia.com/googletextads.html';

            var html = markers[i].getAttribute("html");


              placeid = new String(placeid);
             
      
             categoryx = categoryx.toLowerCase();
             countrycode = countrycode.toLowerCase();

    
             if(theadmin == undefined || theadmin == "")
             {
              
              //htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/' + countrycode + '/' + categoryx + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr><tr><td style="background-color:#ddd" align=center>Address:</td></tr><tr><td style="background-color:#eee" align=center>'+addressx+'</td></tr><tr><td style="background-color:#ddd" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center>Category:</td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center>Submitted By:</td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></div>';       
              
              if(video=="No Video Code"){
              
             // htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
               htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
             
              }
              else{
                
            //  htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              
              htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
             
             
              }
              
              
              
              
             }                       
              else if(theadmin == "admin" ){ //*******Needs to be session user fix!************
              //alert("Super Admin - Can Edit Everything");

              
              if(video=="No Video Code"){
              
             
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
              }
              else{
              //HERE  
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
              }
              
              
             
              }  
             else if(theadmin == username ){ //Need to Match Country Admin - Country == Admin Country IsCOuntry Admin in XML file. 3phase
    
              if(video=="No Video Code"){
              
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
              
              }
              else{
                
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
             
             
              }
             
             
             }  
             
             
             
             else{
              
              
              // htmlx = '<div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/' + countrycode + '/' + categoryx + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr><tr><td style="background-color:#ddd" align=center>Address:</td></tr><tr><td style="background-color:#eee">'+addressx+'</td></tr><tr><td style="background-color:#ddd" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center>Category:</td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center>Submitted By:</td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></div>';       
                  if(video=="No Video Code"){
              
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
              
              }
              else{
                
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
             
             
             
              }
             
             
             
             
             
             }
            
         
             
              var marker =  createMarkerx(lat,lng,zoom,point,countrycode,placename,categoryx,image,htmlx,iconObj,video)
            
            
            
            
            map.addOverlay(marker);
          }
          // put the assembled side_bar_html contents into the side_bar div

          document.getElementById("side_bar").innerHTML = side_bar_html;
        
         // document.getElementById("legend_bar").innerHTML = side_bar_html;
        }
      }
      request.send(null);   
         
}// A function to create the marker and set up the event window





function findcountry(letter){
     
var wletter = letter;  
xmlfile = xmlfileused;
var newxml = xmlfile; 
var counttodelimeter = xmlfile.lastIndexOf('/'); //Count to delimeter
language = xmlfileused.substring(0, counttodelimeter); //Get Language
var xmlfilename = xmlfile.substring(counttodelimeter + 1,xmlfile.length);
var newxmlfilelenght = xmlfilename.length;
var stripxmlfile = newxmlfilelenght-4;

i=0;
map.clearOverlays();
clearxml();//Clear Side Bar then populate with hotel info. 

//clearpreviousxml();

if(language=='english'){
   document.getElementById("side_bartop").innerHTML =  '<A title="All Countries" href="javascript:loadcountryxmlfile(\'english/countries.xml\');moveMap(\'0\');">' + xmlfilename.substring(0,stripxmlfile) + '- (' + wletter + ')' + '</a>';
   }
else if(language=='espanol'){
    var translatedxml = translate(xmlfilename.substring(0,stripxmlfile));
    
    
    
    document.getElementById("side_bartop").innerHTML =  translatedxml + '- (' + wletter + ')';

}



var request = GXmlHttp.create();
request.open("GET", "http://www.travelmapia.com/files/" + xmlfileused, true);   
request.onreadystatechange = function() 
      {
       
        if (request.readyState == 4) 
        { var xmlDoc = GXml.parse(request.responseText); 
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
           
          for (var i = 0; i < markers.length; i++) // obtain the array of markers and loop through it
          { var placename = markers[i].getAttribute("label");    // obtain the attribues of each marker 
          
           if(placename.substring(0,1) == wletter){
            
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var image = markers[i].getAttribute("image"); 
            var video = markers[i].getAttribute("video");
            var html = markers[i].getAttribute("html");
            var url = markers[i].getAttribute("url");
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
        
            var iconObj = new GIcon();
            iconObj.image = markers[i].getAttribute("icon");
            iconObj.iconSize = new GSize(16,11);
            iconObj.iconAnchor = new GPoint(16,11);
            iconObj.infoWindowAnchor = new GPoint(9, 2);
            
         
            var  jscriptads='http://www.travelmapia.com/googletextads.html';

            //   alert(xmlfilename.substring(0,stripxmlfile) + '/' + image);

            if(newxml == language + '/' + 'videos.xml'){
                       
            var htmlx = '<div style="padding-left:1px; padding-top:3px; font-size:14px; font-weight: bolder; color:#996633">' + placename + '</DIV><table border=0 cellPadding=0><tr><td width="280" valign=top>' + html + '</td><tr></table>' 
            var marker = createvideoMarker(point,placename,htmlx,iconObj,video);// create the marker
            }
            else if(newxml==language + '/' + 'pictures.xml'){ 
              var htmlx = '<div style="padding-left:1px; padding-top:3px; font-size:14px; font-weight: bolder; color:#996633">' + placename + '</DIV><div style="width:370px; height:250px;border:thin solid; border-width:1px;border-color: #CC9E47"><img src="images/pictures/' + image + '" align="left" width=370 height=250></div>' 
              var marker = createpictureMarker(point,placename,htmlx,iconObj);
            }
            else{
              var htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;<a href="' + url + '" target="_blank"><IMG border=0 alt="Web Link" src="images/icons/weblink.gif"> Web Link</a></div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/' + xmlfilename.substring(0,stripxmlfile) + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></table></div>'  
            //var marker = createCountryMarker(lat,lng,point,placename,image,htmlx,iconObj,video);// create the marker
              var marker = createCountryMarker(placename,zoom,lat,lng,point,placename,image,html,iconObj,video)
            }     
            map.addOverlay(marker);
          }
          document.getElementById("side_bar").innerHTML = side_bar_html;// put the assembled side_bar_html contents into the side_bar div
          
        }
        
      }
      }
      request.send(null);   
         
}








function find(letter){

//Need to change directory path to images/bz/attractions/ eg

     
var wletter = letter;  
xmlfile = xmlfileused;
var newxml = xmlfile; 
var counttodelimeter = xmlfile.lastIndexOf('/'); //Count to delimeter
language = xmlfileused.substring(0, counttodelimeter); //Get Language
var xmlfilename = xmlfile.substring(counttodelimeter + 1,xmlfile.length);
var newxmlfilelenght = xmlfilename.length;
var stripxmlfile = newxmlfilelenght-4;

i=0;
map.clearOverlays();
clearxml();//Clear Side Bar then populate with hotel info. 

if(language=='english'){
   document.getElementById("side_bartop").innerHTML =  xmlfilename.substring(0,stripxmlfile) + '- (' + wletter + ')';
   }
else if(language=='espanol'){
    var translatedxml = translate(xmlfilename.substring(0,stripxmlfile));
    document.getElementById("side_bartop").innerHTML =  translatedxml + '- (' + wletter + ')';

}





var request = GXmlHttp.create();
request.open("GET", "http://www.travelmapia.com/files/" + xmlfileused, true);   
request.onreadystatechange = function() 
      {
      
        if(request.readyState == 1){
        
        
       
        document.getElementById("side_bar").innerHTML =  '<div id="ajaxloadericon"></div>';
         
      
        }
      
      
       
        else if (request.readyState == 4) 
        { var xmlDoc = GXml.parse(request.responseText); 
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
           
          for (var i = 0; i < markers.length; i++) // obtain the array of markers and loop through it
          { var placename = markers[i].getAttribute("placename");    // obtain the attribues of each marker 
          
           if(placename.substring(0,1) == wletter){
            
            var categoryx = markers[i].getAttribute("category");
            var placeid = markers[i].getAttribute("placeid");
            var addressx = markers[i].getAttribute("address");
            var phonex = markers[i].getAttribute("phone");
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            var countrycode = markers[i].getAttribute("countrycode");
            var phonex = markers[i].getAttribute("phone");
            var username = markers[i].getAttribute("username");
            var userlevel = markers[i].getAttribute("userlevel"); 
            var image = markers[i].getAttribute("image"); 
            var video = markers[i].getAttribute("video");
            var html = markers[i].getAttribute("html");
            var url = markers[i].getAttribute("url");
            var iconObj = new GIcon();
            iconObj.image = markers[i].getAttribute("icon");
            iconObj.iconSize = new GSize(23,33);
            iconObj.iconAnchor = new GPoint(5,33);
            iconObj.infoWindowAnchor = new GPoint(9, 2);
            
            categoryx = categoryx.toLowerCase();
            countrycode = countrycode.toLowerCase();

            
            var  jscriptads='http://www.travelmapia.com/googletextads.html';
            var htmlx;

    
             if(theadmin == undefined || theadmin == "")
             {
              
              if(video=="No Video Code")
              {
                htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
              else{
              htmlx = '<IFRAME SRC='+jscriptads+' WIDTH=485 HEIGHT=70 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME><div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
             }                       
             else if(theadmin == "admin" )
             { //*******Needs to be session user fix!************
              //alert("Super Admin - Can Edit Everything");
              if(video=="No Video Code")
              {
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
              else
              {
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
             }  
             else if(theadmin == username )
             { //Need to Match Country Admin - Country == Admin Country IsCOuntry Admin in XML file. 3phase
              if(video=="No Video Code")
              {
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
              else{
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
             }  
             else
             {
              if(video=="No Video Code")
              {
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
              else
              {  
              htmlx = '<div id="win_container"><div id="win_container_head"><span class="header_text">' + placename + '</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<a class="win_text" href="javascript:see_video_click()"><img valign=bottom border=0 src="http://www.travelmapia.com/images/youtube.gif" width="32" height="13"> See Video</a>&nbsp;&nbsp<a class="win_text" href="javascript:setZM(' + zoom + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="http://www.travelmapia.com/images/icons/zoomin.gif" border=0 width="14" height="12"> Zoom In</a>&nbsp;<a class="win_text" href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="http://www.travelmapia.com/images/icons/weblink.gif" width="14" height="15"> Edit</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=0><tr><td><table cellpadding=0 width=130><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/'+countrycode+'/'+categoryx+'/'+image+'" align="left" width=125 height=100></div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Address:</span></td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Phone:</span> </td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Category:</span></td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center><span class="win_text">Submitted By:</span></td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></td><td valign=top><table border=0 cellPadding=1><tr><td><iframe  style="margin-left:3px;height:54px;width:340px;" src="http://www.travelmapia.com/starrating/places.php?placeid='+placeid+'" width=340 height=54 scrolling=no frameborder=0 marginheight=0 marginwidth=0></iframe></td></tr><tr><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></td></tr></table></div>';        
              }
             }
             
            
                      
            var marker = createMarkerx(lat,lng,zoom,point,countrycode,placename,categoryx,image,htmlx,iconObj,video);// create the marker
        
            map.addOverlay(marker);
          }// ENDS IF
          document.getElementById("side_bar").innerHTML = side_bar_html;// put the assembled side_bar_html contents into the side_bar div
          
        }// END REQUEST
        
      }
      }
      request.send(null);   
         
}


//Create a Home Marker at Load Page
function createHomeMarker(point,html) 
{
// var abouticon = new GIcon();
// aboutObj.image = "corozallogo.gif";
// aboutObj.iconSize = new GSize(23,33);
// aboutObj.iconAnchor = new GPoint(5,33);
// aboutObj.infoWindowAnchor = new GPoint(9, 2);
var homemarker = new GMarker(point);    
GEvent.addListener(homemarker, "click", function() {homemarker.openInfoWindowHtml(html);});
return homemarker;
}

function see_video_click()
{
var infoWin=map.getInfoWindow();
infoWin.selectTab(1);
}

//Clear Side Bar
function clearxml()
{ 
 side_bar_html = [" "]; 
 document.getElementById("side_bar").innerHTML = ""; 
 document.getElementById("side_bartop").innerHTML = ""; 
 
 
 
 
}




function clearpreviousxml()
{ 
 side_bar_html = [" "]; 
 document.getElementById("side_bar").innerHTML = ""; 
 document.getElementById("side_bartop").innerHTML = "SEARCH RESULTS"; 
 
 
 
 
}

function unloadhotels()
{
document.getElementById("hotelbutton").innerHTML = '<A title="Remove Markers :: alt+1" onclick="loadhotels(); return false;" accessKey=1 tabIndex=1 href="#">Places to Stay</A> '; 
//map.clearOverlays();
//clearxml();         
}

function cancelsubmit(){
closeIW()
map.clearOverlays();

}


function setinputimage(imagevalue) { 


window.frames["infoframe"].document.forms["submitformx"].elements["uploadedimage"].value = imagevalue;

uploadedimagevalue=imagevalue;
  
//alert("Putting PHP Variable IMAGE" + uploadedimagevalue + " to form");
  

} 


function getinputimage() { 

return uploadedimagevalue;
  
//alert("returning image from memory:"+ uploadedimagevalue);

} 


function setinputicon(iconvalue) { 

window.frames["infoframe"].document.forms["submitformx"].elements["uploadedicon"].value = iconvalue;

uploadediconvalue=iconvalue;
  
//alert("Putting PHP Variable ICON" + uploadediconvalue + " to form");
  
} 


function getinputicon() { 

return uploadediconvalue;
  
//alert("returning icon from memory:"+ uploadediconvalue);

}

function  psmessage(){




map.clearOverlays();

document.getElementById("sidebarwrapper").innerHTML = '<div id="letterbar"><ul><li><A title="A" onclick="find(\'A\'); return false;" href="http://www.travelmapia.com/sitemap.html">A</A></li><li><A title="B" onclick="find(\'B\'); return false;" href="http://www.travelmapia.com/sitemap.html">B</A></li><li><A title="C" onclick="find(\'C\'); return false;" href="http://www.travelmapia.com/sitemap.html">C</A><li><A title="D" onclick="find(\'D\'); return false;" href="http://www.travelmapia.com/sitemap.html">D</A></li></li><li><A title="E" onclick="find(\'E\'); return false;" href="http://www.travelmapia.com/sitemap.html">E</A></li><li><A title="F" onclick="find(\'F\'); return false;" href="http://www.travelmapia.com/sitemap.html">F</A></li><li><A title="G" onclick="find(\'G\'); return false;" href="http://www.travelmapia.com/sitemap.html">G</A></li><li><A title="H" onclick="find(\'H\'); return false;" href="http://www.travelmapia.com/sitemap.html">H</A></li><li><A title="I" onclick="find(\'I\'); return false;" href="http://www.travelmapia.com/sitemap.html">I</A></li><li><A title="J" onclick="find(\'J\'); return false;" href="http://www.travelmapia.com/sitemap.html">J</A></li><li><A title="K" onclick="find(\'K\'); return false;" href="http://www.travelmapia.com/sitemap.html">K</A></li><li><A title="L" onclick="find(\'L\'); return false;" href="http://www.travelmapia.com/sitemap.html">L</A></li><li><A title="M" onclick="find(\'M\'); return false;" href="http://www.travelmapia.com/sitemap.html">M</A></li><li><A title="N" onclick="find(\'N\'); return false;" href="http://www.travelmapia.com/sitemap.html">N</A></li><li><A title="O" onclick="find(\'O\'); return false;" href="http://www.travelmapia.com/sitemap.html">O</A></li><li><A title="P" onclick="find(\'P\'); return false;" href="http://www.travelmapia.com/sitemap.html">P</A></li><li><A title="Q" onclick="find(\'Q\'); return false;" href="http://www.travelmapia.com/sitemap.html">Q</A></li><li><A title="R" onclick="find(\'R\'); return false;" href="http://www.travelmapia.com/sitemap.html">R</A></li><li><A title="S" onclick="find(\'S\'); return false;" href="http://www.travelmapia.com/sitemap.html">S</A></li><li><A title="T" onclick="find(\'T\'); return false;" href="http://www.travelmapia.com/sitemap.html">T</A></li><li><A title="U" onclick="find(\'U\'); return false;" href="http://www.travelmapia.com/sitemap.html">U</A></li><li><A title="V" onclick="find(\'V\'); return false;" href="http://www.travelmapia.com/sitemap.html">V</A></li><li><A title="W" onclick="find(\'W\'); return false;" href="http://www.travelmapia.com/sitemap.html">W</A></li><li><A title="X" onclick="find(\'X\'); return false;" href="http://www.travelmapia.com/sitemap.html">X</A></li><li><A title="Y" onclick="find(\'Y\'); return false;" href="http://www.travelmapia.com/sitemap.html">Y</A></li><li><A title="Z" onclick="find(\'Z\'); return false;" href="http://www.travelmapia.com/sitemap.html">Z</A></li></ul></div><!--END LETTERBAR--><div id="sidebarcontainer"><div id="side_bartop"> <a href="">' + chosencountry +' Attractions</a></div><div id="side_bar"></div><!-- END side_bar--></div>';

loadxmlfile("english/" + chosencountry + "_attractions.xml");


}



function clearmapobjects(){


  
  
document.getElementById("sidebarwrapper").innerHTML = '<div id="letterbar"><ul><li><A title="A" onclick="find(\'A\'); return false;" href="http://www.travelmapia.com/sitemap.html">A</A></li><li><A title="B" onclick="find(\'B\'); return false;" href="http://www.travelmapia.com/sitemap.html">B</A></li><li><A title="C" onclick="find(\'C\'); return false;" href="http://www.travelmapia.com/sitemap.html">C</A><li><A title="D" onclick="find(\'D\'); return false;" href="http://www.travelmapia.com/sitemap.html">D</A></li></li><li><A title="E" onclick="find(\'E\'); return false;" href="http://www.travelmapia.com/sitemap.html">E</A></li><li><A title="F" onclick="find(\'F\'); return false;" href="http://www.travelmapia.com/sitemap.html">F</A></li><li><A title="G" onclick="find(\'G\'); return false;" href="http://www.travelmapia.com/sitemap.html">G</A></li><li><A title="H" onclick="find(\'H\'); return false;" href="http://www.travelmapia.com/sitemap.html">H</A></li><li><A title="I" onclick="find(\'I\'); return false;" href="http://www.travelmapia.com/sitemap.html">I</A></li><li><A title="J" onclick="find(\'J\'); return false;" href="http://www.travelmapia.com/sitemap.html">J</A></li><li><A title="K" onclick="find(\'K\'); return false;" href="http://www.travelmapia.com/sitemap.html">K</A></li><li><A title="L" onclick="find(\'L\'); return false;" href="http://www.travelmapia.com/sitemap.html">L</A></li><li><A title="M" onclick="find(\'M\'); return false;" href="http://www.travelmapia.com/sitemap.html">M</A></li><li><A title="N" onclick="find(\'N\'); return false;" href="http://www.travelmapia.com/sitemap.html">N</A></li><li><A title="O" onclick="find(\'O\'); return false;" href="http://www.travelmapia.com/sitemap.html">O</A></li><li><A title="P" onclick="find(\'P\'); return false;" href="http://www.travelmapia.com/sitemap.html">P</A></li><li><A title="Q" onclick="find(\'Q\'); return false;" href="http://www.travelmapia.com/sitemap.html">Q</A></li><li><A title="R" onclick="find(\'R\'); return false;" href="http://www.travelmapia.com/sitemap.html">R</A></li><li><A title="S" onclick="find(\'S\'); return false;" href="http://www.travelmapia.com/sitemap.html">S</A></li><li><A title="T" onclick="find(\'T\'); return false;" href="http://www.travelmapia.com/sitemap.html">T</A></li><li><A title="U" onclick="find(\'U\'); return false;" href="http://www.travelmapia.com/sitemap.html">U</A></li><li><A title="V" onclick="find(\'V\'); return false;" href="http://www.travelmapia.com/sitemap.html">V</A></li><li><A title="W" onclick="find(\'W\'); return false;" href="http://www.travelmapia.com/sitemap.html">W</A></li><li><A title="X" onclick="find(\'X\'); return false;" href="http://www.travelmapia.com/sitemap.html">X</A></li><li><A title="Y" onclick="find(\'Y\'); return false;" href="http://www.travelmapia.com/sitemap.html">Y</A></li><li><A title="Z" onclick="find(\'Z\'); return false;" href="http://www.travelmapia.com/sitemap.html">Z</A></li></ul></div><!--END LETTERBAR--><div id="sidebarcontainer"><div id="side_bartop"> <a href="">' + chosencountry +' Attractions</a></div><div id="side_bar"></div><!-- END side_bar--></div>';


map.clearOverlays();

loadxmlfile("english/" + chosencountry + "_attractions.xml");

}



function load_sqlajax(){

  document.getElementById("sidebarwrapper").innerHTML = '<div id="letterbar"><ul><li><A title="A" onclick="find(\'A\'); return false;" href="http://www.travelmapia.com/sitemap.html">A</A></li><li><A title="B" onclick="find(\'B\'); return false;" href="http://www.travelmapia.com/sitemap.html">B</A></li><li><A title="C" onclick="find(\'C\'); return false;" href="http://www.travelmapia.com/sitemap.html">C</A><li><A title="D" onclick="find(\'D\'); return false;" href="http://www.travelmapia.com/sitemap.html">D</A></li></li><li><A title="E" onclick="find(\'E\'); return false;" href="http://www.travelmapia.com/sitemap.html">E</A></li><li><A title="F" onclick="find(\'F\'); return false;" href="http://www.travelmapia.com/sitemap.html">F</A></li><li><A title="G" onclick="find(\'G\'); return false;" href="http://www.travelmapia.com/sitemap.html">G</A></li><li><A title="H" onclick="find(\'H\'); return false;" href="http://www.travelmapia.com/sitemap.html">H</A></li><li><A title="I" onclick="find(\'I\'); return false;" href="http://www.travelmapia.com/sitemap.html">I</A></li><li><A title="J" onclick="find(\'J\'); return false;" href="http://www.travelmapia.com/sitemap.html">J</A></li><li><A title="K" onclick="find(\'K\'); return false;" href="http://www.travelmapia.com/sitemap.html">K</A></li><li><A title="L" onclick="find(\'L\'); return false;" href="http://www.travelmapia.com/sitemap.html">L</A></li><li><A title="M" onclick="find(\'M\'); return false;" href="http://www.travelmapia.com/sitemap.html">M</A></li><li><A title="N" onclick="find(\'N\'); return false;" href="http://www.travelmapia.com/sitemap.html">N</A></li><li><A title="O" onclick="find(\'O\'); return false;" href="http://www.travelmapia.com/sitemap.html">O</A></li><li><A title="P" onclick="find(\'P\'); return false;" href="http://www.travelmapia.com/sitemap.html">P</A></li><li><A title="Q" onclick="find(\'Q\'); return false;" href="http://www.travelmapia.com/sitemap.html">Q</A></li><li><A title="R" onclick="find(\'R\'); return false;" href="http://www.travelmapia.com/sitemap.html">R</A></li><li><A title="S" onclick="find(\'S\'); return false;" href="http://www.travelmapia.com/sitemap.html">S</A></li><li><A title="T" onclick="find(\'T\'); return false;" href="http://www.travelmapia.com/sitemap.html">T</A></li><li><A title="U" onclick="find(\'U\'); return false;" href="http://www.travelmapia.com/sitemap.html">U</A></li><li><A title="V" onclick="find(\'V\'); return false;" href="http://www.travelmapia.com/sitemap.html">V</A></li><li><A title="W" onclick="find(\'W\'); return false;" href="http://www.travelmapia.com/sitemap.html">W</A></li><li><A title="X" onclick="find(\'X\'); return false;" href="http://www.travelmapia.com/sitemap.html">X</A></li><li><A title="Y" onclick="find(\'Y\'); return false;" href="http://www.travelmapia.com/sitemap.html">Y</A></li><li><A title="Z" onclick="find(\'Z\'); return false;" href="http://www.travelmapia.com/sitemap.html">Z</A></li></ul></div><!--END LETTERBAR--><div id="sidebarcontainer"><div id="side_bartop"> <a href="http://www.travelmapia.com/belize/attractions/index.html">Attractions</a></div><div id="side_bar"></div><!-- END side_bar--></div>';
  
  map.clearOverlays();//Clear markers
  clearpreviousxml();//Clear Side Bar then populate. 
  GDownloadUrl("php/phpsqlajax.php"+"?&dummy="+Math.random(), function(data) {
  var xml = GXml.parse(data);
  var markers = xml.documentElement.getElementsByTagName("marker");
  for (var i = 0; i < markers.length; i++) {
    
   
    var categoryx = markers[i].getAttribute("category");
    var placename = markers[i].getAttribute("placename");
    var addressx = markers[i].getAttribute("address");
    var phonex = markers[i].getAttribute("phone");
    var image = markers[i].getAttribute("image"); 
    var video = markers[i].getAttribute("video");
    var username = markers[i].getAttribute("username");
    var userlevel = markers[i].getAttribute("userlevel");
    var html = markers[i].getAttribute("html");
    var lat = markers[i].getAttribute("lat");
    var lng = markers[i].getAttribute("lng");
    
    var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("lng")));

    var iconObj = new GIcon();
    iconObj.image = markers[i].getAttribute("icon");
    iconObj.iconSize = new GSize(23,33);
    iconObj.iconAnchor = new GPoint(5,33);
    iconObj.infoWindowAnchor = new GPoint(9, 2);             
    
    var htmlx;
       

    //Assume Guests
    if(theadmin == undefined || theadmin == ""){

     htmlx = '<div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="images/' + categoryx + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr><tr><td style="background-color:#ddd" align=center>Address:</td></tr><tr><td style="background-color:#eee" align=center>'+addressx+'</td></tr><tr><td style="background-color:#ddd" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center>Category:</td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center>Submitted By:</td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></div>';       
      
     }                       
    else if(theadmin == "admin" ){ //*******Needs to be session user fix!************
    //alert("Super Admin - Can Edit Everything");

     htmlx = '<div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;<a href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="images/icons/weblink.gif"> Edit</a></div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="images/' + categoryx + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr><tr><td style="background-color:#ddd" align=center>Address:</td></tr><tr><td style="background-color:#eee" align=center>'+addressx+'</td></tr><tr><td style="background-color:#ddd" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center>Category:</td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center>Submitted By:</td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></div>';        

    }  
    else if(theadmin == username ){ //Need to Match Country Admin - Country == Admin Country IsCOuntry Admin in XML file. 3phase
    
    //alert("Registered User - Only Edit his/her posts");

     htmlx = '<div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;<a href="javascript:editsubmission(' + lat + ',' + lng + ')"><IMG border=0 alt="Edit details." src="images/icons/weblink.gif"> Edit</a></div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="images/' + categoryx + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr><tr><td style="background-color:#ccc" align=center>Address:</td></tr><tr><td style="background-color:#eee" align=center>'+addressx+'</td></tr><tr><td style="background-color:#ddd" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center>Category:</td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center>Submitted By:</td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></div>';        
    
    }  
    
    else{
      //  alert("Cannot edit ");

      htmlx = '<div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + i + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="images/' + categoryx + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr><tr><td style="background-color:#ddd" align=center>Address:</td></tr><tr><td style="background-color:#eee">'+addressx+'</td></tr><tr><td style="background-color:#ddd" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center>Category:</td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#ddd" align=center>Submitted By:</td></tr><tr><td style="background-color:#eee" align=center>'+username+'</td></tr></table></div>';       

    }

  
    var marker = createMarkerx(lat,lng,point,placename,image,htmlx,iconObj,video);
    map.addOverlay(marker);
  }
  
   document.getElementById("side_bar").innerHTML = side_bar_html;// put the assembled side_bar_html contents into the side_bar div   
 
});




}


function createMarkerx(lat,lng,zoom,point,countrycode,placename,categoryx,image,html,iconObj,video) 
{
   
  
  
   var youtubevideoformat = '<table border=0 cellPadding=0><tr><td align="left" ><div><object width="380" height="300"><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="380" height="300"></embed></object></div></td><td vAlign="Top" width="0"></td></table>'
   
  
   countrycode=countrycode.toLowerCase();
  
   categoryx=categoryx.toLowerCase();
  
    
   var marker = new GMarker(point,iconObj); 
   marker.tooltip = '<div class="tooltip"><img style="border:3px #ffc61d solid;" src="http://www.travelmapia.com/images/' + countrycode + '/' + categoryx + '/' +image+ '" width="50" height="50"><br><div id="tooltiptext">' +placename+'</div></div>';
   GEvent.addListener(marker, "click", function() 
   {
    document.getElementById("mapwindow").innerHTML =  '';
    document.getElementById("adminwindow").innerHTML =  '';

    marker.openInfoWindowTabsHtml([new GInfoWindowTab("Overview",html), new GInfoWindowTab("Video",youtubevideoformat)],{suppressMapPan:false});
	   
	 map.savePosition();
	 
	 
	 
	 

     }
	);
             
      GEvent.addListener(map, "infowindowclose", function(){map.returnToSavedPosition()}); 
       // save the info we need to use later for the side_bar
       
 
       jlabels[i] = placename;
       gmarkers[i] = marker;
	   htmls[i] = html;
	   youtubevideos[i] = youtubevideoformat;
	   
	  if (video == "No Video Code")

      {  
     
      side_bar_html += '<a href="javascript:myclick(' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + placename + '</a><br>';
	  }
	  else
	  {   side_bar_html += '<a href="javascript:myclick(' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + placename + " " + '<img width=32 height=13 border=0 valign=center src="http://www.travelmapia.com/images/youtube.gif"></img></a><br>';
	  }
	

      i++;
      //  ======  The new marker "mouseover" and "mouseout" listeners  ======
      GEvent.addListener(marker,"mouseover", function() {showTooltip(marker);});        
      GEvent.addListener(marker,"mouseout", function() {tooltip.style.visibility="hidden"});  
      return marker;
       
}


function isadmin(adminname)
{
//alert(adminname);
theadmin = adminname;
return theadmin;

}

function clearadmin()
{

 theadmin = "";


}


function editsubmission(latx,lngx){
    
   
  closeIW();
  
  map.clearOverlays();

  GDownloadUrl("http://www.travelmapia.com/php/phpsqlajax.php"+"?&dummy="+Math.random(), function(data) {
  var xml = GXml.parse(data);
  var markers = xml.documentElement.getElementsByTagName("marker");
  for (var i = 0; i < markers.length; i++) 
  {
    
  var lat = markers[i].getAttribute("lat");
  var lng = markers[i].getAttribute("lng");
    
  
    if(latx == lat){
    
    var placeidx = markers[i].getAttribute("placeid");
    var districtnamex = markers[i].getAttribute("districtname"); 
    var countrycodex = markers[i].getAttribute("countrycode");
    var categoryx = markers[i].getAttribute("category");
    var placename = markers[i].getAttribute("placename");
    var placenametags = markers[i].getAttribute("placenametags");
    var addressx = markers[i].getAttribute("address");
    var phonex = markers[i].getAttribute("phone");
    var image = markers[i].getAttribute("image"); 
    var video = markers[i].getAttribute("video");
    var username = markers[i].getAttribute("username");
    var zoom = markers[i].getAttribute("zoomlevel");
    var userlevel = markers[i].getAttribute("userlevel");
    var html = markers[i].getAttribute("html");
    var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("lng")));               
    var iconObj = new GIcon();
    iconObj.image = markers[i].getAttribute("icon");
    iconObj.iconSize = new GSize(23,33);
    iconObj.iconAnchor = new GPoint(5,33);
    iconObj.infoWindowAnchor = new GPoint(9, 2);             
    
    var htmlx;
     
    if (language=='english')
    {
        submitfile = 'http://www.travelmapia.com/php/editplaceform.php'
        submitfilex = 'http://www.travelmapia.com/upload/imageupload.html'
         submiticon = 'http://www.travelmapia.com/upload/iconupload.html'
    }
    else if(language=='espanol'){
    submitfile = 'http://www.travelmapia.com/upload/indexesp.php'
    }
     
    document.getElementById("sidebarwrapper").innerHTML = '<div id="submitform"><div id="submitformheader"><table margin=0><tr><td><div style="float:left" id="subcategoriestexthtml"></div></td></tr><tr><td align="left"><span class="submitformwhitetext">Country Code&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;Select State or District:</span></td></tr><tr><td><div style="width:auto"><div style="padding-left:5px; float:left; width:45px"><input id="country_codebx" style="width:30px" font-family: Helvetica,Verdana, Arial, sans-serif;font-size:12px" type="text" size="2" onkeypress="return imposeMaxLength(this, 2);" name="country_codebx" maxlength="2" value=""></div><div style="float:left;padding-right:10px; padding-top:4px; width:auto" id="countryflag"></div><div style="padding-left:3px;float:left" id="districtstexthtml"></div></div></td></tr></table></div><div id="submitformimageform"><IFRAME id="imageframe" name="imageframe" SRC="' + submitfilex + '" WIDTH=100% HEIGHT=72px FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 ALLOWTRANSPARENCY="false" scrolling="no"></IFRAME></div><div id="submiticonform"><IFRAME name="icon_frame" SRC="' + submiticon + '" WIDTH=100% HEIGHT=57 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 ALLOWTRANSPARENCY="false" scrolling="no"></IFRAME></div><div id="submitformdata"><IFRAME name="infoframe" SRC="' + submitfile + '" WIDTH=100% HEIGHT=425px ALLOWTRANSPARENCY="false" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 scrolling="no"></IFRAME></div></div>';

    var marker = createEditMarkerx(lat,lng,zoom,point, placeidx, districtnamex, countrycodex, placename,placenametags,categoryx,addressx,phonex,image,html,iconObj,video);
    map.addOverlay(marker);  
    
    }//CLOSE IF
  
  }//CLOSE FOR
});//CLOSE FUNCTION



}



function geteditcategory(){

return editcategory;

}

function geteditlat(){

return editlat;

}

function geteditlng(){

return editlng;

}


function geteditplacename(){

return editplacename;

}


function geteditplaceid(){



return editplaceid;

}


function geteditplacenametags(){

return editplacenametags;

}


function geteditaddress(){

return editaddress;

}


function geteditphone(){

return editphone;

}

function getedithtml(){

return edithtml;

}

function geteditvideo(){

return editvideo;

}

function geteditdistrict(){

return editdistrict;

}



function createEditMarkerx(lat,lng,zoom,point,placeidx, districtnamex, countrycodex, placename,placenametags,categoryx,addressx,phonex,image,html,iconObj,video) 
{
   editplaceid = placeidx;
   editcountrycode = countrycodex;
   editcategory = categoryx;
   editlat = lat;
   editlng = lng;
   editplacename = placename;
   editplacenametags = placenametags;
   editaddress = addressx;
   edithtml = html;
   editphone = phonex;
   editdistrict = districtnamex;
   zoomlevelx = zoom;
   
   
   if(video=="No Video Code"){ 
   editvideo = "";
   }
   else{
   editvideo = '<object width="380" height="300"><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="380" height="300"></embed></object>';
   }

   editimage = image;
   parent.document.getElementById("country_codebx").value = editcountrycode;
 
    var thepoint = parent.showAddress(point);//Initializing Country Code
   
  countrycodex = countrycodex.toLowerCase();
  categoryx = categoryx.toLowerCase();
    
   // var thecountryx = parent.marker(); 
    
  var htmlx = '<div style="font-size:14px; font-weight: bolder; color:#996633">' + placename + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<a valign=middle href="javascript:setZM(' + zoomlevelx + ',' + lat + ',' + lng + ')"><IMG alt="Zoom Into Map" src="images/icons/zoomin.gif" border=0> Zoom In</a>&nbsp;&nbsp;&nbsp;</div><table border=0 cellPadding=1><tr><td><div style="width:125px; height:100px;border:thin solid; border-width:2px;border-color: #CC9E47"><img src="http://www.travelmapia.com/images/' + countrycodex + '/' + categoryx + '/' + image + '" align="left" width=125 height=100></div></td><td width="340" valign=top><div style="font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr><tr><td style="background-color:#ddd" align=center>Address:</td></tr><tr><td style="background-color:#eee" align=center>'+addressx+'</td></tr><tr><td style="background-color:#eee" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center>'+phonex+'</td></tr><tr><td style="background-color:#ddd" align=center >Category:</td></tr><tr><td style="background-color:#eee" align=center>'+categoryx+'</td></tr><tr><td style="background-color:#eee" align=center>Submitted By:</td></tr></table></div>';       
    
    
  // var jscriptadsvideo = 'adbritevideozone.html'
  var youtubevideoformat = '<table border=0 cellPadding=0><tr><td align="left" ><div><object width="380" height="300"><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="380" height="300"></embed></object></div></td><td vAlign="Top" width="0"></td></table>'
  //<IFRAME SRC='+jscriptads+' WIDTH=469 HEIGHT=115 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1></IFRAME>'
   
   editmarker = new GMarker(point,iconObj); 
   // === store the name so that the tooltip function can use it ===
 
 
   editmarker.tooltip = '<div class="tooltip"><img style="border:3px #ffc61d solid;" src="http://www.travelmapia.com/images/' + countrycodex + '/' + categoryx + '/' +image+ '" width="50" height="50"><br><div id="tooltiptext">'+placename+'</div></div>';
   GEvent.addListener(editmarker, "click", function() 
   {
    document.getElementById("mapwindow").innerHTML =  '';
    document.getElementById("adminwindow").innerHTML =  '';

    editmarker.openInfoWindowTabsHtml([new GInfoWindowTab("Overview",htmlx), new GInfoWindowTab("Video",youtubevideoformat)],{suppressMapPan:false});
	   
	 map.savePosition();
   }
	);
	
             
      GEvent.addListener(map, "infowindowclose", function(){map.returnToSavedPosition()}); 
       // save the info we need to use later for the side_bar
       
       jlabels[i] = placename;
       gmarkers[i] = editmarker;
	   htmls[i] = html;
	   youtubevideos[i] = youtubevideoformat;
	   
	  if (video =="")
      {   side_bar_html += '<a href="javascript:myclick(' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + placename + '</a><br>';
	  }
	  else
	  {   side_bar_html += '<a href="javascript:myclick(' + i + ',' + lat + ',' + lng + ')" onmouseover="mymouseover('+i+')" onmouseout="mymouseout()">' + placename + " " + '<img border=0 valign=center src="http://www.travelmapia.com/images/youtube.gif"></img></a><br>';
	  }
	

      i++;
      //  ======  The new marker "mouseover" and "mouseout" listeners  ======
      GEvent.addListener(editmarker,"mouseover", function() {showTooltip(editmarker);});        
      GEvent.addListener(editmarker,"mouseout", function() {tooltip.style.visibility="hidden"});  
      return editmarker;
       
}


function getcountry(){


return thecountrycode;


}

function satellitetype(){

map.setMapType(G_SATELLITE_MAP); 


}

function threedtype(){

map.setMapType(G_SATELLITE_3D_MAP); 


}

function normalmaptype(){

map.setMapType(G_NORMAL_MAP); 


}

function hybridtype(){

map.setMapType(G_HYBRID_MAP); 


}


function physicaltype(){

map.setMapType(G_PHYSICAL_MAP); 


}


function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length < MaxLen);
}


function countrydistrictview(thedistrict){
var districtxmlfile;


//alert(chosencountry);

if(chosencountry == "" | chosencountry == undefined ){


//alert("Country:" +thecountry);

 chosencountry = thecountry;

 districtxmlfile = chosencountry+"_districts_view.xml";


}

else{


 //alert("ELSE" + chosencountry);

if(countrydistricts == "" | countrydistricts == undefined){
districtxmlfile = chosencountry+"_districts_view.xml";


}

else{
 districtxmlfile = countrydistricts+"_districts_view.xml";

}


}


thedistrict = thedistrict.toLowerCase();
thedistrict = thedistrict.replace(/\s/g, "");

thedistrict=new String(thedistrict);


//alert(districtxmlfile);

var districtstring="";
var districtarray=[];
var districthtmlcode="";
var request = GXmlHttp.create();


if(language=='english'){
request.open("GET", "http://www.travelmapia.com/files/" + "english/" + districtxmlfile, true);   
}else if(language=='espanol'){
request.open("GET", "http://www.travelmapia.com/files/" + "espanol/" + "icons.xml", true);   
}
 
 

request.onreadystatechange = function() 

 {



   if (request.readyState==4) 
   {      //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
           
          for (var i = 0; i < markers.length; i++) 
          {  // obtain the attribues of each marker
            districtstring = markers[i].getAttribute("district");
            var zoom = parseInt(markers[i].getAttribute("zoomlevel"));
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            districtstring = districtstring.toLowerCase();
            districtstring = districtstring.replace(/\s/g, "");
          
            var RegularExpression  =  new RegExp(thedistrict); 
            
            var found = districtstring.search(RegularExpression)
          
          
          
          
          
          if (found!=-1){
          
          
          if(thedistrict=="worldview"){
          
          
            setZM(zoom,lat,lng);
          
          loadcountryxmlfile("english/countries.xml");
          
         resetcountry("english/continents.xml")          
          return;
          }
          
          else{
          
          setZM(zoom,lat,lng);
          
          return;
          
          }
          
          
          
          
          
          }
          
          
          

           
                    
           
           
         }
               
   
    }
                     
 }

   
request.send(null); 


}



function resetcountry(countrydistricts){

var countrystring="";
var countryarray=[];
var countryhtmlcode="";
var request = GXmlHttp.create();

var districtxmlfile = countrydistricts;

//alert(districtxmlfile);
 
if(language=='english'){
request.open("GET", "http://www.travelmapia.com/files/" + districtxmlfile, true);   
}else if(language=='espanol'){
request.open("GET", "http://www.travelmapia.com/files/" + "espanol/" + "icons.xml", true);   
}
 
request.onreadystatechange = function() 
 {
   
   if(request.readyState==1){
    
   document.getElementById("countrynav").innerHTML = '<img align="center" src=http://www.travelmapia.com/images/loadingview.gif></img>';

   }
   
   else if (request.readyState==4) 
   {      //Removed for IE documentElement error.
          //var xmlDoc = request.responseXML;
          var xmlDoc = GXml.parse(request.responseText); 
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
           
          for (var i = 0; i < markers.length; i++) 
          {  // obtain the attribues of each marker
            countrystring = markers[i].getAttribute("label");
            var zoom = parseInt(markers[i].getAttribute("zoom"));
                     
            countryarray[i]=countrystring;
       
            countryhtmlcode += '<option value="' + countryarray[i] + '">' + countryarray[i] + '</option>';
                     
          }
          
            countryhtmltext = '<img valign=bottom align=left src="http://www.travelmapia.com/selectview.gif"></img><FORM style="margin:0" name="continentselectform"><select style="font-family: Helvetica,Verdana, Arial, sans-serif;font-size:10px;text-align:left" name="thecontinent" id="thecontinent" onChange="continentview(document.continentselectform.thecontinent.options[document.continentselectform.thecontinent.selectedIndex].value);" >'+ countryhtmlcode +'</select></form>';
            document.getElementById("countrynav").innerHTML = countryhtmltext;
          
      
    
    }
                     
 }

   
request.send(null); 
//return subcategorytexthtml;
}







