function mgtSetVisibility(id, mode) {
    if (mode != '' && mode != 'none') {
     setIdProperty( id, "display", mode );
    }
    else {
     setIdProperty( id, "display", "none" );
    }
}

function mgtLoadExternal(url) {
  if ( window.frames['buffer'] ) {
    window.frames['buffer'].document.body.innerHTML = '&nbsp;&nbsp;';
    window.frames['buffer'].location = url;
    return false;
  } 
  return true;
}

function mgtLoadIframe(url,mode) {
  if(url != 'none') {
    mgtLoadExternal(url); 
  }
  mgtSetVisibility('display', mode);
  return(false);
}

function mgtShowIframe(url) {
  mgtLoadIframe(url, 'block');
  return(false);
}

function mgtHideIframe(url) {
  mgtLoadIframe(url, 'none');
  window.frames['buffer'].document.body.innerHTML = '&nbsp;&nbsp;';
  return(false);
}

function mgtPopIframe() {
  mgtSetVisibility('display', 'block');
  return(false);
}

function mgtPushIframe() {
  mgtSetVisibility('display', 'none');
  return(false);
}


// old functions stubs
function mgtSetInvisible(id, force) {
  status = getIdProperty(id,'display');
  if (status != 'none' || force) {
    mgtSetVisibility(id,'none');
  }
  return(false);
}

function mgtSetVisible(id, force) {
  status = getIdProperty(id,'display');
  if (force || status == 'none') {
    mgtSetVisibility(id,'block');
  }
  return(false);
}

function mgtChangeVis(id, vmode) {
  return(mgtSetVisibility(id,vmode));
}

function mgtRdl(url,tto) {
   var string;
   string = 'document.location.replace(' + '"' + url + '"' + ')';
   setTimeout(string,tto);
}

function mgtById(id) {
	return document.getElementById(id);
}

function mgtGetSetTag(source,sourceTag,sourceSel,destination,destinationSel) {
    var vastring = mgtGetSourceTagValues(source,sourceTag,sourceSel);
    var form = mgtById(destination);
    form[destinationSel].value  = vastring;
}

function mgtGetSourceTagValues(sourceId,sourceTag,sourceSel) {
    var vastring;
    var source = mgtById(sourceId);
    var sli = source.getElementsByTagName(sourceTag);
    if(sli) {
        for(var x=0; x < sli.length; x++) {
            if(vastring) {
                vastring = vastring + ',' + sli.item(x).getAttribute(sourceSel);
            }
            else {
                vastring = sli.item(x).getAttribute(sourceSel);
            }
        }
    }
    return(vastring);
    }

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='none');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

