// ¿¡·¯¸Þ½ÃÁö Æ÷¸ä Á¤ÀÇ ///
var NO_BLANK = "{name+À»¸¦} ÀÔ·ÂÇØÁÖ¼¼¿ä";
var NOT_VALID = "{name+ÀÌ°¡} ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù";
var TOO_LONG = "{name}ÀÇ ±æÀÌ°¡ ÃÊ°úµÇ¾ú½À´Ï´Ù (ÃÖ´ë {maxbyte}¹ÙÀÌÆ®)";
var STRING_FR  = 6
var STRING_TO  = 10
var old_menu = '';
var old_cell = '';

/// ½ºÆ®¸µ °´Ã¼¿¡ ¸Þ¼Òµå Ãß°¡ ///

String.prototype.trim = function(str) {
	str = this != window ? this : str;
	return str.replace(/^\s+/g,'').replace(/\s+$/g,'');
}

String.prototype.hasFinalConsonant = function(str) {
	str = this != window ? this : str;
	var strTemp = str.substr(str.length-1);
	return ((strTemp.charCodeAt(0)-16)%28!=0);
}

String.prototype.bytes = function(str) {
	str = this != window ? this : str;
  var len = 0;
  for(j=0; j<str.length; j++) {
		var chr = str.charAt(j);
		len += (chr.charCodeAt() > 128) ? 2 : 1
	}
	return len;
}


/// ½ÇÁúÀû ÆûÃ¼Å© ÇÔ¼ö ///


function validate(form) {
	for (i = 0; i < form.elements.length; i++ ) {
		var el = form.elements[i];
		if (el.tagName == "FIELDSET") continue;
		el.value = el.value.trim();

		var minbyte = el.getAttribute("MINBYTE");
		var maxbyte = el.getAttribute("MAXBYTE");
		var option = el.getAttribute("OPTION");
		var match = el.getAttribute("MATCH");
		var glue = el.getAttribute('GLUE');


		if (el.getAttribute("REQUIRED") != null) {	//ÇÊ¼ö »çÇ×¿¡ ´ëÇÑ Ã³¸®
			if (el.value == null || el.value == "") {
				return doError(el,NO_BLANK);
			}
		}

		if (minbyte != null) { //¹®ÀÚ¿­ ±æÀÌ Ã¼Å©
			if (el.value.bytes() < parseInt(minbyte)) {
				return doError(el,"{name+Àº´Â} ÃÖ¼Ò "+minbyte+"¹ÙÀÌÆ® ÀÌ»ó ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.");
			}
		}

		if (maxbyte != null && el.value != "") { //¹®ÀÚ¿­ ±æÀÌ Ã¼Å©
			var len = 0;
			if (el.value.bytes() > parseInt(maxbyte)) {
				return doError(el,"{name}ÀÇ ±æÀÌ°¡ ÃÊ°úµÇ¾ú½À´Ï´Ù (ÃÖ´ë "+maxbyte+"¹ÙÀÌÆ®)");
			}
		}

		if (match && (el.value != form.elements[match].value)) return doError(el,"{name+ÀÌ°¡} ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù");  //µÎ°³ÀÇ ¹®ÀÚ¿­ ÀÏÄ¡ Ã¼Å©

		if (option != null) {   /// Æ¯¼ö ÆÐÅÏ °Ë»ç ÇÔ¼ö Æ÷¿öµù ///
			if (el.getAttribute('SPAN') != null) {
				var _value = new Array();
				for (span=0; span<el.getAttribute('SPAN');span++ ) {
					_value[span] = form.elements[i+span].value;
				}
				var value = _value.join(glue == null ? '' : glue);
				if (!funcs[option](el,value)) return false;
			} else {
				if (!funcs[option](el)) return false;
			}
		}
	}
	return true;
}
// Textarea ±ÛÀÚ¼ö Á¶Àý
// ÀÔ·Â¿¹Á¦ <textarea onKeyPress="fnChkRemark(this,'50')">  -- fnChkRemark(ÅØ½ºÆ®°ª, ÀÚ¸´¼ö)

function fnChkRemark(obj, strCnt) {
	var strtempRemark = obj.value;
	var len = 0;
	var tString = '';
	for(j=0; j< strtempRemark.length; j++) {
		var chr = strtempRemark.charAt(j);
		len += (chr.charCodeAt() > 128) ? 2 : 1;
		if (len <= strCnt)
			tString += chr;
	}
	if (len >= strCnt) {
		alert('¿µ¹®Àº ' + strCnt + 'ÀÚ ÀÌÇÏ, ÇÑ±ÛÀº '+ strCnt/2 + 'ÀÚ ÀÌÇÏ·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä. ');
		obj.focus();
		obj.value = tString;
		return false;
	}
}



