//===================================================================
// alert 메세지
//====================================================================
var WRITE_ERR			= 'Save Error retry!';
var MODIFY_ERR			= 'Modify Error retry!';
var DEL_ERR				= 'Delete Error retry!';
var ADD_ERR				= '주소를 정확히 입력하세요';
var ID_ERR				= 'Please input ID';
var PW_ERR				= 'Please input password';
var ADID_ERR			= 'Please input manager id';
var ADPW_ERR			= 'Please input manager password';
var TITLE_ERR			= "Please input title";
var CONTENT_ERR			= "Please input contents";
var NAME_ERR			= "Please input name";
var PASSWD_ERR			= "Please input password";
var VAR_title			= "Please input title";
var VAR_content			= "Please input contents";
var VAR_viewType		= "Would you change view option?";
var VAR_eventConfType	= "Would you change event option?";
var VAR_sellerConf		= "판매자 승인속성을 수정하시겠습니까?";

var VAR_emptyType		= "Would you change sold out option?";
var VAR_firstType		= "Would you change notice option?";
var VAR_login			= "Login members page.\n\nAre you login now?";
var VAR_hotType			= "Would you change hit goods option?";
var VAR_recomType		= "Would you change recommand goods option?";
var VAR_mainHotType		= "Would you change hit goods option of main page?";
/*===================================================================
공백 여부 체크 함수
====================================================================*/
function emptyForm(text) {
	if (text.value.length==0)
	return true;

	for (var i=0; i<text.value.length; i++) {
	var ch=text.value.charAt(i);
	if (ch!=' ' && ch!='\t')
	return false;
	}
	return true;
}  

//===================================================================
// 팝창 처리 함수
//===================================================================
function POP_UP(A,B,C,D){
	if(D=='no'){
		var sz = 'width='+B+',height='+C;
	}else{
		var sz = 'width='+B+',height='+C+',scrollbars=yes';
	}
	window.open(A,'',sz)
}

function POP_UP2(A,B,C,D){
	if(D=='no'){
		var sz = 'width='+B+',height='+C+'resizable=yes';
	}else{
		var sz = 'width='+B+',height='+C+',scrollbars=yes,resizable=yes';
	}
	window.open(A,'',sz)
}

//===================================================================
// 연결프로그램 선택
//===================================================================
function Write_type_select(s_val){
	if (s_val == 2){
		document.all["LayerText"].style.display = "none";
		document.all["LayerEditor"].style.display = "";
		document.all["LayerHTML"].style.display = "none";
	}else if (s_val == 1 ){		
		//alert('3');
		document.all["LayerText"].style.display = "none";
		document.all["LayerEditor"].style.display = "none";
		document.all["LayerHTML"].style.display = "";
	}else {
		document.all["LayerText"].style.display = "";
		document.all["LayerEditor"].style.display = "none";
		document.all["LayerHTML"].style.display = "none";
	}
}

//===================================================================
// 팝창 처리 함수
//===================================================================
// A : page name
// B : width
// C : height
// D : scroll type(yes,no)
// E : form.name
// F : field.name
function POP_UP_POST(A,B,C,D,E,F){
	if(F=="memberID"){
		if(!document.forms[E].all[F].value || emptyForm(document.forms[E].all[F])){
			alert('please input your ID');
			document.all[F].focus();
			return;
		}
	}else if(F=="del_list_value"){
		if(!document.forms[E].all[F].value || emptyForm(document.forms[E].all[F])){
			alert('메일발송 회원을 선택하세요');
			return;
		}
	}
	if(D=='no'){
		var sz = 'width='+B+',height='+C;
	}else{
		var sz = 'width='+B+',height='+C+',scrollbars=yes';
	}
	window.open(A,'pop_post',sz);
	document.all[E].target='pop_post';
	document.all[E].action=A;
	document.all[E].submit();
}

function POP_UP_PREVIEW(A,B,C,D,E,F){
	document.forms[E].content_remark.value = nvHtmlEdit.document.body.innerHTML;
	if(D=='no'){
		var sz = 'width='+B+',height='+C;
	}else{
		var sz = 'width='+B+',height='+C+',scrollbars=yes';
	}
	window.open(A,'pop_post',sz);
	document.all[E].target='pop_post';
	document.all[E].action=A;
	document.all[E].submit();
}


//===================================================================
// 연결프로그램 선택
//===================================================================
function Write_init(s_val){
	if (s_val == 1){		
		document.all["LayerText"].style.display = "none";
		document.all["LayerHTML"].style.display = "";
		document.all["LayerEditor"].style.display = "none";
	}else if (s_val == 2 ){		
		//alert('3');	
		document.all["LayerText"].style.display = "none";
		document.all["LayerHTML"].style.display = "none";
		document.all["LayerEditor"].style.display = "";
	}else {		
		document.all["LayerText"].style.display = "";
		document.all["LayerHTML"].style.display = "none";
		document.all["LayerEditor"].style.display = "none";
	}
}

//===================================================================
// 멀티 자료 첨부(삭제)
// A : 폼이름
//===================================================================
function delList(A,B){
	try{
		var conf_val	= confirm('파일을 삭제 하시겠습니까?');
		if(conf_val){
			var target		= document.forms[A].elements['fileList[]'];
			target.options[target.selectedIndex] = null;
			var fileName = document.forms[A].all['selFile'].value;
			dynamic.src = "/TM_config/DelFile.php?DelFile_Val="+fileName+"&upload_Folder="+B;	
			//alert(fileName);
			//alert(B);
		}else{
			return false;
		}
	}catch(e){
		alert('파일 삭제 중 에러발생');
		return false;
	}
}

//===================================================================
// multi upload process 
// if select options
// A:value
// B:form name
//===================================================================
function CngSel(A,B){
	var selF	= A.split("|");
	document.forms[B].all['selFile'].value=selF[1];
}

