// Browser Sniffing

var browser = "OTHER"
var version = 0
var release = 0
var optnbr = 0

function tick() {

  // Make sure that sniff() is called first!
	// Clock only works with MSIE	
	if (browser != "MSIE") return;
	if (version < 5) return;
	
  var hours, minutes, seconds, ap;
  var intHours, intMinutes, intSeconds;
  var today;

  today = new Date();

  intHours = today.getHours();
  intMinutes = today.getMinutes();
  intSeconds = today.getSeconds();

  if (intHours == 0) {
     hours = "12:";
     ap = "Midnight";
  } else if (intHours < 12) { 
     hours = intHours+":";

     ap = "A.M.";
  } else if (intHours == 12) {
     hours = "12:";
     ap = "Noon";
  } else {
     intHours = intHours - 12
     hours = intHours + ":";
     ap = "P.M.";
  }

  if (intMinutes < 10) {
     minutes = "0"+intMinutes+":";
  } else {
     minutes = intMinutes+":";
  }

  if (intSeconds < 10) {
     seconds = "0"+intSeconds+" ";
  } else {
     seconds = intSeconds+" ";
  } 

  timeString = hours+minutes+seconds+ap;
  Clock.innerHTML = timeString;
  window.setTimeout("tick();", 100);
}

//  -----------------

function sniff () {
  // indexOf() is used to retrieve the position of the text within the parentheses.  If
  // the text is not found then the method returns a value of -1

  if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1) browser="MSIE"
  else if (navigator.appName.indexOf("Netscape") != -1) browser="NS"

  version = parseInt(navigator.appVersion.substring(0, 2))
  release = parseInt(navigator.appVersion.substring(2, 4))

  // If MSIE, override version and release of Mozilla support with version and 
  // release of MSIE

  if (browser == "MSIE" & version > 3) {
    var pos = navigator.appVersion.indexOf("MSIE")  // locate MSIE

    // substring() returns the character string beginning at the position and ending
    // just prior to the final position

    version = parseInt(navigator.appVersion.substring(pos+5, pos+7))
    release = parseInt(navigator.appVersion.substring(pos+7, pos+9))  // extract locate release
  }

}

//  -----------------

function menu (page) {

optnbr=0

if (page != "home") {
  option("home.php","Go to HDAC home page.","HDAC Home Page", "_self")
}

if (page != "faq") {
  option("hdfaq/faq.php","Go here to get a quick answer!","Frequently Asked Questions", "_self")
}
option("http://www.hdac.org/phorum31/index.php", "Post your questions to the HDAC Message Board", "HDAC Message Board", "_blank")

if (page != "allchat") {
  dateObj = new Date()
  var href = "allchat.php?gmt="+dateObj.getTimezoneOffset()
  option(href,"All known chat rooms and message boards","Chat Rooms, Msg Boards", "_self")
}

if (page != "huntdis") {
  option("huntdis/index.html","Information about HUNT-DIS!","Hunt-Dis ListServ", "_self")
}

document.write("<hr>")
if (page != "features") {
  option("features/features.html","Locate a featured article!","Featured Articles Archive", "_self")
}

if (page != "pactivist") {
  option("pac/pactivist.html","Make your voice heard!","The Political Activist", "_self")
}

if (page != "chat") {
  option("chat.html","Join the HD Advocacy Center Chat Room","HDAC Chat Room", "_blank")
}

if (page != "idcard") {
  option("idcard.html","Print your own personal Id card","HD Identification Card", "_self")
}
document.write("<hr>")
if (page != "about") {
  option("about.html","Go here to find out more about HDAC!","About This Site", "_self")
}
if (page != "orglinks") {
  option("orglinks.php","Go here for more HD related organizations.","Other Organizations", "_self")
}
if (page != "perlinks") {
  option("perlinks.php","Go here for personal web sites that discuss HD.","Personal Sites", "_self")
}

}

//  -----------------

function option (sURL, sTitle, sLink, sTarget) {

optnbr = optnbr+1

var tagset = "<a href=\"" + sURL + "\" title=\"" + sTitle + "\" onMouseOver=\"document.id"    
tagset = tagset + optnbr + ".src='sel.gif'\" onMouseOut=\"document.id" + optnbr    
tagset = tagset + ".src=\'unsel.gif\'\"  target=\"" + sTarget + "\">" + sLink + "</a><img src=\"unsel.gif\" border=0 name=id"   
tagset = tagset + optnbr + "><br>"  
document.write(tagset) 

// onMouseOver="document.id99.src='sel.gif'" onMouseOut="document.id99.src='unsel.gif'">linktext</a><img src="unsel.gif" border=0 name="id99"><br>

}


