
var submitmarkerx;
var point;
var homemarker;
var submittedpointx;
var submittedpointy;
var submitplace;
var closeinfowin;
var zoomlevelx="";
var latpoint;
var longpoint;
var youtubevideopreview = "";
var htmlpreview = "";
//var thecountrycode = "";
var ccode = "";
var categorysubmitted="";
var subcategorytexthtml="";
var subcategoryhtml;

var defaultsubcategory="";
var thedistrictx="";


var selectedsubcategory="";

var selecteddistrict="";


function translateeng() {
   //Top Nav
   document.getElementById("legendbutton").innerHTML = '<A title="See Legend" onclick="showlegend(); return false;" href="#">Legend</A>'; 
   document.getElementById("videobutton").innerHTML = '<A title="See Videos" onclick="loadxmlfile(\'english/videos.xml\'); return false;" href="#">Videos</A>'; 
   document.getElementById("picturebutton").innerHTML = '<A title="See Pictures" onclick="loadxmlfile(\'english/pictures.xml\'); return false;" href="#">Pictures</A>'; 
   document.getElementById("attractionsbutton").innerHTML = '<A title="See Attractions" onclick="loadxmlfile(\'english/attractions.xml\'); return false;" href="#">Attractions</A>'; 
   document.getElementById("hotelbutton").innerHTML = '<A title="See Hotels" onclick="loadxmlfile(\'english/hotels.xml\'); return false;" href="#">Hotels</A>'; 
   document.getElementById("restaurantbutton").innerHTML = '<A title="See Restaurants" onclick="loadxmlfile(\'english/restaurants.xml\'); return false;" href="#">Restaurants</A>'; 
   document.getElementById("realestatebutton").innerHTML = '<A title="See Real Estate" onclick="loadxmlfile(\'english/realestate.xml\'); return false;" href="#">Real Estate</A>'; 
   document.getElementById("viewmorebutton").innerHTML = '<A title="See Real Estate" onclick="showlegend(); return false;" href="#">View More</A>'; 
   document.getElementById("contactbutton").innerHTML = '<A title="Contact Us" onclick="opencontactusfile(); return false;" href="#">Contact</A>'; 
   document.getElementById("submitbutton").innerHTML = '<A title="Submit a Place" onclick="submit(); return false;" href="#">Submit Place</A>'; 
   //Bottom Nav
   document.getElementById("aboutus").innerHTML = '<A href="#" onclick="aboutusclick(); return false;">About</A> | '; 
   document.getElementById("privacy").innerHTML = '<A href="#" onclick="privacyclick(); return false;">Privacy</A> | '; 
   document.getElementById("termsofuse").innerHTML = '<A href="#" onclick="termsofuseclick(); return false;">Terms of Use</A> | '; 
   document.getElementById("advertise").innerHTML = '<A href="#" onclick="advertiseclick(); return false;">Advertise Here</A> | '; 
   document.getElementById("contactus").innerHTML = '<A href="#" onclick="opencontactusfile(); return false;">Contact Us</A> | '; 
   document.getElementById("sitemap").innerHTML = '<A href="sitemap.html">Sitemap</A> | '; 
   loadxmlfile('english/' + xmlfilename);
}

function translate(filename) {

    // language ='espanol';
    if (filename=='attractions')
    {translatedfilename = 'atracciones';
    }
    else if (filename=='hotels')
    {
    translatedfilename = 'hoteles';
    
    }else if (filename=='restaurants'){
    
    translatedfilename = 'restaurantes';
    
    }else if (filename=='realestate'){
    
    translatedfilename = 'bienesraices';
    
    }else if (filename=='pictures'){
    
    translatedfilename = 'fotos';
    
    }else if (filename=='videos'){
    
    translatedfilename = 'videos';
    
    }
         return translatedfilename;
   
}

