/* 기본변수
	this_url="세부적인 보드링크 url";
	this_skin="현재출력 스킨 디렉토리의 url/path";
	is_Admin="관리자 접속이면 1";
	is_Member='회원로그인이면 1';
*/








//------기본함수 활용 방법은 [사용자 매뉴얼]->[응용,확장] 참조할것


// 기본 윈도우창
// (1파일명 or URL, 2가로크기, 3세로크기, 4가로위치, 5세로위치, 6글번호, 7GET인수, 8스키롤, 9크기변경, 10타겟, 11윈도우 구분)
function xwindow_OPEN(exe,  div_w,  div_h,  coord_x,  coord_y,  no,  str,  scroll,  resize,  target,  wintype){
	linkurlsrc=(Public_URL(exe))? exe : this_url+"&command=exp_window"+(no>0?'&no='+no:'')+"&exe="+exe+"&"+str;
	if(wintype!=1)	OpenWin_smart(linkurlsrc,target,div_w,div_h,coord_x,coord_y,scroll,resize); // 메뉴없는 창
	else					OpenWin_variety(linkurlsrc,target,div_w,div_h,coord_x,coord_y,scroll,resize); // 메뉴있는 창
}


// 응용레이어 추가 생성방법및 옵션지정은 매뉴얼 참조
// iwindow_OPEN(실행파일, iwin이름, get쿼리, 'width=,height=,left=,top=,move_left=,move_top=,btn_help=,btn_grow=,btn_close=,autoclose=1,titlebar=,new_iwin=,css_style=')
function iwindow_OPEN(exe, iwin_name, str_query, option_set){
	var Opt_Set=new Array(); option_set=TnT_option_set_chk(option_set);
	var OPT=option_set.toLowerCase().split(',');
	for(i=0; i<OPT.length; ++i){TMP=OPT[i].split('='); Opt_Set[TMP[0]]=TMP[1];}
	if(value_renwl(Opt_Set['new_iwin'])){create_iwindow(TnT_time(),Opt_Set['css_style']);}
	else{
		iwchk=document.getElementById('TnTeIwin'+iwin_name);
		if(!iwchk) create_iwindow(iwin_name,Opt_Set['css_style']); else set_iwindow_focus_change(iwin_name);
	}
	TnTw_size=parseInt(Opt_Set['width']); if(!TnTw_size||TnTw_size<10) TnTw_size=250;
	TnTh_size=parseInt(Opt_Set['height']); if(!TnTh_size||TnTh_size<10) TnTh_size=250;
	if(Opt_Set['left'] && Opt_Set['left'].match(/[0-9]+%/)){
		Opt_Set['left']=parseInt(Opt_Set['left']);
		Opt_Set['left']=(document.body.clientWidth*Opt_Set['left']/100)+document.body.scrollLeft-(TnTw_size/2);
		if(Opt_Set['left']<document.body.scrollLeft)Opt_Set['left']=document.body.scrollLeft+1;
	}
	if(Opt_Set['top'] && Opt_Set['top'].match(/[0-9]+%/)){
		Opt_Set['top']=parseInt(Opt_Set['top']);
		Opt_Set['top']=(document.body.clientHeight*Opt_Set['top']/100)+document.body.scrollTop-(TnTh_size/2);
		if(Opt_Set['top']<document.body.scrollTop)Opt_Set['top']=document.body.scrollTop+1;
	}
	if(Opt_Set['function']) eval(Opt_Set['function']+"('"+exe+"','"+str_query+"','"+option_set+"')");
	else HideBox_id.src=(Public_URL(exe))? exe : this_url+exe+"&"+str_query;
	iwindow_RESIZE(TnTw_size,TnTh_size);
	layer_large_btn.style.display=value_renwl(Opt_Set['btn_grow'])?'':'none';
	layer_help_btn.style.display=value_renwl(Opt_Set['btn_help'])?'':'none';
	layer_close_btn.style.display=value_renwl(Opt_Set['btn_close'],1)?'':'none';
	iwindowTopTr.style.display=value_renwl(Opt_Set['titlebar'],1)?'':'none';
	iwindowTopTr2.style.display=value_renwl(Opt_Set['titlebar'],1)?'none':'';
	layer_help_func=exe;
	TnT_layer_open(TnTw_size,TnTh_size,parseInt(Opt_Set['left']),parseInt(Opt_Set['top']),parseInt(Opt_Set['move_left']),parseInt(Opt_Set['move_top']));
	if(!value_renwl(Opt_Set['autoclose'],1)) TnTL_clickTime=1;
	return 1;
}
// option value
function value_renwl(setvalue,setdefault){
	if(!setvalue)setvalue=setdefault;
	if(setvalue=='yes' || setvalue=='y' || setvalue=='true' || parseInt(setvalue)==1) return true;
	return false;
}
// option str
function TnT_option_set_chk(str){
	if(!str) return '';
	return str.replace(/^\s+/,'').replace(/\s+$/,'').replace(/\s+\,\s+/,',').replace(/\s+=\s+/g,'=');
}

