
function linkMouseOver( itm )
{
    itm.style.textDecoration = "underline";
    itm.style.color = "blue";
}

function linkMouseOut( itm )
{
    itm.style.textDecoration = "none";
    itm.style.color = "#000099";
}

function linkLaunch( url )
{
    if (document.images)
    {
        top.location.replace(url);
    }
    else
    {
        top.location.href = url;
    }    
}


   function openWindow(url, width, height)
   {
      if ((width + 30 > screen.width) || (height + 60 > screen.height))
      {
              width = width + 50;
                   if (width > screen.width - 80)
            width = screen.width - 80;
              height = height + 50;
         if (height > screen.height - 110)
            height = screen.height - 110;
         popupWin = window.open(url, "Image", "resizable,scrollbars,width=" + width + ",height=" + height + ",top=40,left=40,screenX=40,screenY=40");
      }
      else
      {
              width = width + 18;
              height = height + 26;
         popupWin = window.open(url, "Image", "resizable,width=" + width + ",height=" + height + ",top=40,left=40,screenX=40,screenY=40");
      }
   }

function reverse( theText )
    {
        var retString;
        var counter;

        retString = "";

        counter = theText.length;

        while( counter > 0 )
        {
            retString = retString + theText.substring( counter - 1, counter );
            counter--;
        }

        return retString;
    }


   var colourSelected = "blue";
   var colourHighlighted = "red";
   var colourNormal = "white";
   var curPageIdx = 0;
   var captionLength = 0;
   var pathRoot = "";

   function pic( picNumber, picWidth, picHeight, thumbWidth, thumbHeight, captionText )
   {
      this.picNumber = picNumber;
      this.picWidth = picWidth;
      this.picHeight = picHeight;
      this.thumbWidth = thumbWidth;
      this.thumbHeight = thumbHeight;
      this.captionText = captionText;
      captionLength = Math.max( captionLength, captionText.Length );
   }

   function showImage( idx )
   {
      selectedPage = "img" + picArray[curPageIdx].picNumber;
      imageName = "img" + picArray[idx].picNumber;

      document[selectedPage].style.borderColor = colourNormal;

      document['tgt'].src = fileName( picArray[idx].picNumber );
      document['tgt'].width = picArray[idx].picWidth;
      document['tgt'].height = picArray[idx].picHeight;

      document[imageName].style.borderColor = colourSelected;

      curPageIdx = idx;
   }

   function mouseover( idx )
   {
      if( curPageIdx != idx )
      {
         document["img" + picArray[idx].picNumber].style.borderColor = colourHighlighted;
      }
   }

   function mouseout( idx )
   {
      if( curPageIdx != idx )
      {
         document["img" + picArray[idx].picNumber].style.borderColor = colourNormal;
      }
   }

   function fileName( imageName )
   {
      return pathRoot + imageName + ".jpg"
   }

   function nextPage()
   {
      pageToShow = curPageIdx + 1;
      if( pageToShow >= picArray.length )
      {
         pageToShow = 0;
      }
      showImage( pageToShow );
   }

   function backPage()
   {
      pageToShow = curPageIdx - 1;
      if( pageToShow < 0 )
      {
         pageToShow = picArray.length -1;
      }
      showImage( pageToShow );
   }

function msg2(str)
{
    var decoded = "mailto:";

    while( str.length > 0 )
    {
        // Eat the string two chars at a time and convert each mouthful from hex
        // to decimal character code to character, building the decoded string
        // as we go.
        var chr = String.fromCharCode( parseInt(str.substr(0,2),16) );
        decoded = decoded + chr;
        str = str.substr(2);
    }
    
       if(document.images)
       {
          location.replace(decoded);
       }
       else
       {
          location = decoded;
       }
}