function translateesp(){
 
 
  document.getElementById("attractionsli").innerHTML = '<A rel="attractions" title="Haga Clic para ver las attraciones en la Mapa de Belice." onclick="loadxmlfile(\'espanol/attractions.xml\'); return false;" href="#">Attraciones <img border="0" src="images/downarrow.gif" width="10" height="10"></A>'; 
  document.getElementById("viewallattractions").innerHTML ='<A href="http://www.travelmapia.com/belize/attractions.html" title="Ver attraciones en la Mapa de Belice." onclick="loadxmlfile(\'espanol/attractions.xml\'); return false;" >Ver Todas</A>';
  document.getElementById("artshops").innerHTML ='<A href="http://www.travelmapia.com/belize/attractions.html" title="Ver attraciones en la Mapa de Belice." onclick="loadxmlfile(\'espanol/attractions.xml\'); return false;" >Tiendas de Arte</A>';


 cssdropdown.startchrome("chromemenu");

   //document.getElementById("lodgingli").innerHTML = '<A rel="lodging" title="Haga Clic para ver hoteles y lugares para quedar en la Mapa de Belice." onclick="loadxmlfile(\'espanol/hotels.xml\'); return false;" href="#">Alojamiento <img border="0" src="images/downarrow.gif" width="10" height="10"></A>'; 
   //document.getElementById("restaurantsli").innerHTML = '<A rel="restaurants" title="Haga Clic para ver las locaciones de varios restaurantes en esta Mapa de Belice." onclick="loadxmlfile(\'espanol/restaurants.xml\'); return false;" href="#">Restaurantes <img border="0" src="images/downarrow.gif" width="10" height="10"></A>';
   //document.getElementById("realestateli").innerHTML = '<A rel="realestate" title="haga Clic para ver buenas raices el esta Mapa de Belice." onclick="loadxmlfile(\'espanol/realestate.xml\'); return false;" href="#">Buenas Raices <img border="0" src="images/downarrow.gif" width="10" height="10"></A>';

   //Bottom Nav
   //document.getElementById("aboutus").innerHTML = '<A href="#" onclick="aboutusclick(); return false;">Acerca de</A> | '; 
   //document.getElementById("privacy").innerHTML = '<A href="#" onclick="privacyclick(); return false;">Intimidad</A> | '; 
   //document.getElementById("termsofuse").innerHTML = '<A href="#" onclick="termsofuseclick(); return false;">Los terminos del Uso</A> | '; 
   //document.getElementById("advertise").innerHTML = '<A href="#" onclick="advertiseclick(); return false;">Anuncie Aqui</A> | '; 
   //document.getElementById("contactus").innerHTML = '<A href="#" onclick="opencontactusfile(); return false;">Contacte Eeuu</A> | '; 
   //document.getElementById("sitemap").innerHTML = '<A href="sitemap.html">Sitemap</A> | '; 
   
   loadxmlfile('espanol/' + xmlfilename);
   
   }
         



function aboutusclick(){

var regfile ='http://www.travelmapia.com/php/register.php';
var abouthtmleng ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"> Travelmapia.com is an Interactive Map of the World. Explore Attractions, Businesses, Hotels, Restaurants and Resorts using an interactive google maps api based mashup. <br><br>This site is updated and maintained regularly to provide easy and timely access to information about hotels, restaurants, entertainment and local business services.<br><br> Using todays breakthorugh technology and Internet Marketing expertise, we bring you a place where your business can be seen in a real world view like never before.  Register Now! and Submit your Business Location for Free.<br><br> Email: corozal@travelmapia.com<br><br><a class="whitetext" href="#" onclick="opencontactusfile(); return false;"> Contact Us</a></div><div id="infowindowbottom"></div>'
var abouthtmlesp ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"> travelmapia.com es la guia del internet mas mejor para los turistas que quieren vistar Belice, Centro America. <br><br>Este sitio es mantenido regular mente para tener accesso sobre infromacion de restaurantes entretenimiento y servicios locales sobre el paise de Belice.<br><br> Usando la nueva technologia podemos traer les un puseto adonde puedes anunciar tu negocio como nunca antes visto.<br><br> Correo: corozal@corozalmapia.com<br><br><a class="closebutton" href="#" onclick="opencontactusfile(); return false;"> Contacto</a></div><div id="infowindowbottom"></div>'

var w=document.getElementById("map").offsetWidth/2;
var h=document.getElementById("map").offsetHeight/2;


document.getElementById("mapwindow").innerHTML =  '';
//var cc = map.fromLatLngToDivPixel(map.getCenter()); 
var left = w - 150; 
var right = h - 180; 
 
document.getElementById("mapwindow").style.visibility = "visible";
 
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(left,right)); 
pos.apply(document.getElementById("mapwindow")); 
document.getElementById("map").appendChild(document.getElementById("mapwindow"));

if (language=="english"){
document.getElementById("mapwindow").innerHTML =  abouthtmleng;
}
else{
document.getElementById("mapwindow").innerHTML =  abouthtmlesp;
}  

}  



function privacyclick(){

var abouthtmleng ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"> At travelmapia.com we recognize that privacy is important. All information submitted is checked and verified before it makes an appearance on this site. If you have any question or concerns reguarding anything in violation please<a class="whitetext" href="#" onclick="opencontactusfile(); return false;"> Contact Us</a></div><div id="infowindowbottom"></div>'
var abouthtmlesp ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"> En travelmapia.com sabemos que importante es lo privado. <br><br>Toda la información presentada es revisados y verificados antes de que haga una aparicion en este sitio.<br><br> Si tiene alguna pregunta o preocupaciones de algo en violacion por favor<a class="whitetext" href="#" onclick="opencontactusfile(); return false;"> Contacto</a></div><div id="infowindowbottom"></div>'

var w=document.getElementById("map").offsetWidth/2;
var h=document.getElementById("map").offsetHeight/2;


document.getElementById("mapwindow").innerHTML =  '';
//var cc = map.fromLatLngToDivPixel(map.getCenter()); 


var left = w - 150; 
var right = h - 180; 
 
document.getElementById("mapwindow").style.visibility = "visible";
 
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(left,right)); 
pos.apply(document.getElementById("mapwindow")); 
document.getElementById("map").appendChild(document.getElementById("mapwindow"));

if (language=="english"){
document.getElementById("mapwindow").innerHTML =  abouthtmleng;
}
else{
document.getElementById("mapwindow").innerHTML =  abouthtmlesp;
}  

} 


function termsofuseclick(){

var abouthtmleng ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"><strong> Our Terms of use:</strong>You agree that You are responsible for your own conduct and content while using the Service and for any consequences thereof. You agree to use the Service only for purposes that are legal, proper and in accordance with these Terms of Use and any applicable policies or guidelines. By way of example, and not as a limitation, You agree that when using the Service, You will not: defame, abuse, harass, stalk, threaten or otherwise violate the legal rights (such as rights of privacy and publicity) of others; upload, post, email or transmit or otherwise make available any inappropriate, defamatory, infringing, obscene, or unlawful Content; upload, post, email or transmit or otherwise make available any Content that infringes any patent, trademark, copyright, trade secret or other proprietary right of any party, unless You are the owner of the Rights or have the permission of the owner to post such Content; promote or provide instructional information about illegal activities or promote physical harm or injury against any group or individual; or transmit any viruses, worms, defects, Trojan horses, or any items of a destructive nature. If you have any question or concerns reguarding our terms of use please<a class="whitetext" href="#" onclick="opencontactusfile(); return false;"> Contact Us</a></div><div id="infowindowbottom"></div>'
var abouthtmlesp ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"><strong> Nuestras condiciones de uso:</strong>Usted acepta que Usted es responsable de su propia conducta y el contenido a traves del uso del Servicio y de las consecuencias derivadas. Usted se compromete a utilizar el servicio solo para propositos legales, adecuados y de acuerdo con estos terminos de uso y las politicas o directrices. A modo de ejemplo, y no como una limitacion, usted acepta que al utilizar el Servicio, Usted no podra: Difamar, abusar, acosar, acechar, amenazar o de otra forma infringir los derechos legales (como los derechos de privacidad y publicidad) de los demas; Cargar, publicar, enviar por correo electronico o transmitir o difundir de otro modo inapropiado, difamatorio, ilegal, obsceno, o ilegal; Cargar, publicar, enviar por correo electronico o transmitir o de otra forma hacer disponible cualquier Contenido que infrinja patentes, marcas, derechos de autor, secretos comerciales o cualquier otro derecho de propiedad de cualquier parte, a menos que Usted sea el propietario de los derechos o tenga permiso del propietario para publicar dicho Contenido; O transmitir virus, gusanos, defectos y troyanos, asi como otros elementos de naturaleza destructiva. Si tiene alguna pregunta o preocupaciones con nuestras condiciones de uso, por favor<a class="whitetext" href="#" onclick="opencontactusfile(); return false;"> Contacta Nos</a></div><div id="infowindowbottom"></div>'

var w=document.getElementById("map").offsetWidth/2;
var h=document.getElementById("map").offsetHeight/2;


document.getElementById("mapwindow").innerHTML =  '';
//var cc = map.fromLatLngToDivPixel(map.getCenter()); 

var left = w - 150; 
var right = h - 180; 
 
document.getElementById("mapwindow").style.visibility = "visible";
 
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(left,right)); 
pos.apply(document.getElementById("mapwindow")); 
document.getElementById("map").appendChild(document.getElementById("mapwindow"));

if (language=="english"){
document.getElementById("mapwindow").innerHTML =  abouthtmleng;
}
else{
document.getElementById("mapwindow").innerHTML =  abouthtmlesp;
}  

} 


function advertiseclick(){

var abouthtmleng ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"><strong>Advertise with us.</strong> <br>Find out how by<a class="whitetext" href="#" onclick="opencontactusfile(); return false;"> Contacting Us</a></div><div id="infowindowbottom"></div>'
var abouthtmlesp ='<div id="infowindowheader"></div> <div id="closebutton"><span class="whitetext"><a href="#" onclick="parent.closemapwindow();">Close This Window</a></span></div><div id="infowindowcenter"><strong>Anunciese aqui.</strong> <br>Descubra como por<a class="whitetext" href="#" onclick="opencontactusfile(); return false;"> Contactado Nos</a></div><div id="infowindowbottom"></div>'

var w=document.getElementById("map").offsetWidth/2;
var h=document.getElementById("map").offsetHeight/2;


document.getElementById("mapwindow").innerHTML =  '';
var cc = map.fromLatLngToDivPixel(map.getCenter()); 
var left = w - 150; 
var right = h - 180; 
 
document.getElementById("mapwindow").style.visibility = "visible";
 
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(left,right)); 
pos.apply(document.getElementById("mapwindow")); 
document.getElementById("map").appendChild(document.getElementById("mapwindow"));

