function ajaxRequest(){
 var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
 if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
  for (var i=0; i<activexmodes.length; i++){
   try{
    return new ActiveXObject(activexmodes[i])
   }
   catch(e){
    //suppress error
   }
  }
 }
 else if (window.XMLHttpRequest) // if Mozilla, Safari etc
  return new XMLHttpRequest()
 else
  return false
}

var request = false;
var isNews = false;

request = new ajaxRequest();

function ajaxSwitch(content) {
if (content == 'news') {
isNews = true;
}
/*the name of your page with the content goes here */
document.getElementById("ajaxcontent").innerHTML = '<div class="ajax_loading">loading ...<br /><img src="images/indicator.black.gif" /></div>';

var url = "ajaxcontent.php?showit=" + escape(content);
request.open("GET", url, true);
request.onreadystatechange = go;
request.send(null);
}

function go() {
  if (request.readyState == 4) {
	  if (request.status == 200) {
		var response = request.responseText;
/* 'ajaxcontent' is the name of my div that will contain the info */
		document.getElementById("ajaxcontent").innerHTML = response;
		if (isNews) {
		setTimeout(loadFB(), 100);
		}
		setTimeout(loadShare(), 100);
		setTimeout(Lightbox.init.bind(Lightbox), 100);
	}
  }
}

function showIt() {
	var aTags=document.getElementById('navibar').getElementsByTagName('a');
	for (i=0; i<aTags.length; i++) {
		aTags[i].onclick=function() {
			var show=this.href.split('site=')[1];
			ajaxSwitch(show);
			return false;
		}
	}
}


window.onload=showIt;
	


