<!--
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];}}
}
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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function popup (url) {
	window.open(url, 'popup', 'width=500,height=500,top=120 left=200,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no');
}
function popup2 (url) {
	window.open(url, 'popup', 'width=650,height=680,top=120 left=200,toolbar=no,location=no,directories=no,status=no,scrollbars=auto,resizable=yes,menubar=no');
}
function popup3 (url) {
	window.open(url, 'popup', 'width=400,height=300,top=120 left=200,toolbar=no,location=no,directories=no,status=no,scrollbars=auto,resizable=yes,menubar=no');
}

// popup window function variables
var strHelpOptions2 ="location=no";
strHelpOptions2 += ",toolbar=no";
strHelpOptions2 += ",menubar=no";
strHelpOptions2 += ",status=yes";
strHelpOptions2 += ",scrollbars=no";
strHelpOptions2 += ",resizable=no";
strHelpOptions2 += ",top=50";
strHelpOptions2 += ",left=50";
strHelpOptions2 += ",width=640";
strHelpOptions2 += ",height=480";

//popup window function
function openWin2(windowURL, windowname){
	mywindow=window.open(windowURL, windowname, strHelpOptions2)
}

// form validation
URL = window.location.href;
pg46 = (URL.indexOf('page=46') > -1); // true if URL contains page=46
pg36 = (URL.indexOf('page=36') > -1); // true if URL contains page=36

function checkForm(TheForm) {
  // url, title, description
  if (TheForm.f1.value.length == 0) {
   TheForm.f1.value = prompt("Please provide first name.");
   return false;
  }
  if (TheForm.f2.value.length == 0) {
   TheForm.f2.value = prompt("Please provide last name.");
   return false;
  }
  if (TheForm.f5.value.length == 0) {
   TheForm.f5.value = prompt("Please enter your email address.");
   return false;
  }
  if (pg46) {
  	if (TheForm.f6.value.length == 0) {
  	 TheForm.f6.value = prompt("Please enter your phone number.");
   	return false;
  	}
  }
  if (pg36) {
  	if (TheForm.f8.value.length == 0) {
  	 TheForm.f8.value = prompt("Please enter your street address.");
   	return false;
  	}
  }
  if (pg36) {
  	if (TheForm.f10.value.length == 0) {
  	 TheForm.f10.value = prompt("Please enter your city.");
   	return false;
  	}
  }
  if (pg36) {
  	if (TheForm.f11.value.length == 0) {
  	 TheForm.f11.value = prompt("Please enter your state.");
   	return false;
  	}
  }
  if (pg36) {
  	if (TheForm.f12.value.length == 0) {
  	 TheForm.f12.value = prompt("Please enter your zip code.");
   	return false;
  	}
  }
  return true;
}// end function checkalForm

// MISC FORM VALIDATION FUNCTIONS
// ******************************
function validateEmpty(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "A required field has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = 'Yellow';
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = 'Yellow';
        error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validateSelect(fld) {
    var error = "";
    
    if (fld.selectedIndex == 0 ) { 
        fld.style.background = 'Yellow';
        error = "Please make a selection from the list.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

// ***************************
// END OF MISC FORM VALIDATION FUNCTIONS

// validate Honor Wall Form
function validateWallHonor(theForm) {
var reason = "";

  reason += validateEmpty(theForm.f1);
  reason += validateEmpty(theForm.f2);
  reason += validateSelect(theForm.f3);
  reason += validateEmpty(theForm.f4);
  reason += validateEmpty(theForm.f5);
  reason += validateEmail(theForm.f6);
  reason += validateEmpty(theForm.f7);
  reason += validateSelect(theForm.f8);
      
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }

  return true;
}



// end function checkHonorWallForm


// newsrelease form validation
// regular expression to match required date format  


function validateNewsRelease(TheForm) {

re = /^\d{1,2}\/\d{1,2}\/\d{4}$/; 
 
  // publish date
  if (TheForm.date.value.length == 0) {
   alert("Please enter News Release Date.");
   return false;
  }
  if(TheForm.date.value.length != 0 && !TheForm.date.value.match(re)) { 
	alert("Invalid date format: " + TheForm.date.value); 
	TheForm.date.focus(); 
	return false; 
  } 
  return true;
}// end function checkalForm
//-->