if (language=="english"){
document.getElementById("mapwindow").innerHTML =  abouthtmleng;
}
else{
document.getElementById("mapwindow").innerHTML =  abouthtmlesp;
}  

} 



//function contactusclick(){ 

//var contactfile = 'contact.html'
//var contactfileesp = 'contacto.html'

//var abouthtmleng ='<IFRAME SRC='+contactfile+' WIDTH=480 HEIGHT=230 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1> </IFRAME>'
//var abouthtmlesp ='<IFRAME SRC='+contactfileesp+' WIDTH=480 HEIGHT=230 FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=1> </IFRAME>'
//var point = new GLatLng(18.39571056792035, -88.39359283447265);

//if (language=="english"){
//var homemarkereng = createHomeMarker(point,abouthtmleng)
//map.addOverlay(homemarkereng);
//map.openInfoWindowHtml(point, abouthtmleng);
//GEvent.addListener(map, "infowindowclose", function(){map.removeOverlay(homemarkereng);});    
//}
//else{
    
//var homemarkeresp = createHomeMarker(point,abouthtmlesp)
//map.addOverlay(homemarkeresp);
//map.openInfoWindowHtml(point, abouthtmlesp);
//GEvent.addListener(map, "infowindowclose", function(){map.removeOverlay(homemarkeresp);});    
//    }   
   
//}





function opencontactusfile(phpfilename){


var w=document.getElementById("map").offsetWidth/2;
var h=document.getElementById("map").offsetHeight/2;



var contactfile = 'contact.html'
var contactfileesp = 'contacto.html'


document.getElementById("mapwindow").innerHTML =  '';

var thephpfile = phpfilename;
//var cc = map.fromLatLngToDivPixel(map.getCenter()); 
var left = w - 150; 
var right = h - 180; 
 
  
document.getElementById("mapwindow").style.visibility = "visible";
 
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(left,right)); 
pos.apply(document.getElementById("mapwindow")); 
document.getElementById("map").appendChild(document.getElementById("mapwindow"));

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + contactfile + '></iframe>';
}  


function getlatitudeMapPoint() { 
  
  //return map.getCenter().toUrlValue(5); 
return submittedpointx;


} 


function getlongtitudeMapPoint() { 
  
  //return map.getCenter().toUrlValue(5); 
return submittedpointy;


} 


function uploadcategory() { 

return categorysubmitted;
  

} 






function submit(submitcategory){ 

var submitfile;
var submiticon;


map.clearOverlays();


categorysubmitted = submitcategory;

//alert(categorysubmitted);

document.getElementById("mapwindow").innerHTML =  '';
document.getElementById("adminwindow").innerHTML =  '';
map.getDragObject().setDraggableCursor('url(http://www.travelmapia.com/fcur2.cur),default');

if (language=='english'){
submitfile = 'http://www.travelmapia.com/php/submitplaceform.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'
}





submitplace = GEvent.addListener(map, "click", function(submitmarkerx, point) {  



zoomlevelx = map.getZoom();

if (zoomlevelx > 8 ){

addlink();




submitmarkerx = createsubmitMarker(point);
map.addOverlay(submitmarkerx);
submitmarkerx.point = point; 
submittedpointx = submitmarkerx.point.y;
submittedpointy = submitmarkerx.point.x;



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" onChange="javascript:setcc();" style="width:30px" font-family: Helvetica,Verdana, Arial, sans-serif;font-size:12px" type="text" size="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" name="districtstexthtml" 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>';

parent.showAddress(point);

//GEvent.addListener(map, "infowindowclose", function(){
//map.removeOverlay(submitmarkerx); map.getDragObject().setDraggableCursor("auto");});


}

else{

alert("Please Select a Country or Zoom In Closer to the Place you are submitting!");

}



}

);             






}



function getzoomlevel(){

//alert(zoomlevelx);
return zoomlevelx;

}

function setcc(){


 var countryc = document.getElementById("country_codebx").value;

 //alert(countryc);
 
 window.frames["infoframe"].document.forms["submitformx"].elements["countrycode"].value = countryc;

 //alert( window.frames["infoframe"].document.forms["submitformx"].elements["countrycode"].value);
 
 
 parent.document.getElementById("countryflag").innerHTML = '<img border="0" height="11" width="16" src="http://www.travelmapia.com/images/flags/' + countryc.toLowerCase() +  '.gif">';
 


 countryc = countryc.toUpperCase(); 


 getdistricts(countryc);
 getsubcategories();

 
}



//function getcountrycode(){
//if(thecountrycode == undefined || thecountrycode == "" ){
// ccode=document.getElementById("country_codebx").value;
//}
//else{
// ccode=thecountrycode.toUpperCase(); ;
//}
//return ccode;
//}


function uploadcountrycode(){


//alert(thecountrycodex);

return thecountrycodex;


}