//--------------------------------------------------
// ajax request 응용(매뉴얼->응용,확장 참조)
// innerhtml_ON(실행파일, div_id, get쿼리, 'width=,height=,left=,top=,move_left=,move_top=,css_style=')
function innerhtml_ON(exe,div_id,str_query,option_set){
	var layer_type,tm_evt_left,tm_evt_top,xm_obj,div_name;
	var Opt_Set=new Array();
	option_set=TnT_option_set_chk(option_set);
	var OPT=option_set.toLowerCase().split(',');
	for(i=0; i<OPT.length; ++i){TMP=OPT[i].split('='); Opt_Set[TMP[0]]=TMP[1];}
	if(!div_id) div_id='TnTinnerdiv1';
	div_name=document.getElementById(div_id);
	if(!div_name){
		div_name=document.createElement('div');
		div_name.setAttribute('id',div_id);
		document.body.appendChild(div_name);
		if(!Opt_Set['left'] && !Opt_Set['move_left']) Opt_Set['move_left']=8;// default left
		if(!Opt_Set['top'] && !Opt_Set['move_top']) Opt_Set['move_top']=8;// default top
		layer_type=1;
	}
	div_name.style.display='block';
	if(Opt_Set['css_style']) div_name.style.cssText=div_name.style.cssText+'; '+Opt_Set['css_style']; // css
	if(Opt_Set['width']>1) div_name.style.width=Opt_Set['width'];
	if(Opt_Set['height']>1) div_name.style.height=Opt_Set['height'];
	if(Opt_Set['left']>=1) {layer_type=1; div_name.style.left=Opt_Set['left'];}
	if(Opt_Set['top']>=1) {layer_type=1; div_name.style.top=Opt_Set['top'];}
	if(Opt_Set['move_left'] || Opt_Set['move_top']){
		layer_type=1;
		if(this_browser=='n'){
			tm_evt_top=ns_pageY();
			tm_evt_left=ns_pageX();
		}
		else{
			tm_evt_top=ie_clientY() + document.body.scrollTop;
			tm_evt_left=ie_clientX() + document.body.scrollLeft;
		}
		if(Opt_Set['move_left']) div_name.style.left=tm_evt_left+parseInt(Opt_Set['move_left']);
		if(Opt_Set['move_top']) div_name.style.top=tm_evt_top+parseInt(Opt_Set['move_top']);
		if(parseInt(div_name.style.left) < 1) div_name.style.left=5;
		if(parseInt(div_name.style.top) < 1) div_name.style.top=5;
	}
	if(layer_type){
		div_name.style.position='absolute';
		div_name.style.visibility='visible';
		div_name.style.zIndex=++iwinzidx;
	}
	str_query=(str_query)?TnT_queryEncode(str_query):'';
	if(!Public_URL(exe)) exe=TnT_urlEncode(this_url)+"&command=innerhtml&exe="+exe;
	else exe=TnT_urlEncode(exe);
	exe=exe+'&'+str_query+'&inner_div='+div_id;
	xm_obj = TnT_xmlRequest();
	xm_obj.open("POST",exe,true);
	xm_obj.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=utf-8');
	xm_obj.onreadystatechange = function(){
		if(xm_obj.readyState == 4) div_name.innerHTML=xm_obj.responseText;
	}
	xm_obj.send('');
}

