/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2002-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// See documentation for information about setting these properties 
// at www.dyn-web/com/dhtml/write-drag/documentation.html
writeDrag.offX = "c";
writeDrag.offY = "c";

function HideWindow(){
	document.getElementById('dragDiv').style.visibility="hidden";
    document.getElementById('overlay_div').style.visibility = "hidden";
}
// required arg's: event, image path and file name (as this.href)
// important but optional arg's: width of image, height of image 
// other optional arg's: Cor de fundo, Fundo visible, click no documento ,txt, layer width, offx, offy
function wrapContent(e, src, w, h, bgcolor, layer, click_doc, txt, wd, offx, offy) {
  var imgStr, cntnt, win, str;
    imgStr = '<div class="dhtmlgoodies_window"' + (w? ' width="' + w + '"': "") + (h? ' height="' + h + '"': "") + '">';
	imgStr += '<div class="dhtmlgoodies_window_top">';
	//imgStr += '<img src="/images/top_left.gif" align="left">';
	imgStr += '<img src="/images/top_center.gif" class="topCenterImage">';
	imgStr += '<div class="top_buttons">';
	//imgStr += '<img src="/images/top_right.gif">';
	imgStr += '<img class="closeButton" src="/images/close.gif" onclick="HideWindow()">';
	imgStr += '</div></div>';
	imgStr += '<div class="dhtmlgoodies_windowMiddle">';
	imgStr += '<div class="dhtmlgoodies_windowContent">';
	imgStr += '<iframe src ="' + src + '"' + (w? ' width="' + (w-5) + '"px': "") + (h? ' height="' + h + '"px': "") + '" scrolling="no" frameborder=0 align="absmiddle"></iframe>';	
	imgStr += '</div></div>';
	imgStr += '<div class="dhtmlgoodies_window_bottom">';
	imgStr += '</div></div>';
	  
    imgStr += '<img src=""' + (w? ' width="' + w + '"': "") + (h? ' height="' + h + '"': "") + '>';
	
	  
  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {
    cntnt = '<div class="img">' + imgStr + '</div>';
    if (txt) cntnt += '<div class="msg">' + txt + '</div>';


    if (!wd) wd = w; 
    writeDrag.set(e, cntnt, wd, offx, offy, bgcolor, layer);    
  } else { // non-capable browsers will open sub window
    w = w+80 || wd || 250; h = h+80 || 250; // size
    win = window.open('', 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
    if (win && !win.closed) win.resizeTo(w,h); 
    str = '<html><head><title>Image Display</title></head>';
  	str += '<body style="text-align:center">';
    str += imgStr + (txt? '<p>' + txt + '</p>':"");
  	str += '</body></html>'
  	win.document.write(str);
  	win.document.close();
    if (win && !win.closed) win.focus(); 
  } 

  return false;
}