//===================================================================
// 멀티 자료 첨부(추가)
// A : 폼이름
//===================================================================
function run_add(A,B) {	
	
	var add_count	= document.forms[A].elements['fileList[]'].options.length;
	var check_value = document.forms[A].add_file.value;	
	if(check_value == '') { 
		alert('첨부파일을 선택하세요'); 
		return false;
	}else{ 		
		switch(B){
			case("goods"):
				var pass_num=6;
				break;			
			default:
				var pass_num=8;
				break;
		}
		if(add_count >=pass_num){
			var err_msg = (pass_num)+" 개 이상의 파일을 업로드 할 수 없습니다";
			alert(err_msg);
			return;
		}else{		
			document.all['processBar'].style.display="";
			if(A=="sub_write_frm"){
				document.forms[A].target="hidden";
				document.forms[A].action="./Multifile_process.php";
				document.forms[A].submit();		
				
				//document.forms[A].elements['add_file'].text='';
			}else{
				document.forms[A].target="hidden";
				document.forms[A].action="/admin/"+B+"/Multifile_process.php";
				document.forms[A].submit();		
				document.forms[A].elements['add_file'].value='';
				//document.forms[A].elements['add_file'].text='';
			}
		}
	} 	
}

//===================================================================
// 멀티 자료 첨부(파일추가)
// A : 폼이름
// B : 경로
// C : 
// D : 
// 이미지일 경우 메인에 이미지를 추가 하는 부분
//===================================================================
function write_add(A,B,C,D) { 	
	//try{
		var res_file = new Array("jpg","gif","btm","jpeg","JPEG","bmp","BMP","GIF","JPG");
		
		var target	= document.forms[A].elements['fileList[]'];
		var add_img_val = target.options[target.selectedIndex].value;
		//alert(add_img_val);
		var v_value = add_img_val.split("|");
		var f_type	= v_value[1].split(".");	
		var w_len	= v_value[3];
		for(i=0;i<res_file.length;i++){
			if(f_type[1]==res_file[i]){
				var type_chk = true;
				//alert(nvHtmlEdit.document.body.innerHTML);
				var content_val = nvHtmlEdit.document.body.innerHTML;				
				var img_http = "/TM_process/photo_target.php?view_path=http://"+C+"/TM_upload_file/"+B+"/"+v_value[1];
				var img_http2 = "http://"+C+"/TM_upload_file/"+B+"/"+v_value[1];
				//add_img_val = "<a style='cursor:hand;' onclick=\"POP_UP('"+img_http+"','200','200','no')\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align=left></a>";
				if(Number(w_len) > Number(D)){
					add_img_val = "<div align='center'><xa href='"+img_http+"' target='hidden'><a style=\"cursor:hand;\" onclick=\"SLB('"+img_http2+"','image',true);\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align='middle' width='"+D+"' onerror='no_image(this)' class='IMG' border='0'></a></div>";
				}else{
					add_img_val = "<div align='center'><xa href='"+img_http+"' target='hidden'><a style=\"cursor:hand;\" onclick=\"SLB('"+img_http2+"','image',true);\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align='middle' onerror='no_image(this)' class='IMG' border='0'></a></div>";
				}			
				re_content = content_val+add_img_val;
				nvHtmlEdit.document.body.innerHTML = re_content;
				
			}
		}
		if(!type_chk){
			alert('이미지 파일만 붙여넣기가 가능합니다.');
		}
	//}catch(e){
	//	alert('등록할 목록을 선택하세요 \n\n이미지 파일만 메인에 등록됩니다');
	//	return false;
	//}
}

//===================================================================
// 이미지 본문에 자동추가하기
function write_add_new(A,B,C,D) { 
	var res_file = new Array("jpg","gif","btm","jpeg","JPEG","bmp","BMP","GIF","JPG");	
	var target	= opener.document.forms[A].elements['fileList[]'];
	var add_img_val = target.options[target.selectedIndex].value;
	//alert(add_img_val);
	var v_value = add_img_val.split("|");
	var f_type	= v_value[1].split(".");	
	var w_len	= v_value[3];
	for(i=0;i<res_file.length;i++){
		if(f_type[1]==res_file[i]){
			var type_chk = true;
			var content_val = opener.nvHtmlEdit.innerHTML;				
			var img_http = "/TM_process/photo_target.php?view_path=http://"+C+"/TM_upload_file/"+B+"/"+v_value[1];
			var img_http2 = "http://"+C+"/TM_upload_file/"+B+"/"+v_value[1];
			//add_img_val = "<a style='cursor:hand;' onclick=\"POP_UP('"+img_http+"','200','200','no')\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align=left></a>";
			if(Number(w_len) > Number(D)){
				add_img_val = "<div align='center'><a style=\"cursor:hand;\" onclick=\"SLB('"+img_http2+"','image',true);\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align='middle' width='"+D+"' onerror='no_image(this)' class='IMG' border='0'></a></div>";
			}else{
				add_img_val = "<div align='center'><a style=\"cursor:hand;\" onclick=\"SLB('"+img_http2+"','image',true);\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align='middle' onerror='no_image(this)' class='IMG' border='0'></a></div>";
			}			
			re_content = content_val+add_img_val;
			opener.nvHtmlEdit.innerHTML = re_content;				
		}
	}

	if(!type_chk){
		alert('이미지 파일만 붙여넣기가 가능합니다.');
	}
}


//===================================================================
// 이미지 본문에 자동추가하기
function write_add_new2(A,B,C,D,E) { 
	var res_file = new Array("jpg","gif","btm","jpeg","JPEG","bmp","BMP","GIF","JPG");	
	var target	= opener.top.frames['detail_hidden'+E].document.forms[A].elements['fileList[]'];
	var add_img_val = target.options[target.selectedIndex].value;
	//alert(add_img_val);
	var v_value = add_img_val.split("|");
	var f_type	= v_value[1].split(".");	
	var w_len	= v_value[3];
	for(i=0;i<res_file.length;i++){
		if(f_type[1]==res_file[i]){
			var type_chk = true;
			var content_val = opener.top.frames['detail_hidden'+E].nvHtmlEdit.document.body.innerHTML;				
			var img_http = "/TM_process/photo_target.php?view_path=http://"+C+"/TM_upload_file/"+B+"/"+v_value[1];
			var img_http2 = "http://"+C+"/TM_upload_file/"+B+"/"+v_value[1];
			//add_img_val = "<a style='cursor:hand;' onclick=\"POP_UP('"+img_http+"','200','200','no')\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align=left></a>";
			if(Number(w_len) > Number(D)){
				add_img_val = "<div align='center'><xa href='"+img_http+"' target='hidden'><a style=\"cursor:hand;\" onclick=\"SLB('"+img_http2+"','image',true);\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align='middle' width='"+D+"' onerror='no_image(this)' class='IMG' border='0'></a></div>";
			}else{
				add_img_val = "<div align='center'><xa href='"+img_http+"' target='hidden'><a style=\"cursor:hand;\" onclick=\"SLB('"+img_http2+"','image',true);\"><img src='http://"+C+"/TM_upload_file/"+B+"/"+v_value[1]+"' align='middle' onerror='no_image(this)' class='IMG' border='0'></a></div>";
			}			
			re_content = content_val+add_img_val;
			opener.top.frames['detail_hidden'+E].nvHtmlEdit.document.body.innerHTML = re_content;				
		}
	}

	if(!type_chk){
		alert('이미지 파일만 붙여넣기가 가능합니다.');
	}
}
//===================================================================
// 동영상 본문에 추가 하기
function write_add_movie(A,B,C,D) { 
	
	var target	= opener.document.forms[A].elements['fileList[]'];
	var add_img_val = target.options[target.selectedIndex].value;
	var v_value = add_img_val.split("|");
	
	var type_chk = true;
	var content_val = opener.nvHtmlEdit.document.body.innerHTML;				
	
	add_img_val = "<embed src='"+C+"/"+B+"/"+v_value[1]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='320' height='240'></embed></object>";
				
	re_content = content_val+add_img_val;
	opener.nvHtmlEdit.document.body.innerHTML = re_content;				
	
}