function TnT_queryEncode(query_str){
	if(query_str=="") return;
	var enc_query='';
	var Arr_tmp=query_str.split('&');
	for(i=0;i<Arr_tmp.length;i++){
		var Arr_tmp2 = Arr_tmp[i].split('=');
		enc_query += '&'+encodeURIComponent(Arr_tmp2[0])+'=';
		enc_query += (Arr_tmp2[1]) ? encodeURIComponent(Arr_tmp2[1]) : '';
	}
	return enc_query;
}

function TnT_urlEncode(url){
	var urlsplit=url.split('?');
	if(urlsplit.length<2) return url+'?';
	var tmp=urlsplit[0];
	urlsplit.shift();
	return tmp+'?'+TnT_queryEncode(urlsplit.join('?'));
}

function TnT_xmlRequest(){
	if(window.XMLHttpRequest) return new XMLHttpRequest();
	else return new ActiveXObject("Microsoft.XMLHTTP");
}

function innerhtml_OFF(div_id){
	if(div_id) div_id=document.getElementById(div_id);
	if(div_id){div_id.style.display='none'; div_id.innerHTML='';}
}
//--------------------------------------------------


// 대화상자 - ModalDialog
// (1파일명 or URL, 2가로크기, 3세로크기, 4가로위치, 5세로위치, 6글번호, 7GET인수, 8스크롤,9크기변경)
function dialog_OPEN(exe, div_w, div_h, coord_x, coord_y, no, str, scroll, resize){
	linkurlsrc= (Public_URL(exe))? exe : this_url+"&command=exp_dialog"+(no>0?'&no='+no:'')+"&exe="+exe+"&"+str;
	return OpenWin_Dialog(linkurlsrc,div_w,div_h,coord_x,coord_y,scroll,resize);
}




// 이미지 사이즈에 맞게 iwindow 출력 
function iview_setimg(str_imgurl,str_query,str_option,recnt){
	var Wi=0;
	var Hi=0;
	if(!recnt){tmpimg= new Image(); tmpimg.src=(str_imgurl);}
	if((tmpimg.width!=0)&&(tmpimg.height!=0)){Wi=tmpimg.width; Hi=tmpimg.height;}
	else{setTimeout("iview_setimg('"+str_imgurl+"','"+str_query+"','"+str_option+"',1)",100); return;}
	with(HideBox_name.document){
		write("<html><body topmargin=0 leftmargin=0 style='padding:0; text-align:center;'><span>");
		write("<img src="+str_imgurl+" border=0 onclick='parent.iwindow_CLOSE()' style='cursor:pointer;'>");
		write("</span></body></html>");
		if(this_browser=='n') body.style.overflow='hidden';
		close();
	}
	TnTw_size=Wi+1;
	TnTh_size=Hi+1;
	iwindow_TITLE(this_skin+'/iwindow/immg/title_imgview.gif');
	iwindow_RESIZE(TnTw_size,TnTh_size);
}


// 접속형태가 일반 URL 인지 , 실행파일명인지 체크
function Public_URL(string){
	if(!string.match(/^\w+$/)) return 1;
}

function TnT_time(){return (new Date()).getTime();}


