// iP DropDown Menus v2.0
function activateMenu(nav) {
   var navroot = document.getElementById(nav);     
   /* Get all the list items within the menu */
   if (navroot) {
     var lis = navroot.getElementsByTagName("LI");  
     
     for (i=0; i<lis.length; i++) {
       /* If the LI has another menu level */
       if(lis[i].lastChild.tagName=="UL"){   
         var objNewNode = document.createElement("iframe");
         objNewNode.setAttribute('class', 'invisible');
         objNewNode.setAttribute('src', '/pages/blank.html');
         lis[i].lastChild.insertBefore(objNewNode, lis[i].lastChild.firstChild);

         /* assign the function to the LI */
         lis[i].onmouseover=function() {	      
           /* display the inner menu */
           this.lastChild.style.display="block";
           this.lastChild.firstChild.style.width = this.lastChild.offsetWidth;
    	   this.lastChild.firstChild.style.height = this.lastChild.offsetHeight;
           this.lastChild.firstChild.style.top = 0;
      	   this.lastChild.firstChild.style.left = 0;
   	   this.lastChild.firstChild.style.zIndex = this.lastChild.style.zIndex - 1;
    	   this.lastChild.firstChild.style.display = "list-item";
         }
         lis[i].onmouseout=function() {                       
           this.lastChild.style.display="none";
	   this.lastChild.firstChild.style.display = "none";
         }
       }
     }
   }
}
window.onload = function(){
    activateMenu('ulNav'); 
}

function checkValue(obj, strVal) {
  if(obj.value == strVal) {
    obj.value = '';
  } else if(obj.value == '') {
     obj.value = strVal;
  }
}

function validateEnews() {
  var fm = document.forms['fmEnews'];
  var strErr = '';
  if (fm.txt_EnewsName.value == '' || fm.txt_EnewsName.value == 'name:') strErr = '- Please enter a name.\n';
  if (fm.txt_EnewsEmail.value == '' || fm.txt_EnewsEmail.value == 'email address:') strErr = strErr + '- Please enter an email address.\n';
  if (strErr == '') {
    return true;
  } else {
    alert('The following errors have occured:\n' + strErr);
    return false;
  }
}

function confirmPassword(pword1, pword2) {
  var password = document.forms['fmChangepassword'].Password_new1.value;
  var password2 = document.forms['fmChangepassword'].Password_new2.value;
  if (password != password2) {
    alert("Your password must match your confirmation password.");
    document.MM_returnValue = false;
  } else {
    document.MM_returnValue = true;
  }
}
