function echomail(acc,dom){document.write(acc+"@"+dom)}
function mail2(acc,dom){location.href="mailto:"+acc+"@"+dom}


function showWin(u,n)
{f=(n=="HRFusion2"?"top=20,left=20":"top=0,left=0")
  +",width=620,height=650,location=no,menubar=no,titlebar=no,status=no,toolbar=no,"
  +"scrollbars=yes,"
  +"resizable=no";
// if(n==undefined) n="HRFusion";
 hwnd=window.open(u,n,f);
 //hwnd.focus();
}
function popup(url){showWin(url,"HRFusion")}



function vContactForm()
{var msg="";
 var obj;
 var form=document.f_contact;
 form.submit.disabled=true;
 if(trim(form.vName.value)=="")
   {msg="Please tell us your name, the way you want us to address you!";
    obj=form.vName;
   }
 else if(!emailCheck(form.vEmail.value))
   {msg="Please specify a valid e-mail address where you want to receive the reply!";
    obj=form.vEmail;
   }
 else if(trim(form.vSubject.value)==""||form.vSubject.value[0]=="-")
   {msg="Please choose a subject for your message!";
    obj=form.vSubject;
   }
 else if(trim(form.vMsg.value)=="")
   {msg="Please type in the message you want to send to us!";
    obj=form.vMsg;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    form.submit.disabled=false;
    return false;
   }
 return true;
}

function vSendpageForm()
{var msg="";
 var obj;
 var form=document.f_sendpage;
 if(processingForm)
   {alert('The form is being processed.');
    return false;
   }
 processingForm=true;
 if(trim(form.vFromName.value)=="")
   {msg="Please enter your name.\nThe invitation will be signed using this name.";
    obj=form.vFromName;
   }
 else if(!emailCheck(form.vFromEmail.value))
   {msg="Please enter your e-mail address and make sure it is correct.\nThis is useful if your friend wants to reply to your invitation.";
    obj=form.vFromEmail;
   }
 else if(trim(form.vToName.value)=="")
   {msg="Please enter your friend's name.\nThe invitation will be addressed to this name.";
    obj=form.vToName;
   }
 else if(!emailCheck(form.vToEmail.value))
   {msg="Please enter your friend's e-mail address and make sure it is correct.\nThe invitation will be sent to this address.";
    obj=form.vToEmail;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    processingForm=false;
    return false;
   }
 return true;
}

function vSubscribeForm()
{var msg="";
 var obj;
 var form=document.f_subscribe;
 form.submit.disabled=true;
 if(trim(form.vName.value)=="")
   {msg="Please tell us your name, the way you want us to address you!";
    obj=form.vName;
   }
 else if(!emailCheck(form.vEmail.value))
   {msg="Please specify a valid e-mail address where you want to receive the GatherIt! update alerts!";
    obj=form.vEmail;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    form.submit.disabled=false;
    return false;
   }
 return true;
}

function vMapDirForm()
{var msg="";
 var obj;
 var form=document.f_mapdir;
 if(trim(form.vAddress.value)=="")
   {msg="Please specify a street address to get directions from or to.";
    obj=form.vAddress;
   }
 else if(trim(form.vCity.value)=="")
   {msg="Please specify the city/town for the address to get directions from or to.";
    obj=form.vCity;
   }
 if(msg!="")
   {alert(msg);
    obj.focus();
    return false;
   }
 return true;
}

function vSearchForm()
{var msg="";
 var obj;
 var form=document.f_search;
 form.submit.disabled=true;
 if(trim(form.q.value).length<3)
   {msg="Please type in the keyword(s)!\nKeywords shorter than 3 letters are ignored.";
    obj=form.q;
   }
 if(msg!="")
   {alert(msg);
    form.submit.disabled=false;
    obj.focus();
    return false;
   }
 return true;
}

function vSearchForm2()
{var msg="";
 var obj;
 var form=document.f_search2;
 form.submit.disabled=true;
 if(trim(form.q.value).length<3)
   {msg="Please type in the keyword(s)!\nKeywords shorter than 3 letters are ignored.";
    obj=form.q;
   }
 if(msg!="")
   {alert(msg);
    form.submit.disabled=false;
    obj.focus();
    return false;
   }
 return true;
}



function trim(str)
{var first,last;
 for (first=0; first<str.length&&str.charCodeAt(first)==32; first++);
 for (last=str.length; last>first&&str.charCodeAt(last-1)==32; last--);
 return (last>first?str.substr(first,last-first):'');
}

function emailCheck(emailStr) {
emailStr=trim(emailStr);
if(emailStr=='')return false;
var emailPat=/^(.+)@(.+)\.(.{2,})$/;
var matchArray=emailStr.match(emailPat);
if (matchArray==null) return false;
return true;
}

function getObj(id,d)
{var i,o,d; if(!d) d=document;
 if(!(o=d[id])&&d.all) o=d.all[id];
 if(!o&&d.getElementById) o=d.getElementById(id);
 for(i=0;!o&&i<d.forms.length;i++) o=d.forms[i][id];
 for(i=0;!o&&d.layers&&i<d.layers.length;i++) o=getObj(id,d.layers[i].document);
 return o;
}

function preloadImages()
{var d=document;
 if(d.images)
   {if(!d._pi) d._pi=new Array();
    var i,j=d._pi.length,a=preloadImages.arguments;
    for(i=0;i<a.length;i++)
      {d._pi[j]=new Image; d._pi[j++].src=a[i];
      }
   }
}

function swapImages()
{var i,j=0,io,a=swapImages.arguments; document._soi=new Array;
 for(i=0;i<(a.length-1);i+=2)
   if((io=getObj(a[i]))!=null)
     {document._soi[j++]=io; if(!io.oSrc) io.oSrc=io.src; io.src=a[i+1];}
}

function restoreSwapImages()
{var i,io,a=document._soi;
 for(i=0;a&&i<a.length&&(io=a[i])&&io.oSrc;i++) io.src=io.oSrc;
}


var visItems=Array();
function toggleVisible(id)
{var obj=getObj(id),vis;
 vis=visItems[id]!=1;
 obj.style.display=vis?'':'none';
 visItems[id]=vis?1:0;
 return false;
}