function _o (a) {
    return document.getElementById(a)
}

function clickCheckbox ( obj, target ) {
    if ( obj.checked ) target.value = obj.value;
    else target.value = "";
}

var move_x, move_y, temp_x, temp_y ;

var objsm;

function mouse_dragdrop() {
    //var obj = selectManager;
    if(event.button == 1 && flag_drag == true) {
        objsm.style.pixelLeft = temp_x + event.clientX - move_x;
        objsm.style.pixelTop = temp_y + event.clientY - move_y;
        if(objsm.style.pixelTop < 5)
        	objsm.style.pixelTop =5
        //obj.style.pixelLeft =  event.clientX - move_x;
        //obj.style.pixelTop =  event.clientY - move_y;
    }

}

function mouse_drag() {
    //var obj = selectManager;
    temp_x = objsm.style.pixelLeft;
    temp_y = objsm.style.pixelTop;

    move_x = event.clientX;
    move_y = event.clientY;

   // document.onmousemove = mouse_dragdrop;

    flag_drag = true;
}

function mouse_up() {
    flag_drag = false;
}


function showManager ( html ) {
	objsm = _o("selectManager");
	//var obj = _o("selectManager");
	objsm.style.width = gPopupWidth
    objsm.style.top  = parent.document.body.scrollTop + 40;
    objsm.style.left = ( document.body.offsetWidth - parseInt(objsm.style.width) ) / 2 ;

    objsm.style.display = "";
    objsm.innerHTML = html;

    //pageDisabled ( true );

}
var gPopupWidth =0;
var gPopupHeight =0;
function showFileManager (pagename,pagetitle,pWidth,pHeight,imgRootPath) {
	//pWidth= pWidth-200;
	//pHeight= pHeight-200;
	//ÇöÀç È­¸éº¸´Ù Å©¸é °­Á¦·Î ÆË¾÷À» ÁÙ¿© ¹ö¸°´Ù.
	if(pHeight > document.body.clientHeight-100)
		pHeight =document.body.clientHeight-100

	if(pWidth > document.body.clientWidth-100)
		pWidth =document.body.clientWidth-100
	

	gPopupWidth =pWidth
	gPopupHeight = pHeight;
	var html = "";
	vWidth = pWidth -4;
	vWidth10 = pWidth -10;
	
    html += '<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout:fixed;">';
    html += '<tr bgcolor="505774">';
    html += 	'<td height="2"><img src="'+ imgRootPath +'/popupbox/box0101.gif" width="2" height="2"></td>';
    html += 	'<td background="'+ imgRootPath +'/popupbox/box0102.gif" bgcolor="505774" width="'+ vWidth +'" height="2"><img src="'+ imgRootPath +'/popupbox/dot.gif" width="2" height="2"></td>';
    html += 	'<td height="2"><img src="'+ imgRootPath +'/popupbox/box0103.gif" width="2" height="2"></td>';
    html += '</tr>';
    html += '<tr bgcolor="505774">';
    html += 	'<td background="'+ imgRootPath +'/popupbox/box0201.gif" bgcolor="505774" height="2"><img src="'+ imgRootPath +'/popupbox/box0201.gif" width="2" height="2"></td>';
    html += 	'<td height="100%" width="'+ vWidth +'" valign="top" bgcolor="505774">'
    html += 		'<table width="'+ vWidth10 +'" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout:fixed;">'
    html += 			'<tr>'
    html += 				'<td height="24" valign="top" bgcolor="505774">'
    html += 					'<table width="100%"	border="0" cellspacing="0" cellpadding="0">'
    html += 						'<tr>'
    html += 							'<td width="89%" height="25" class="white12b" style="cursor:move;" onmouseover="startMouseCapture(this);" onmouseout="endMouseCapture(this);" onmousedown="mouse_drag()" onmousemove="mouse_dragdrop()" onmouseup="mouse_up()"> <img src="'+ imgRootPath +'/popupbox/dot.gif" width="10" height="1"><img src="'+ imgRootPath +'/popupbox/bl_st.gif" width="8" height="11"> <font color="#FFFFFF"><span id="spanPOPUPTITLE">'+ pagetitle +'</span></font></td>'
    html += 							'<td width="11%" height="25" align="right"><a href="#" onclick="hideManager();return false;" ><img src="'+ imgRootPath +'/popupbox/bt_popclose.gif" width="57" border="0" height="13" hspace="5"></a></td>'
    html += 						'</tr>'
    html += 					'</table>'
    html += 				'</td>'
    html += 			'</tr>'
    html += 			'<tr>'
    html += 				'<td valign="top" bgcolor="EEEEEE" height="100%">'
    html += 					'<iframe name="if_Manager" src="'+ pagename +'" style="width:100%;height:'+ pHeight +'" frameborder="0"></iframe>'
    html += 				'</td>'
    html += 			'</tr>'
    html += 		'</table>'
    html += 	'</td>'
    html += 	'<td background="'+ imgRootPath +'/popupbox/box0202.gif" height="2"bgcolor="505774"><img src="'+ imgRootPath +'/popupbox/box0202.gif" width="2" height="2"></td>'
    html += '</tr>'
    html += '<tr bgcolor="505774" height="2">'
    html += 	'<td height="4"><img src="'+ imgRootPath +'/popupbox/box0301.gif" width="2" height="2"></td>'
    html += 	'<td background="'+ imgRootPath +'/popupbox/box0302.gif" bgcolor="505774" width="'+ vWidth +'" height="4"><img src="'+ imgRootPath +'/popupbox/dot.gif" width="2" height="2"></td>'
    html += 	'<td height="4"><img src="'+ imgRootPath +'/popupbox/box0303.gif" width="2" height="2"></td>'
    html += '</tr>'
    html += '</table>'
    


    showManager ( html );
}

function hideManager () {
    var obj = _o("selectManager");
    obj.innerHTML = '<table><tr><td></td></tr></table>';
    obj.style.display = "none";

    pageDisabled ( false );

	//º¹±ÍÇÏ¸é¼­ ºÎ¸ð Æã¼Ç Á¸ÀçÇÏ¸é È£Ãâ
    if(typeof(fnStateReturn) == "function") fnStateReturn();
}

function pageDisabled ( b ) {

	var objbg = _o("selectManagerBack");
	if ( b ) {
		divH = 150;
		if(document.body.scrollHeight > divH)
			divH = document.body.scrollHeight
		objbg.style.cssText = "position:absolute;top:0px;left:0px;width:" + document.body.scrollWidth + "px;height:"+ divH +"px;background-color:#aaaaaa;z-index:98;filter:alpha(opacity=50)'> ";
		objbg.style.display = "";
	} else {
		objbg.style.display="none";
	}
    //document.body.disabled = b;

}

   function startMouseCapture(objCapture)
   {
       //if ( isIE == false ) return;
       objCapture.setCapture();
   }

   function endMouseCapture(objCapture)
   {
       //if ( isIE == false )return;
       objCapture.releaseCapture();
   }
