<!--

// 텍스트 필드에서 등록후 다음 포커스로 이동
function defNextFocus(len, nextObj, obj){
	if(len <= obj.value.length){
		nextObj.focus();
	}
}

// 레이어 iframe 생성
function createLayerFrame(width, height, url, left, top){


	if(document.getElementById("layerFrame")) return false;	// 중복생성 방지
	layerFrame = document.createElement("DIV");
	layerFrame.setAttribute('id', 'layerFrame');
	layerFrame.style.width = width;
	layerFrame.style.height = height;
	layerFrame.style.zIndex = 999;
	layerFrame.style.position = 'absolute';

	// 레이어 위치를 정하지 않았을경우
	if(!left || !top){
		layerFrame.style.left = event.x + document.body.scrollLeft;
		layerFrame.style.top = event.y + document.body.scrollTop;
	}else{
		layerFrame.style.left = left;
		layerFrame.style.top = top;
	}
	layerFrame.innerHTML = "<iframe frameborder=\"0\" id=\"innerFrame\"  scrolling=\"no\" width=\"100%\" height=\"100%\"></iframe>";
	document.body.appendChild(layerFrame);
	document.getElementById("innerFrame").setAttribute('src', url);
}

// 레이어 iframe 삭제
function removeLayerFrame(){
	document.body.removeChild(document.getElementById('layerFrame'));
}

// 잘못된 메일체크
function emailCheck(str){ 
	var emailEx1 = /^([A-Za-z0-9]{0,1})([A-Za-z0-9]{1,15})([A-Za-z0-9\-_.]{0,1})([A-Za-z0-9]{1,15})([A-Za-z0-9]{0,1})(@{1})([A-Za-z0-9_]{1,15})(.{1})([A-Za-z0-9_]{2,10})(.{1}[A-Za-z]{2,10})?(.{1}[A-Za-z]{2,10})?$/;
	if(!emailEx1.test(str)){
		return false;
	}else{
		return true;
	}
}

// ltrim
function ltrim(s){
	return s.replace( /^[\ ]+/g , "" );
}

// rtrim
function rtrim(s) {
	return s.replace( /[\s*$ ]+$/g, "" );
}

// trim
function trim(s) {
	return this.rtrim(this.ltrim(s));
}

// numberFormat
function numberFormat(num) {
	num = num.toString();
	num = num.replace(/,/g, "")
	var num_str = num.toString()
	var result = ''

	for(var i=0; i<num_str.length; i++) {
		var tmp = num_str.length-(i+1)
		if(i%3==0 && i!=0) result = ',' + result
		result = num_str.charAt(tmp) + result
	}
	return result;
}	// end numberFormat function

// numberFormat
function numberFormat2(num) {
	num = num.toString();
	num = num.replace(/,/g, "")
	num = parseInt(num)
	var num_str = num.toString()
	var result = ''

	for(var i=0; i<num_str.length; i++) {
		var tmp = num_str.length-(i+1)
		if(i%3==0 && i!=0) result = ',' + result
		result = num_str.charAt(tmp) + result
	}
	return result;
}	// end numberFormat function



// 드림위버 js
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_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_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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// 메뉴등 숨기기또는 보이기
function displayBlock(obj){
	if(obj.style.display == 'none'){
		obj.style.display = 'block';
	}else{
		obj.style.display = 'none';
	}
}


// 정확한비율 이미지 보기
function imagePopup(URL,Width,Height){
	var screen_width = window.screen.width; // 윈도우 넓이
	var screen_height = window.screen.height; // 윈도우 높이
	// 이미지 크기가 윈도우 사이즈보다 클경우
	if(Width >= screen_width){
		var Open_Width = screen_width;
		var Open_Height = (screen_width/Width)*Height;
	}else if(Height >= screen_height){
		var Open_Height = screen_height;
		var Open_Width = (screen_height/Height)*Width;
	}else{
		var Open_Width = Width;
		var Open_Height = Height;
	}
	if(Open_Height >= screen_height){
		var Open_Width = (screen_height/Open_Height)*Open_Width;
		var Open_Height = screen_height;
	}
	window.open(URL,'','width='+Open_Width+', height='+Open_Height+', toolbar=no, resizeable=no, scrolling=no, scrollbars=no, top=0, left=0');
}

//-->