function josa(str,tail) {
	return (str.hasFinalConsonant()) ? tail.substring(0,1) : tail.substring(1,2);
}

function doError(el,type,action) { //¿¡·¯ Ã³¸® ÇÔ¼ö
	var pattern = /{([a-zA-Z0-9_]+)\+?([°¡-Èþ]{2})?}/;
	var name = (hname = el.getAttribute("HNAME")) ? hname : el.getAttribute("NAME");
	pattern.exec(type);
	var tail = (RegExp.$2) ? josa(eval(RegExp.$1),RegExp.$2) : "";
	alert(type.replace(pattern,eval(RegExp.$1) + tail));
	if (action == "sel") {
		el.select();
	} else if (action == "del")	{
		el.value = "";
	}
	el.focus();
	return false;
}

/// Æ¯¼ö ÆÐÅÏ °Ë»ç ÇÔ¼ö ¸ÅÇÎ ///
var funcs = new Array();
funcs['email'] = isValidEmail;
funcs['phone'] = isValidPhone;
funcs['userid'] = isValidUserid;
funcs['pass'] = isValidPass;
funcs['hangul'] = hasHangul;
funcs['number'] = isNumeric;
funcs['engonly'] = alphaOnly;
funcs['jumin'] = isValidJumin;
funcs['bizno'] = isValidBizNo;
funcs['domain'] = isValidDomain;


/// ÆÐÅÏ °Ë»ç ÇÔ¼öµé ///
function isValidEmail(el,value) {
	var value = value ? value : el.value;
	var pattern = /^[_a-zA-Z0-9-\.]+@[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/;
	return (pattern.test(value)) ? true : doError(el,NOT_VALID);
}

function isValidUserid(el) {
	var pattern = /^[a-zA-Z0-9]{1}[a-zA-Z0-9]{3,13}$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 4ÀÚÀÌ»ó 14ÀÚ ÀÌÇÏÀÌ¾î¾ß ÇÏ°í,\n\n¿µ¹® ¶Ç´Â ¿µ¹®/¼ýÀÚ Á¶ÇÕÀÌ¾î¾ß ÇÕ´Ï´Ù");
}
function isValidPass(el) {
	var pattern = /^[a-zA-Z0-9]{1}[a-zA-Z0-9]{3,10}$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 4ÀÚÀÌ»ó 10ÀÚ ÀÌÇÏÀÌ¾î¾ß ÇÏ°í,\n\n¿µ¹®ÀÌ³ª ¼ýÀÚ ¿µ¹®/¼ýÀÚ Á¶ÇÕÀÌ¾î¾ß ÇÕ´Ï´Ù");
}

function hasHangul(el) {
	var pattern = /^[°¡-Èþ]+$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} ¹Ýµå½Ã ÇÑ±Û·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù");
}

function alphaOnly(el) {
	var pattern = /^[a-zA-Z/ ]+$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} ¹Ýµå½Ã ¿µ¹®À¸·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù");
}

function isNumeric(el) {
	var pattern = /^[0-9]+$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} ¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù");
}

function isValidJumin(value) { //ÁÖ¹Î¹øÈ£ Ã¼Å©
    var pattern = /^([0-9]{6})-?([0-9]{7})$/;
	  var num = value;
    if (!pattern.test(num)) return false;
    num = RegExp.$1 + RegExp.$2;

	var sum = 0;
	var last = num.charCodeAt(12) - 0x30;
	var bases = "234567892345";
	for (var i=0; i<12; i++) {
		if (isNaN(num.substring(i,i+1))) return false;
		sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
	}
	var mod = sum % 11;
	return ((11 - mod) % 10 == last) ? true : false;
}

function isValidBizNo(el, value) { //»ç¾÷¹øÈ£ Ã¼Å©
    var pattern = /([0-9]{3})-?([0-9]{2})-?([0-9]{5})/;
	var num = value ? value : el.value;
    if (!pattern.test(num)) return doError(el,NOT_VALID);
    num = RegExp.$1 + RegExp.$2 + RegExp.$3;
    var cVal = 0;
    for (var i=0; i<8; i++) {
        var cKeyNum = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp  == 1 ) ? 3 : 7);
        cVal += (parseFloat(num.substring(i,i+1)) * cKeyNum) % 10;
    }
    var li_temp = parseFloat(num.substring(i,i+1)) * 5 + '0';
    cVal += parseFloat(li_temp.substring(0,1)) + parseFloat(li_temp.substring(1,2));
    return (parseInt(num.substring(9,10)) == 10-(cVal % 10)%10) ? true : doError(el,NOT_VALID);
}