// 부라우저 상단 메뉴,버튼 '없는' 윈도우 창
function OpenWin_smart(Url,Target,Xsize,Ysize,left_is,top_is,Scroll,Resize){
		if(!Xsize || Xsize<40) Xsize=500;
		if(!Ysize || Ysize<40) Ysize=450;
		if(Resize != 'no' && Resize != 0 ) Resize=1;
		if(!left_is || left_is<1) left_is= (screen.width-Xsize)/2;
		if(!top_is || top_is<1) top_is= (screen.height-Ysize-200)/2;
		smart_Browser=window.open(Url,Target,'width='+Xsize+',height='+Ysize + ',left=' +left_is+ ',top=' +top_is+ ',scrollbars='+Scroll+',resizable='+Resize+',status=0');
		smart_Browser.focus();
}


// 부라우저 상단 메뉴,버튼 '있는' 윈도우 창
function OpenWin_variety(Url,Target,Xsize,Ysize,left_is,top_is){
		if(!Xsize || Xsize<40)Xsize=screen.width -80;
		if(!Ysize || Ysize<40)Ysize=screen.height -80;
		if(!left_is || left_is<1) left_is= (screen.width-Xsize)/2;
		if(!top_is || top_is<1) top_is= (screen.height-Ysize)/2;
		variety_Browser=window.open(Url,Target,'width='+Xsize+',height='+Ysize + ',left=' +left_is+ ',top=' +top_is + ',scrollbars=1,toolbar=1,location=1,directories=1,status=1,menubar=1,resizable=1,copyhistory=1');
		variety_Browser.focus();
}


// ModalDialog 박스1
function OpenWin_Dialog(Url,width_is,height_is,left_is,top_is,scroll_is,resize_is){
		if(Url=="") return;
		if(!width_is || width_is<40) width_is= 250;
		if(!height_is || height_is<40) height_is= 250;
		if(!left_is || left_is<1) left_is=  (screen.width-width_is)/2;
		if(!top_is || top_is<1) top_is=  (screen.height-height_is-200)/2;
		scroll_is=(scroll_is>0)?'1':'0';
		resize_is=(resize_is>0)?'1':'0';
		return_value=showModalDialog(Url,0,'dialogWidth:'+width_is+'px; dialogHeight:'+height_is+'px; dialogLeft:'+left_is+'px; dialogTop:'+top_is+'px; status:0; scroll:'+scroll_is+'; help:0; resizable:'+resize_is+';');
		return return_value;
		//  showModalDialog("abcd.html","window","font-family:Verdana; font-size:12; dialogHeight:310px; dialogWidth:480px; dialogLeft:30px; dialogTop:500px; status:no; help:no; scroll:no");
}


// ModalDialog 박스2(사용안함)
function OpenWin_Always(Url,width_is,height_is,left_is,top_is,scroll_is,resize_is){
		if(Url=="") return;
		if(!width_is || width_is<40) width_is= 250;
		if(!height_is || height_is<40) height_is= 250;
		if(!left_is || left_is<1) left_is=  (screen.width-width_is)/2;
		if(!top_is || top_is<1) top_is=  (screen.height-height_is-200)/2;
		scroll_is=(scroll_is>0)?'1':'0';
		resize_is=(resize_is>0)?'1':'0';
		return_value=showModelessDialog(Url,0,'dialogWidth:'+width_is+'px; dialogHeight:'+height_is+'px; dialogLeft:'+left_is+'px; dialogTop:'+top_is+'px; status:0; scroll:'+scroll_is+'; help:0; resizable:'+resize_is+';edge:raised;');
		return return_value;
		//  showModalDialog("abcd.html","window","font-family:Verdana; font-size:12; dialogHeight:310px; dialogWidth:480px; dialogLeft:30px; dialogTop:500px; status:no; help:no; scroll:no");
}






//-----------------------------------------------------------------------------------------

