var _useChallenge = false;
function validate_form(form) 
{
  if ( form.user_id.value == "" || form.password.value == "" )
  {
    alert( "Please enter a username and password." );
    return false;
  } 
  //short-cut if challenge/response is disabled.
  if ( !_useChallenge )
  {
    form.encoded_pw.value = base64encode( form.password.value );
    form.password.value =  "";
    return true;
  }

  var passwd_enc = calcMD5(form.password.value);
  var final_to_encode = passwd_enc + form.one_time_token.value;
  form.encoded_pw.value = calcMD5(final_to_encode);
  form.password.value = "";
  return true; 
}

function menu_bg_hi(obj) {
	obj.style.background = '#ECF1F6';
}

function menu_bg_lo(obj) {
	obj.style.background = '#FFF';
}

var mainContentOrig = 565;
var mainContentExp = 751;

function hide_siteNav() {
	objNav = document.getElementById('siteNav');
	objCont = document.getElementById('mainContent');
	objHref = document.getElementById('hrefFunc');
	objCell = document.getElementById('mcCell');	
	if(objNav.style.display == '') { 
		objNav.style.display = 'none';
		objCont.width = mainContentExp;
		objCell.align = 'center';
		objHref.innerHTML = 'Show Site Navigation';
	} else {
		objNav.style.display = '';
		objCont.width = mainContentOrig;
		objCell.align = '';
		objHref.innerHTML = 'Hide Site Navigation';
	}
}

function popUp(URL,width,height) {
	eval("window.open(URL, '" + name + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + "');");
}

function openWindow(URL, width, height){
	var newWin = window.open(URL,'_print','scrollbars=yes,resizable=1,width=' + width + ',height=' + height);
	if( !newWin ) { return true; } //popup blockers should not cause errors
	return false;
}