function isValidPhone(el,value) {//ÀüÈ­¹øÈ£
	//var pattern = /([0-9]{3})-\d([0-9]{3,4})-\d([0-9]{4})/;
  var pattern = /([0-9]{2,3})-(\d{3,4})-(\d{4})/;
	var num = value ? value : el.value;
	if (num == null || num == "") {
		return doError(el,NO_BLANK);
	}
	else {
	  return (pattern.test(num)) ? true : doError(el,NOT_VALID);
	}
}


function isValidDomain(el,value) { //µµ¸ÞÀÎ Ã¼Å©
	var value = value ? value : el.value;
	var pattern = new RegExp("^(http://)?(www\.)?([°¡-Èþa-zA-Z0-9-]+\.[a-zA-Z]{2,3}$)","i");
	if (pattern.test(value)) {
		el.value = RegExp.$3;
		return true;
	} else {
		return doError(el,NOT_VALID);
	}
}

function onlyNumber(){             /* ¼ýÀÚ Ã¼Å© ÇÔ¼ö */

	var e1 = event.srcElement;
	var num ="0123456789";
	event.returnValue = true;

	for (var i=0;i< e1.value.length;i++)
	{
		if(-1 == num.indexOf(e1.value.charAt(i)))
		event.returnValue = false;
	}
	if (!event.returnValue)
	e1.value="";
}


function chk_focus(){
	if(document.chk_member.cu_jmno1.value.length == 6){
	document.chk_member.cu_jmno2.focus();
	}
}


function menuclick( submenu, cellbar, tbl, seq )
{
  if( old_menu != submenu ) {
    if( old_menu !='' ) {
      old_menu.style.display = 'none';
	  //old_cell.src= 'images/plus.gif';
    }
    submenu.style.display = 'block';
    //cellbar.src = 'images/act.gif';
    old_menu = submenu;
    old_cell = cellbar;

  } else {
    submenu.style.display = 'none';
    //cellbar.src= 'images/plus.gif';
    old_menu = '';
    old_cell = '';
  }

 showreLayer('/customer/count_upd.ts',2000,2000,tbl,seq);


}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function moveLayer(strlayer, left, top) {
	var theObj;
	if (navigator.appName == 'Netscape' && document.layers != null)
		theObj = eval("document.layers['" + strlayer + "']");
	else if (document.all != null) //IE
		theObj = eval("document.all['" + strlayer + "'].style");

	if(theObj) {
		theObj.left = left;
		theObj.top = top;
	}
}
function showLayer(strlayer, left, top) {
	moveLayer(strlayer, left, top);
	MM_showHideLayers(strlayer, "show");
}
function hideLayer(strlayer) {
	MM_showHideLayers(strlayer, "hide");
}

function showreLayer(url, left, top, tbl, seq) {
	if(document.all['LayerA'].style.visibility=="visible")
		hideLayer('LayerA');
	else
		openLayer(reLayer, url+"?tbl="+tbl+"&seq="+seq, 'LayerA', left, top);
}
function openLayer(win, url, strlayer, left, top) {
	win.location.href=url
	moveLayer(strlayer, left, top);
	MM_showHideLayers(strlayer, "show");
}


//È¸¿ø ÀÎÁõ °ü·Ã ½ºÅ©¸³Æ®//

function log_yn(f_url){
	answer = confirm("ÇØ´ç ¼­ºñ½º´Â ÀÎÁõµÈ °í°´ Àü¿ëÀÔ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?");
	if(answer == true){
	location.href='/other/login.asp?f_url='+f_url;
	}
}

function find_id01() {
	var form = document.form1;
	if(form.cu_id.value == ""){
	alert("»ç¿ëÇÏ½Ç ID¸¦ ¸ÕÀú ÀÔ·ÂÇÏ¼¼¿ä");
	form.cu_id.focus();
	return;
	}
	if((form.cu_id.value.length<4)||(form.cu_id.value.length>8)){
		alert("»ç¿ëÇÏ½Ç ¾ÆÀÌµð´Â 4ÀÚ ÀÌ»ó 8ÀÚ ÀÌÇÏÀÔ´Ï´Ù.")
		form.cu_id.select();
		return;

	}
	else {
	window.open("/ordinary/tabi_regi_pop04.ts?cu_id=" + form.cu_id.value,"fdid","width=400,height=174,left=400,top=380");
	}
	return;
}


