current = '';
var hh=0;
var inter;

function showThingy(url, pageElement, callMessage, errorMessage) {
     document.getElementById(pageElement).innerHTML = callMessage;
     try {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
         } catch (E) {
          req = false;
         } 
       } 
     }
     req.onreadystatechange = function() {responseAHAH(pageElement, errorMessage);};
     req.open("GET",url,true);
     req.send(null);
  }

function responseAHAH(pageElement, errorMessage) {
   var output = '';
   if(req.readyState == 4) {
      if(req.status == 200) {
         output = req.responseText;
         document.getElementById(pageElement).innerHTML = output;
         } else {
         document.getElementById(pageElement).innerHTML = errorMessage+"\n"+output;
         }
      }
  }

function makeactive(tab) { 
	
	if(tab!="current"){
		current = tab;
	}
	else tab=current;
	/*document.getElementById("exec").className = ""; 
	document.getElementById("pi").className = ""; 
	document.getElementById("rho").className = "";
	document.getElementById("sigma").className = "";
	document.getElementById("tau").className = "";
	document.getElementById("upsilon").className = "";
	document.getElementById("phi").className = "";
	document.getElementById("chi").className = "";
	document.getElementById("world").className = "";
	document.getElementById(tab).className = "active";*/
	var list = $$('.active');
	list.each(function(pledge){
		pledge.className = "pledgeList";
	});
	document.getElementById(tab).className = "active";
	hideMap();
	showImage('pics/profiles/'+tab+'.jpg', tab);
	showThingy('brotherlist2.php?content='+tab, 'brotherlist', /*'<center>Getting content for '+tab+'. Please wait...<br>If you see this for too long, please click again =X</center>'*/'', 'Error');
} 
function showWindow(toShow){
	if(toShow=="current"){
		toShow = current;
	}
	showWin();
	showThingy('window.php?show='+toShow, 'window', /*'<center>Getting content now. Please wait...<br>If you see this for too long, please click again =X</center>'*/'', 'Error');
	}

function showImage(source, tab){
	/*e=document.getElementById(imageChange);
	e.style.display="inline";*/
	document["mainImage"].src=source;
	document["mainImage"].style.display="inline";
	document["mainImage"].name=tab;
	document["mainImage"].title=tab+" Group Pic";
	hideWindow();
}

function hideImage(){
	//document["mainImage"].style.display="none";
}

function hideWindow(){
	if($('window')) $('window').style.display='none';
}

function showWin(){
	win = document.getElementById("window");
	win.style.display="block";
	//inter=setInterval('ShowBox()',3);
	
}

function ShowBox(){
	obj = document.getElementById("window");
	var intElemScrollHeight = document.getElementById("window").scrollHeight;
	var intElemScrollHeight2 = obj.clientHeight;
	alert(intElemScrollHeight);
	if(intElemScrollHeight==intElemScrollHeight2)
	{
	clearInterval(inter);
	return;
	}

	hh+=2;
	obj.style.height = hh + 'px';
}

function showMap(){
	map = document.getElementById("mapper");
	map.style.display="inline";
}

function hideMap(){
	map = document.getElementById("mapper");
	map.style.display="none";
}

function showBrothers(){
	map = document.getElementById("brotherlist");
	map.style.display="inline"
}
function hideBrothers(){
	map = document.getElementById("brotherlist");
	map.style.display="none"
}
