function viewArt() { window.open('view-paintings.html','','height=500,width=660'); }

function admCont(s,qmsg) {
  if (s[s.selectedIndex].value=='delete') return(confirm("Are you sure you want to delete this " + qmsg + "?"));
  return true;
}

// 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);
  if (f.style) {
    f.onchange = fldReset;
    f.style.backgroundColor="#ff9"; 
    f.style.borderColor="#f00"; 
    f.focus(); 
  }
  return false;
}

// Check field(s) for required input, When a field is found with missing input,
// alert user, set field pink, and set focus to it.
function chkRqrd(s) {
  if (arguments.length<2) return true
  for ( var i = 1; i < arguments.length; i++ ) {
    fptr = s[arguments[i]];								// Get form field pointer
    if ( fptr.value=='' ) return setErm(fptr,'You must enter your name to continue.')	// Check field for content
  }
  return true;
}

function chkEmail(s) {
  if (s.indexOf('@')==-1) return false;
  if (s.indexOf('.')==-1) return false;
  return true;
}

function genFrq(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11) { this.firstname=s1; this.lastname=s2; this.street=s3; this.city=s4; this.state=s5; this.zipcode=s6; this.country=s7; this.dayphone=s8; this.evephone=s9; this.fax=s10; this.email=s11; }

// 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 chkContact(s,r) {
  reqfld = new Object();
  reqfld["none"]	= new genFrq(false,false,false,false,false,false,false,false,false,false,false);
  reqfld["standard"]	= new genFrq(true,true,true,true,true,true,false,true,false,false,true);
  reqfld["membership"]	= new genFrq(true,true,true,true,true,true,false,false,false,false,true);
  if ((reqfld[r].firstname)&&(s.firstname.value==''))		return setErm(s['firstname'],	'You must enter your first name to continue.')
  if ((reqfld[r].lastname) &&(s.lastname.value==''))		return setErm(s['lastname'],	'You must enter your last name to continue.')
  if ((reqfld[r].street)   &&(s.street.value==''))		return setErm(s['street'],	'You must enter your street address to continue.')
  if ((reqfld[r].city)     &&(s.city.value==''))		return setErm(s['city'],	'You must enter your city to continue.')
  if ((reqfld[r].state)    &&(s.state.value==''))		return setErm(s['state'],	'You must enter your state to continue.')
  if ((reqfld[r].zipcode)  &&(s.zipcode.value==''))		return setErm(s['zipcode'],	'You must enter your zipcode to continue.')
  if ((reqfld[r].dayphone) &&(s.dayphone.value==''))		return setErm(s['dayphone'],	'You must enter your day time phone number to continue.')
  if ((reqfld[r].email)    &&(s.email.value==''))		return setErm(s['email'],	'You must enter your email address to continue.')
  if ((reqfld[r].email)    &&(chkEmail(s.email.value)==false))	return setErm(s['email'],	'Your E-mail address appears to be invalid. Plaese check!')
  return true;
}

// 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 chkBid(s) {
  if (s.firstname.value=='')		return setErm(s['firstname'],		'You must enter your first name to continue.')
  if (s.lastname.value=='')		return setErm(s['lastname'],		'You must enter your last 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.dayphone.value=='')		return setErm(s['dayphone'],		'You must enter your day time phone number to continue.')
  if (s.email.value=='')		return setErm(s['email'],		'You must enter your email address to continue.')
  if (chkEmail(s.email.value)==false)	return setErm(s['email'],		'Your E-mail address appears to be invalid. Plaese check!')
  if (s.bid.value=='')			return setErm(s['bid'],			'You must enter a bid value before you can complete.')
  return true;
}

function chkDonMoney(s) {
  if (s.amount.value=='')		return setErm(s['amount'],		'You must enter a donation amount to continue.')
  if (!chkContact(s,"standard")) return false;
  return true;
}

function chkDonSponsor(s) {
  if ( (!s.donator[0].checked) &&
       (!s.donator[1].checked) &&
       (!s.donator[2].checked) &&
       (!s.donator[3].checked) ) return setErm(s['donator'],		'You must check a sponsor type to continue.')
  if ( (!s.donlevel[0].checked) &&
       (!s.donlevel[1].checked) &&
       (!s.donlevel[2].checked) &&
       (!s.donlevel[3].checked) ) return setErm(s['donlevel'],		'You must select a sponsorship to continue.')
  if (s.amount.value=='')		return setErm(s['amount'],		'You must enter a donation amount to continue.')
  if (!chkContact(s,"standard")) return false;
  return true;
}