function setday(year,mon) {
		var day;
		if (mon==1 || mon==3 || mon==5 || mon==7 || mon==8 || mon==10 || mon==12) day=31;
		else if (mon==2) { if (year%4==0) day=29; else day=28; } // 2¿ùÃ³¸®
		else day=30;
			opt = "<option value=''>ÀÏ</option>"
			for (var i=1; i<=day; i++) {
			  var opt = opt + "<option ";
				if (i < 10){
					opt = opt + "value='0" + i + "'>" + i + "</option>";
				}else{
					opt = opt + "value='" + i + "'>" + i + "</option>";
				}
			}
		ChgDay.innerHTML="<select name=day class='input'>" + opt + "</select>";
}
function setday1(year,mon) {
		var day;
		if (mon==1 || mon==3 || mon==5 || mon==7 || mon==8 || mon==10 || mon==12) day=31;
		else if (mon==2) { if (year%4==0) day=29; else day=28; } // 2¿ùÃ³¸®
		else day=30;
			opt = "<option value=''>ÀÏ</option>"
			for (var i=1; i<=day; i++) {
			  var opt = opt + "<option ";
				if (i < 10){
					opt = opt + "value='0" + i + "'>" + i + "</option>";
				}else{
					opt = opt + "value='" + i + "'>" + i + "</option>";
				}
			}
		ChgDay1.innerHTML="<select name=pp_dd class='input'>" + opt + "</select>";
}

function setday_now() {
	var now=new Date()
	var year=now.getYear()
	var dd=now.getDate()
	var mon=now.getMonth()+1

	if (mon==1 || mon==3 || mon==5 || mon==7 || mon==8 || mon==10 || mon==12) day=31;
	else if (mon==2) { if (year%4==0) day=29; else day=28; } // 2¿ùÃ³¸®
	else day=30;
		opt = "<option value=''>ÀÏ</option>"
		for (var i=1; i<=day; i++) {
		  var opt = opt + "<option ";
		  if (i==dd) opt = opt ;
				if (i < 10){
					//i = "0" + i;
					opt = opt + "value='0" + i + "'>" + i + "</option>";
				}else{
					opt = opt + "value='" + i + "'>" + i + "</option>";
				}
		}
	ChgDay.innerHTML="<select name=day class='input'>" + opt + "</select>";

}
function setday_now1() {
	var now=new Date()
	var year=now.getYear()
	var dd=now.getDate()
	var mon=now.getMonth()+1

	if (mon==1 || mon==3 || mon==5 || mon==7 || mon==8 || mon==10 || mon==12) day=31;
	else if (mon==2) { if (year%4==0) day=29; else day=28; } // 2¿ùÃ³¸®
	else day=30;
		opt = "<option value=''>ÀÏ</option>"
		for (var i=1; i<=day; i++) {
		  var opt = opt + "<option ";
		  if (i==dd) opt = opt ;
				if (i < 10){
					//i = "0" + i;
					opt = opt + "value='0" + i + "'>" + i + "</option>";
				}else{
					opt = opt + "value='" + i + "'>" + i + "</option>";
				}
		}
	ChgDay1.innerHTML="<select name=pp_dd class='input'>" + opt + "</select>";

}



function check_box() {
	var count;
	var form = document.chk_insert;
	count = 0;
	var choice = form.elements.length;

	for (var i=0; i<= choice - 1; i++) {
		if (form.elements[i].checked==true) {
		   count++;
		}
	}
	if (count <= 0) {
		alert("   ÀÌ¿ë¾à°ü¿¡ µ¿ÀÇÇÏ¼Å¾ß ÇÕ´Ï´Ù !   ");
		return false;
	}
	form.submit();

}




