//팝업 센터처러
function MM_openPopup(theURL,winName,w,h) { //v2.0
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;

	winPop_upoint=window.open(theURL,winName,"width="+w+",height="+h+",top="+wint+",left="+winl+",status=yes");
	winPop_upoint.focus()
}


//숫자 세자리 쉽표만 입력1
function Number_Format(fn){


  var num_str = fn.value;
  var Re = /[^0-9]/g;
  var ReN = /(-?[0-9]+)([0-9]{3})/;
  num_str = num_str.replace(Re,'');


  while (ReN.test(num_str)) {
    num_str = num_str.replace(ReN, "$1,$2");

  }
  fn.value = num_str;
}


//숫자 세자리 쉽표만 입력2 --------------텍스트 리턴형
function Number_Format_txt(int_str){


  var num_str = int_str;
  var Re = /[^0-9]/g;
  var ReN = /(-?[0-9]+)([0-9]{3})/;
  num_str = num_str.replace(Re,'');


  while (ReN.test(num_str)) {
    num_str = num_str.replace(ReN, "$1,$2");

  }
  return num_str;
}


//숫자 만 입력3
function Number_Only(fn){


  var num_str = fn.value;

  if (isNaN(num_str)){
	  alert("숫자로만 입력 해야합니다.")
	  fn.value=""
	  fn.focus()

  }
}


// 체크박스 전체 체크
function check_all(){
		if(form2.chk_all.checked==true){

			for (i=1; i<form2.elements.length; i++){
				if (form2.elements[i].type == 'checkbox'){
					form2.elements[i].checked=true;
				}
			}
		}else{
			for (i=1; i<form2.elements.length; i++){
				if (form2.elements[i].type == 'checkbox'){
					form2.elements[i].checked=false;
				}
			}
		}
}

function check_all2(){
				if(form1.chk_all.checked==true){

					for (i=0; i<form2.elements.length; i++){
					  if (form2.elements[i].type == 'checkbox'){
							form2.elements[i].checked=true;
					  }
					}
				}else{
					for (i=0; i<form2.elements.length; i++){
					  if (form2.elements[i].type == 'checkbox'){
							form2.elements[i].checked=false;
					  }
					}
				}
}


// 아이프레임으로 삭제
function i_del(url){
	my_chk=confirm('삭제하시겠습니까?')
	if(my_chk==false){
		return;
	}

	iframeset.location.replace(url);
}



//접근금지 팝업창
function authReject(){
		winreject=window.open('../include/reject.html','auth1','width=391,height=181,left=300,top=200,tomargin=0,leftmargin=0,scrollbars=0,resizable=0,menubar=0,directories=0,status=0,titlebar=0,toolbar=0location=0');
		winreject.focus()
}

//값에 공백이 있는지 체크

function IsEmpty(Str) {
  for (var i=0;i<Str.length;i++) { if (Str.substring(i,i+1) != " ") return false;  }
  return true;
}

//select : select에서 str값을 가진 option을 선택되도록 설정

function setSelect(input,str) {

  for (i=0;i<input.options.length;i++) {
    if (input.options[i].value == str) input.options[i].selected=true;
  }

}


//메인 이미지 모서리 라운드 처리


function roundTable(objID) {
var obj = document.getElementById(objID);
var Parent, objTmp, Table, TBody, TR, TD;
var bdcolor, bgcolor, Space;
var trIDX, tdIDX, MAX;
var styleWidth, styleHeight;

// get parent node
Parent = obj.parentNode;
objTmp = document.createElement('SPAN');
Parent.insertBefore(objTmp, obj);
Parent.removeChild(obj);

// get attribute
bdcolor = obj.getAttribute('rborder');
bgcolor = obj.getAttribute('rbgcolor');
radius = parseInt(obj.getAttribute('radius'));
if (radius == null || radius < 1) radius = 1;
else if (radius > 6) radius = 6;

MAX = radius * 2 + 1;

/*
create table {{
*/
Table = document.createElement('TABLE');
TBody = document.createElement('TBODY');

Table.cellSpacing = 0;
Table.cellPadding = 0;

for (trIDX=0; trIDX < MAX; trIDX++) {
TR = document.createElement('TR');
Space = Math.abs(trIDX - parseInt(radius));
for (tdIDX=0; tdIDX < MAX; tdIDX++) {
TD = document.createElement('TD');

styleWidth = '1px'; styleHeight = '1px';
if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
else if (radius > 2) {
if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
}

if (styleWidth != null) TD.style.width = styleWidth;
if (styleHeight != null) TD.style.height = styleHeight;

if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
else if (tdIDX > Space && Space < MAX - tdIDX - 1) TD.style.backgroundColor = bgcolor;

if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
TR.appendChild(TD);
}
TBody.appendChild(TR);
}

/*
}}
*/

Table.appendChild(TBody);

// insert table and remove original table
Parent.insertBefore(Table, objTmp);
}


//################3 화면 축소 확대 #########################
//################3 화면 축소 확대 #########################
var nowZoom = 100; // 현재비율 
var maxZoom = 200; // 최대비율(500으로하면 5배 커진다) 
var minZoom = 80; // 최소비율 

//화면 키운다. 
function zoomIn(){ 
    if (nowZoom < maxZoom){ 
        nowZoom += 10; //25%씩 커진다. 
    }else{ 
  alert("화면의 최대비율 입니다.");
        return; 
    } 
    document.body.style.zoom = nowZoom + "%"; 
} 

//화면 줄인다. 
function zoomOut(){ 

    if (nowZoom > minZoom){ 
        nowZoom -= 10; //25%씩 작아진다. 
    }else{ 
 alert("화면의 최소비율 입니다.");
        return; 
    } 
    document.body.style.zoom = nowZoom + "%"; 
} 

//화면 원래대로 
function zoomDefault(){ 
    nowZoom = 100; 
    document.body.style.zoom = nowZoom + "%"; 
} 

//################3 화면 축소 확대 #########################
//################3 화면 축소 확대 #######################