﻿﻿// 함수명 : layershow(경로, 좌측좌표, 상단좌표, 넓이, 높이)
function layershow(url, le, to, wi, hi) {
	var obj = window.document.getElementById("mainLayer");
	if(!obj) {
		obj = window.document.createElement("div");
		obj.setAttribute("id","mainLayer");
		window.document.body.appendChild(obj);
	}
	obj.style.display = "";
	obj.style.position = "absolute";
	obj.style.zIndex = "100";
	obj.style.top = to;
	obj.style.left = le;
	obj.style.height = hi;
	obj.style.width = wi;
	obj.innerHTML = "<iframe id='iframe' name='iframe' frameborder='0' scrolling='auto'></iframe>";
	window.document.getElementById("iframe").src = url;
	window.document.getElementById("iframe").style.width = wi;
	window.document.getElementById("iframe").style.height = hi;
}
function layerhide() {
    parent.document.body.scroll = 'yes';
    window.top.document.scroll = 'yes';
	var obj = window.parent.document.getElementById("mainLayer");
	obj.style.display = "none";
	
}
// 함수명 : layershow2(경로 , 넓이, 높이)
function layershow2(url, wi, hi) {
	var obj = window.document.getElementById("mainLayer");
	if(!obj) {
		obj = window.document.createElement("div");
		obj.setAttribute("id","mainLayer");
		window.document.body.appendChild(obj);
	}
	obj.style.display = "";
	obj.style.position = "absolute";
	obj.style.zIndex = "100";

	var objLayerWidth = wi;
	var objLayerHeight = hi;
	var objLayerLeft = parseInt(((document.body.clientWidth - parseInt(objLayerWidth)) / 2) + document.body.scrollLeft);
	var objLayerTop = parseInt(((document.body.clientHeight - parseInt(objLayerHeight)) / 2) + document.body.scrollTop);
	if(parseInt(document.body.clientHeight) < parseInt(objLayerHeight)) objLayerTop = document.body.scrollTop;
	if(objLayerTop < 0) objLayerTop = 0;
	if(objLayerLeft < 100) objLayerLeft = 0;
	window.document.getElementById("mainLayer").style.left = objLayerLeft;
	window.document.getElementById("mainLayer").style.top = objLayerTop;
	obj.innerHTML = "<iframe id='iframe' name='iframe' frameborder='0' scrolling='auto'></iframe>";
	window.document.getElementById("iframe").src = url;
	window.document.getElementById("iframe").style.width = wi;
	window.document.getElementById("iframe").style.height = hi;
	
}
/// parent.document.body.scroll = "no";
<!-- S : Sub Menu // 따라다니는 link 메뉴 -->
var scroll_pixel,div_pixel,gtpos,gbpos,loop,moving_spd;
var top_margin = 300;		/// 창의 맨위와의 여백 내려올때
var top_margin2 =300;		/// 창의 맨위와의 여백 올라올때
var speed = 20;			/// 점차 줄어드는 속도를 위한 설정
var speed2 = 15;		/// setTimeout을 위한 속도 설정
var moving_stat = 1;		/// 메뉴의 스크롤을 로딩시 on/off설정 1=움직임 0은 멈춤
 