function getdistricts(thecountrycode){


if(thecountrycode == undefined || thecountrycode == ""){

 ccode=document.getElementById("country_codebx").value;

}
else{

 ccode=thecountrycode;
 

}

ccode = ccode.toLowerCase();

var districtstring="";
var districtarray=[];

var fdistrictstring="";
var fdistrictarray=[];

var districthtmlcode="";
var request = GXmlHttp.create();
var districtxmlfile = ccode + "_districts.xml";



//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==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");
            
            fdistrictstring = districtstring.toLowerCase();
            fdistrictstring = fdistrictstring.replace(/\s/g, "");
            
         
            
            districtarray[i]=districtstring;
            fdistrictarray[i]=fdistrictstring;
            
        
            
            districthtmlcode += '<option value="' + fdistrictarray[i] + '">' + districtarray[i] + '</option>';
          
          }
           
           
             
            districttexthtml = '<FORM style="margin:0" name="districtform"><select style="font-family: Helvetica,Verdana, Arial, sans-serif;font-size:10px;text-align:left" name="thedistrict" id="thedistrict" onChange="uploaddistrict(document.districtform.thedistrict.options[document.districtform.thedistrict.selectedIndex].value);" >'+ districthtmlcode +'</select></form>';
                
               
            parent.document.getElementById("districtstexthtml").innerHTML = districttexthtml;
          
      
    
    }
                     
 }

   
request.send(null); 
//return subcategorytexthtml;
}















function continentview(thecontinent){



var thecontinentxmlfile = "continents.xml";
thecontinent = thecontinent.toLowerCase();
thecontinent = thecontinent.replace(/\s/g, "");

thecontinent=new String(thecontinent);

//alert(thecontinentxmlfile + " " + thecontinent);

var districtstring="";
var districtarray=[];
var districthtmlcode="";
var request = GXmlHttp.create();


if(language=='english'){
request.open("GET", "http://www.travelmapia.com/files/" + "english/" + thecontinentxmlfile, 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("label");
            var zoom = parseInt(markers[i].getAttribute("zoom"));
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            districtstring = districtstring.toLowerCase();
            districtstring = districtstring.replace(/\s/g, "");

     //     alert("Matching:" + thecontinent + "with:" + districtstring);
          
          
          
            var RegularExpression  =  new RegExp(thecontinent); 
            
            var found = districtstring.search(RegularExpression)
          
          
          
          
          
          if (found!=-1){
          
          
          if(thecontinent=="worldview"){
          
          
            setZM(zoom,lat,lng);
          
          loadcountryxmlfile("english/countries.xml");
          
         resetcountry("english/continents.xml")          
          return;
          }
          
          else{
          
          setZM(zoom,lat,lng);
          
          return;
          
          }
          
          
          
          
          
          }
          
          
          

           
                    
           
           
         }
               
   
    }
                     
 }

   
request.send(null); 


}








function getsubcategories(){


var subcategorystring="";
var categoryarray=[];
var categoryhtmlcode="";
var request = GXmlHttp.create();



var cattype = categorysubmitted.toLowerCase();
var stripedcattype = cattype.replace(/\s/g, "");
var cattypexmlfile = stripedcattype + "category.xml";


 
if(language=='english'){
request.open("GET", "http://www.travelmapia.com/files/" + "english/" + cattypexmlfile, 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
            subcategorystring = markers[i].getAttribute("subcategory");
            categoryarray[i]=subcategorystring;
            categoryhtmlcode += '<option value="' + categoryarray[i] + '">' + categoryarray[i] + '</option>';
          
          }
          
         
            subcategorytexthtml = '<FORM style="margin:0" name="categoryselectform"><select style="font-family: Helvetica,Verdana, Arial, sans-serif;font-size:10px;text-align:left" name="subcategory" id="thecategory" onChange="uploadsubcategory(document.categoryselectform.thecategory.options[document.categoryselectform.thecategory.selectedIndex].value);" >'+ categoryhtmlcode +'</select></form>';
                           
            parent.document.getElementById("subcategoriestexthtml").innerHTML = subcategorytexthtml;
          
      
    
    }
                     
 }

   


   
request.send(null); 
//return subcategorytexthtml;
}



function geteditsubcategories(theeditcategory){


var subcategorystring="";
var categoryarray=[];
var categoryhtmlcode="";
var request=GXmlHttp.create();

//alert(theeditcategory);

var editingcat = theeditcategory;



var cattype = editingcat.toLowerCase();
var stripedcattype = cattype.replace(/\s/g, "");
var cattypexmlfile = stripedcattype + "category.xml";


if(language=='english'){
request.open("GET", "http://www.travelmapia.com/files/" + "english/" + cattypexmlfile, 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
            subcategorystring = markers[i].getAttribute("subcategory");
            categoryarray[i]=subcategorystring;
            categoryhtmlcode += '<option value="' + categoryarray[i] + '">' + categoryarray[i] + '</option>';
          }   
            subcategorytexthtml = '<FORM style="margin:0" name="categoryselectform"><select style="font-family: Helvetica,Verdana, Arial, sans-serif;font-size:10px;text-align:left" name="subcategory" id="thecategory" onChange="uploadsubcategory(document.categoryselectform.thecategory.options[document.categoryselectform.thecategory.selectedIndex].value);" >'+ categoryhtmlcode +'</select></form>';                          
            parent.document.getElementById("subcategoriestexthtml").innerHTML = subcategorytexthtml;        
    }                       
 }

