ieDropDowns = function()  {
  startList();
}

startList = function() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("dmenu");
		for (i=0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}


window.onload=ieDropDowns;


/* change password field to type="password" on click */

function passworddiv() {  /* runs onload */
  var ni = document.getElementById('passwordfield');
  var newdiv = document.createElement('div');
  var divIdName = 'passwordfieldtwo';
  var id = 1;
  newdiv.setAttribute('id', divIdName);
  newdiv.innerHTML = '<input type="text" id="password" name="password" value="password" maxlength="16" size="10" onfocus="hidepass()"><br>';
  ni.appendChild(newdiv);
}

function hidepass()  {
  var pword = document.getElementById('password').value;
  var ptype = document.getElementById('password').type;
  if (pword == 'password' && ptype == 'text')
    {
      var d = document.getElementById('passwordfield');
      var olddiv = document.getElementById('passwordfieldtwo');
      d.removeChild(olddiv);

      var ni = document.getElementById('passwordfield');
      var newdiv = document.createElement('div');
      var divIdName = 'passwordfieldtwo';
      var id = 1;
      newdiv.setAttribute('id', divIdName);
      newdiv.innerHTML = '<input type="password" id="password" name="password" value="" maxlength="16" size="10"><br>';
      ni.appendChild(newdiv);
  
     document.LoginForm.password.focus();
    }    
}



function hidethumb(entry,id)  {
  var entry = entry;
  var id = id;
  var param = entry + '*' + id;
  var url = 'xmlgetHideThumb.php?param=';
  http.open("GET", url + escape(param), true);
  http.onreadystatechange = handleHttpResponseHideThumb;
  http.send(null);  
}

function handleHttpResponseHideThumb() {
  if (http.readyState == 4) {
    var results = http.responseText.split("*");
    var hidden = results[0];
    if (hidden == 1)
      {
        alert('Thumbnail is now hidden');
      }
   }
}


function minmaxnoteon(note) {
  var note = note;
  if (note == 'totalfat')
    {
      var cal = document.getElementById("calmaintval").value;
      var message = 'Based on ' + cal + ' calories for weight maintenance.';
    }
  else if (note == 'alttotalfat')
    {
      var cal = document.getElementById("caleatenval").value;
      var message = 'Based on ' + cal + ' calories eaten.';
    }
  var isnotice = message.length;
  if (isnotice > 0)
    {
      document.getElementById("minmaxnotice").innerHTML = message;
      document.getElementById("minmaxnotice").style.display = 'block';
    }
}

function minmaxnoteoff()  {
  document.getElementById("minmaxnotice").style.display = 'none';
}



function minmaxnoteon2(note) {
  var note = note;
  if (note == 'fiber')
    {
      var cal = document.getElementById("calmaintval").value;
      var message = 'Based on ' + cal + ' calories for weight maintenance.';
    }
  else if (note == 'altfiber')
    {
      var cal = document.getElementById("caleatenval").value;
      var message = 'Based on ' + cal + ' calories eaten.';
    }
  var isnotice = message.length;
  if (isnotice > 0)
    {
      document.getElementById("minmaxnotice2").innerHTML = message;
      document.getElementById("minmaxnotice2").style.display = 'block';
    }
}

function minmaxnoteoff2()  {
  document.getElementById("minmaxnotice2").style.display = 'none';
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject();