
/**************************************************************************/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no'
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}
/**************************************************************************/

function jump_to(myobj)
 {
 	if (myobj.options[myobj.selectedIndex].value != "")
 	{
 		window.location = myobj.options[myobj.selectedIndex].value;
 	}
 }
 
/**************************************************************************/
doFadeObjects = new Object();
doFadeTimers = new Object();

function doFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){
        setTimeout("doFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }

    clearTimeout(doFadeTimers[object.sourceIndex]);

    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        doFadeObjects[object.sourceIndex]=object;
        doFadeTimers[object.sourceIndex]=setTimeout("doFade(doFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}
/**************************************************************************

Xoffset=-90;
Yoffset=25;

var old,skn,iex=(document.all),yyy=-1000;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

if (ns4)
skn=document.dek
else if (ns6)
skn=("POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;").style
else if (ie4)
skn=document.all.dek.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
skn.visibility="visible"
skn.display="none"
}
document.onmousemove=get_mouse;

function y_square(msg,bak,dire){
var content="<TABLE STYLE=\"border-collapse: collapse\" "+dire+" WIDTH=250 BORDER=1  BORDERCOLOR=black CELLPADDING=2 CELLSPACING=0 "+
"BGCOLOR="+bak+" ><TD ALIGN=center><FONT COLOR=black STYLE=\"font-size: 8pt\">"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
 if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
 if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}
 if(ie4){document.all("dek").innerHTML=content;skn.display=''}
}
function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}

function kill(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
skn.display="none"
}

*****************************************************************************/
function submitonce(theform) {
 if (document.all || document.getElementById) {
  // hunt down "submit" and "reset"
  for (i=0;i<theform.length;i++) {
   var tempobj=theform.elements[i];
   if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") {
    tempobj.disabled=true;
   }
  }
 }
}
/**************************************************************************/

var nodes		= new Array();;
var openNodes	= new Array();
var icons		= new Array(6);
function preloadIcons() {
	icons[0] = new Image();
	icons[0].src = "inc/units/Dir/img/plus.gif";
	icons[1] = new Image();
	icons[1].src = "inc/units/Dir/img/plusbottom.gif";
	icons[2] = new Image();
	icons[2].src = "inc/units/Dir/img/minus.gif";
	icons[3] = new Image();
	icons[3].src = "inc/units/Dir/img/minusbottom.gif";
	icons[4] = new Image();
	icons[4].src = "inc/units/Dir/img/folder.gif";
	icons[5] = new Image();
	icons[5].src = "inc/units/Dir/img/folderopen.gif";
}
function createTree(arrName, startNode, openNode) {
	nodes = arrName;
	if (nodes.length > 0) {
		preloadIcons();
		if (startNode == null) startNode = 0;
		if (openNode != 0 || openNode != null) setOpenNodes(openNode);

		if (startNode !=0) {
			var nodeValues = nodes[getArrayId(startNode)].split("|");
			document.write("<a href=\"" + nodeValues[3] + "\" onmouseover=\"window.status='" + nodeValues[2] + "';return true;\" onmouseout=\"window.status=' ';return true;\"><img src=\"inc/units/Dir/img/folderopen.gif\" align=\"absbottom\" alt=\"\" />" + nodeValues[2] + "</a><br />");
		} else document.write("<img src=\"inc/units/Dir/img/base.gif\" align=\"absbottom\" alt=\"\" />I??? C?????<br />");

		var recursedNodes = new Array();
		addNode(startNode, recursedNodes);
	}
}
function getArrayId(node) {
	for (i=0; i<nodes.length; i++) {
		var nodeValues = nodes[i].split("|");
		if (nodeValues[0]==node) return i;
	}
}
function setOpenNodes(openNode) {
	for (i=0; i<nodes.length; i++) {
		var nodeValues = nodes[i].split("|");
		if (nodeValues[0]==openNode) {
			openNodes.push(nodeValues[0]);
			setOpenNodes(nodeValues[1]);
		}
	}
}
function isNodeOpen(node) {
	for (i=0; i<openNodes.length; i++)
		if (openNodes[i]==node) return true;
	return false;
}
function hasChildNode(parentNode) {
	for (i=0; i< nodes.length; i++) {
		var nodeValues = nodes[i].split("|");
		if (nodeValues[1] == parentNode) return true;
	}
	return false;
}
function lastSibling (node, parentNode) {
	var lastChild = 0;
	for (i=0; i< nodes.length; i++) {
		var nodeValues = nodes[i].split("|");
		if (nodeValues[1] == parentNode)
			lastChild = nodeValues[0];
	}
	if (lastChild==node) return true;
	return false;
}
function addNode(parentNode, recursedNodes) {
	for (var i = 0; i < nodes.length; i++) {
		var nodeValues = nodes[i].split("|");
		if (nodeValues[1] == parentNode) {
			var ls	= lastSibling(nodeValues[0], nodeValues[1]);
			var hcn	= hasChildNode(nodeValues[0]);
			var ino = isNodeOpen(nodeValues[0]);
			for (g=0; g<recursedNodes.length; g++) {
				if (recursedNodes[g] == 1) document.write("<img src=\"inc/units/Dir/img/line.gif\" align=\"absbottom\" alt=\"\" />");
				else  document.write("<img src=\"inc/units/Dir/img/empty.gif\" align=\"absbottom\" alt=\"\" />");
			}
			if (ls) recursedNodes.push(0);
			else recursedNodes.push(1);
			if (hcn) {
				if (ls) {
					document.write("<a href=\"javascript: oc(" + nodeValues[0] + ", 1);\"><img id=\"join" + nodeValues[0] + "\" src=\"inc/units/Dir/img/");
					 	if (ino) document.write("minus");
						else document.write("plus");
					document.write("bottom.gif\" align=\"absbottom\" alt=\"?E?/?U?C? ???I\" /></a>");
				} else {
					document.write("<a href=\"javascript: oc(" + nodeValues[0] + ", 0);\"><img id=\"join" + nodeValues[0] + "\" src=\"inc/units/Dir/img/");
						if (ino) document.write("minus");
						else document.write("plus");
					document.write(".gif\" align=\"absbottom\" alt=\"?E?/?U?C? ???I\" /></a>");
				}
			} else {
				if (ls) document.write("<img src=\"inc/units/Dir/img/join.gif\" align=\"absbottom\" alt=\"\" />");
				else document.write("<img src=\"inc/units/Dir/img/joinbottom.gif\" align=\"absbottom\" alt=\"\" />");
			}
			document.write("<a href=\"" + nodeValues[3] + "\" onmouseover=\"window.status='" + nodeValues[2] + "';return true;\" onmouseout=\"window.status=' ';return true;\">");
			if (hcn) {
				document.write("<img id=\"icon" + nodeValues[0] + "\" src=\"inc/units/Dir/img/folder")
					if (ino) document.write("open");
				document.write(".gif\" align=\"absbottom\" alt=\"???I\" />");
			} else document.write("<img id=\"icon" + nodeValues[0] + "\" src=\"inc/units/Dir/img/page.gif\" align=\"absbottom\" alt=\"???E\" />");
			document.write(nodeValues[2]);
			document.write("</a><br />");
			if (hcn) {
				document.write("<div id=\"div" + nodeValues[0] + "\"");
					if (!ino) document.write(" style=\"display: none;\"");
				document.write(">");
				addNode(nodeValues[0], recursedNodes);
				document.write("</div>");
			}

			recursedNodes.pop();
		}
	}
}
function oc(node, bottom) {
	var theDiv = document.getElementById("div" + node);
	var theJoin	= document.getElementById("join" + node);
	var theIcon = document.getElementById("icon" + node);

	if (theDiv.style.display == 'none') {
		if (bottom==1) theJoin.src = icons[3].src;
		else theJoin.src = icons[2].src;
		theIcon.src = icons[5].src;
		theDiv.style.display = '';
	} else {
		if (bottom==1) theJoin.src = icons[1].src;
		else theJoin.src = icons[0].src;
		theIcon.src = icons[4].src;
		theDiv.style.display = 'none';
	}
}
if(!Array.prototype.push) {
	function array_push() {
		for(var i=0;i<arguments.length;i++)
			this[this.length]=arguments[i];
		return this.length;
	}
	Array.prototype.push = array_push;
}
if(!Array.prototype.pop) {
	function array_pop(){
		lastElement = this[this.length-1];
		this.length = Math.max(this.length-1,0);
		return lastElement;
	}
	Array.prototype.pop = array_pop;
}

/******** clear textbox ************/
function clear_textbox()
{
if (document.text_form.u_input.value == " Enter Your Search Here ")
document.text_form.u_input.value = "";
} 
/************end clear box ***********/

  /* check email address *********************/
  
  var good;
function checkEmailAddress(field) {
// the following expression must be all on one line...
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid e-mail address.');
field.focus();
field.select();
good = false;
   }
}
u = window.location;
m = "I thought this might interest you...";
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.address);
if (good) {
// the following expression must be all on one line...
window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" "+u;
   }
}
//  End -->
/************end check email *******/
