
//  -----------------------------------------------------------------
//    Notes:	The purpose of this Javascript File is to preload images and set effects as they are rendered by the browser
//
//
//    Arguments:   
//    Returns:	N/A
//  		E:\WebSite_Default\ArcIMSFrameWorkSource\JavaScript\ArcIMSFrameWork_PreloadImage.js
//   -----------------------------------------------------------------
//    Orginization:	City of Asheville IT Services
//    Original Code: 	Dave Michelson 1/31/2006
//    Last Update:	Dave Michelson 1/31/2006
//  


  function fadeIn(objId,opacity)
  {
    if (document.getElementById)
    {
      obj = parent.document.getElementById(objId);
      
      if (opacity <= 100)
      {
        setOpacity(obj, opacity);
        opacity += 25;
        window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 500);
      }else{
        obj.style.visibility = 'visible';
      }
    }
  }

  function fadeOut(objId,opacity)
  {
    if (document.getElementById)
    {
      obj = parent.document.getElementById(objId);
      if (opacity >= 100)
      {
        setOpacity(obj, opacity);
        opacity = opacity - 25;
        window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 500);
      }else{
      }
    }
  }

  function setOpacity(obj, opacity)
  {
    opacity = (opacity == 100)?99.999:opacity;
  
    // IE/Win
    obj.style.filter = "alpha(opacity:"+opacity+")";

    // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity/100;

    // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity/100;
  
    // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity/100;

  }

  function initImage( myPic , mSrc , isGo )
  {
    
    var objID = 'map_img';
    var obj = parent.document.getElementById( objID );
    obj.src = mSrc;
    
    var cnt = 0;
    while (! obj.complete ){
      cnt = cnt + 1;
    }
    
    if (isGo)
    {
      obj.style.visibility = 'hidden';
      var InOpacity = 30;
      fadeIn( objID , InOpacity );
      parent.moveIt( objID ,'0','0');
    }
  }

  