function chkDonMember(s) {
  if ( (!s.membership[0].checked) &&
       (!s.membership[1].checked) &&
       (!s.membership[2].checked) &&
       (!s.membership[3].checked) &&
       (!s.membership[4].checked) &&
       (!s.membership[5].checked) ) return setErm(s['membership'],		'You must check a membership type to continue.')
  if (!chkContact(s,"membership")) return false;
  return true;
}

function chkDonitem(s) {
  if (!chkContact(s)) return false;
  if (s.item.value=='')			return setErm(s['item'],		'What kind of merchandise?')
  if (s.estval.value=='')		return setErm(s['estval'],		'What is it\'s stimated value?')
  return true;
}

function chkpaybyEcard(s) {
  if (s.ccname.value=='')		return setErm(s['ccname'],	'You must enter the cardholder name to continue.')
  if (s.ccstreet.value=='')		return setErm(s['ccstreet'],	'You must enter the cardholder street address to continue.')
  if (s.cccity.value=='')		return setErm(s['cccity'],	'You must enter the cardholder city to continue.')
  if (s.ccstate.value=='')		return setErm(s['ccstate'],	'You must enter the cardholder state to continue.')
  if (s.cczipcode.value=='')		return setErm(s['cczipcode'],	'You must enter the cardholder zipcode to continue.')
  if (s.cctype.selectedIndex==0)	return setErm(s['cctype'],	'You must indicate the Credit Card type continue.')
  if (s.ccnumber.value=='')		return setErm(s['ccnumber'],	'You must enter the Credit Card Number to continue.')
  var Tar = s.cctype[s.cctype.selectedIndex].value.split("|");
  if ((s.ccseccode.value=='') && (Tar[1]=="1")) {
      	 return setErm(s['ccseccode'],'You must enter your Credit Card Security Code to continue.')
      }
  if (s.ccexpmo.selectedIndex==0)	return setErm(s['ccexpmo'],	'You must indicate the Credit Card expiration month to continue.')
  if (s.ccexpyr.selectedIndex==0)	return setErm(s['ccexpyr'],	'You must indicate the Credit Card expiration year to continue.')
  return true;
}

function chkpaybyPh(s) {
  if (s.phnumber.value=='')		return setErm(s['phnumber'],	'You must enter a phone number to continue.')
  if (s.Time_to_Call.value=='')		return setErm(s['Time_to_Call'],'You must enter a time to call to continue.')
//  if (s.AMorPM.selectedIndex==0)	return setErm(s['AMorPM'],	'You must indicate Am or PM type continue.')
  if (s['phdate[m]'].value=='')		return setErm(s['phdate[m]'],	'You must indicate month to call to continue.')
  if (s['phdate[d]'].value=='')		return setErm(s['phdate[d]'],	'You must indicate day of month to call to continue.')
  if (s['phdate[y]'].value=='')		return setErm(s['phdate[y]'],	'You must indicate year to call to continue.')
  if (s['phdate[y]'].value<2003)	return setErm(s['phdate[y]'],	'An invalid year date has been specifed. Please correct to continue.')
}

function allClients() {
  var sz = document.distrib['MM_EMAILTO[]'].length;
  for (var i=0; i<sz; i++) document.distrib['MM_EMAILTO[]'][i].checked=true;
}

function distCheck() {
  if (document.distrib['MM_EMAILTO[]']==undefined) return alert("You must define a distribution list with at\nleast 1 email recipent to continue.");
  var sz = document.distrib['MM_EMAILTO[]'].length;
  if (sz==undefined)  { if (document.distrib['MM_EMAILTO[]'].checked==true) return true; }
  else for (var i=0; i<sz; i++) if (document.distrib['MM_EMAILTO[]'][i].checked==true) return true;
  alert("You must select at least 1 email recipent to continue.");
  return false;
}

function chkContEdit(s) {
  if (s.subject.selectedIndex==0)	return setErm(s['subject'],	'You must indicate the Type of Contact to continue.')
}

// No unsolicited contact toggled. Process other contact options
function chkNodist(s) { return ((s.form.nodist.checked)?false:true); }

// No unsolicited contact toggled. Process other contact options
function setNodist(s) {
  if (!s.checked) return;
  var t = s.form;
  t.adist.checked = false;
  t.edist.checked = false;
  t.gdist.checked = false;
  t.ndist.checked = false;
}