// TnT_layer_open(width,height,절대위치x,절대위치y,이동위치W,이동위치H)
TnTL_clickTime=1;
function TnT_layer_open(Table_w,Table_h,fs_X,fs_Y,mv_W,mv_H){
	var clX,clY,mvX,mvY;
	mvX=(mv_W>=1 || mv_W<=-1)?mv_W:8;//x move
	mvY=(mv_H>=1 || mv_H<=-1)?mv_H:8;//y move
	iwindowLAYER.opened=true;
	if(this_browser=='n'){
		clY=(fs_Y > 0)?fs_Y:ns_pageY()+mvY;
		clX=(fs_X > 0)?fs_X:ns_pageX()+mvX;
	}
	else{
		clY=(fs_Y > 0)?fs_Y: ie_clientY()+ document.body.scrollTop+mvY;
		clX=(fs_X > 0)?fs_X: ie_clientX()+ document.body.scrollLeft+mvX;
	}
	if(clX+Table_w+15>document.body.clientWidth) clX=clX-Table_w-40; // 가로
	if(clY+Table_h+45>document.body.clientHeight+document.body.scrollTop) clY=clY-Table_h-40; // 세로
	if(clX<document.body.scrollLeft) clX=document.body.scrollLeft+3; // left
	if(clY<document.body.scrollTop) clY=document.body.scrollTop+3; // top
	iwindow_MOVE(clX,clY);
	iwindowLAYER.style.visibility='visible';
	TnTlayerResize=0; // 레이어 크기 변경 구분 숫자
	TnTL_clickTime=(new Date()).getTime(); // 레이어 출력 시간
}

def_iwinXY=0;
function ns_pageY(){if(mouseDN_Y==0) return def_iwinXY+=10; return mouseDN_Y;}
function ns_pageX(){if(mouseDN_X==0) return def_iwinXY+=20; return mouseDN_X;}
function ie_clientY(){if(!event) return def_iwinXY+=10; return event.clientY;}
function ie_clientX(){if(!event) return def_iwinXY+=20; return event.clientX;}



// 레이어 확대
function iwindow_ENLARGE(){
	body_W=document.body.clientWidth;
	body_H=document.body.clientHeight;
	if(TnTlayerResize==0){
		it_tn_st_w=parseInt(TntiwindowTable.width);
		it_tn_st_h=parseInt(TntiwindowTable.height);
		add_W=(body_W - it_tn_st_w-20)/3;
		add_H=(body_H - it_tn_st_h-40)/3;
	}
	newSize_w=parseInt(TntiwindowTable.width)+add_W;
	newSize_h=parseInt(TntiwindowTable.height)+add_H;
	if(body_W-20<newSize_w || body_H-40<newSize_h){
		newSize_w=it_tn_st_w;
		newSize_h=it_tn_st_h;
	}
	iwindow_MOVE((body_W-newSize_w)/2+document.body.scrollLeft,(body_H-newSize_h)/2+document.body.scrollTop);
	 iwindow_RESIZE(newSize_w,newSize_h);
	TnTlayerResize++;
	TnTL_clickTime=1;
}






// 레이어 위치 지정(절대위치Left,절대위치Top,상대위치Left,상대위치Top)
function iwindow_MOVE(L,T,mv_L,mv_T){
	if(L) iwindowLAYER.style.left=L;
	if(T) iwindowLAYER.style.top=T;
	if(mv_L) iwindowLAYER.style.left=parseInt(iwindowLAYER.style.left)+mv_L;
	if(mv_T) iwindowLAYER.style.top=parseInt(iwindowLAYER.style.top)+mv_T;
}

// 레이어 타이틀 이미지
function iwindow_TITLE(imgsrc){
		if(tntactiwin) HideBox_title.src=imgsrc; // 레이어 타이틀바에 출력될 이미지
}


// 레이어 크기변경
function iwindow_RESIZE(x,y){
	if(x>0) TntiwindowTable.width=x;
	if(y>0){ TntiwindowTable.height=y;
		TntiwindowTable.style.height=y;
	}
}


// 레이어 close
function iwindow_CLOSE(){
	iwindowLAYER.opened = false;
	iwindowLAYER.style.visibility = 'hidden';
	TnTL_clickTime=1;
}


