// JavaScript Function Library
VENDOR = ''

// Check DOM support
if 	(document.getElementById)	DOMS = 3	// Supports Web Standard
else if	(document.all)		 	DOMS = 2	// Supports MS document.all
else if	(document.layers)	 	DOMS = 0	// Supports NS layers
else				 	DOMS = 0;	// No DOM gateway support

// Return DOM object pointer for appropriate DOM interface
function getObj(s) {
  switch(DOMS) { 
    case 1: return(document[s]);
    case 2: return(document.all[s]);
    case 3: return(document.getElementById(s));
  }
}

// Reset input field color when changed
function fldReset() { this.style.backgroundColor=''; this.style.borderColor='#bbbbbb'; }

// display error message, color error field, set 
function setErm(f,m) {
  alert(m);
  f.onchange = fldReset;
  f.style.backgroundColor="#ff9"; 
  f.style.borderColor="#f00"; 
  f.focus(); 
  return false;
}

// Check mailto form field(s) for required input, When a field is found with missing input,
// alert user, set field pink, and set focus to it.
function chkMailform(s) {
   if (s.name.value=='')		return setErm(s['name'],	'You must enter your name to continue.')
   if (s.street.value=='')		return setErm(s['street'],	'You must enter your street address to continue.')
   if (s.city.value=='')		return setErm(s['city'],	'You must enter your city to continue.')
   if (s.state.value=='')		return setErm(s['state'],	'You must enter your state to continue.')
   if (s.zipcode.value=='')		return setErm(s['zipcode'],	'You must enter your zipcode to continue.')
   if (s.country.value=='')		return setErm(s['country'],	'You must enter your country of address to continue.')
   if (s.dayphone.value=='')		return setErm(s['dayphone'],	'You must enter your daytime phone number to continue.')
// if (s.evephone.value=='')		return setErm(s['evephone'],	'You must enter your evening phone number to continue.')
// if (s.fax.value=='')		return setErm(s['fax'],	'You must enter your fax number to continue.')
   if (s.email.value=='')		return setErm(s['email'],	'You must enter your email address to continue.');
   if (s.email.value.indexOf('@')==-1)	return setErm(s['email'],	'Your E-mail address appears to be invalid. Please check!');
   if (s.email.value.indexOf('.')==-1)	return setErm(s['email'],	'Your E-mail address appears to be invalid. Please check!');
   return true;
}

function imgRot(s,pt,tm) {
  document.images[s].src = "images/"+s+"/"+pt+".jpg";
  ++pt;
  if (pt>5) { pt = 1 };
  setTimeout('imgRot("' + s + '",' + pt + ',' + tm + ')',tm);
}

function editCalendar(eid) {
  window.open('admin_edit_calendar.php?eid='+eid,'calendar','height=500,width=500,scrollbars,resizable');
  return false;
}
function editMessage(msgid) {
  window.open('admin_edit_message.php?msgid='+msgid,'message','height=500,width=500,scrollbars,resizable');
  return false;
}

function editNewsletter(nid) {
  window.open('admin_edit_newsletter.php?nid='+nid,'newletter','height=520,width=580,scrollbars');
  return false;
}

function editBulletin(nid) {
  window.open('admin_edit_bulletin.php?nid='+nid,'bulletin','height=520,width=580,scrollbars');
  return false;
}

function editStaff(staffid) {
  window.open('admin_edit_staff.php?staffid='+staffid,'staff','height=500,width=550,scrollbars');
  return false;
}
