
var nn4 = (document.layers);
var nn6 = (document.getElementById && !document.all);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);


function loadUrlInFrame(url, frameId) { 
  
  if (ie5 || nn6) {    
    document.getElementById(frameId).src = url;
  }  
}


function copyFromFrame(frameId, sourceId, targetId) {  
  if(nn6 || ie5) { 
    document.getElementById(targetId).innerHTML = window.frames[frameId].document.getElementById(sourceId).innerHTML;
  }
}

function getImageById(id) {
  var query = "images.html?_refreshFrameId=tempLoaderFrame&_targetId=replacer&command=setViewAttributes&id="+id;
  loadUrlInFrame(query, 'tempLoaderFrame');
}

function imgPopup(src, width, height, caption, windowTitle, margin) {			 
  
  var winHeight = height + 2*margin;
  var winWidth = width + 2*margin;
  
  var win = window.open("","imagePopup","dependent=yes, directories=no, location=no, menubar=no, personalbar=no, toolbar=no, scrollbars=no, status=no, resizable=no, width=" + winWidth + ", height=" + winHeight + "");

  win.document.open("text/html");
  win.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
  win.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">');  
  win.document.writeln("<head><title>" + windowTitle + "</title></head>");
  win.document.writeln("<body style='background-color:#5a5a5a;'><div style='width: " + width + "px; margin: 0 auto; padding-top: " + margin + "px;'>");
  win.document.writeln("<a href='javascript: window.close();'><img src='" + src + "' border='0' style='border: 1px solid #FFF;' /></a>");
  win.document.writeln("<div id='imageCaption'>" + caption + "</div>");
  win.document.writeln("</div></body></html>");
  win.document.close();

  win.focus();	
}
