function writeDiv(id, text, mode) {
  if (document.getElementById ) {
    x = document.getElementById(id);
    if (!mode) x.innerHTML = text;
    else x.innerHTML = text + x.innerHTML;
    return true;
  }
  else if (document.all) {
    x = document.all[id];
    if (!mode) x.innerHTML = text;
    else x.innerHTML = text + x.innerHTML;
    return true;
  }
  else if (document.layers) {
    x = document.layers[id];
    if (!mode) {
      x.document.open();
      x.document.write(text);
      x.document.close();
    }
    else {
      x.document.open();
      x.document.write(text + x.document);
      x.document.close();
    }
    return true;
  }
  else return false;
}

function getStyle(id) {
  if(document.getElementById && document.getElementById(id))
    return document.getElementById(id).style;
  else if (document.all && document.all(id))
    return document.all(id).style;
  else if (document.layers && document.layers[id])
    return document.layers[id];
  else
    return false;
}

function setDisplay(id, state) {
  var style = getStyle(id);
  if (state == 1)
    style.display = 'block';
  else if (state == 0)
    style.display = 'none';
  else if (state == 2) {
    if (style.display == 'none') style.display = 'block';
    else if (style.display == 'block') style.display = 'none';
  }
  if (style.display == 'none') return 0;
  else if (style.display == 'block') return 1;
}

function fixIE () {
  //writeDiv('tabLine', '<div style="float:left"></div>', 1);
}

function facultyPop(url) {
  MM_openBrWindow(url,'pop','scrollbars=yes,width=660,height=800,resizable=yes');
}

function imgPop(url,width,height,imgH) {
 if (!width) width = 500;
 if (!height) height = 500;
 wwidth =  40 + parseInt(width);
 wheight = 70 + parseInt(height);// + Math.floor((height-imgH)/2);
 features = 'scrollbars=no,width='+wwidth+',height='+wheight+',resizable=no';
 margin_top = Math.floor((height-imgH)/2) + 20
 win = window.open('','WUNeuroscience',features);
 win.resizeTo(wwidth,wheight);
 win.document.open();
 win.document.write('<html><head><title>Department of Anatomy &amp; Neurobiology</title>');
 win.document.write('<style>body{background-color:$fff;padding:0');
 win.document.write('px;margin:0 auto;text-align:center;}');
 win.document.write('img{padding:0px;margin:0px;');
 win.document.write('margin-top:'+margin_top+'px;}');
 win.document.write('div.s{text-align:center;height:'+height+'px;width:'+width+'px;margin:0px;}');
 win.document.write('</style></head>');
 win.document.write('<body onload="window.focus()"><center><div class="s">');
 win.document.write('<img src="'+url+'" height="'+imgH+'" /></div></center></body></html>');
 win.document.close();
 win.focus();
}

/////////////////////////////////
/////////////////////////////////
// original javascript follows //
/////////////////////////////////
/////////////////////////////////
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