// 레이어 메시지 출력
function iwindow_MESSAGE(msg,x,y,place,closetime){
	var isactiwn;
	if(place=='self'){// iwindow 현재위치에서 출력
		x=parseInt(iwindowLAYER.style.left);
		y=parseInt(iwindowLAYER.style.top);
		isactiwn=tntactiwin.replace(/TnTeIwin/,'');
	}
	iwindow_OPEN(this_url+'&command=public&exe=error_msg_iwindow&msg='+msg,isactiwn,'','width=250,height=100,left='+x+',top='+y);
	if(closetime>10) setTimeout("iwindow_CLOSE()",closetime);
}


//--------------------



// iwindow 에서 상위 프레임에 레이어 출력(event,레이어id,[절대위치left,절대위치top,상대위치left,상대위치top])
function iwindow_sub_OPEN(evt,layer_id,abs_left,abs_top,each_left,each_top){
	var temp_layer=document.getElementById('TnT_TempLayer');
	var act_frame=HideBox_name;
	var act_div=act_frame.document.getElementById(layer_id);
	var act_w=parseInt(act_div.style.width);
	var act_h=parseInt(act_div.style.height);

	var i_left=parseInt(iwindowLAYER.style.left);
	var i_top=parseInt(iwindowLAYER.style.top);

	if(abs_left!=0 || abs_top!=0){ // 절대위치
		temp_layer.style.left = abs_left;
		temp_layer.style.top = abs_top;
	}
	else{//상대위치

		if(this_browser=='n'){
			temp_layer.style.left = evt.pageX+i_left+each_left+5; // 5: left border 보상
			temp_layer.style.top = evt.pageY+i_top-each_top+20; //20: head td 보상
		}
		else{
			temp_layer.style.left = act_frame.event.clientX+ act_frame.document.body.scrollLeft+i_left+each_left+5;  // 5: left border 보상
			temp_layer.style.top = act_frame.event.clientY+ act_frame.document.body.scrollTop+i_top-each_top+20; //20: head td 보상
		}
	}

	if(act_w>50){ //width 보상
		temp_layer.style.width=act_w;
		if(parseInt(temp_layer.style.left)+act_w>document.body.clientWidth+ document.body.scrollLeft){
			temp_layer.style.left=parseInt(temp_layer.style.left)-act_w-each_left*2;
		}
		if(parseInt(temp_layer.style.left)<1)temp_layer.style.left=1; // 가로
	}
	else 	temp_layer.style.width=50;


	if(act_h>10){ //height 보상
		temp_layer.style.height=act_h;
		if(parseInt(temp_layer.style.top)+act_h>document.body.clientHeight+ document.body.scrollTop){
			temp_layer.style.top=parseInt(temp_layer.style.top)-act_h+each_top*2;
		}
		if(parseInt(temp_layer.style.top)<1)temp_layer.style.top=1; // 세로
	}
	else temp_layer.style.height=10;

	temp_layer.innerHTML=act_div.innerHTML;
	temp_layer.style.visibility = 'visible';
	temp_layer.style.zIndex=1000;

}

// 닫기
function iwindow_sub_CLOSE(){
	document.getElementById('TnT_TempLayer').style.visibility = 'hidden';
}




