// to close the window
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//called by showhidelayers to find the correct object
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;
}

//show and hide layers
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//open popup window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//opens window and goes to link selected in combo box
function MM_openBrWindow2(theURL,winName,features,obj) { //v2.0
if (window.document.form1.elements[obj].selectedIndex >0) 
{
var the_select = window.document.form1.elements[obj];
var the_index = the_select.selectedIndex;
var the_selected = (the_select.options[the_index].value);
	window.document.form1.elements[obj].selectedIndex =0
  window.open(the_selected,winName,features);
}
}

//Enforce max # of characters script- by javascriptkit.com
//Visit JavaScript Kit (http://www.javascriptkit.com) for script
//limit is an integer representing max # of characters form element accepts
function enforcechar(what,limit){
if (what.value.length>limit) {
alert("Please restrain your input to " + limit + " or fewer characters!")
return false}
}

//oblige choice of item in select drop down list
function confirm_dropdown(obj,msg)
{
// Check to see if dropdown value is first choice
if (document.forms[0].elements[obj].selectedIndex == 0)
{
// If first choice is selected display alert box
alert("Please select " + msg);
// Focus on dropdown menu after OK is clicked from alert box
document.forms[0].elements[obj].focus();
return (false);
}
// A choice other than the first was selected so continue processing 
return (true);
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors)
	{ alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
	return (false);
	}
	return (true);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function selectUser() {
	document.all('userForm').submit();
}

function showAlert(aMessage) {
	alert(aMessage);
}

function selectRole() {
	document.all('userForm').submit();
}


function KIA_toggleLayers() { 
  var i,v,obj,args=KIA_toggleLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style) {
        obj=obj.style;
        if (obj.visibility=='visible')
          obj.visibility='hidden';
        else if (obj.visibility=='hidden')
          obj.visibility='visible';
      }
      else {
        if (obj.visibility=='show')
          obj.visibility='hide';
        else if (obj.visibility=='hide')
          obj.visibility='show';
      }
    }
  }
}


function toggleChecked(oElement) 
{ 
  oForm = oElement.form; 
  oElement = oForm.elements[oElement.name]; 
  if(oElement.length) 
  { 
    bChecked = oElement[0].checked; 
    for(i = 1; i < oElement.length; i++) 
      oElement[i].checked = bChecked; 
  } 
} 

function Bcheckall(bstate) {
	var theForm = document.form1;
	for(i=0; i<theForm.elements.length; i++)
	{
		if(theForm.elements[i].type=="checkbox")
		{
			theForm.elements[i].checked=bstate;
		}
	}
}

function Validate()
{
	var theForm = document.form1;
	var errC = "You must select at least one country or group\n";
	for(i=0; i<theForm.elements.length; i++)
	{
		if(theForm.elements[i].checked==true)
		{	
			var errC="";
		}
	}
	if ("" != errC )
	{
		alert(errC)}
		document.MM_returnValue = (errC=='');
	}