request.send(null); 
//return subcategorytexthtml;
}






function uploadsubcategory(thesubcategory){


selectedsubcategory = thesubcategory;

//alert(thesubcategory);

window.frames["infoframe"].document.forms["submitformx"].elements["uploadedsubcategory"].value = thesubcategory;
//ALSO UPLOADING COUNTRY CODE TO THE FORM FOR SUBMISSION

window.frames["infoframe"].document.forms["submitformx"].elements["countrycode"].value = thecountrycode;


return selectedsubcategory;

}








function uploaddistrict(thedistrict){



selecteddistrict = thedistrict;

thedistrict = thedistrict.toLowerCase();
thedistrict = thedistrict.replace(/\s/g, "");

window.frames["infoframe"].document.forms["submitformx"].elements["districtname"].value = thedistrict;

return selecteddistrict;

}







function assignsubcategories(){

var thecategoryx = document.categoryselectform.thecategory.options[document.categoryselectform.thecategory.selectedIndex].value;
alert("AssigningX"+thecategoryx);
return thecategoryx;

}


function resizeFrame(f) {
f.style.height=f.contentWindow.document.body.scrollHeight + "px";
}

function resizeimageframe() {
//f.style.height = f.contentWindow.document.body.scrollHeight + "px";
//var the_height=document.getElementById('imageframe').contentWindow.document.body.scrollHeight;
//document.getElementById('imageframe').contentWindow.document.body.scrollHeight=104;
document.getElementById('imageframe').height=104;

}





function previeweditmarker(htmlpreview,youtubevideopreview){

map.savePosition();
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/' + youtubevideopreview + '&hl=en&fs=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + youtubevideopreview + '&hl=en&fs=1" type="application/x-shockwave-flash" wmode="transparent" width="380" height="300"></embed></object></div></td><td vAlign="Top" width="0"></td></table>'

editmarker.openInfoWindowTabsHtml([new GInfoWindowTab("Overview",htmlpreview), new GInfoWindowTab("Video",youtubevideoformat)],{suppressMapPan:false});

GEvent.addListener(map, "infowindowclose", function(){map.returnToSavedPosition()});


}






function previewsubmitmarker(htmlpreview,youtubevideopreview){

map.savePosition();
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/' + youtubevideopreview + '&hl=en&fs=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + youtubevideopreview + '&hl=en&fs=1" type="application/x-shockwave-flash" wmode="transparent" width="380" height="300"></embed></object></div></td><td vAlign="Top" width="0"></td></table>'

homemarker.openInfoWindowTabsHtml([new GInfoWindowTab("Overview",htmlpreview), new GInfoWindowTab("Video",youtubevideoformat)],{suppressMapPan:false});

GEvent.addListener(map, "infowindowclose", function(){map.returnToSavedPosition()});


}

 
function createsubmitMarker(point) {


GEvent.removeListener(submitplace);


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);

homemarker = new GMarker(point,{icon:icon, draggable: true});  
//Clear Category Menu
GEvent.addListener(homemarker, "mouseover", function() { document.getElementById("mapwindow").innerHTML =  '';} );