function check_scrollmove()
{
  scroll_pixel = document.body.scrollTop;
        gtpos = document.body.scrollTop+top_margin;
        gbpos = document.body.scrollTop+top_margin2;
  if(quickmenu.style.pixelTop < gtpos)
        {
         moving_spd = (gbpos-quickmenu.style.pixelTop)/speed;
         quickmenu.style.pixelTop += moving_spd;
        }
        if(quickmenu.style.pixelTop > gtpos)
        {
         moving_spd = (quickmenu.style.pixelTop-gtpos)/speed;
         quickmenu.style.pixelTop -= moving_spd;
        }
        loop = setTimeout("check_scrollmove()",speed2);
}
function moving_control()
{
  if(!moving_stat){ check_scrollmove(); moving_stat = 1;}
        else{ clearTimeout(loop); moving_stat = 0; quickmenu.style.pixelTop = top_margin;}
}
<!-- E : Sub Menu // 따라다니는 link 메뉴 --> 

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 flash(c,d,e) {
//alert(e);
 var flash_tag = "";
 flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
 flash_tag +='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
 flash_tag +='WIDTH="'+c+'" HEIGHT="'+d+'" >';
 flash_tag +='<param name="movie" value="'+e+'">';
 flash_tag +='<param name="quality" value="high">';
 flash_tag +='<param name="wmode" value="transparent">';
 flash_tag +='<embed src="'+e+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
 flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+c+'" HEIGHT="'+d+'"></embed></object>'

 document.write(flash_tag);

}
function showLeftFlash( src, width, height ) {
	document.write( "<object id='LeftFlash' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+width+"' height='"+height+"'>" );
	document.write( "<param name='allowScriptAccess' value='sameDomain'>" );
	document.write( "<param name='movie' value='"+src+"'>" );
	document.write( "<param name='quality' value='high'>" );
	document.write( "<param name='wmode' value='transparent' />" );
	document.write( "<param name='bgcolor' value='#ffffff'>" );
	document.write( "<embed src='"+src+"' quality='high' bgcolor='#ffffff' width='"+width+"' height='"+height+"' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>" );
	document.write( "</object>" );
}

function changeFlashMenu( lmnum, lsnum ) {

	var LeftFlash = document.getElementById("LeftFlash");

	if( LeftFlash != null ) {
		LeftFlash.movie += "?menunum="+lmnum+"&submenunum="+lsnum;
	}
}
//<!--
//    function MM_jumpMenu (targ,selObj,restore){ //v3.0
//    if (selObj.selectedIndex == 0) {return false; 
//    } else { 
//        eval("window.open('"+selObj.options[selObj.selectedIndex].value+"','','')");
//        if (restore) selObj.selectedIndex=0;
//    }
//}-->
function showMapFlash( src, width, height ) {
	document.write( "<object id='DealerMap' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+width+"' height='"+height+"'>" );
	document.write( "<param name='allowScriptAccess' value='sameDomain'>" );
	document.write( "<param name='movie' value='"+src+"'>" );
	document.write( "<param name='quality' value='high'>" );
	document.write( "<param name='bgcolor' value='#ffffff'>" );
	document.write( "<embed src='"+src+"' quality='high' bgcolor='#ffffff' width='"+width+"' height='"+height+"' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>" );
	document.write( "</object>" );
}
//-->

//개발추가
 /**********************************************************************************
    함수명			: checkKoreanOnly(koreanChar)
    작성목적		: 한글만 입력체크
    작성자			: 문광복
    최초작성일	    : 2007.08.23
    최종작성일	    : 2007.08.23
    수정내역		: 
    **********************************************************************************/
function checkKoreanOnly( koreanChar ) {
   
   if ( koreanChar == null ) return false ;
   
   for(var i=0; i < koreanChar.length; i++){ 

     var c=koreanChar.charCodeAt(i); 

     //( 0xAC00 <= c && c <= 0xD7A3 ) 초중종성이 모인 한글자 
     //( 0x3131 <= c && c <= 0x318E ) 자음 모음 

     if( !( ( 0xAC00 <= c && c <= 0xD7A3 ) || ( 0x3131 <= c && c <= 0x318E ) ) ) {      
        return false ; 
     }
   }  
   return true ;
}

 /**********************************************************************************
    함수명			: checkEnglishOnly( englishChar )
    작성목적		: 영문만 입력체크
    작성자			: 문광복
    최초작성일	    : 2007.08.23
    최종작성일	    : 2007.08.23
    수정내역		: 
    **********************************************************************************/
function checkEnglishOnly( englishChar ) {  
    
    if ( englishChar == null ) return false ;
       
    for( var i=0; i < englishChar.length;i++){          
       var c=englishChar.charCodeAt(i);       
       if( !( (  0x61 <= c && c <= 0x7A ) || ( 0x41 <= c && c <= 0x5A ) ) ) {         
        return false ;       
       }
     }      
    return true ;
     
}

 /**********************************************************************************
    함수명			: checkDigitOnly(digitChar)
    작성목적		: 숫자만 입력체크
    작성자			: 문광복
    최초작성일	    : 2007.08.23
    최종작성일	    : 2007.08.23
    수정내역		: 
    **********************************************************************************/
function checkDigitOnly(digitChar)
{
    if ( digitChar == null ) return false ;
       
    for(var i=0;i<digitChar.length;i++){          
       var c=digitChar.charCodeAt(i);       
       if( !(  0x30 <= c && c <= 0x39 ) ) {         
        return false ;       
       }
     }      
    return true ;
}

/**********************************************************************************
    함수명			: numcheck() // onKeyPress="numcheck()" 체크
    작성목적		: 입력시 숫자만 입력하기
    작성자			: 문광복
    최초작성일	    : 2007.08.23
    최종작성일	    : 2007.08.23
    수정내역		: 
    **********************************************************************************/
function numcheck()  {  
 if ((event.keyCode<48) || (event.keyCode>57))  {
      event.returnValue=false;
  }
 }
 
/**********************************************************************************
    함수명			: EmailChk(Email)
    작성목적		: EMAIL 유효값 체크
    작성자			: 문광복
    최초작성일	    : 2007.08.23
    최종작성일	    : 2007.08.23
    수정내역		: 
    **********************************************************************************/
function EmailChk(Email)  { 

 invalidchars = " /:,;"
 for (i=0; i<invalidchars.length; i++)  {
  badchar = invalidchars.charAt(i)
  if (Email.indexOf(badchar,0) > -1)   {
   return (false);
  }
 }
 atPos = Email.indexOf("@",1)
 if (atPos == -1) {
  return (false);
 }
 if (Email.indexOf("@",atPos+1) > -1) {
  return (false);
 }
 periodPos = Email.indexOf(".",atPos)
 if (periodPos == -1) {
  return (false);
 }
 if (periodPos+3 > Email.length) {
  return (false);
 }
 return (true);
} 

/**********************************************************************************
    함수명			: Check_Empty(str)
    작성목적		: 문자열중 공백체크
    작성자			: 문광복
    최초작성일	    : 2007.08.23
    최종작성일	    : 2007.08.23
    수정내역		: 
    **********************************************************************************/
function Check_Empty(str) { 
   for (var i = 0; i < str.length; i++)
      if ( str.charAt(i) != " ")
         return (false);
       return (true);
}

/**********************************************************************************
    함수명			: validate(emailad)
    작성목적		: 이메일 체크
    작성자			: 윤영준
    최초작성일	    : 2008.06.26
    최종작성일	    : 2008.06.26
    수정내역		: 
    **********************************************************************************/
function validate(emailad) {

 var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
 var check=/@[\w\-]+\./;
 var checkend=/\.[a-zA-Z]{2,3}$/;

 if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
  return false;
 }
 else {
   return true;
 }
}

/**********************************************************************************
    함수명			: act(x)
    작성목적		: FAQ 게시판
    작성자			: 윤영준
    최초작성일	    : 2008.06.26
    최종작성일	    : 2008.06.26
    수정내역		: 
**********************************************************************************/
function act(x) {
	if (document.all[x].style.display == "none") {
			document.all[x].style.display = "block";
	} else {
		document.all[x].style.display = "none";
	}	
 }

/**********************************************************************************
    함수명			: act(x)
    작성목적		: FAQ 게시판
    작성자			: 윤영준
    최초작성일	    : 2008.06.26
    최종작성일	    : 2008.06.26
    수정내역		: 
**********************************************************************************/
function telNoChk(objValue, alertText) {
    var text = objValue.split('-');
    var arrNo = new Array('02','031','032','033','041','042','043','051','052','053','054','055','061','062','063','064','010','011','016','017','018','019');
    
    var newLen = objValue.length;
    var flag = false;
    
    if (newLen<11 || newLen>13 || text.length!=3) {
        alert(alertText);
        return false;
    }
    
    for(var i = 0; i < arrNo.length; i++) {
        if (text[0] == arrNo[i]) {
            flag = true;
            break;
        }
    }
    
    if (!flag) {
        alert(alertText);
        return false;
    }
    
    return true;
}

//base64
/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/

var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}
function setCookie(cName, cValue, cDate) {
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + cDate );
        document.cookie = cName + "=" + escape( cValue ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
/**
*
*  unit change
*  creater : mun
*
**/
function fn_UnitUS()
{
//top.main_frame["unit_US"].style.display
    top.main_frame["unit_US"].style.display = "";
    top.main_frame["unit_Metric"].style.display = "none";
}
function fn_UnitMetric()
{
    top.main_frame["unit_US"].style.display = "none";
    top.main_frame["unit_Metric"].style.display = "";
}