// 일반레이어 on/off 활용 (event,레이어id,[절대위치left,절대위치top,상대위치left,상대위치top])
function publicLayerDisplay(evt,layer_id,abs_left,abs_top,each_left,each_top,toggle){
	thislayer=document.getElementById(layer_id);
	if(evt=='close'){thislayer.style.visibility = 'hidden'; return;}
	if(toggle && thislayer.style.visibility =='visible') {thislayer.style.visibility = 'hidden'; return;}
	abs_left=parseInt(abs_left); abs_top=parseInt(abs_top);
	each_left=parseInt(each_left); each_top=parseInt(each_top);
	if(abs_left==0 && abs_top==0){
		abs_left=(this_browser=='n')? evt.pageX+each_left : event.clientX+document.body.scrollLeft+each_left;
		abs_top=(this_browser=='n')? evt.pageY-each_top : event.clientY+document.body.scrollTop-each_top;
	}
	thislayer.style.left = abs_left;
	thislayer.style.top =abs_top;
	var all_left_ck=TnT_get_objLeft(thislayer);
	var all_top_ck=TnT_get_objTop(thislayer);
	if(abs_left!=all_left_ck || abs_top!=all_top_ck){
		var p_left_ck=TnT_get_objLeft(thislayer.offsetParent);
		var p_top_ck=TnT_get_objTop(thislayer.offsetParent);
		thislayer.style.left=all_left_ck-p_left_ck*2;
		thislayer.style.top=all_top_ck-p_top_ck*2;
	}
	thislayer.style.visibility = 'visible';
}


//-----------------------------------




// iwindow : Drag & Resize --------------------------------------------------------

DragResize_start=0;
function DragResize_DN(it_Resize,evt,div_id){

	if(div_id){
		mv_act_objt=document.getElementById(div_id);
		if(mv_act_objt.style.position!='absolute'){
			mv_act_objt.style.left=TnT_get_objLeft(mv_act_objt);
			mv_act_objt.style.top=TnT_get_objTop(mv_act_objt);
			mv_act_objt.style.position='absolute';
		}
		mv_act_objt.style.zIndex=++iwinzidx;
	}
	else{mv_act_objt=iwindowLAYER;}

	DragResize_start=1;
	Drg_x=(this_browser=='n')? evt.pageX : event.clientX;
	Drg_y=(this_browser=='n')? evt.pageY : event.clientY;

	if(it_Resize<1){// Drag
		temp1=parseInt(mv_act_objt.style.left);
		temp2=parseInt(mv_act_objt.style.top);
		if(this_browser=='n')  document.onmousemove=TnTmoveAct_n;
		else document.onmousemove=TnTmoveAct;
	}
	else{// Resize
		iwindoWidth=parseInt(TntiwindowTable.width); // 가로
		iwindoHeight=parseInt(TntiwindowTable.height); // 세로
		if(this_browser=='n')  document.onmousemove=TnTresizeAct_n;
		else document.onmousemove=TnTresizeAct;
	}
	TnTL_clickTime=1;
}

function drag_time_true(){ // when iframe onmouseover
	if(DragResize_start==1 && this_browser!='n') iwindowLAYER.style.top=parseInt(iwindowLAYER.style.top)+100;
}

function TnTmoveAct(){ // drag
	if(DragResize_start==1){
		mv_act_objt.style.left=temp1+event.clientX-Drg_x;
		mv_act_objt.style.top=temp2+event.clientY-Drg_y;
		return false;
	}
}

// resize move
function TnTresizeAct(){
	if(DragResize_start==1){
		var re_x=iwindoWidth+event.clientX-Drg_x;
		var re_y=iwindoHeight+event.clientY-Drg_y;
		if(re_x<50 || re_y<50) return false;
		iwindow_RESIZE(re_x,re_y);
		return false;
	}
}


function TnTmoveAct_n(evt){ // drag
	if (DragResize_start==1){
		mv_act_objt.style.left=temp1+evt.pageX-Drg_x;
		mv_act_objt.style.top=temp2+evt.pageY-Drg_y;
		return false;
	}
}

// resize move
function TnTresizeAct_n(evt){
	if (DragResize_start==1){
		var re_x=iwindoWidth+evt.pageX-Drg_x;
		var re_y=iwindoHeight+evt.pageY-Drg_y;
		if(re_x<50 || re_y<50) return false;
		iwindow_RESIZE(re_x,re_y);
		return false;
	}
}


// end
function DragResize_UP(){
	document.onmousemove='';
	DragResize_start=0;
}
//-----------------------------------------------------------------------------------




