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 ValidateWWC_Contact(theForm)
{
  if (theForm.Name.value == "")
  {
    alert("Please enter your Name.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length < 1)
  {
    alert("Please enter your Name.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Mailing_Address.value == "")
  {
    alert("Please enter your Mailing Address.");
    theForm.Mailing_Address.focus();
    return (false);
  }
  if (theForm.Mailing_Address.value.length < 1)
  {
    alert("Please enter your Mailing Address.");
    theForm.Mailing_Address.focus();
    return (false);
  }
  if (theForm.Phone.value == "")
  {
    alert("Please enter your Area Code & Phone.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Phone.value.length < 10)
  {
    alert("Please enter your Area Code & Phone.");
    theForm.Phone.focus();
    return (false);
  }
  if (!validateEmail(theForm.Email.value,1,1))
  {
  theForm.Email.focus();
  return false;
  }
  if (theForm.Class_Interest.value == "")
  {
    alert("Please indicate what classes your are interested in.");
    theForm.Class_Interest.focus();
    return (false);
  }
  if (theForm.Class_Interest.value.length < 1)
  {
    alert("Please indicate what classes your are interested in.");
    theForm.Class_Interest.focus();
    return (false);
  }
  return (true);
}

function ValidateG2GSurvey(theForm)
{
  if (theForm.Participant_Name.value == "")
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Participant_Name.focus();
    return (false);
  }
  if (theForm.Participant_Name.value.length < 1)
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Participant_Name.focus();
    return (false);
  }

  if (theForm.Participant_Phone.value == "")
  {
    alert("Please enter your Phone Number in \"Phone\" field.");
    theForm.Participant_Phone.focus();
    return (false);
  }
  if (theForm.Participant_Phone.value.length < 10)
  {
    alert("Please enter your Phone Number including area code in \"Phone\" field.");
    theForm.Participant_Phone.focus();
    return (false);
  }

  if (!validateEmail(theForm.Participant_Email.value,1,1))
  {
  theForm.Participant_Email.focus();
  return false;
  }
  return (true);
}

function ValidateBeads(theForm)
{
  if (theForm.Name.value == "")
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length < 1)
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Address.value == "")
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
  if (theForm.Address.value.length < 1)
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }
  if (theForm.City.value.length < 1)
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.Zip.value == "")
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }
  if (theForm.Zip.value.length < 5)
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Phone.value == "")
  {
    alert("Please enter your Phone Number in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Phone.value.length < 10)
  {
    alert("Please enter your Phone Number including area code in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }

  if (!validateEmail(theForm.Email.value,1,1))
  {
  theForm.Email.focus();
  return false;
  }

  return (true);
}


function ValidateDonation(theForm)
{
  if (theForm.Name.value == "")
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length < 1)
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Address.value == "")
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
  if (theForm.Address.value.length < 1)
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }
  if (theForm.City.value.length < 1)
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.Zip.value == "")
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }
  if (theForm.Zip.value.length < 5)
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Phone.value == "")
  {
    alert("Please enter your Phone Number in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Phone.value.length < 10)
  {
    alert("Please enter your Phone Number including area code in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }

  if (!validateEmail(theForm.Email.value,1,1))
  {
  theForm.Email.focus();
  return false;
  }
  return (true);
}

function ValidateG2G(theForm)
{
  if (theForm.Name.value == "")
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length < 1)
  {
    alert("Please enter your Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Organization.value == "")
  {
    alert("Please enter your Organization name in \"Organization\" field.");
    theForm.Organization.focus();
    return (false);
  }
  if (theForm.Organization.value.length < 1)
  {
    alert("Please enter your Organization name in \"Organization\" field.");
    theForm.Organization.focus();
    return (false);
  }
  if (theForm.Address.value == "")
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
  if (theForm.Address.value.length < 1)
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }
  if (theForm.City.value.length < 1)
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.Zip.value == "")
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }
  if (theForm.Zip.value.length < 5)
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Phone.value == "")
  {
    alert("Please enter your Phone Number in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Phone.value.length < 10)
  {
    alert("Please enter your Phone Number including area code in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }

  if (!validateEmail(theForm.Email.value,1,1))
  {
  theForm.Email.focus();
  return false;
  }
  return (true);
}

function ValidateTraining(theForm)
{
  if (theForm.paymentOption.selectedIndex == 0)
  {
    alert("Please choose a \"Payment Method\".");
    theForm.paymentOption.focus();
    return (false);
  }
  if (theForm.Name.value == "")
  {
    alert("Please enter your Full Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length < 1)
  {
    alert("Please enter your Full Name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Address.value == "")
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }
  if (theForm.Address.value.length < 1)
  {
    alert("Please enter your Address in \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }
  if (theForm.City.value.length < 1)
  {
    alert("Please enter your City in \"City\" field.");
    theForm.City.focus();
    return (false);
  }

  if (theForm.Zip.value == "")
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }
  if (theForm.Zip.value.length < 5)
  {
    alert("Please enter your Zip Code in \"Zip\" field.");
    theForm.Zip.focus();
    return (false);
  }

  if (theForm.Phone.value == "")
  {
    alert("Please enter your Phone Number in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Phone.value.length < 10)
  {
    alert("Please enter your Phone Number including area code in \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }

  if (!validateEmail(theForm.Email.value,1,1))
  {
  theForm.Email.focus();
  return false;
  }

  if (theForm.Reason.value == "")
  {
    alert("Please enter a value in the \"Reason for Training\" field.");
    theForm.Reason.focus();
    return (false);
  }
  if (theForm.Reason.value.length < 1)
  {
    alert("Please enter a value in the \"Reason for Training\" field.");
    theForm.Reason.focus();
    return (false);
  }
  return (true);
}

function ValidateLink(theForm)
{
  if (theForm.cattitle.value == "")
  {
    alert("Please enter the a category in the \"Category\" field.");
    theForm.cattitle.focus();
    return (false);
  }
  if (theForm.cattitle.value.length < 1)
  {
    alert("Please enter the a category in the \"Category\" field.");
    theForm.cattitle.focus();
    return (false);
  }
  if (theForm.title.value == "")
  {
    alert("Please enter the site title in the \"Title of Web Site\" field.");
    theForm.title.focus();
    return (false);
  }
  if (theForm.title.value.length < 1)
  {
    alert("Please enter the site title in the \"Title of Web Site\" field.");
    theForm.title.focus();
    return (false);
  }
  if (theForm.url.value == "")
  {
    alert("Please enter a valid web address in the \"URL\" field.");
    theForm.url.focus();
    return (false);
  }
  if (theForm.url.value.length < 7)
  {
    alert("Please enter a valid web address in the \"URL\" field.");
    theForm.url.focus();
    return (false);
  }
  if (theForm.desc.value == "")
  {
    alert("Please enter a description of the site in the \"Site Description\" field.");
    theForm.desc.focus();
    return (false);
  }
  if (theForm.desc.value.length < 1)
  {
    alert("Please enter a description of the site in the \"Site Description\" field.");
    theForm.desc.focus();
    return (false);
  }
  return (true);
}

function ValidateContact(theForm)
{
  if (theForm.Name.value == "")
  {
    alert("Please enter your name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length < 1)
  {
    alert("Please enter your name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (!validateEmail(theForm.Email.value,1,1))
  {
  theForm.Email.focus();
  return false;
  }
  if (theForm.Message.value == "")
  {
    alert("Please enter your question or comment in the \"Message\" field.");
    theForm.Message.focus();
    return (false);
  }
  if (theForm.Message.value.length < 1)
  {
    alert("Please enter your question or comment in the \"Message\" field.");
    theForm.Message.focus();
    return (false);
  }
  if (theForm.strCAPTCHA.value == "")
  {
    alert("Please enter a value for the \"Verification Characters\" field.");
    theForm.strCAPTCHA.focus();
    return (false);
  }  
  return (true);
}

function ValidateVolunteer(theForm)
{
  if (theForm.Name.value == "")
  {
    alert("Please enter your name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.Name.value.length < 1)
  {
    alert("Please enter your name in \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (!validateEmail(theForm.Email.value,1,1))
  {
  theForm.Email.focus();
  return false;
  }
  if (theForm.Phone.value == "")
  {
    alert("Please enter a valid phone number including area code in the \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }
  if (theForm.Phone.value.length < 10)
  {
    alert("Please enter a valid phone number including area code in the \"Phone\" field.");
    theForm.Phone.focus();
    return (false);
  }

  if (theForm.Message.value == "")
  {
    alert("Please enter your question or comment in the \"Message\" field.");
    theForm.Message.focus();
    return (false);
  }
  if (theForm.Message.value.length < 1)
  {
    alert("Please enter your question or comment in the \"Message\" field.");
    theForm.Message.focus();
    return (false);
  }
  return (true);
}

// a class hover fade
startColor = "#9932CC"; // MouseOut link color
endColor = "#5E446D"; // MouseOver link color

stepIn = 20; // delay when fading in
stepOut = 20; // delay when fading out

autoFade = false;
sloppyClass = true;

hexa = new makearray(16);
for(var i = 0; i < 10; i++)
hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";

document.onmouseover = domouseover;
document.onmouseout = domouseout;

startColor = dehexize(startColor.toLowerCase());
endColor = dehexize(endColor.toLowerCase());

var fadeId = new Array();

function dehexize(Color){
var colorArr = new makearray(3);
for (i=1; i<7; i++){
for (j=0; j<16; j++){
if (Color.charAt(i) == hexa[j]){
if (i%2 !=0)
colorArr[Math.floor((i-1)/2)]=eval(j)*16;
else
colorArr[Math.floor((i-1)/2)]+=eval(j);
}
}
}
return colorArr;
}

function domouseover() {
if(document.all){
var srcElement = event.srcElement;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(startColor,endColor,srcElement.uniqueID,stepIn);
}
}

function domouseout() {
if (document.all){
var srcElement = event.srcElement;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(endColor,startColor,srcElement.uniqueID,stepOut);
}
}

function makearray(n) {
this.length = n;
for(var i = 1; i <= n; i++)
this[i] = 0;
return this;
}

function hex(i) {
if (i < 0)
return "00";
else if (i > 255)
return "ff";
else
return "" + hexa[Math.floor(i/16)] + hexa[i%16];}

function setColor(r, g, b, element) {
var hr = hex(r); var hg = hex(g); var hb = hex(b);
element.style.color = "#"+hr+hg+hb;
}

function fade(s,e, element,step){
var sr = s[0]; var sg = s[1]; var sb = s[2];
var er = e[0]; var eg = e[1]; var eb = e[2];

if (fadeId[0] != null && fade[0] != element){
setColor(sr,sg,sb,eval(fadeId[0]));
var i = 1;
while(i < fadeId.length){
clearTimeout(fadeId[i]);
i++;
}
}

for(var i = 0; i <= step; i++) {
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step);
}
fadeId[0] = element;
}

// form button rollover
function ClassNew(obj, new_style) {
    obj.className = new_style;
}

// default status message

defaultStatus="connections for positive change - citrine health";

// scramble email addresses

var stext;
var user;
var domain;
var suffix;
function jemail(stext, user, domain, suffix){
document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + stext + '</a>');}

//if (document.all||document.getElementById)
//document.write(cssdefinition)
function over_effect(e,state, bgcolor){
if (document.all)
source4=event.srcElement
else if (document.getElementById)
source4=e.target
if (source4.className=="menuitems"){
source4.style.borderStyle=state
source4.style.backgroundColor=bgcolor
}
else{
while(source4.tagName!="DIV"){
source4=document.getElementById? source4.parentNode : source4.parentElement
if (source4.className=="menuitems"){
source4.style.borderStyle=state
source4.style.backgroundColor=bgcolor
}
}
}
}

function validateEmail(addr,man,db)
{
 addr = addr.toLowerCase()
  if (addr == '' && man) {
     if (db) alert('valid email address is required');
     return false;
  }
  var invalidChars = '\/\'\\ ";,:?!()[]\{\}^|';
  for (i=0; i<invalidChars.length; i++) {
     if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
        if (db) alert('email address contains invalid characters');
        return false;
     }
  }
  for (i=0; i<addr.length; i++) {
     if (addr.charCodeAt(i)>127) {
        if (db) alert("email address contains invalid non ascii characters.");
        return false;
     }
  }
  var atPos = addr.indexOf('@',0);
  if (atPos == -1) {
     if (db) alert('email address must contain an @');
     return false;
  }
  if (atPos == 0) {
     if (db) alert('email address must not start with @');
     return false;
  }
  if (addr.indexOf('@', atPos + 1) > - 1) {
     if (db) alert('email address must contain only one @');
     return false;
  }
  if (addr.indexOf('.', atPos) == -1) {
     if (db) alert('email address must contain a period in the domain name');
     return false;
  }
  if (addr.indexOf('@.',0) != -1) {
     if (db) alert('period must not immediately follow @ in email address');
     return false;
  }
  if (addr.indexOf('.@',0) != -1){
     if (db) alert('period must not immediately precede @ in email address');
     return false;
  }
  if (addr.indexOf('..',0) != -1) {
     if (db) alert('two periods must not be adjacent in email address');
     return false;
  }
  var suffix = addr.substring(addr.lastIndexOf('.')+1);
  var validTLD = new Array("com","net","org","edu","int","mil","gov","arpa","biz","aero","name","coop","info","pro","museum","ac","ad","ae","af","ag","ai","al","am","an","ao","aq","ar","as","at","au","aw","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","cr","cu","cv","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","eh","er","es","et","fi","fj","fk","fm","fo","fr","ga","gd","ge","gf","gg","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it","je","jm","jo","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","mg","mh","mk","ml","mm","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","st","sv","sy","sz","tc","td","tf","tg","th","tj","tk","tm","tn","to","tp","tr","tt","tv","tw","tz","ua","ug","uk","um","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","ye","yt","yu","za","zm","zw")
  var foundTLD = 0;
    for (var loopCounter=0; loopCounter<(validTLD.length); loopCounter++)
      {
        if (validTLD[loopCounter] == suffix) {foundTLD++;}
      }
    if (!(foundTLD > 0)) {
      if (db) alert('invalid Top Level Domain (i.e., domain name suffix - *.com) in email address');
      return false;
      }
    {
  }
return true;
}


var win2= null;
function NewWindow2(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=yes';
  win2=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win2.window.focus();}
}
