/*
 * Hide email addresses
 */

function mailRef(linktext,email1,email2)
{
 document.write("<a href="+"mail"+"to:"+email1+"&#064;"+email2+
   ' title="Send mail'+' to '+linktext+'">'+linktext+"</"+"a>");
 return true;
}

function mailRef2(email1,email2)
{
 document.write("<a href="+"mail"+
   "to:"+email1+"&#064;"+email2+">"+email1+"&#064;"+email2+"</"+"a>");
 return true;
}

function nothing()
{
}

function createMailto()
{
 var sp = this.firstChild;
 var origtext = sp.innerHTML;
 var temp = sp.className.split('_');
 var dest = temp[0] + '@' + temp[1] + '.' + temp[2];

 var anchor = document.createElement('A');
 anchor.setAttribute('href','mailto:' + dest);
 if (this.className == 'mailref')
    var t = document.createTextNode(origtext);
 else
    var t = document.createTextNode(dest);
 anchor.appendChild(t);

 sp.removeChild(sp.firstChild);
 sp.appendChild(anchor);
 this.onmouseover = nothing;
}

function initMail()
{
 if (!(document.getElementById && document.createElement)) return;
 if (!document.getElementsByTagName) return;

 var aSpans = document.getElementsByTagName('span');

 for (var i = 0; i < aSpans.length; i++)
   {
    if ((aSpans[i].className == 'mailref') || (aSpans[i].className == 'mailref2'))
      {
       aSpans[i].onmouseover = createMailto;
      }
   } /* for each span */
} /* initMail */


/*
 * Standards-compliant Rollover Script
 * Author : Daniel Nolan
 * http://www.bleedingego.co.uk/webdev.php
 */

function initRollovers()
{
 if (!document.getElementById) return;

 var aPreLoad = new Array();
 var sTempSrc; /* global: src of currently rolled-over image */
 var aImages = document.getElementsByTagName('img');

 for (var i = 0; i < aImages.length; i++)
   {
    if (aImages[i].className == 'imgover')
      {
       var src = aImages[i].getAttribute('src');
       var ftype = src.substring(src.lastIndexOf('.'), src.length);
       var hsrc = src.replace(ftype, '_on'+ftype);

       aImages[i].setAttribute('hsrc', hsrc);

       aPreLoad[i] = new Image();
       aPreLoad[i].src = hsrc;

       aImages[i].onmouseover =
          function()
            {
             sTempSrc = this.getAttribute('src'); /* set the global */
             this.setAttribute('src', this.getAttribute('hsrc'));
            }

       aImages[i].onmouseout =
          function()
            {
             if (!sTempSrc)
                sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
             this.setAttribute('src', sTempSrc);
            }

      } /* if imgover */
   } /* for each image */
} /* initRollovers */

window.onload = function () { initRollovers(); initMail(); };
