/*
  Eduardo 23/07/08

*/

function showPopWindow(url) {
  var iframe = document.getElementById("popup_iframe")

  if (!iframe) {  
    iframe = document.createElement("IFRAME");
    iframe.src = url;
    iframe.id = "popup_iframe";	
	iframe.scrolling = 'no';
    document.body.appendChild(iframe);
  } else {
	iframe.src = url; // refresh (fiz isso, pois eventualmente a url do iframe pode ter sido trocada [location, ex])
	iframe.style.display = "block";	
  }
}

function hidePopWindow() {
  window.top.document.getElementById("popup_iframe").style.display = "none";
}

function preparePopWindow(title) {
  var div = document.createElement("DIV");
  var span = document.createElement("SPAN");
  var a = document.createElement("A");
  var img = document.createElement("IMG");

  div.id = "popup_toolbar"; 
  span.innerHTML = title;
  a.href = "javascript:hidePopWindow()";
  img.src="img/popup_close.gif"
  
  
  a.appendChild(img);
  div.appendChild(span);
  div.appendChild(a);  

  document.body.insertBefore(div, document.body.firstChild);

  addHandle(document.getElementById("popup_toolbar"), window);
}
