var swfu;

function showField(field, url)
{
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  } catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
            alert("Your browser does not support AJAX!");
            return false;
        }
    }
  }
  
  xmlHttp.onreadystatechange=function()
  {
      if(xmlHttp.readyState==4) {
        document.getElementById(field).innerHTML=xmlHttp.responseText;
        if (url == "/editPhotoInfo.php?action=addphotos")
            initSWFUpload();
      }
  }
  
  document.getElementById(field).innerHTML = "Loading...<br>";
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

function showFieldNL(field, url)
{
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  } catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
            alert("Your browser does not support AJAX!");
            return false;
        }
    }
  }
  
  xmlHttp.onreadystatechange=function()
  {
      if(xmlHttp.readyState==4) {
        document.getElementById(field).innerHTML=xmlHttp.responseText;
        if (url == "/editPhotoInfo.php?action=addphotos")
            initSWFUpload();
      }
  }
  
  //document.getElementById(field).innerHTML = "Loading...<br>";
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

function initTheImage(imageID)
{
    image = document.getElementById(imageId);
    setOpacity(image, 0);
    image.style.visibility = 'visible';
    fadeIn(imageId,0);
}

function fadeIn(objId, opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

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;
}