//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//À±³âÀ» Æ÷ÇÔÇÏ¿© °¢ ¿ùÀÇ ³¯ ¼ö °è»êÇÏ´Â ÇÔ¼ö
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "4" || WhichMonth == "6" || WhichMonth == "9" || WhichMonth == "11") DaysInMonth = 30;
  if (WhichMonth == "2" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
  if (WhichMonth == "2" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
  return DaysInMonth;
}

//°¢ ¿ù¿¡¼­ »ç¿ë °¡´ÉÇÑ ³¯Â¥·Î º¯°æ
function ChangeOptionDays(Which)
{
  DaysObject = eval("document.incentive." + Which + "day");
  MonthObject = eval("document.incentive." + Which + "month");
  YearObject = eval("document.incentive." + Which + "year");

  Month = MonthObject[MonthObject.selectedIndex].text;
  Year = YearObject[YearObject.selectedIndex].text;

  DaysForThisSelection = DaysInMonth(Month, Year);
  CurrentDaysInSelection = DaysObject.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      NewOption = new Option(DaysObject.options.length + 1);
      DaysObject.add(NewOption);
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

//ÇöÀç ³¯Â¥·Î ¼ÂÆÃ
function SetToToday(Which)
{
  DaysObject = eval("document.incentive." + Which + "day");
  MonthObject = eval("document.incentive." + Which + "month");
  YearObject = eval("document.incentive." + Which + "year");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay-1].selected = true;
}

//option years¸¦ ÁöÁ¤ÇÑ ¸¸Å­ ÀÛ¼ºÇÏ´Â ÇÔ¼ö
function WriteYearOptions(YearsAhead)
{
  line = "";
  for (i=0; i<YearsAhead; i++)
  {
    line += "<OPTION>";
    line += NowYear + i;
  }
  return line;
}
function ch_evDay(){
	var form    = document.incentive ;
	if (form.ev_day_cnt1.value > form.ev_day_cnt2.value) {
		form.ev_day_cnt2.value = Number(form.ev_day_cnt1.value) + 1
	}
}
function moveFocus(num,fromform,toform){
	var str = fromform.value.length;
	if(str == num)
	toform.focus();
}
//½ºÄ«ÀÌ ½ºÅ©·¦ÆÛ ÇÔ¼ö
function CheckUIElements(){
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

        if ( bNetscape4plus ) {
                yMenuFrom   = document["divMenu"].top;
                yMenuTo     = top.pageYOffset + 62;
        }
        else if ( bExplorer4plus ) {
                yMenuFrom   = parseInt (divMenu.style.top, 10);
				if (document.body.scrollTop<700)
	                yMenuTo     = document.body.scrollTop + 253;	//<-----½ÇÁ¦ ³ôÀÌ À§Ä¡ Á¶Á¤
        }

        timeoutNextCheck = 200;

        if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
                setTimeout ("CheckUIElements()", timeoutNextCheck);
                return;
        }

        if ( yButtonFrom != yButtonTo ) {
                yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
                if ( yButtonTo < yButtonFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divLinkButton"].top += yOffset;
                else if ( bExplorer4plus )
                        divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divMenu"].top += yOffset;
                else if ( bExplorer4plus )
					if (document.body.scrollTop<700)
                        divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }

        setTimeout ("CheckUIElements()", timeoutNextCheck);
}


function winPop(pPage,name,wid,hei)
{
	var winl = (screen.width - wid) / 2;
	var wint = (screen.height - hei) / 2;
	var popUpWin;
	winprops = 'height='+hei+',width='+wid+',top='+wint+',left='+winl
	popUpWin = window.open(pPage,name,winprops);
	if (parseInt(navigator.appVersion) >= 4) { popUpWin.window.focus(); }
	popUpWin.focus();
}

function Win_pop(newwin,w,h) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=no,status=no,menu=no';
  win = window.open(newwin, "PopWin01", winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function SWin_pop(newwin,name,w,h) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars=yes,status=no,menu=no';
  win = window.open(newwin, name, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}	

function fncImagePopup(image)
{
	var winImagePopup = window.open("", "winImagePopup","location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no")
	winImagePopup.focus();
	winImagePopup.document.open();
	winImagePopup.document.write("<HTML><HEAD>");
	winImagePopup.document.write("<TITLE>ÀÌ¹ÌÁöº¸±â</TITLE>");
	winImagePopup.document.write("</HEAD><BODY topmargin=\"0\" leftmargin=\"0\">");
	winImagePopup.document.write("<img src=\"" + encodeURI(decodeURI(image)) + "\" id=\"ImagePopup\" onLoad=\"window.resizeBy(Math.min(this.width,screen.availWidth-70)-document.body.clientWidth,Math.min(document.body.scrollHeight,screen.availHeight-70)-document.body.clientHeight);window.resizeBy(0,Math.min(document.body.scrollHeight,screen.availHeight-70)-document.body.clientHeight);window.moveBy(Math.min(0,screen.availWidth-(window.screenLeft+document.body.clientWidth+30)),Math.min(0,screen.availHeight-(window.screenTop+document.body.clientHeight+30)));\" onClick=\"window.close()\">");
	winImagePopup.document.write("</BODY></HTML>");
	winImagePopup.document.close();
}

// ¼³Á¤µÈ Æ¯¼ö¹®ÀÚÀÏ °æ¿ì true, ¾Æ´Ï¸é false 
function isSpecial(strID){
  var spc="!@#$%^&*()-=[]\;',./_+{}|:<>?";
  var matchCnt = 0;

  for(var i=0;i<spc.length;i++){
    for(var j=0;j<strID.length;j++){
      if(spc.charAt(i) == strID.charAt(j)){
        matchCnt++;
      } 
    }
  }

  if(matchCnt == strID.length){
    return true;
  }else{
    return false;
  }
}

/**
 * Á¤±ÔÇ¥Çö½ÄÀ» ÀÌ¿ëÇÑ °ø¹é Ã¼Å©
 */
function isNull( text )  
{  
 if( text == null ) return true;  

 var result = text.replace(/(^\s*)|(\s*$)/g, "");  

 if( result )  
  return false;  
 else  
  return true;  
}

// º»¹®ÀÇ ÀÌ¹ÌÁö »çÀÌÁî ÁÙÀÌ±â. °¡º¯ ¹öÁ¯...

function adjustimage(target_img,mWidth,mHeight)
{
	var newX;
	var newY;
	var newHeight;
	var newWidth;
	var maxWidth = mWidth;
	var maxHeight = mHeight;
	var newImg = new Image();

	newImg.src = target_img.src;
	imgw = newImg.width;
	imgh = newImg.height;

	if (imgw > maxWidth || imgh > maxHeight)
	{
		if (imgw > imgh)
		{
			if (imgw > maxWidth)
				newWidth = maxWidth;
			else
				newWidth = imgw;
				newHeight = Math.round((imgh * newWidth) / imgw);
		}
		else
		{
			if (imgh > maxHeight)
				newHeight = maxHeight;
			else
				newHeight = imgh;
				newWidth = Math.round((imgw * newHeight) / imgh);
		}
	}
	else
	{
		newWidth = imgw;
		newHeight = imgh;
	}

	newX = maxWidth / 2 - newWidth / 2;
	newY = maxHeight / 2 - newHeight / 2;

	target_img.onload = null;
	target_img.src = newImg.src;
	target_img.width = newWidth;
	target_img.height = newHeight;
}
function view(dirName,imgSav,imgOrg)
{ 
	page = "/Common/Function/File/Show_b_img.asp?dirName=" + dirName+"&imgSav="+imgSav+"&imgOrg="+imgOrg;
	window.open(page,'','width=800,height=600');
}


/***** popup *********************************************************************************************/
function popwin(url,w,h) //½ºÅ©·Ñ¹Ù ¾ø´Â ÀÏ¹ÝÆË¾÷
{ 
    window.open(url,'','width='+w+',height='+h+',scrollbars=no,resizable=no,toolbar=no,top=10,left=10');
}
function popwin_roll(url,w,h) //½ºÅ©·Ñ¹Ù ÀÖ´Â ÀÏ¹ÝÆË¾÷
{
    window.open(url,'','width='+w+',height='+h+',scrollbars=yes,resizable=no,toolbar=no,top=10,left=10');
}
function popwin_name(url,name,w,h) //Ã¢ÀÌ¸§ÀÌ ÀÖ¾î¾ß ÇÏ´Â ÆË¾÷
{
    window.open(url,name,'width='+w+',height='+h+',scrollbars=no,resizable=no,toolbar=no,top=10,left=10');
}

function popsn(url,name,w,h) //½ºÅ©·Ñ¹Ù ¾ø°í Ã¢ÀÌ¸§ ÀÖ´Â ÆË¾÷
{
    window.open(url,name,'width='+w+',height='+h+',scrollbars=no,resizable=no,copyhistory=no,toolbar=no,top=10,left=10');
}

function popsy(url,name,w,h) //½ºÅ©·Ñ¹Ù ÀÖ°í Ã¢ÀÌ¸§ ÀÖ´Â ÆË¾÷
{
    window.open(url,name,'width='+w+',height='+h+',scrollbars=yes,resizable=no,copyhistory=no,toolbar=no,top=10,left=10');
}