/*
 * Mark Huppert, SIS WDC
 * 14/01/2009
 * for index.html of /collections
 */

// attaches event handlers to the table headings 

var stuff=[]; //array of event handler functions
function art(event) {makeover('105');stopDefaultAction(event);return false;}
stuff['art']=art;
function chi(event) {makeover('15');stopDefaultAction(event);return false;}
stuff['chi']=chi;
function han(event) {makeover('43');stopDefaultAction(event);return false;}
stuff['han']=han;
function law(event) {makeover('5');stopDefaultAction(event);return false;}
stuff['law']=law;
function men(event) {makeover('2');stopDefaultAction(event);return false;}
stuff['men']=men;
function mus(event) {makeover('100');stopDefaultAction(event);return false;}
stuff['mus']=mus;
function chem(event) {makeover('35');stopDefaultAction(event);return false;}
stuff['chem']=chem;
function earth(event) {makeover('61');stopDefaultAction(event);return false;}
stuff['earth']=earth;

addLoadListener(function(){
for(var key in stuff) {
    //windows
    if(document.getElementById(key).attachEvent) {
          document.getElementById(key).attachEvent("onclick",stuff[key]);
          document.getElementById(key).onmouseover=overIt;
          document.getElementById(key).onmouseout=offIt;
    } 
    //mozilla 5 (Firefox, etc)
    if(document.getElementById(key).addEventListener) {
          document.getElementById(key).addEventListener("click",stuff[key],true);
          document.getElementById(key).onmouseover=overIt;
          document.getElementById(key).onmouseout=offIt;
    }
}

});



/*------------------------------------------------*/
function overIt() {this.firstChild.className="over"; }
function offIt() {this.firstChild.className="out"; }
/*------------------------------------------------*/

var _FOO;
/*------------------------------------------------*/
function makeover(url) { 
/*------------------------------------------------
 * makes a popup window
 */
   var s='http://campusmap.anu.edu.au/displaybldg.asp?no='+url+'&printerfriendly=true';
   if(_FOO) { _FOO.close(); }
   _FOO=window.open(s,'_FOO','top=30,left=200,width=600,height=350,resizable=yes,toolbar=no,scrollbars=yes');_FOO.focus();return false;
}