GEvent.addListener(homemarker, "click", function() {

document.getElementById("mapwindow").innerHTML =  '';
document.getElementById("adminwindow").innerHTML =  '';


imagefilename = window.frames["infoframe"].document.forms["submitformx"].elements["uploadedimage"].value;
iconfilename = window.frames["infoframe"].document.forms["submitformx"].elements["uploadedicon"].value;

label = window.frames["infoframe"].document.forms["submitformx"].elements["placename"].value;
html = window.frames["infoframe"].document.forms["submitformx"].elements["html"].value;
categoryx = window.frames["infoframe"].document.forms["submitformx"].elements["uploadedsubcategory"].value;

addressx = window.frames["infoframe"].document.forms["submitformx"].elements["address"].value;
phonex = window.frames["infoframe"].document.forms["submitformx"].elements["phone"].value;


youtubevideopreview = window.frames["infoframe"].document.forms["submitformx"].elements["youtubevideo"].value;
//returnvalx = true;

var youtubecodeindex = youtubevideopreview.indexOf('/v/'); //Count to delimeter
  
var strippedyoutubecode = youtubevideopreview.substring(youtubecodeindex + 3, youtubecodeindex + 12);   
  
//htmlpreview='<div style="font-size:14px; font-weight: bolder; color:#996633">' + label + '&nbsp;&nbsp;&nbsp;&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/~off/images/' + imagefilename + '" align="left" width=125 height=100></div></td><td valign=top><div style="word-wrap: break-word; white-space:nowrap;width:350px;font-family:Helvetica,Verdana, Arial, sans-serif;text-align:justify;font-size:12px">' + html + '</div></td></tr></table></div>';
htmlpreview='<div style="font-size:14px; font-weight: bolder; color:#996633">' + label + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&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/~off/images/' + imagefilename + '" 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="text-decoration:underline; background-color:#ddd" align=center>Address:</td></tr><tr><td align=center style="background-color:#eee"><div style="width:130px">'+addressx+'</div></td></tr><tr><td style="text-decoration:underline; background-color:#ddd" align=center>Phone:</td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+phonex+'</div></td></tr><tr><td style="text-decoration:underline; background-color:#ddd" align=center>Category:</td></tr><tr><td style="background-color:#eee" align=center><div style="width:130px">'+categoryx+'</div></td></tr></table></div>';
previewsubmitmarker(htmlpreview,strippedyoutubecode);




//*********ENABLE TO GET PROMPT TO DELETE MARKER WHEN CLOSING INFO WINDOW
//closeinfowin = GEvent.addListener(map, "infowindowclose", function(){
//input_box=confirm("Are you sure you want to Cancel your Submission?");
//if (input_box==true)
//{ 
//map.removeOverlay(homemarker); map.getDragObject().setDraggableCursor("auto");
//GEvent.removeListener(submitplace);  
//GEvent.removeListener(closeinfowin);
//document.getElementById("sidebarwrapper").innerHTML = '<div id="letterbar"><ul><li><A title="A" onclick="find(\'A\'); return false;" href="http://www.travelmapia.com/directory/index.html">A</A></li><li><A title="B" onclick="find(\'B\'); return false;" href="http://www.travelmapia.com/directory/index.html">B</A></li><li><A title="C" onclick="find(\'C\'); return false;" href="http://www.travelmapia.com/directory/index.html">C</A><li><A title="D" onclick="find(\'D\'); return false;" href="http://www.travelmapia.com/directory/index.html">D</A></li></li><li><A title="E" onclick="find(\'E\'); return false;" href="http://www.travelmapia.com/directory/index.html">E</A></li><li><A title="F" onclick="find(\'F\'); return false;" href="http://www.travelmapia.com/directory/index.html">F</A></li><li><A title="G" onclick="find(\'G\'); return false;" href="http://www.travelmapia.com/directory/index.html">G</A></li><li><A title="H" onclick="find(\'H\'); return false;" href="http://www.travelmapia.com/directory/index.html">H</A></li><li><A title="I" onclick="find(\'I\'); return false;" href="http://www.travelmapia.com/directory/index.html">I</A></li><li><A title="J" onclick="find(\'J\'); return false;" href="http://www.travelmapia.com/directory/index.html">J</A></li><li><A title="K" onclick="find(\'K\'); return false;" href="http://www.travelmapia.com/directory/index.html">K</A></li><li><A title="L" onclick="find(\'L\'); return false;" href="http://www.travelmapia.com/directory/index.html">L</A></li><li><A title="M" onclick="find(\'M\'); return false;" href="http://www.travelmapia.com/directory/index.html">M</A></li><li><A title="N" onclick="find(\'N\'); return false;" href="http://www.travelmapia.com/directory/index.html">N</A></li><li><A title="O" onclick="find(\'O\'); return false;" href="http://www.travelmapia.com/directory/index.html">O</A></li><li><A title="P" onclick="find(\'P\'); return false;" href="http://www.travelmapia.com/directory/index.html">P</A></li><li><A title="Q" onclick="find(\'Q\'); return false;" href="http://www.travelmapia.com/directory/index.html">Q</A></li><li><A title="R" onclick="find(\'R\'); return false;" href="http://www.travelmapia.com/directory/index.html">R</A></li><li><A title="S" onclick="find(\'S\'); return false;" href="http://www.travelmapia.com/directory/index.html">S</A></li><li><A title="T" onclick="find(\'T\'); return false;" href="http://www.travelmapia.com/directory/index.html">T</A></li><li><A title="U" onclick="find(\'U\'); return false;" href="http://www.travelmapia.com/directory/index.html">U</A></li><li><A title="V" onclick="find(\'V\'); return false;" href="http://www.travelmapia.com/directory/index.html">V</A></li><li><A title="W" onclick="find(\'W\'); return false;" href="http://www.travelmapia.com/directory/index.html">W</A></li><li><A title="X" onclick="find(\'X\'); return false;" href="http://www.travelmapia.com/directory/index.html">X</A></li><li><A title="Y" onclick="find(\'Y\'); return false;" href="http://www.travelmapia.com/directory/index.html">Y</A></li><li><A title="Z" onclick="find(\'Z\'); return false;" href="http://www.travelmapia.com/directory/index.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>';
//}
//else
//{
//GEvent.removeListener(submitplace);
//GEvent.removeListener(closeinfowin);
//}
//});

GEvent.removeListener(submitplace); 
   
});

