//Script created for
//Industrial Research Foundation
//Ver 1.0 09012002
var navId=""  //the element Id that is active

function StartNav() {
  var d=document
  MenuDiv()
}

function Menu(txt, href, ttl) {
  var d=document
  MenuDiv()
  d.writeln("<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">")
  d.writeln("<tr>")
  d.writeln("  <td width=\"5\">&nbsp;</td>")
  d.writeln("  <td id=\""+txt+"\" onclick=\"javascript:goTo('"+href+"');\" width=\"138\" class=\"navcell\" onmouseOver=\"highlight('"+txt+"');\" onmouseOut=\"unhighlight('"+txt+"')\">")
  d.writeln("    <a class=\"nav\" href=\""+href+"\" title=\""+ttl+"\" onmouseOver=\"highlight('"+txt+"');\" onmouseOut=\"unhighlight('"+txt+"')\" target=\"main\">"+txt+"</a></td>")
  d.writeln("  <td width=\"7\">&nbsp;</td>")
  d.writeln("</tr>")
  d.writeln("</table>")
}

function SubMenu(txt, href, ttl) {
  var d=document
  d.writeln("<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">")
  d.writeln("<tr>")
  d.writeln("  <td width=\"15\">&nbsp;</td>")
  d.writeln("  <td id=\""+txt+"\" onclick=\"javascript:goTo('"+href+"');\" width=\"128\" class=\"navcell\" onmouseOver=\"highlight('"+txt+"');\" onmouseOut=\"unhighlight('"+txt+"')\">")
  d.writeln("    <a class=\"nav\" href=\""+href+"\" title=\""+ttl+"\" onmouseOver=\"highlight('"+txt+"');\" onmouseOut=\"unhighlight('"+txt+"')\" target=\"main\">"+txt+"</a></td>")
  d.writeln("  <td width=\"7\">&nbsp;</td>")
  d.writeln("</tr>")
  d.writeln("</table>")
}

function MenuDiv() {
  var d=document
  d.writeln("<table width=\"150\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">")
  d.writeln("<tr>")
  d.writeln("  <td width=\"5\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>")
  d.writeln("  <td><img src=\"images/nav_div.gif\" width=\"138\" height=\"2\"></td>")
  d.writeln("</tr>")
  d.writeln("</table>")
}

function EndNav() {
  var d=document
  MenuDiv()
}

function ActiveNav(idName) {
  var d=document
  var obj = d.all[idName]
  obj.className="navhigh"
}

function highlight(idName) {
  var d=document
  var obj = d.all[idName]
  obj.style.backgroundColor='#38B5DD'
}

function unhighlight(idName) {
  var d=document
  var obj = d.all[idName]
  obj.style.backgroundColor=''
}

function goTo(url) {
  window.location.href=url
  window.status=url
  return true
}

function showMenu(idName) {
    var d=document
	Menu('Home','index.html','HOME')
	Menu('IRF Story','irfstory_cntnt.html','IRF STORY')
	Menu('IRF Pioneers','pioneers_cntnt.html','PIONEERS')
	Menu('IRF Members','irfmembers_cntnt.html','MEMBERS')
	Menu('IRF Projects','atc_cntnt.html','PROJECTS')
	ActiveNav(idName)
	EndNav()
}

function showProjMenu(idName) {
    var d=document
	Menu('Home','index.html','HOME')
	Menu('IRF Story','irfstory_cntnt.html','IRF STORY')
	Menu('IRF Pioneers','pioneers_cntnt.html','PIONEERS')
	Menu('IRF Members','irfmembers_cntnt.html','MEMBERS')
	Menu('IRF Projects','atc_cntnt.html','PROJECTS')
	SubMenu('ATC','atc_cntnt.html','ATC')
	SubMenu('Others','oth_cntnt.html','Other Projects')
	ActiveNav(idName)
	EndNav()
}

function maxSize() {
  resizeTo(screen.availWidth, screen.availHeight)
}

function popUp(url, height, width, scrollStat, name) {
  var props = "left=30, top=115, titlebar=no, height="+height+", width="+width+", status=no, scrollbars="+scrollStat+" ";
  window.open(url, name, props)
}

function hideStat() {
  window.status="";
}

function getParam(str) {
  var locationObj = document.location;
  var paramValue="";
  if (locationObj.search!=null) {
    var params = locationObj.search.split('&');
    //take away the ? for the first param
    params[0]=params[0].substring(1);
    for (var i=0; i<params.length; i++) {
      var paramName = params[i].substring(0, params[i].indexOf('='));

      if (paramName==str) {
        paramValue = params[i].substring(params[i].indexOf('=')+1);
        return unescape(paramValue);
      }
    }
  }
  //return empty space when there are no params
  return paramValue;
}

function checkParam() {
  var mode=getParam('mod')
  if (mode=="pion") {
    window.location.href="pioneers.html"
	document.history(-1)
  }
}

function getScreen() {
  var s=screen
  var d=document
  d.writeln("You are currently using a resolution set to ")
  d.writeln("<b>"+ s.width + " x " + s.height + "</b>.<br>")
  if (s.width < 1024 && s.height < 768)
    d.writeln("This site is best viewed in a <b>1024 x 768</b> resolution.")
}