var ie4 = false; if(document.all) { ie4 = true; }
function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } 
}

function printImage(position) {
	var w = (position == 2) ? 150 : 160;
	var LastPart = '.jpg" height="91" width="' + w + '">';
	var r = Math.ceil(Math.random() * 2);
	document.write('<img src="/img/random/banner' + position + '-' + r + LastPart); 
}

function showItem(target,source,txtOpen) {
  source.firstChild.nodeValue = txtOpen;
  getObject(target).style.display = "block";
}

function hideItem(target,source,txtClosed) {
  source.firstChild.nodeValue = txtClosed;
  getObject(target).style.display = "none";
}

function toggleItem(target,source,txtOpen,txtClosed) {
  if (source.firstChild.nodeValue == txtClosed)
    showItem(target,source,txtOpen)
  else
    hideItem(target,source,txtClosed)
}

function toggledetails(link,divId) {
  toggleItem(divId,link,"[-] Click HERE to close details","[+] Click HERE for details")
}

function togglegrant(link,divId) {
  toggleItem(divId,link,"[-] Click HERE to close Abstract","[+] Click HERE to view Abstract")
}

function togglequestion(link,divId) {
  toggleItem(divId,link,"[-] Click HERE to close answers","[+] Click HERE for answers")
}

function togglesitemap(link,divId) {
  toggleItem(divId,link,"–","+")
}


function toggleAllQuestions() {

  var aDivs = document.getElementsByTagName("DIV");
  var i, thisDiv, functionCall

  if  (showingAll == true) {
    functionCall = "hideItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"[+] Click HERE for answers\")";
    showingAll = false;
  }
  else {
    functionCall = "showItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"[-] Click HERE to close answers\")";
    showingAll = true;
  }

  for (i = 0; i < aDivs.length; i++) {
    thisDiv = aDivs[i]
     if (thisDiv.id.search('exp') != -1)
      eval(functionCall)
  }

}

function toggleAllAbstracts() {

  var aDivs = document.getElementsByTagName("DIV");
  var i, thisDiv, functionCall

  if  (showingAll == true) {
    functionCall = "hideItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"[+] Click HERE to view Abstract\")";
    showingAll = false;
  }
  else {
    functionCall = "showItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"[-] Click HERE to close Abstract\")";
    showingAll = true;
  }

  for (i = 0; i < aDivs.length; i++) {
    thisDiv = aDivs[i]
     if (thisDiv.id.search('exp') != -1)
      eval(functionCall)
  }

}

function toggleAllSiteMap() {

  var aDivs = document.getElementsByTagName("DIV");
  var i, thisDiv, functionCall

  if  (showingAll == true) {
    functionCall = "hideItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"+\")";
    showingAll = false;
  }
  else {
    functionCall = "showItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"-\")";
    showingAll = true;
  }

  for (i = 0; i < aDivs.length; i++) {
    thisDiv = aDivs[i]
     if (thisDiv.id.search('exp') != -1)
      eval(functionCall)
  }

}
function toggleAllDetails() {

  var aDivs = document.getElementsByTagName("DIV");
  var i, thisDiv, functionCall

  if  (showingAll == true) {
    functionCall = "hideItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"[+] Click HERE for details\")";
    showingAll = false;
  }
  else {
    functionCall = "showItem(thisDiv.id,getObject(thisDiv.id + \"_link\"),\"[-] Click HERE to close details\")";
    showingAll = true;
  }

  for (i = 0; i < aDivs.length; i++) {
    thisDiv = aDivs[i]
     if (thisDiv.id.search('exp') != -1)
      eval(functionCall)
  }

}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}




