var LastValue;
var bShow;
var sShow;
var sImgID;

function ClickPop( sFile, iWidth, iHeight ) {
  // You can find more info here: http://www.htmlgoodies.com/beyond/openwin.html
  //window.open (sFile, 'newwindow', config='height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
	window.open('' + sFile,'clickpop','toolbar=0,location=0,status=0,menubar=0,scrollbars=2,resizable=0,top=200,left=274,width='+iWidth+',height='+iHeight);
}

function ClickPopCenter( sFile, popWidth, popHeight ) {
  var iWidth = screen.availWidth;
  var iHeight = screen.availHeight;
  var leftPos = (iWidth-popWidth)/2, topPos = (iHeight-popHeight)/2;
  // You can find more info here: http://www.htmlgoodies.com/beyond/openwin.html
  //window.open (sFile, 'newwindow', config='height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
  window.open(sFile ,'popup','width=' + popWidth + ',height=' + popHeight + ',top=' + topPos + ',left=' + leftPos + 'fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no' );
}

function ClickPopCenterFull( sFile, popWidth, popHeight ) {
  var iWidth = screen.availWidth;  var iHeight = screen.availHeight;
  popWidth = screen.availWidth; popHeight = screen.availHeight;

  var leftPos = (iWidth-popWidth)/2, topPos = (iHeight-popHeight)/2;
  // You can find more info here: http://www.htmlgoodies.com/beyond/openwin.html
  //window.open (sFile, 'newwindow', config='height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
  window.open(sFile ,'popup','width=' + popWidth + ',height=' + popHeight + ',top=' + topPos + ',left=' + leftPos + 'fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no' );
}

function ClickPopCenterFullTrap( sFile, popWidth, popHeight ) {
  var NewWinHeight = 200; var NewWinWidth = 200;
  var NewWinPutX = 10; var NewWinPutY = 10;
  TheNewWin = window.open(sFile,'TheNewpop','fullscreen = yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
  TheNewWin.resizeTo(NewWinHeight, NewWinWidth);
  TheNewWin.moveTo(NewWinPutX, NewWinPutY);
}

  var intMenuOpen = 0;
function toggleDisplay( objMenuGroup )
{
  var objSubMenuGroup;
  eval("objSubMenuGroup = sub" + objMenuGroup.id + ";");

  if ( intMenuOpen != 0 && objMenuGroup.id != "menuGroup" + intMenuOpen )
  {
    eval( "menuGroup" + intMenuOpen ).style.backgroundColor = '#002c52';
    eval( "submenuGroup" + intMenuOpen ).style.display = 'none';
  }

  if ( objSubMenuGroup.style.display == "" )
  {
    objSubMenuGroup.style.display = "none";
    intMenuOpen = 0;
  }
  else
  {
    objSubMenuGroup.style.display = "";
    intMenuOpen = objMenuGroup.id.substr(9,objMenuGroup.id.length);
  }
}

function ChgBG(obj,color){
// 	Menu - Highlights the background of the menu items when you
//	mouse over them.

  if ( obj.id.substr(0,9) == "menuGroup"  &&  eval( "sub" + obj.id + ".style.display" ) == "" && color == "#002c52")
  {
    return;
  }

	if (color == 'rev')
		eval(obj).style.backgroundColor = LastValue;
	else {
		LastValue = eval(obj).style.backgroundColor;
		eval(obj).style.backgroundColor = color;
	}
}

/*
function MouseoverSubMenu(obj,bSwitch) {
//	Menu - Does the mouseover effects for the submenus.

	sBackgroundOn = '1E4C7B';		// 336699
	sTextOn = 'FFFFFF';
	sTextOff = 'FFFFFF';
	if (bSwitch) {
		ChgBG(obj, sBackgroundOn);
		eval(obj).style.color = sTextOn;
	} else {
		ChgBG(obj, 'rev');
		eval(obj).style.color = sTextOff;
	}
}
*/

function findTag(eItem, eTag) {
	var objTag = new Object();
	objTag = eItem.all.tags(eTag);
	return objTag;
}

function NavClick(eItem){
	top.location.href= findTag(eItem, "A").item(0).getAttribute("HREF")
}

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

/* object - image to be faded (actual object, not name);
 * destop - destination transparency level (ie 80, for mostly solid)
 * rate   - time in milliseconds between trasparency changes (best under 100)
 * delta  - amount of change each time (ie 5, for 5% change in transparency)
 */

function nereidFade(object, destOp, rate, delta){
	if (!document.all)
		return;
  if (object != "[object]"){  //do this so I can take a string too
      setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
      return;
  }

  clearTimeout(nereidFadeTimers[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){
      nereidFadeObjects[object.sourceIndex]=object;
      nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
  }
}

function stdValidate( form )
{
  for ( var e = 0; e < form.elements.length; e++ ) {
    var element = form.elements[e];

    if ( element.required != "false" )
    {
      if (element.type == 'text' || element.type == 'textarea' ||
          element.type == 'password' || element.type == 'file' ) {
        if (element.value == '') {
          //alert('Please fill out the text field');
          alert( 'Please fill out all required fields' );
          element.focus();
          return false;
        }
      }
      else if (element.type.indexOf('select') != -1) {
        if ( element.selectedIndex == -1 || element.selectedIndex == 0 ) {
          //alert('Please select a value of the select field');
          alert( 'Please fill out all required fields' );
          element.focus();
          return false;
        }
      }
      else if (element.type == 'radio') {
        var group = form[element.name];
        var checked = false;
        if (!group.length)
          checked = element.checked;
        else
          for (var r = 0; r < group.length; r++)
            if ((checked = group[r].checked))
              break;
        if (!checked) {
          //alert('Please check one of the radio buttons');
          alert( 'Please fill out all required fields' );
          element.focus();
          return false;
        }
      }
      else if (element.type == 'checkbox') {
        var group = form[element.name];
        if (group.length) {
          var checked = false;
          for (var r = 0; r < group.length; r++)
            if ((checked = group[r].checked))
              break;
          if (!checked) {
            //alert('Please check one of the checkboxes');
            alert( 'Please fill out all required fields' );
            element.focus();
            return false;
          }
        }
      }
    }
  }
  return true;
}