function ResizeImage(image, maxwidth, maxheight, imageid)
{
     if (image.className == "Thumbnail")
     {
          if (navigator.appName == "Microsoft Internet Explorer")
          {
               myImage = new Image()
               myImage.src = document.getElementById('picture-'+imageid+'').src
               w = myImage.width
               h = myImage.height           
               //alert(w);
               if( w == 0 || h == 0 )
               {
                   document.getElementById('picture-'+imageid+'').width = maxwidth;
                   document.getElementById('picture-'+imageid+'').height = maxheight;
               }
               else if (w > h)
               {
                   if (w > maxwidth) document.getElementById('picture-'+imageid+'').width = maxwidth;
               }
               else
               {
                   if (h > maxheight) document.getElementById('picture-'+imageid+'').height = maxheight;
               }
          }
          if (navigator.appName == "Netscape")
          {
               var w = image.width;
               var h = image.height;
               if( w == 0 || h == 0 )
               {
                   image.width = maxwidth;
                   image.height = maxheight;
               }
               else if (w > h)
               {
                   if (w > maxwidth) image.width = maxwidth;
               }
               else
               {
                   if (h > maxheight) image.height = maxheight;
               }
          }
                  
          image.className = "ScaledThumbnail";
          image.style.display = "";
          document.getElementById("imgload-"+imageid+"").style.display = "none";
     }
}

function GetImgDimensions(imgurl, imgtitle)
{
     var img = new Image();
     img.onload = function() {OpenGalleryImageFF(imgurl, this.width, this.height, imgtitle)};
     img.src = imgurl;
}

function OpenGalleryImage(str, nTitle)
{
     if (navigator.appName == "Microsoft Internet Explorer")
     {
          var newImg = new Image();
          newImg.src = str;
          var height = newImg.height;
          var width = newImg.width;
          WindowWidth = width + 22;
          WindowHeight = height + 25;
          ImgWidth = width;
          ImgHeight = height;
          NewStr = "image_display.asp?img="+str+"&w="+ImgWidth+"&h="+ImgHeight;
          settingswindow=dhtmlmodal.open('EmailBox', 'iframe', NewStr, nTitle, 'width='+WindowWidth+'px,height='+WindowHeight+'px,center=1,resize=0,scrolling=0')
     }
     if (navigator.appName == "Netscape")
     {
          GetImgDimensions(str, nTitle);
     }
}

function OpenGalleryImageFF(str, nWidth, nHeight, nTitle)
{
     WindowWidth = nWidth + 16;
     WindowHeight = nHeight + 24;
     ImgWidth = nWidth;
     ImgHeight = nHeight;
     NewStr = "image_display.asp?img="+str+"&w="+ImgWidth+"&h="+ImgHeight;
     settingswindow=dhtmlmodal.open('EmailBox', 'iframe', NewStr, nTitle, 'width='+WindowWidth+'px,height='+WindowHeight+'px,center=1,resize=0,scrolling=0')
}

