function confirmDelete(Name)
// creates a pop up when called, asking are you sure you want to delete?
// called usually when a delete button or link is pushed.
{
var agree=confirm("Are you sure you wish to delete the list?");
if (agree)
	return true ;
else
	return false ;
}

function OnSubmitUsernamePassword(passForm) {
if ((passForm.user.value == "") || (passForm.pass.value == "")) {
	alert ("You must fill in both username and password fields.")
	return false
	}
}


initCat = "";

//preload floating images
processImage= new Image()
processImage.src = "images/process_insert.gif"
starImage= new Image()
starImage.src = "images/star_insert.gif"
sesImage= new Image()
sesImage.src = "images/ses_insert.gif"
upnwImage= new Image()
upnwImage.src = "images/upnw_insert.gif"
upwImage= new Image()
upwImage.src = "images/upw_insert.gif"


function hideImages()
{
	hideById('processImage');
	hideById('starImage');
	hideById('sesImage');
	hideById('upnwImage');
	hideById('upwImage');
}

function revertImage()
{
	if(initCat != "")
		swapImage(initCat);
	else
		hideImages();
	return false
}

function swapCurrentImage(e)
{
 var theTarget = e.target ? e.target : e.srcElement;
 theTarget = getTargetParentId(theTarget);
 if(theTarget.id != null && theTarget.id.length >0)
 {
  swapImage(theTarget.id);
 }
}
function swapImage(cat)
{
	hideImages();	
	showById(cat + 'Image');
	return false
}

function getTargetParentId(elem)
{
 if (elem.parentNode != null)
 {
   elem = elem.parentNode;
   if (elem.id != null && elem.id.length > 0 && elem.tagName.toLowerCase() == "li")
   		return elem;
  	else
			return getTargetParentId(elem);
	}
	else
  	return elem;
}

//startup functions
defineTopLevelEvents = function()
{
	var tlMenuItems = getElementsByClassName(document.getElementById("nav"), "li", "tl")
	if (tlMenuItems == null)
		 return;
	for (a = 0; a < tlMenuItems.length; a++)
	{
		var currTl = tlMenuItems[a];		
		addEvent(currTl, "mouseover", swapCurrentImage);
		addEvent(currTl, "mouseout", revertImage);
	}
	
}

startList = function() 
{
	if (document.all&&document.getElementById) 
	{
		navRoot = document.getElementById("nav");
		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", "");
       }
      }
    }
  }
}

initDoc = function()
{
	startList();
	defineTopLevelEvents();
}

window.onload=initDoc;
