function openWin(url, width, height, scrollbars, resizeable,fname) {
  if (fname) {
    var popup = window.open(url,fname,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + scrollbars + ',resizable=' + resizeable + ',width=' + width +',height=' + height + '');
  } else {
    var popup = window.open(url,"",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + scrollbars + ',resizable=' + resizeable + ',width=' + width +',height=' + height + '');
  }
}

function abort() {
  close();
  opener.focus();
}
function finish() {
  opener.parent.location.reload();
  close();
  opener.focus();
}

function ShowHide(id) {
    obj = document.getElementsByTagName("div");
    if (obj[id].style.visibility == 'visible'){
    obj[id].style.visibility = 'hidden';
    }
    else {
    obj[id].style.visibility = 'visible';
    }
}


function ShowHide3(id, tag) {
    if (!tag) tag = "div";
    obj = document.getElementsByTagName(tag);
    if (obj[id].style.visibility == 'visible'){
      obj[id].style.visibility = 'hidden';
      obj[id].style.display = 'none';
    }
    else {
      obj[id].style.visibility = 'visible';
      if (tag == "tr") obj[id].style.display = (navigator.appName == "Microsoft Internet Explorer" ? 'block' : 'table-row');
      else obj[id].style.display = 'block';
    }
}
function ShowHide2(id,showorhide,tag,block) {
    if (!tag) tag = "span";
    obj = document.getElementsByTagName(tag);
    if (showorhide == 'hide'){
      obj[id].style.visibility = 'hidden';
      if (block) obj[id].style.display = 'none';
    }
    else {
      obj[id].style.visibility = 'visible';
      if (block) obj[id].style.display = 'block';
    }
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
  for(var i=0; i<document.images.length; i++) {
    var img = document.images[i]
    var imgName = img.src.toUpperCase()
    var img2check = img.name.toUpperCase()
    if ((imgName.substring(imgName.length-3, imgName.length) == "PNG")) {
       var imgOver = img.onmouseover;
       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='scale');\"></span>" 
       img.outerHTML = strNewHTML
       i = i-1
    }
  }
}

function flipani(id,ani) {
  var this_src = window.document.images[id].src;
  if (ani == true) {
    newsrc = this_src.replace(".gif","_ani.gif");
  } else {
    newsrc = this_src.replace("_ani.gif",".gif");
  }
  window.document.images[id].src = newsrc;
}

function flipsel(id,on,ext) {
  var this_src = id.src;
  if (!ext) {
    ext = ".jpg";
  } 
  if (on == true) {
    newsrc = this_src.replace(ext,"sel"+ext);
  } else {
    newsrc = this_src.replace("sel"+ext,ext);
  }
  id.src = newsrc;
}

function flipsel2(id,on,ext) {
  var this_src = window.document.images[id].src;
  if (!ext) {
    ext = ".jpg";
  } 
  if (on == true) {
    newsrc = this_src.replace(ext,"sel"+ext);
  } else {
    newsrc = this_src.replace("sel"+ext,ext);
  }
  window.document.images[id].src = newsrc;
}


function getBrowserSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return new Array(myWidth, myHeight);
}