//===================================================================
// 페이지 이동 처리 부분
// argument 값를 받아서 해당 페이지로 이동 처리
//===================================================================
function go_list(){ 	
	var arg_vals,sp_args,conf_value,target_value;
	var i, args=go_list.arguments,ret_val; 
	for (i=0; i<(args.length); i++) { 
		arg_vals = args[i].split("|");			
		if(arg_vals[0]=="reurl"){
			var go_page=arg_vals[1];
		}
		if(arg_vals[0]=="conf_val"){
			conf_value=true;
			switch(arg_vals[1]){
				default:
					var conf = confirm('Are you delete?');
					break;
			}			
		}
		if(arg_vals[0]=="target"){
			target_value = true;
			var go_target = arg_vals[1];
		}else{
			if(i==0){
				ret_val+="<input type='hidden' name='"+arg_vals[0]+"' value='"+arg_vals[1]+"'>";
			}else{
				ret_val+="<input type='hidden' name='"+arg_vals[0]+"' value='"+arg_vals[1]+"'>";
			}		
		}
	}
	//alert(ret_val);
	if(conf){	
		if(target_value){
			document.getElementById('protank_span').innerHTML = ret_val;
			document.getElementById('protank_frm').target=go_target;
			document.getElementById('protank_frm').action=go_page;
			document.getElementById('protank_frm').submit();	
		}else{
			document.getElementById('protank_span').innerHTML = ret_val;
			document.getElementById('protank_frm').target='';
			document.getElementById('protank_frm').action=go_page;
			document.getElementById('protank_frm').submit();	
		}
	}else{
		if(!conf_value){
			if(target_value){
				document.getElementById('protank_span').innerHTML = ret_val;
				document.getElementById('protank_frm').target=go_target;
				document.getElementById('protank_frm').action=go_page;
				document.getElementById('protank_frm').submit();	
			}else{
				//alert('4');
				//alert(ret_val);
				document.getElementById('protank_span').innerHTML = ret_val;
				document.getElementById('protank_frm').target='';
				document.getElementById('protank_frm').action=go_page;
				document.getElementById('protank_frm').submit();	
			}
		}
		return false;
	}
} 


//===================================================================
// 이미지 미리보기 버튼
// A : 이미지 경로
// B : 파일종류
//===================================================================
function showLayer(A,B){
	var obj=document.all["prvImg"];	
	obj.style.display = '';
	
	//alert(document.body.scrollTop);
	//alert(document.body.clientHeight);
	var _tmpx,_tmpy, marginx, marginy;   	   	
	_tmpx = parseInt(document.body.scrollLeft);
	_tmpy = parseInt(document.body.scrollTop);
	_marginx = document.body.clientWidth - _tmpx;
	_marginy = document.body.clientHeight - _tmpy ;
	if(_marginx < 0)
		_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
	else
		_tmpx = event.clientX + document.body.scrollLeft ;
	if(_marginy < 0)
		_tmpy = event.clientY + document.body.scrollTop + _marginy ;
	else
		_tmpy = event.clientY + document.body.scrollTop ;
	
	obj.style.left=_tmpx;
	obj.style.top=_tmpy;	
	if(B=="Flash"){
		FlashObLayer(A,'100','100','','','prvImg');
	}else{
		document.all['preView'].src = A;
	}
	
}

//===================================================================
// 마우스 오른쪽 버튼)
//===================================================================
function popLayer(e){	
	if (event.button==2){				
		var obj=document.all["show_list"];			
		obj.style.display = '';
		var _tmpx,_tmpy, marginx, marginy;   	   	
		_tmpx = event.clientX + parseInt(obj.offsetWidth);
		_tmpy = event.clientY + parseInt(obj.offsetHeight);
		_marginx = document.body.clientWidth - _tmpx;
		_marginy = document.body.clientHeight - _tmpy ;
		if(_marginx < 0)
			_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
		else
			_tmpx = event.clientX + document.body.scrollLeft ;
		if(_marginy < 0)
			_tmpy = event.clientY + document.body.scrollTop + _marginy +20;
		else
			_tmpy = event.clientY + document.body.scrollTop ;
		obj.style.posLeft=_tmpx+5;
		obj.style.posTop=_tmpy+5;
		return false;
	}else{		
		var obj=document.all["show_list"];			
		obj.style.display = 'none';
	}
}

//===================================================================
// 아파트 관리자 메뉴(마우스 left 버튼)
// A : layer num
// B : 상태값(visible,hidden)
//===================================================================
function mouseRightMenu(A,B){
	var select_obj;
	var obj=document.all["mouseLeft"+A];
	//var obj=document.all["mouseLeft"];			
	//obj.style.display = '';
	var _tmpx,_tmpy, marginx, marginy;   	   	
	_tmpx = event.clientX + parseInt(obj.offsetWidth);
	_tmpy = event.clientY + parseInt(obj.offsetHeight);
	_marginx = document.body.clientWidth - _tmpx;
	_marginy = document.body.clientHeight - _tmpy ;
	if(_marginx < 0)
		_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
	else
		_tmpx = event.clientX + document.body.scrollLeft ;
	if(_marginy < 0)
		_tmpy = event.clientY + document.body.scrollTop + _marginy +20;
	else
		_tmpy = event.clientY + document.body.scrollTop ;
		obj.style.posLeft=_tmpx-40;
		obj.style.posTop=_tmpy-25;

	if(B=='visible') {
		if(select_obj) {
			select_obj.style.visibility='hidden';
			select_obj=null;
		}
		select_obj=obj;
	}else{
		select_obj=null;
	}

	obj.style.visibility=B; 
}

