//begin Macromedia Dreamweaver generated functions
function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
//end Macromedia Dreamweaver generated functions

function infoW(lnk) {
	window.open(lnk,"Viewer","width=400,height=400,left=100,top=200,dependent,scrollbars,resizable")
}
function infoB(lnk) {
	window.open(lnk,"Viewer","width=600,height=400,left=100,top=200,dependent,scrollbars,resizable")
}

/*
  Expandable Listmenu Script
  Author : Thomas Bakketun
  http://www.bakketun.net/listmenu/

  Based on script by:
  Author : Daniel Nolan
  http://www.bleedingego.co.uk/webdev.php
*/

function expandAll(){
	//added 2004-02-23 -LR
	//find the treemenu UL tag and call initMenu in order to set singleopen to false so that once all items are expanded, the user can collapse each one individually
	var menus = document.getElementsByTagName("UL");
	for (var i = 0; i < menus.length; i++){
		if (menus[i].className.indexOf("treemenu") > -1){
			initMenu(menus[i], false, false);
		}
	}
	//expand each LI tag
	var items = document.getElementsByTagName("LI");
	for (var i = 0; i < items.length; i++){
		setMenu(items[i], true);
	}
}

function collapseAll(){
	//added 2004-02-23 -LR
	//find the treemenu UL tag and call initMenu in order to set singleopen to true so that the user can expand only one item at a time
	var menus = document.getElementsByTagName("UL");
	for (var i = 0; i < menus.length; i++){
		if (menus[i].className.indexOf("treemenu") > -1){
			initMenu(menus[i], true, false);
		}
	}
	//collapse each LI tag
	var items = document.getElementsByTagName("LI");
	for (var i = 0; i < items.length; i++){
		setMenu(items[i], false);
	}
}

function initMenus() {
  //if no tags, do nothing
  if (!document.getElementsByTagName) return;

  var singleopen, keepopen
  var menus = document.getElementsByTagName("UL");
  //for each UL tag
  for (var i = 0; i < menus.length; i++) {
    //if the class name is "treemenu"
    if (menus[i].className.indexOf("treemenu") > -1) {
	  //if class name contains singleopen set singleopen to true otherwise set it to false
      singleopen = menus[i].className.indexOf("singleopen") > -1
	  //if class name contains keepopen set keepopen to true otherwise set it to false
      keepopen = menus[i].className.indexOf("keepopen") > -1
	  //call initMenu passing each UL tag and two booleans for singleopen and keepopen
      initMenu(menus[i], singleopen, keepopen);
    }
  }
  //set the display value of the style on the body tag to nothing
  document.body.style.display = "";
}

function getChildNodes(element, tag) {
  var r = new Array();
  var nodes = element.childNodes;
  for (var i = 0; i<nodes.length; i++) {
    if (nodes[i].tagName == tag) {
      r.push(nodes[i]);
    }
  }
  return r;
}

function createA(menu) {
  var a, text;
  text = menu.firstChild;
  a = document.createElement("A");
  a.href = "#";
  menu.replaceChild(a, text);
  a.appendChild(text);
  return a;
}

function initMenu(menu, singleopen, keepopen) {
  var item, a, open;
  var items = getChildNodes(menu, "LI");
  open = false;
  for (var i = 0; i<items.length; i++) {
    item = items[i];
    a = getChildNodes(item, "A")[0];
    var submenu = getChildNodes(item, "UL")[0];
    if (submenu) {
      if (!a) {
        a = createA(item);
      }
      open = initMenu(submenu, singleopen, keepopen) || open;
      a.onclick = function() { return menuonclick(this, singleopen); }
    } else {
      if (a) open = open || (keepopen && a.href == window.location);
    }
    if (item.className == "treenodeopen") setMenu(item, true);
    open = open || item.className == "treenodeshow";
  }
  setMenu(menu.parentNode, open);
  return open;
}

function menuonclick(a, singleopen) {
  setMenu(a.parentNode, a.className == "treeclosed");
  var menus = getChildNodes(a.parentNode.parentNode, "LI");
  if (singleopen) {
    for (var i = 0; i<menus.length; i++) {
      if (menus[i] != a.parentNode) {
        setMenu(menus[i], false);
      }
    }
  }
  return false;
}

function setMenu(menu, open) {
  var a = getChildNodes(menu, "A")[0];
  var ul = getChildNodes(menu, "UL")[0];
  if (a && ul) {
    if (open) {
      a.className = "treeopen";
      ul.style.display = "block";
    } else {
      a.className = "treeclosed";
      ul.style.display = "none";
    }
  }
}
window.onload = initMenus; 

/*
Check required form elements script-
By JavaScript Kit (http://javascriptkit.com)
Over 200+ free scripts here!
*/

function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("Please select an application from the box, then select View Form.")
return false
}
else
return true
}