// 부라우저 바탕화면 클릭시 레이어 자동으로 닫히게함(지워 버려도 됨) ----------------------
 document.onclick=iwindow_CLOSE_AUTO;
function iwindow_CLOSE_AUTO(){
	DragResize_start=0;
	if(TnTL_clickTime==1) return; // iwindow 를 드래그 ro 크기변경 동작후에는 자동닫기 적용안함(무조건 자동닫기 적용하려면 이 라인을 삭제)
	if(this_browser=='e'){
		if (event.srcElement.className=="TnT_Layer_dragin") return; // iwindow: Drag, Resize
		if (event.srcElement.className=="TnT_Top_button") return; // iwindow : TopButton
		if (event.srcElement.className=="TnT_Editor_button") return; // editor : Button
	}
	if((TnTL_clickTime+500)<(new Date()).getTime()){iwindow_CLOSE();}
}


// thisobj 의 Top
function TnT_get_objTop(thisobj){
	if (thisobj.offsetParent==document.body) return thisobj.offsetTop;
	else return thisobj.offsetTop + TnT_get_objTop(thisobj.offsetParent);
}

// thisobj 의 Left
function TnT_get_objLeft(thisobj){
	if (thisobj.offsetParent==document.body) return thisobj.offsetLeft;
	else return thisobj.offsetLeft + TnT_get_objLeft(thisobj.offsetParent);
}

// 말풍선 on/off
function balloon_on(str,obj,mv_right,mv_up){
	var alt_balloon=document.getElementById('TnT_TempLayer2');
	alt_balloon.innerHTML="<table cellpadding=0 cellspacing=0 border=0><tr><td width=4 hight=21><img src="+this_skin+"/b_img/icons/alt_left.gif align=absmiddle></td><td background="+this_skin+"/b_img/icons/alt_center.gif style='color:#624c10; font-size:8pt; letter-spacing:-1; font-family:돋움;'><nobr>&nbsp;"+str+"&nbsp;</nobr></td><td width=5 hight=21><img src="+this_skin+"/b_img/icons/alt_right.gif align=absmiddle></td></tr></table>";
	alt_balloon.style.left=TnT_get_objLeft(obj)+mv_right;
	alt_balloon.style.top=TnT_get_objTop(obj)-20-mv_up;
	alt_balloon.style.visibility = 'visible';
}function balloon_off(){document.getElementById('TnT_TempLayer2').style.visibility = 'hidden';}


// 팝업레이어 on/off
function square_on(str,obj,mv_right,mv_up,style){
	var alt_square=document.getElementById('TnT_TempLayer2');
	alt_square.innerHTML="<div onmouseover=square_off(1) onmouseout=square_off() style='border:1px solid #888888; padding:3; background-color:#ffffff; color:#333333; text-align:left; line-height:140%; "+style+"' class=MenuTextColor>"+str+"</div>";
	alt_square.style.left=TnT_get_objLeft(obj)+mv_right;
	alt_square.style.top=TnT_get_objTop(obj)-20-mv_up;
	alt_square.style.visibility = 'visible';
}function square_off(sw){document.getElementById('TnT_TempLayer2').style.visibility=sw?'visible':'hidden';}



// onload 기본모드
		mouseDN_X=0;
		mouseDN_Y=0;
		if(navigator.userAgent.indexOf('MSIE') == -1){
			this_browser='n';
			document.onmousedown=function(n_evt){
				mouseDN_X=n_evt.pageX;
				mouseDN_Y=n_evt.pageY;
			}
			it_img_tag='input type=image '; // iwindow title
		}
		else{
			this_browser='e';
			it_img_tag='img ';
		}

		document.write("<div id='TnT_TempLayer' style='width:50px; position:absolute; visibility:hidden; z-Index:11; padding:0;'></div>");
		document.write("<div id='TnT_TempLayer2' style='position:absolute; visibility:hidden; z-Index:11; padding:0;'></div>");
