//////////////////////////////////////////////////////////////////
// Ajax code: initially just for maps                           //
//															    // 
//////////////////////////////////////////////////////////////////

function makeRequest( url, this_element_name )
  {
  var httpRequest;
    
  if( window.XMLHttpRequest ) 
    { // Mozilla, Safari, ...
    httpRequest = new XMLHttpRequest();
    
	if( httpRequest.overrideMimeType ) 
	  {
      httpRequest.overrideMimeType('text/xml');
      // See note below about this line
      }
    } 
  else if( window.ActiveXObject ) 
    { // IE
    try 
	  {
      httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
      } 
    catch( e ) 
	  {
      try 
	    {
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        } 
       catch( e ) 
	     {
	     }
       }
     }

   if( !httpRequest ) 
     {
     //alert('Giving up :( Cannot create an XMLHTTP instance');
     return false;
     }
   
   httpRequest.onreadystatechange = function() { alertContents( httpRequest, this_element_name ); };
   httpRequest.open('GET', url, true);
   httpRequest.send('');
   }

function alertContents( httpRequest, this_element_name ) 
  {
  if( httpRequest.readyState == 4 )  
    {
    if( httpRequest.status == 200 ) 
	  {
	  document.getElementById( this_element_name ).innerHTML = httpRequest.responseText;
      } 
	else 
	  {
      //alert('There was a problem with the request.');
      }
    }
  }
 
function ajax_map( form, selector_name, this_element_name, lang )
    { 	
	var newIndex = eval( "form." + selector_name + ".selectedIndex" ); 
	
	// selected country
	var val = eval( "form." + selector_name + ".options[ " + newIndex + " ].value" ); 
	
	makeRequest('http://www.buymydreamhotel.com/dbase_map_expt.php?xxx_lang=' + lang + '&xxx_co=' + val, this_element_name );
	}
	
