function maskOverlaySize(){
  if (window.innerHeight && window.scrollMaxY) {  
    yScroll = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    yScroll = document.body.scrollHeight;
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
    yScroll = document.body.offsetHeight;
    }
  $('maskOverlay').setStyle({height: yScroll +"px"});
}

/*
 * Takes three arguments, the element to position, its width, and its height
 */
function centerDiv() {	
  var pagesize = maskGetPageSize();
  var arrayPageScroll = maskGetPageScrollTop();
  $(arguments[0]).setStyle({left: ((pagesize[0] - arguments[1])/2)+"px", top: (arrayPageScroll[1] + ((pagesize[1]-arguments[2])/2))+"px" })
  $(arguments[0]).setStyle({display:"block"});
}

function maskGetPageScrollTop(){
  var yScrolltop;
  if (self.pageYOffset) {
    yScrolltop = self.pageYOffset;
  } else if (document.documentElement && document.documentElement.scrollTop){   // Explorer 6 Strict
    yScrolltop = document.documentElement.scrollTop;
  } else if (document.body) {// all other Explorers
    yScrolltop = document.body.scrollTop;
  }
  arrayPageScroll = new Array('',yScrolltop) 
  return arrayPageScroll;
}
function maskGetPageSize(){
  var de = document.documentElement;
  var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
  var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
  
  arrayPageSize = new Array(w,h) 
  return arrayPageSize;
}

function maskScreen() {
  document.getElementById('maskOverlay').style.display='block';
  maskOverlaySize();
  centerDiv('maskLoad',100,100);
}

function unmaskScreen() {
  document.getElementById('maskOverlay').style.display='none';
  document.getElementById('maskLoad').style.display='none';
}


//on page load call TB_init
//$(document).ready(TB_init);
//add thickbox to href elements that have a class of .thickbox
function TB_init(){
  $("a.thickbox").click(function(){
  var t = this.title || this.name || null;
  var g = this.rel || false;
  TB_show(t,this.href,g);
  this.blur();
  return false;
  });
}
