var xmlHttp;

function loadData(data) {
  switchSubnav(data);
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null) {
    alert ("Your browser does not support XMLHTTP Request");
    return;
  }
  var url="xmlfetch.php";
  url=url+"?q="+data;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=stateChanged;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
  window.addEvent("domready", Slimbox.scanPage);
}

function stateChanged() {
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
    document.getElementById("copyborder").innerHTML=xmlHttp.responseText;
    
  var links = $$("a").filter(function(el) {
		return el.rel && el.rel.test(/^lightbox/i);
	});
	$$(links).slimbox({/* Put custom options here */}, null, function(el) {
		return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
	});
  }
}

function GetXmlHttpObject() {
  var xmlHttp=null;
  try {
    xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
  }
  catch (e) {
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); //Internet Explorer
    }
    catch (e) {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  window.addEvent("domready", Slimbox.scanPage);
  return xmlHttp;
}

function switchSubnav(str) {
  var subnav=document.getElementById('contentleft').getElementsByTagName("a");
  var i=0;
  for (i=0;i<subnav.length;i=i+1) {
    subnav[i].style.color='#666666';
  }
  document.getElementById(str).style.color='#A90000';
}

function mouseOver(navID) {
  document.getElementById(navID).style.textDecoration='underline';
}
function mouseOut(navID) {
  document.getElementById(navID).style.textDecoration='none';
}

function getGallery() {
  var gallno;
  var rnd=Math.random();
  rnd=rnd*10;
  rnd=Math.round(rnd);
  if (rnd<2.5) { gallno=1; }
  else if (rnd<5.0) { gallno=2; }
  else if (rnd<7.5) { gallno=3; }
  else { gallno=4; }
  return gallno;
}