/**
 * PhotoDetail.js
 */

var win = null;

function setWindowSize() {

	var iframe = document.getElementById("win_detail_content");	

	if(iframe.contentDocument) {
		var el = iframe.contentDocument.getElementById("ofWindowSize");
	}else{
		var el = iframe.contentWindow.document.getElementById("ofWindowSize");
	}

	if(!el) {
		win.close();
		win = null;
	}

	var y = document.body.scrollTop || document.documentElement.scrollTop;
	
	win.setLocation(y, (screen.width - el.clientWidth)/2)

	win.setSize(el.clientWidth+3, el.clientHeight+3);
	
	;
}

function windowOpenByURL(url,width,height,modal) {
	
	win = new Window("win_detail", {className:"ws_dialog",
	                  zIndex:100,
	                  url:url,
	                  top: -10,
	                  left: -10,
	                  minWidth: 1,
	                  minHeigth: 0,
	                  width: 0,
	                  height: 0,
	                  closable:false,
                      resizable:false,
                      minimizable:false,
                      maximizable:false,
                      draggable:false,
					  onload:setWindowSize,
                      showEffect: Element.show,
                      hideEffect: Element.hide
                      });
	win.setDestroyOnClose();
    if(modal==true) {
        win.show(true);
    }else {
        win.show();
    }
    
    var iframe = document.getElementById("win_detail_content");
	if(iframe){
		iframe.setAttribute("scrolling","no");
	};
}

function windowClose() {
    if(win != null) {
    	win.close();
    	win = null;
    }
    return true;
}