//===================================================================
// 셀렉트박스
//===================================================================
function mycafe_change(value,typeVal){
	if(typeVal=="gohyang"){
		url_val	= "/club/home/main.php";
		fName	= "mygohyang_list";
	}else{
		url_val	= "/club/school/main.php";
		fName	= "myschool_list";
	}
	valArr	= value.split("|");
	
	switch(value){
		case"0":
			break;		
		case"login":
			document.forms[fName].target="";
			document.forms[fName].action="/join/login_01.php";
			document.forms[fName].submit();
			break;
		default:
			var list_html = "<input type='hidden' name='clubID' value='"+valArr[0]+"'><input type='hidden' name='clubIDAdd' value='"+valArr[1]+"'><input type='hidden' name='clubType' value='"+typeVal+"'>";
			document.all["protank_span"].innerHTML=list_html;
			document.protank_frm.target="";
			document.protank_frm.action=url_val;
			document.protank_frm.submit();	
			break;
	}
}

//===================================================================
// 이미지가 없을 경우
//===================================================================
function on_image(A){
	A.style.display='none';
}
//===================================================================
// 이미지가 없을 경우
//===================================================================
function no_image(A,B){
	A.src=B;
}

//===================================================================
// 전체선택 , 전체선택 취소
// A : 체크박스 버튼명
// B : 폼안, 폼밖(폼명)
// C : text 명
//===================================================================
function chkboxAll(bool,A,B,C) { // 전체선택/해제 
    var obj = document.getElementsByName(A);
	var loop_count =1
    for (var i=0; i<obj.length; i++){
		if(bool == true){
			if(loop_count==1){
				document.forms[B].all[C].value =obj[i].value;
			}else{
				document.forms[B].all[C].value =document.forms[B].all[C].value +","+obj[i].value;
			}
			loop_count = loop_count+1;
		}else{
			document.forms[B].all[C].value ='';
		}
		obj[i].checked = bool; 
	} 
} 

//===================================================================
// 셀렉트 박스 하나씩 선택
// B : 폼이름
// A : 선택된 값
// C : 셀렉트박스의 값
//===================================================================
function chkboxSel(bool,A,B,C) { 
    var obj = document.getElementsByName(A);
	var loop_count =1
    for (var i=0; i<obj.length; i++){
		if(obj[i].checked == true){
			if(loop_count==1){
				document.forms[B].all[C].value =obj[i].value;
			}else{
				document.forms[B].all[C].value =document.forms[B].all[C].value +","+obj[i].value;
			}	
		loop_count = loop_count+1;
		}		
	} 
	if(loop_count==1){
		document.forms[B].all[C].value ='';
	}
}

function chkboxSel2(bool,A,B,C) { 
    var obj = top.document.getElementsByName(A);
	var loop_count =1;
	var arrVal;
    for (var i=0; i<obj.length; i++){
		if(obj[i].checked == true){
			arrVal	= obj[i].value.split("|");
			if(loop_count==1){				
				top.document.forms[B].all[C].value =arrVal[0];
				top.document.forms[B].all['memberIDList'].value =arrVal[1];
				top.document.forms[B].all['memberNameList'].value =arrVal[2];
			}else{
				top.document.forms[B].all[C].value =top.document.forms[B].all[C].value +","+arrVal[0];
				top.document.forms[B].all['memberIDList'].value =top.document.forms[B].all['memberIDList'].value +","+arrVal[1];
				top.document.forms[B].all['memberNameList'].value =top.document.forms[B].all['memberNameList'].value +","+arrVal[2];
			}	
		loop_count = loop_count+1;
		}		
	} 
	if(loop_count==1){
		top.document.forms[B].all[C].value ='';
		top.document.forms[B].all['memberIDList'].value ='';
		top.document.forms[B].all['memberNameList'].value ='';
	}
}

//===================================================================
// 롤 오버용 스크립트 공통 부분
//===================================================================
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function hide(){
    document.all['prvImg'].style.display = 'none';
}

//===================================================================
// DB이용 멀티 셀렉트
//=================================================================== 
// sel : form 
// target : 
// trigger : option의 value
function loadData(sel,target,tb_name,field_name) {
	var trigger = sel.options[sel.selectedIndex].value;
	var form = sel.form.name;
	//alert(form);
	//alert("./loadData.php?form=" + form + "&trigger=" + trigger + "&target=" + target +"&tb_name="+tb_name+"&field_name="+field_name);
	
	dynamic.src = "./loadData.php?form=" + form + "&trigger=" + trigger + "&target=" + target +"&tb_name="+tb_name+"&field_name="+field_name;	
}


//===================================================================
// 정렬 숫자값 처리 부분
//===================================================================
// A : view_num
// B : loop 숫자
// C : gu 값
function save_order(A,B,C){
	var img_val	 ="sort_val"+B;
	var order_val = document.all[img_val].value;
	if(!check_num('form1',document.all[img_val].name)){
		alert('정렬값은 숫자만 입력할 수 있습니다');
		document.all[img_val].focus();
		return false;
	}
	if(!order_val || order_val < 0){
		alert('정렬값을 정확히 입력하세요');
		document.all[img_val].focus();
		return false;
	}
	list_html = "<input type='hidden' name='edit_num' value='"+A+"'><input type='hidden' name='sort_val' value='"+order_val+"'><input type='hidden' name='gu' value='"+C+"'><input type='hidden' name='process_value' value='sort_change'>";
	document.all["board_list_select"].innerHTML=list_html;
	document.board_view_frm_limit.target="process";
	document.board_view_frm_limit.action="./process.php";
	document.board_view_frm_limit.submit();

}