GEvent.addListener(homemarker, "dragend", function(point) {


latpoint = point.x;
longpoint = point.y;


window.frames["infoframe"].document.forms["submitformx"].elements["latitudex"].value = longpoint ;
window.frames["infoframe"].document.forms["submitformx"].elements["longtitudex"].value = latpoint;




var thepoint = parent.showAddress(point);//Initializing Country Code
var thecountryx = parent.getcountry(); 




parent.document.getElementById("country_codebx").value = thecountryx;

thecountryx = thecountryx.toLowerCase();

parent.document.getElementById("countryflag").innerHTML = '<img border="0" height="11" width="16" src="http://www.travelmapia.com/images/flags/' + thecountryx +  '.gif">';



});


map.getDragObject().setDraggableCursor("pointer");


return homemarker;





}




function validatecategory(fld){

var error ="";

    if (fld == "Select Sub Category") {
       
     var error = "-Please Select a Sub Category.\n";
    } 
    
    else {
       
    } 
    
return error; 

}

function validateimagefile(fld){

var error ="";

    if (fld == "undefined") {
       
     var error = "-Please Select and Upload and Image of your Place.\n";
    } 
        
    else {
       
    } 
    
return error; 

}

function validateicon(fld){

var error ="";

    if (fld == "undefined") {
       
     var error = "-Please Select or Upload and Icon for your Place.\n";
    }   
    
    else {
       
    } 
    
return error; 

}







function removelink(){

//window.frames["useriframe"].document.elements("hey").onclick=function()
//document.getElementById('useriframex').contentWindow.document.getElementById('hey').onclick=function()
//{
//alert("click on the map to submit");
//}

document.getElementById("iframediv").innerHTML ='<iframe frameborder=0 width="800px" height="39px" marginheight=0px marginwidth=800px scrolling=no allowTransparency=true src=http://www.travelmapia.com/php/loginx.php></iframe>'


}


function addlink(){
//window.frames["useriframe"].document.getElementById("hey").onclick=function()
//document.getElementById('useriframex').contentWindow.document.getElementById('hey').onclick=function()

//{
//parent.submit();
//removelink();
//}

document.getElementById("iframediv").innerHTML ='<iframe frameborder=0 width="800px" height="39px" marginheight=0px marginwidth=800px scrolling=no allowTransparency=true src=http://www.travelmapia.com/php/login.php></iframe>'




}




function loadhelp(helptype){

var youtubehelpfile;
var youtubehelpfileesp;

var placenamehelpfile;

var w=document.getElementById("map").offsetWidth/2;
var h=document.getElementById("map").offsetHeight/2;



document.getElementById("mapwindow").innerHTML =  '';

//var cc = map.fromLatLngToDivPixel(map.getCenter()); 
var left = w - 150; 
var right = h - 180; 
 
  
document.getElementById("mapwindow").style.visibility = "visible";
 
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(left,right)); 
pos.apply(document.getElementById("mapwindow")); 
document.getElementById("map").appendChild(document.getElementById("mapwindow"));




if(helptype=="youtube"){

youtubehelpfile = 'youtubehelp.html'

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + youtubehelpfile + '></iframe>';

}


else if(helptype=="placenametags"){

placenametagshelpfile = 'placenametagshelp.html'

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + placenametagshelpfile + '></iframe>';



}


else if(helptype=="placename"){

placenamehelpfile = 'placenamehelp.html'

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + placenamehelpfile + '></iframe>';



}



else if(helptype=="address"){

addresshelpfile = 'addresshelp.html'

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + addresshelpfile + '></iframe>';



}


else if(helptype=="lat"){

lathelpfile = 'lathelp.html'

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + lathelpfile + '></iframe>';



}


else if(helptype=="lng"){

lnghelpfile = 'lnghelp.html'

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + lnghelpfile + '></iframe>';



}


else if(helptype=="html"){

htmlhelpfile = 'htmlhelp.html'

document.getElementById("mapwindow").innerHTML =  '<iframe frameBorder=no align=left allowTransparency=true width=400px height=500px scrolling=no src=http://www.travelmapia.com/' + htmlhelpfile + '></iframe>';



}



else{


alert("Help File Not Available");

}


}




function getmarkernewpoint(ex,lx){

var thepointd = new GLatLng(ex,lx);


var newmarker = createsubmitMarker(thepointd);
map.clearOverlays();
map.addOverlay(newmarker);


//return thepointd;

}




function popswitchbox(){



parent.document.getElementById("placeswitch").innerHTML = '<select style="font-family: Helvetica,Verdana, Arial, sans-serif;font-size:10px;text-align:left" name="subcategory" id="thecategory" onChange="uploadsubcategory(document.categoryselectform.thecategory.options[document.categoryselectform.thecategory.selectedIndex].value);" ></select>';


}
