

//Ajax script for loading gallery
 //Create a boolean variable to check for a valid Internet Explorer instance.

  var xmlhttp = false;

  //Check if we are using IE.
  try {
    //If the Javascript version is greater than 5.
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    //If not, then use the older active x object.
    try {
      //If we are using Internet Explorer.
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      //Else we must be using a non-IE browser.
      xmlhttp = false;
    }
  }

  //If we are using a non-IE browser, create a javascript instance of the object.
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  


  function get_gallery(galleryID, sp) {

    var obj = document.getElementById("images");
    var url = "get_gallery.php?id="+galleryID;
    if (sp) url += "&sp="+sp;
    xmlhttp.open("GET", url);
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        obj.innerHTML = xmlhttp.responseText;
      //  alert(xmlhttp.responseText);
      }
    }
    xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
    setStatus ("Loading...","images");
    xmlhttp.send(null);
  }
  
  function setStatus (theStatus, theObj){
  obj = document.getElementById(theObj);
  if (obj){
    obj.innerHTML = "<div class='load'>" + theStatus + "</h3><div style='clear:both;'></div>";
  }
}
// end of Ajax script

function toggleMenu(objID) {
if (!document.getElementById) return;
var obj = document.getElementById(objID);
//var ob = document.getElementById(objID).style;
//ob.display = (ob.display == 'block')?'none': 'block';
//alert(obj.className);
obj.className = (obj.className == 'leaf_wrap')?'leaf_wrap_show': 'leaf_wrap';
var plus = document.getElementById('plus'+objID);
plus.innerHTML = (obj.className == 'leaf_wrap_show')?'-': '+';
}

// open the gallery on the right
function open_image_page( page ) {
image_page=window.open( '/tour/link=' + page, 'image_page', 'scrollbars,toolbar,menubar,resizable,location,width=800,height=600');
image_page.focus();
}

function mark_current(id) {
 var obj1 = document.getElementById("title" + id);

 //obj1.style.color = '#ffffff';
// obj1.style.textDecoration = 'none';
obj1.className = 'cur_gal';
 if (prev_id) {
    var obj2 = document.getElementById("title" + prev_id);
  //  obj2.style.color = '#66ccff';
   //  obj2.style.textDecoration = 'underline';
   obj2.className = 'link_gal';
 }
 var elem = obj1;
 while (elem.parentNode){
    if ( elem.className == 'leaf_wrap') elem.className = 'leaf_wrap_show';
    elem = elem.parentNode;
 }
 prev_id = id;
}