//===================================================================
// 속성 처리 부분(체크박스 속성 처리 부분)
//===================================================================
// A : 반복변수
// B : 게시판 아이디
// C : 테이블 명
// D : 필드명
function viewType_frm(A,B,C,D){	
	switch(D){
		case("viewType"):			//보기속성
			if (!document.all["viewTypeVal"+A].checked){
				var check_value=0;
			}else{
				var check_value=1;
			}
			var conf	= confirm(VAR_viewType);
			break;
		
		case("first_display"):		//공지속성
			if (!document.all["first_show"+A].checked){
				var check_value=0;
			}else{
				var check_value=1;
			}
			var conf	= confirm(VAR_firstType);
			break;
		case("emptyType"):			//품절속성
			if (!document.all["emptyTypeVal"+A].checked){
				var check_value=0;
			}else{
				var check_value=1;
			}
			var conf	= confirm(VAR_emptyType);
			break;
		
		case("hotType"):			//추천상품속성
			if (!document.all["hotTypeVal"+A].checked){
				var check_value=0;
			}else{
				var check_value=1;
			}
			var conf	= confirm(VAR_hotType);
			break;
		case("mainHotType"):			//추천상품속성
			if (!document.all["mainHotTypeVal"+A].checked){
				var check_value=0;
			}else{
				var check_value=1;
			}
			var conf	= confirm(VAR_mainHotType);
			break;
		
		case("viewDel"):		//삭제처리			
			var conf	= confirm('제품을 삭제하시겠습니까?');
			break;
		case("Recover"):		//삭제처리			
			var conf	= confirm('제품을 복구하시겠습니까?');
			break;
	}
	
	if(conf){
		var in_html = "<input type='hidden' name='num' value='"+A+"'><input type='hidden' name='boardID' value='"+B+"'><input type='hidden' name='tb_name' value='"+C+"'><input type='hidden' name='fieldName' value='"+D+"'><input type='hidden' name='chk_value' value='"+check_value+"'><input type='hidden' name='process_value' value='viewTypeChk'>";
		document.all["protank_span"].innerHTML = in_html;
		document.protank_frm.target="hidden";
		document.protank_frm.action="./process.php";
		document.protank_frm.submit();
	}
}

//===================================================================
// 펼쳐 상세보기 처리 부분
//===================================================================
// A : view_num
// B : 상세페이지 주소
function show_detail(A,B){
	if(B){
		var re_val	= document.all["detail_view"+A].style.display;
		if(re_val=="none"){	
			var tgfrm = "detail_hidden"+A;
			document.all["detail_view"+A].style.display = "";
			document.frames["detail_hidden"+A].location.href = B;	
		}else{
			document.all["detail_view"+A].style.display = "none";		
		}
	}else{
		var re_val	= document.all[A].style.display;
		if(re_val=="none"){	
			document.all[A].style.display = "";		
		}else{
			document.all[A].style.display = "none";		
		}
	}
}
//===================================================================
// 정렬 값 수정
//===================================================================
// A : view_num
// B : 반복변수
// C : gu
// D : form 명
function save_order(A,B,C,D){
	var img_val	 ="sort_val"+B;
	alert(img_val);	
	var order_val = document.all[img_val].value;

	list_html = "<input type='hidden' name='edit_num' value='"+A+"'><input type='hidden' name='sort_val' value='"+order_val+"'><input type='hidden' name='gu' value='"+C+"'><input type='hidden' name='process_value' value='sort_change'>";
	document.all["protank_span"].innerHTML=list_html;
	document.protank_frm.target="process";
	document.protank_frm.action="./process.php";
	document.protank_frm.submit();
}

//===================================================================
// 팝창 사이즈 자동조절 처리 부분
//===================================================================
function newResize(){
	var Dwidth = parseInt(document.body.scrollWidth); 
    var Dheight = parseInt(document.body.scrollHeight); 
    var divEl = document.createElement("div"); 
    divEl.style.position = "absolute"; 
    divEl.style.left = "0px"; 
    divEl.style.top = "0px"; 
    divEl.style.width = "100%"; 
    divEl.style.height = "100%"; 

    document.body.appendChild(divEl); 

    window.resizeBy(Dwidth-divEl.offsetWidth, Dheight-divEl.offsetHeight); 
    document.body.removeChild(divEl); 
}



//===================================================================
// flash 처리 부분
//===================================================================
// A : 파일명
// B : width
// C : height
// D : page
// E : layer
function FlashOb(A,B,C,D,E){
	if(D){
		var Fname = A+"?pageNum="+D;
	}else{
		var Fname = A;
	}
	document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + B + "\" height=\"" + C + "\">"); 
	document.writeln("<param name=\"movie\" value=\"" + Fname + "\">"); 
	document.writeln("<param name=\"quality\" value=\"high\" />");     
	document.writeln("<param name=\"wmode\" value=\"transparent\">"); 
	document.writeln("<embed src=\"" + Fname + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + B + "\"  height=\"" + C + "\">"); 
	document.writeln("</object>");

}

//===================================================================
// flash 처리 부분
//===================================================================
// A : 파일명
// B : width
// C : height
// D : page
// E : 변수명
// F : div
function FlashObLayer(A,B,C,D,E,F){
	var layerVal;
	if(D){
		var Fname = A+"?"+E+"="+D;
	}else{
		var Fname = A;
	}
	layerVal	= "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+B+"' height='"+C+"'>";
	layerVal	+= "<param name='movie' value='"+Fname+"'>";
	layerVal	+= "<param name='quality' value='high'>";
	layerVal	+= "<param name='WMode' value='Transparent'>";
	layerVal	+= "<embed src='/flash/navigation-nonsub.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+B+"' height='"+C+"'></embed></object>";
	
	document.getElementById('F').innerHTML = layerVal;
	return;
}

//===================================================================
// 동적 필드 추가
// A : form name
// B : input text 앞
// C : input text 뒤
// D : question number
// 
//===================================================================
function Protank_applyAdd(){
	try{

		var objI, objRow, objCell;
		objI = document.all['AddFileForm'];
		objRow = objI.insertRow();
		objCell = objRow.insertCell();
		objCell.className = "Text";	
		objCell.insertAdjacentHTML("AfterBegin", "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td width='50%'><input type='text' name='goods_color[]' class='textfield' size='40' value=''></td><td><input type='text' name='goods_size[]' class='textfield' size='25' value=''></td></tr></table>");
		document.all['question_number'].value = Number(document.all['question_number'].value) + 1;
		return;
	}catch(e){
		alert('추가 중 에러발생 다시시도하세요');
		return false;
	}
}

function add_goodsInfo(A,B,C,D){
	try{
		var objI, objRow, objCell;
		objI = document.all[A];
		objRow = objI.insertRow();
		objCell = objRow.insertCell();
		objCell.className = "Text";	
		objCell.insertAdjacentHTML("AfterBegin", "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td width='50%'><input type='text' name='"+B+"' class='textfield' size='40' value=''></td><td><input type='text' name='"+C+"' class='textfield' size='25' value=''></td></tr></table>");
		document.all[D].value = Number(document.all[D].value) + 1;
	}catch(e){
		alert('추가 중 에러발생 다시시도하세요');
		return false;
	}
}

function add_question(){
	try{
		var objI, objRow, objCell , objAdd;
		objI = document.all["AddFileForm"];
		del_cnt = Number(document.all["question_number"].value)+1;
		objRow = objI.insertRow();
		objCell = objRow.insertCell();
		objCell.className = "Text";	
		objI.clickedRowIndex=this.rowIndex;
		
		objAdd = "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>";                      
		objAdd += "<tr>"; 
		objAdd += "<td height='28' align='center' class='text' width='50'>문항"+del_cnt+"</td>";
		objAdd += "	<td align='left'> <input name='poll_question[]' type='text' class='textfield' size='45'>"; 
		objAdd += "	</td>";
		objAdd += "	</tr>";		
		objAdd += "</table>";
		objCell.insertAdjacentHTML("AfterBegin", objAdd);
		document.all["question_number"].value = Number(document.all["question_number"].value) + 1;
	}catch(e){
		alert('추가 중 에러발생 다시시도하세요');
		return false;
	}
}

function add_bankInfo(){
	try{
		var objI, objRow, objCell , objAdd;
		objI = document.all["AddFileForm"];
		del_cnt = Number(document.all["question_number"].value)+1;
		objRow = objI.insertRow();
		objCell = objRow.insertCell();
		objCell.className = "Text";	
		objI.clickedRowIndex=this.rowIndex;
		
		objAdd = "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>";                      
		objAdd += "<tr>"; 
		objAdd += "<td height='28' align='center' class='text' width='10%'>은행"+del_cnt+"</td>";
		objAdd += "	<td align='left' width='90%'> <input name='bankInfoArr[]' type='text' class='textfield' size='40' maxlength='100' required reqName='은행정보를 입력하세요'> "; 
		objAdd += "&nbsp;(EX: 은행명 / 계좌번호 / 예금주)";
		objAdd += "	</td>";
		objAdd += "	</tr>";		
		objAdd += "</table>";
		objCell.insertAdjacentHTML("AfterBegin", objAdd);
		document.all["question_number"].value = Number(document.all["question_number"].value) + 1;
	}catch(e){
		alert('추가 중 에러발생 다시시도하세요');
		return false;
	}
}

//===================================================================
// 동적 필드 삭제
// A : form field
// B : question number
//===================================================================
function del_question(A,B){
	try{
		var objI, objRow, objCell;
		document.all[A].deleteRow();   
		document.all[B].value = Number(document.all[B].value) - 1;
	}catch(e){
		alert('더 이상 삭제할 수 없습니다');
		return false;
	}
}

//==============================================================
// 목록 위로 이동
//==============================================================
function list_up(A,B,C){
	try{	
		var target	= document.all[A];
		var target_pos,t_pos,tt_pos,t_value;	

		target_pos	= target.options[target.selectedIndex].value;
		t_value		= target_pos.split(",");
		t_pos		= target.selectedIndex;			

		if(t_pos==0){
			//return false;
		}else{
			tt_pos = t_pos-1;
		}		

		ttarget_pos	= target.options[tt_pos].value;	
		tt_value	= ttarget_pos.split(",");			
		
		var temp_option = new Option(target.options[tt_pos].text,target.options[tt_pos].value);
		target[tt_pos]	= new Option(target.options[target.selectedIndex].text,target.options[target.selectedIndex].value);
		target[t_pos]	= temp_option;		
		target[tt_pos].selected = true;	
		
	}catch(e){
		alert('이동할 항목을 선택하세요');
		return false;
	}
	value_change(A,B,C);
}

//===============================================================
// 목록 아래로 이동
//===============================================================
function list_down(A,B,C){
	try{
		var target	= document.all[A];
		var target_pos,t_pos,tt_pos,t_value;	
		var b_length
		target_pos	= target.options[target.selectedIndex].value;
		t_value		= target_pos.split(",");
		t_pos		= target.selectedIndex;	
		
		if(t_pos==b_length){
			return false;
		}else{
			tt_pos = t_pos+1;
		}		

		ttarget_pos	= target.options[tt_pos].value;	
		tt_value	= ttarget_pos.split(",");			
		
		var temp_option = new Option(target.options[tt_pos].text,target.options[tt_pos].value);
		target[tt_pos]	= new Option(target.options[target.selectedIndex].text,target.options[target.selectedIndex].value);
		target[t_pos]	= temp_option;		
		target[tt_pos].selected = true;			
	}catch(e){
		alert('이동할 목록을 선택하세요');
		return false;
	}
	value_change(A,B,C);
}

//===================================================================
// 위,아래 이동에 따른 text 값 순서변경 처리
//===================================================================
function value_change(A,B,C){
	var target		= document.all[A];
	var re_list		= document.all[B].value;
	var re_name		= document.all[C].value;
	var source		= document.all[A];
	var re_list_val , re_name_val
	for(var i=0;i<source.options.length;i++){
		if(i==0){
			re_list_val = source.options[i].value;
			re_name_val	= source.options[i].text;
		}else{
			re_list_val	= re_list_val + "|" +source.options[i].value;
			re_name_val	= re_name_val + "|" +source.options[i].text;
		}		
	}
	document.all[B].value	= re_list_val;
	document.all[C].value	= re_name_val;
}

//===================================================================
// 업로드전 이미지 미리보기
//===================================================================
function preView(A){
	document.getElementById("preViewImg").src=A; 
}

//===================================================================
// 주문정보 속성 변경 처리 부분(selectBox) - TM_orderInfo
// A : option value
// B : table name
// C : num
// D : target
//===================================================================
function ProcessChange(A,B,C,D){
	var conf	= confirm('주문상태를 변경하시겠습니까?');
	if(conf){
		list_html = "<input type='hidden' name='processVal' value='"+A+"'><input type='hidden' name='tb_name' value='"+B+"'><input type='hidden' name='view_num' value='"+C+"'><input type='hidden' name='process_value' value='orderProcessChange'>";
		document.all["protank_span"].innerHTML=list_html;
		document.protank_frm.target=D;
		document.protank_frm.action="./process.php";
		document.protank_frm.submit();	
	}
}

//===================================================================
// 주문정보 속성 변경 처리 부분(selectBox) - TM_orderList
// A : option value
// B : table name
// C : num
// D : target
//===================================================================
function ProcessListChange(A,B,C,D){
	var conf	= confirm('주문상태를 변경하시겠습니까?');
	if(conf){
		list_html = "<input type='hidden' name='processVal' value='"+A+"'><input type='hidden' name='tb_name' value='"+B+"'><input type='hidden' name='view_num' value='"+C+"'><input type='hidden' name='process_value' value='orderProcessListChange'>";
		document.all["protank_span"].innerHTML=list_html;
		document.protank_frm.target=D;
		document.protank_frm.action="./process.php";
		document.protank_frm.submit();	
	}
}

//===================================================================
// 주문내역 멀티삭제
function orderDel(form,target){
	if(!form.del_list_value.value){
		alert('삭제할 주문내역을 선택하세요');
		return;
	}
	var conf	= confirm('선택한 주문내역을 삭제하시겠습니까?');
	if(conf){
		form.target=target;
		form.action='./process.php';
		form.submit();
	}
}


//===================================================================
// 설문등록 처리 부분
function send_Poll(form){
	var PQ		= document.forms['write_frm'].elements['poll_question[]'];
	var del_cnt = document.all["question_number"].value;
	try{
		if(!form.title.value || emptyForm(form.title)){
			alert('설문 제목을 입력하세요');
			form.title.focus();
			return;
		}
		if(del_cnt<1){
			alert('설문 문항은 1개 이상 있어야 합니다');
			return;
		}
		for(var i=0;i<del_cnt;i++){
			if(!PQ[i].value || emptyForm(PQ[i])){
				alert('설문 문항의 내용을 입력하세요');
				PQ[i].focus();
				return;
			}
		}
	}catch(e){
		if(!form.title.value || emptyForm(form.title)){
			alert('설문 제목을 입력하세요');
			form.title.focus();
			return;
		}
		if(del_cnt<1){
			alert('설문 문항은 1개 이상 있어야 합니다');
			return;
		}
		if(!PQ.value || emptyForm(PQ)){
			alert('설문 문항의 내용을 입력하세요');
			PQ.focus();
			return;
		}
	}
	form.target="";
	form.action="./process.php";
	form.submit();

}

//===================================================================
// 쿠키 체크 처리 부분
function getCookie(strName){
	var strArg = new String(strName + '=');	
	var nArgLen, nCookieLen, nEnd;
	var i = 0, j;

	nArgLen    = strArg.length;
	nCookieLen = document.cookie.length;

	if(nCookieLen > 0) {
		while(i < nCookieLen) {
			j = i + nArgLen;
			if(document.cookie.substring(i, j) == strArg) {
				nEnd = document.cookie.indexOf (';', j);
				if(nEnd == -1) nEnd = document.cookie.length;
				return unescape(document.cookie.substring(j, nEnd));
			}
			i = document.cookie.indexOf(' ', i) + 1;
			if (i == 0) break;
		}
	}
	return('');
}
function setCookie( name, value, expiredays ){
	var today = new Date();
	today.setDate( today.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
}
function closewin(A) {
   if ( document.all['popup'].checked ) {
	setCookie( A, "checked" ,1 );
          }
   top.close();
}


function Protank_SetHome(A)  {
	if(!K_SetHomePage.isHomePage(A))        
	K_SetHomePage.setHomePage(A); 
}

function copy_clip(meintext){ 
	if (window.clipboardData)	{ 
	window.clipboardData.setData("Text", meintext); 
	} 
	else if (window.netscape) 
	{ 
	netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 

	var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 
	if (!clip) return; 

	var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 
	if (!trans) return; 

	trans.addDataFlavor('text/unicode'); 

	var str = new Object(); 
	var len = new Object(); 
	var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 
	var copytext=meintext; 
	str.data=copytext; 
	trans.setTransferData("text/unicode",str,copytext.length*2); 
	var clipid=Components.interfaces.nsIClipboard; 
	if (!clip) return false; 
	clip.setData(trans,null,clipid.kGlobalClipboard); 
	} 
	alert("경로가 복사되었습니다.\n" + meintext); 
	return false; 
} 

function LayerMenu(A){
	if(document.all[A].style.display=="none"){
		document.all[A].style.display="";
	}else{
		document.all[A].style.display="none";
	}	
}
//===================================================================
// 적립금 사용하기 처리 부분
// A : 사용할 적립금 폼
// B : 사용할 적립금 필드
// C : 나의 현재 총 적립금액
// D : 사용적립금 표시 필드
// E : 총 결재금액(적립금 사용이전)
// F : 총 결재금액 표시 필드
function saveMoneyUse(A,B,C,D,E,F){
	//var float E
	if(Protank_chkPatten(document.forms[A].all[B],'regNum','숫자만 입력할 수 있습니다.')){
		if(Number(C) < Number(document.all[B].value)){
			alert('나의 보유 적립금 이상은 사용할 수 없습니다.');
			return;
		}
		if(Number(E) < Number(document.all[B].value)){
			alert('결제금액보다 큰 금액은 사용할 수 없습니다.');
			return;
		}
		if(Number(E) - Number(document.all[B].value) <1000){
		//===========================================================
		// 1000원 이하일 경우는 무통장, 실시간 계좌이체만 활성화		
			document.all['payMethod'].disabled = true;
		}
		document.all[D].innerHTML = Protank_Comma(Number(document.all[B].value))+" 원";
		document.all[F].innerHTML = Protank_Comma(Number(parseInt(E)-document.all[B].value))+" 원";
		document.all['totalPayMoney'].value	= Number(parseInt(E)-document.all[B].value);
		document.all['good_mny'].value	= Number(parseInt(E)-document.all[B].value);
	} 	
}

function Protank_Comma(number) {
    number = '' + number;
    if (number.length > 3) {

    var mod = number.length % 3;
    var output = (mod > 0 ? (number.substring(0,mod)) : '');
        for (i=0 ; i < Math.floor(number.length / 3); i++) {
        if ((mod == 0) && (i == 0))
            output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
        else
            output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
        }
    return (output);
    }
    else return number;
}

function detailView(A){
	if(document.all['contentID'+A].style.display=="none"){
		document.all['contentID'+A].style.display="";
	}else{
		document.all['contentID'+A].style.display="none";
	}
}

//===================================================================
// 우측 배너 처리 부분
String.prototype.toInteger = function() {
 return this.replace(/[^0-9]/g, '') * 1;
}

function follow_banner(div_id, origin_top, limit_top, margin_top)
{
 var d, t, s, g, target_height;
 origin_top *= 1;
 limit_top *= 1;
 margin_top *= 1;
 
 d = document.getElementById(div_id);
 s = document.body.scrollTop + "";

 target_height = s.toInteger() + margin_top;
 if(target_height < limit_top) {
  target_height = origin_top;
 }
 
 t = d.style.top.toInteger();
 
 if(t != target_height) {
  g = Math.ceil((t - target_height) / 5);
  if(g > 50) {
   g = 50;
  } else if (g < -50) {
   g = -50;
  }
  d.style.top = (t - g) + "px";
 }
 
 setTimeout("follow_banner('" + div_id + "', " + origin_top + ", " + limit_top + ", " + margin_top + ");", 1);
}

//===================================================================
// 즐겨찾기
function AddFavoriteFunc(url,title){
	window.external.AddFavorite('http://'+url,title);
	return;
}

//===================================================================
// 줄색 변경(마우스 오버)
function setColor(trName, color) { 
    tdCnt = trName.getElementsByTagName('td').length; 
    for(var i=0;i<tdCnt;i++) { 
        trName.getElementsByTagName('td')[i].style.backgroundColor=color; 
    } 
} 

//===================================================================
//미리보기 (파일처리부분)
function multiSelect(){
	try{
	var currElVal	= document.all['fileList[]'];
	for(var mulUp=0; mulUp<currElVal.options.length; mulUp++) {
		currElVal.options[mulUp].selected = true;				
	}
	}catch(e){}
}

//===================================================================
// alert(부분)
function Loading(mode,width_inc,name) { 
	var fontSize  = 14;        // 폰트 최대값 

	// 값을 변경하지 마세요 
	var left      = 0; 
	var top      = 0; 
	var fs      = 0; 

	var obj = document.getElementById(name); 

	if (!left) left = parseInt(obj.style.left.replace("px","")); 
	if (!top)  top  = parseInt(obj.style.top.replace("px","")); 
	if (obj.style.visibility == "hidden") obj.style.visibility = "visible"; 

	if ((mode == 1 && fs <= fontSize) || (mode == 2 && fs > 0)) { 
	obj.style.left      = left + (((fontSize*width_inc) - (fs*width_inc < 1 ? 20 : fs*width_inc)) / 2); 
	obj.style.top      = top + (fontSize - fs) / 2; 
	obj.style.width      = fs*width_inc < 1 ? 20 : fs*width_inc; 
	obj.style.fontSize = fs; 
	if (mode == 1) fs += 2; 
	else          fs -= 2; 
	setTimeout("Loading("+mode+","+width_inc+",'"+name+"')",30); 
	} 

	if (mode == 2 && fs < 1) { 
	fs = 0; 
	obj.style.visibility = "hidden"; 
	} 
} 

//===================================================================
// 자리이동
function Protank_Focus(obj, toID) {
	if (toID == null) return;
	var maxLen = obj.getAttribute("maxlength"); 
	if (obj.value.length >= maxLen) {
		focusThis(toID);
	}
}

function focusThis(id) {
	document.getElementById(id).focus();
}


//===================================================================
// 동영상 플레이
function Protank_movieImsi(fn,width,height){
	var kbtcMovie = "";
	kbtcMovie += '<OBJECT ID="kbtc" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase width="'+width+'" height="'+height+'" > ';
	kbtcMovie += '<PARAM name="url" value="' + fn + '"/>';
	kbtcMovie += '<PARAM name="defaultFrame" value="content"/>';	
	kbtcMovie += '<PARAM name="autoStart" value="true"/>';
	kbtcMovie += '<PARAM name="AnimationAtStart" value="1"/>';
	kbtcMovie += '<PARAM name="CursorType" value="1"/>';
	kbtcMovie += '<PARAM name="enableContextMenu" value="false"/>';
	kbtcMovie += '<PARAM name="ShowPositionControls" value="false"/>'; 
	kbtcMovie += '<PARAM name="fullScreen" value="false"/>'; 
	kbtcMovie += '<PARAM name="enabled" value="True"/>';
	kbtcMovie += '<PARAM name="stretchToFit" value="true"/>';
	kbtcMovie += '<PARAM name="AllowChangeDisplayMode" value="true"/>';
	kbtcMovie += '<PARAM name="MovieWindowSize" value="1"/>';
	kbtcMovie += '<PARAM name="saveHistory" content="no">';
	kbtcMovie += '<PARAM name="volume" value="70"/>';
	kbtcMovie += '<PARAM name="enableContextMenu" value="false">';
	kbtcMovie += '<embed src="' + fn + '" autostart="true" hidden="true" loop="0" id="kbtc">';
	//kbtcMovie += '<PARAM name="AutoSize" value="True"/>';
	kbtcMovie += '</OBJECT>';


	document.all['kbtc640'].innerHTML = kbtcMovie;	
}

//===================================================================
// 동영상 플레이
function Protank_movie(fn,width,height){
	var kbtcMovie;
	//if(chkVal=='1'){
	//	kbtcMovie = "<embed name='kbtc' src='"+fn+"' autostart='true' height='"+height+"' width='"+width+"' loop='0' id='kbtc' showControls='1' ShowStatusBar='true' SHOWGOTOBAR='1' ShowPositionControls='1' ShowTracker='1'>";
	//}else{
		kbtcMovie = "<embed name='kbtc' src='"+fn+"' autostart='true' height='"+height+"' width='"+width+"' loop='0' id='kbtc' showControls='1' ShowStatusBar='true' SHOWGOTOBAR='0' ShowPositionControls='0' ShowTracker='1'>";
	//}

	document.all['kbtc640'].innerHTML = kbtcMovie;	
}