// ¿¡·¯¸Þ½ÃÁö Æ÷¸ä Á¤ÀÇ ///
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;
	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/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;
funcs['goodcd'] = isgoodcd;


funcs['phone_null'] = isValidPhone_null; //°ø¹éÇã¿ë


/// ÆÐÅÏ °Ë»ç ÇÔ¼öµé ///
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-Z]{1}[a-zA-Z0-9_]{3,9}$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 4ÀÚÀÌ»ó 10ÀÚ ÀÌÇÏÀÌ¾î¾ß ÇÏ°í,\n\n¿µ¹® ¶Ç´Â ¿µ¹®/¼ýÀÚ Á¶ÇÕÀÌ¾î¾ß ÇÕ´Ï´Ù");
}

function isValidPass(el) {
	var pattern = /^[a-zA-Z0-9]{1}[a-zA-Z0-9]{3,14}$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 4ÀÚÀÌ»ó 15ÀÚ ÀÌÇÏÀÌ¾î¾ß ÇÏ°í,\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+Àº´Â} ¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù","sel");
}

function isgoodcd(el) {
	var pattern = /^[0-9]{1}[0-9]{7,9}$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 8ÀÚÀÌ»ó 10ÀÚ ÀÌÇÏÀÌ¾î¾ß ÇÏ°í,\n\n¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù");
}


function isValidJumin(el,value) { //ÁÖ¹Î¹øÈ£ Ã¼Å©
    var pattern = /^([0-9]{6})-?([0-9]{7})$/; 
	var num = value ? value : el.value;
    if (!pattern.test(num)) return doError(el,NOT_VALID); 
    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 doError(el,NOT_VALID);
		sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
	}
	var mod = sum % 11;
	return ((11 - mod) % 10 == last) ? true : doError(el,NOT_VALID);
}

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]+$/;
	var num = value ? value : el.value;
	if (num == null || num == "") {
		return doError(el,NO_BLANK);
	}
	else {

	return (pattern.test(num)) ? true : doError(el,"{name+Àº´Â} ¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù");
	}
}


function isValidPhone_null(el,value) {//ÀüÈ­¹øÈ£	°ø¹éÇã¿ë
	var pattern = /^[0-9]+$/;
	var num = value ? value : el.value;
	if (num == null || num == "") {
		return true;
	}
	else {

	return (pattern.test(num)) ? true : doError(el,"{name+Àº´Â} ¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù");
	}
}



function isValidDomain(el) { //µµ¸ÞÀÎ Ã¼Å©
	var pattern = /^.+(\.[a-zA-Z]{2,3})$/;
	return (pattern.test(el.value)) ? 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';
    }
    submenu.style.display = 'block';
    old_menu = submenu;
    old_cell = cellbar;

  } else {
    submenu.style.display = 'none';
    old_menu = '';
    old_cell = '';
  }

// showreLayer('/customer/count_upd.cie',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) {	//´Ù¸¥ ÇÔ¼ö¿¡¼­ ÄÝ, ·¹ÀÌ¾î¸¦ show¼Ó¼ºÀ¸·Î º¯°æ
	moveLayer(strlayer, left, top);
	MM_showHideLayers(strlayer, "show");
}

function hideLayer(strlayer) {				//´Ù¸¥ ÇÔ¼ö¿¡¼­ ÄÝ, ·¹ÀÌ¾î¸¦ hide¼Ó¼ºÀ¸·Î º¯°æ
	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 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_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_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 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("aaaaa.cie?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 Jumin_chk(it) {    //ÁÖ¹Î¹øÈ£ Ã¼Å© ÇÔ¼ö

	IDtot = 0;
	IDAdd="234567892345";

	for(i=0;i<12;i++){
			IDtot=IDtot+parseInt(it.substring(i,i+1))*parseInt(IDAdd.substring(i,i+1)); 
	}
	IDtot=11-(IDtot%11);

	if(IDtot==10) {
		IDtot=0;
	}

	else if(IDtot==11){
		IDtot=1;
	}
	if(parseInt(it.substring(12,13))!=IDtot) return true;
	
} 
function chkpid(){
		var form = document.form1;
		var val1 = form.cu_jmno1.value;
		var val2 = form.cu_jmno2.value;
		var iden = val1 + val2
		if (val1.length > 0){		
			if(iden == "1111111111118" || iden == "2222222222225"){
				alert("  ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸ø µÇ¾ú½À´Ï´Ù.   \n\n         ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä !  ");
				form.cu_jmno1.value = "";
				form.cu_jmno2.value = "";
				form.cu_jmno1.focus();
				return false;
			}
			
				if(iden.length != 13) {
					alert("   ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸ø ÀÔ·ÂµÇ¾ú½À´Ï´Ù.   \n\n          ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä ! ");
						form.cu_jmno1.value = "";
						form.cu_jmno2.value = "";
						form.cu_jmno1.focus();
						return false;
			   }		   
			  
			   else {
			   
					var iden_tot = 0;
					var iden_ad = "234567892345";
						 for(i=0; i<=11; i++) {
							iden_tot = iden_tot + parseInt(iden.substring(i, i+1)) * parseInt(iden_ad.substring(i, i+1));
							
						 }
						 
						iden_tot = 11 - (iden_tot % 11);
						
							if(iden_tot == 10) {
								iden_tot = 0;
							} else if(iden_tot == 11) {
								iden_tot = 1;
							}
							
						if(parseInt(iden.substring(12, 13)) != iden_tot) {
							alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸ø ÀÔ·ÂµÇ¾ú½À´Ï´Ù.");
							form.cu_jmno1.value = "";
							form.cu_jmno2.value = "";
							form.cu_jmno1.focus();
							return false;
						  }
					}
		}
}

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 + 130;	//<-----½ÇÁ¦ ³ôÀÌ À§Ä¡ Á¶Á¤
        } 

        timeoutNextCheck = 500; 

        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 chkeng(val){  
	if (val.length > 0 ) {
		var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/ ";
		for (i=0 ;  i <  val.length ;  i++)
		{
			chk = val.charAt(i);
			for (j=0;  j< str.length; j++)
			if (chk == str.charAt(j))
				 break;
			 if (j == str.length){
				 alert("  ¿µ¹®¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù !  ");
				 frmReservation.cu_nm_eng1.select();
			return false;
				}
			}
	}
}



// ÀÌ¸ÞÀÏ °ü·Ã
function setEmailEnable(emailcodeObject,ipmenu2Object) {
	if (emailcodeObject.value == "0" || emailcodeObject.value == "9") {
		ipmenu2Object.value = "";
		ipmenu2Object.focus();
	}
	else
		ipmenu2Object.blur();

}
//by jpspace, 2004-08-09, emaildomainÀ» select·Î ¼±ÅÃ
function setEmailcode(setObject,selectObject,index) {
	setObject.value = selectObject[index].text;
	if (selectObject.value == "0" || selectObject.value == "9") {
		//alert("±âÅ¸ µµ¸ÞÀÎÀ» ÀÔ·ÂÇÏ¼¼¿ä!");
		setObject.focus();
	}
	else
		setObject.blur();
		
}

//È¸¿øÀÌ¿ë ¿©ºÎ
function log_yn(f_url){
	answer = confirm("  ¾ÆÀÌÅõ¾î¿£Å©·çÁî È¸¿ø¸¸ ÀÌ¿ë°¡´ÉÇÕ´Ï´Ù   \n\n  ·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?");
	if(answer == true){
	    location.href= "/join/index.cie?ts=login&f_url="+f_url ;
	}
}

//È¸¿øÀÌ¿ë ÆäÀÌÁö ´ÙÀÌ·ºÆ® Á¢±Ù°ÅºÎ
function log_yn2(f_url){
	alert(f_url);
	answer = confirm("  ¾ÆÀÌÅõ¾î¿£Å©·çÁî È¸¿ø¸¸ ÀÌ¿ë°¡´ÉÇÕ´Ï´Ù   \n\n  ·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?");
	if(answer == true){
	    location.href= "/join/index.cie?ts=login&f_url="+f_url ;
	}
	else{
		history.back();
	}
}

//µ¿¿µ»óÇÃ·¹ÀÌ¾î ÆË¾÷Ã¢
function onair() {
	wURL = "/onair.cie";
	var winl = 0
	var wint = 0
	winprops = 'height='+500+',width='+400+',top='+wint+',left='+winl+',toolbar='+0+',location='+0+',status='+0+',menubar='+0+',resizable='+0
	win = window.open(wURL, "±¤°í¹æ¼Û", winprops)
}

//ÇÃ·¡½Ã È£ÃâÇÔ¼ö
function writeControl(id)
{
      document.write(id.innerHTML);
      id.id="";
}

//Á¦Ç°»ó¼¼º¸±â ¸µÅ©È£Ãâ
function fn_detailView(url){
	location.href = url;
}




//ÇÃ·¡½Ã È£ÃâÇÔ¼ö
function setEmbed() {
	var obj = new String; 
	var parameter = new String; 
	var embed = new String; 
	var html = new String; 
	var allParameter = new String; 
	var clsid = new String; 
	var codebase = new String; 
	var pluginspace = new String; 
	var embedType = new String; 
	var src = new String; 
	var width = new String; 
	var height = new String; 

	this.init = function(getType , s ,w , h , t ) {
		if ( getType == "flash") {
			clsid = "D27CDB6E-AE6D-11CF-96B8-444553540000";
			codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"; 
			pluginspage = "http://www.macromedia.com/go/getflashplayer"; 
			embedType = "application/x-shockwave-flash"; 
		}
		/* type Ãß°¡ 
		else if ( ) {
		} 
		*/

		parameter += "<param name='movie' value='"+ s + "'>\n";
		parameter += "<param name='quality' value='high'>\n";
	
		if(t == "1"){
			parameter += "<param name='wmode' value='transparent'>\n";
		}

		src = s;
		width = w;
		height = h;
	}

	this.parameter = function( parm , value ) {
		parameter += "<param name='"+parm +"' value='"+ value + "'>\n";
		allParameter += " "+parm + "='"+ value+"'";
	}

	this.show = function() {
		if (clsid) {
			obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\" width='"+ width +"' height='"+ height +"'>\n";
		}

		embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "' width='"+ width + "' height='"+ height +"'"+ allParameter +" ></embed>\n";

		if (obj) {
			embed += "</object>\n"; 
		}

		html = obj + parameter + embed;

		document.write(html);
	}
}


//ÇÃ·¡½Ã È£ÃâÇÔ¼ö
function setEmbed1() {
	var obj = new String; 
	var parameter = new String; 
	var embed = new String; 
	var html = new String; 
	var allParameter = new String; 
	var clsid = new String; 
	var codebase = new String; 
	var pluginspace = new String; 
	var embedType = new String; 
	var src = new String; 
	var width = new String; 
	var height = new String; 

	this.init = function(getType , s ,w , h , t ) {
		if ( getType == "flash") {
			clsid = "D27CDB6E-AE6D-11CF-96B8-444553540000";
			codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"; 
			pluginspage = "http://www.macromedia.com/go/getflashplayer"; 
			embedType = "application/x-shockwave-flash"; 
		}
		/* type Ãß°¡ 
		else if ( ) {
		} 
		*/

		parameter += "<param name='movie' value='"+ s + "'>\n";
		parameter += "<param name='quality' value='high'>\n";
	
		if(t == "1"){
			parameter += "<param name='wmode' value='transparent'>\n";
		}

		src = s;
		width = w;
		height = h;
	}

	this.parameter = function( parm , value ) {
		parameter += "<param name='"+parm +"' value='"+ value + "'>\n";
		allParameter += " "+parm + "='"+ value+"'";
	}

	this.show = function() {
		if (clsid) {
			obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\" width='"+ width +"' height='"+ height +"'>\n";
		}

		embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "' width='"+ width + "' height='"+ height +"'"+ allParameter +" ></embed>\n";

		if (obj) {
			embed += "</object>\n"; 
		}

		html = obj + parameter + embed;

		document.write(html);
	}
}


//========================================================================//
// ÀÌ¿Ã¶ó½º¹®Á¦ ÇØ°á°Ç                                                 //
// embed_swf( swf_filepath, width, height, ¹è°æÅõ¸íÀÌ¸é 1, ¾Æ´Ï¸é 0 );
//========================================================================//
function embed_swf( sObjSrc, nWidth, nHeight, sWMode ){
 if(sWMode == 0){
  document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
  document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0' ");
  document.write("width='" + nWidth + "' height='" + nHeight + "'>");
  document.write("<param name='movie' value='" + sObjSrc + "'>");
  document.write("<param name='quality' value='high'>");
  document.write("</object>");
}else{
  document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
  document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0' ");
  document.write("width='" + nWidth + "' height='" + nHeight + "'>");
  document.write("<param name='wmode' value='transparent'>");
  document.write("<param name='movie' value='" + sObjSrc + "'>");
  document.write("<param name='quality' value='high'>");
   document.write("<embed src='" + sObjSrc + "' ");
  document.write("quality='high' wmode='transparent' ");
  document.write("pluginspage='http://www.macromedia.com/go/getflashplayer' ");
  document.write("type='application/x-shockwave-flash' ");
  document.write("width='" + nWidth + "' height='" + nHeight + "'></embed> ");
  document.write("</object>");

	}
}

var _dropinslideshowcount=0

function dropinslideshow(imgarray, w, h, delay){
    this.id="_dropslide"+(++_dropinslideshowcount) //Generate unique ID for this slideshow instance (automated)
    this.createcontainer(parseInt(w), parseInt(h))
    this.delay=delay
    this.imgarray=imgarray
    var preloadimages=[]
    for (var i=0; i<imgarray.length; i++){
        preloadimages[i]=new Image()
        preloadimages[i].src=imgarray[i][0]
    }
    this.animatestartpos=parseInt(h)*(-1) //Starting "top" position of an image before it drops in
    this.slidedegree=10 //Slide degree (> is faster)
    this.slidedelay=30 //Delay between slide animation (< is faster)
    this.activecanvasindex=0 //Current "active" canvas- Two canvas DIVs in total
    this.curimageindex=0
    this.zindex=0
    this.isMouseover=0
    this.init()
}


dropinslideshow.prototype.createcontainer=function(w, h){
document.write('<div id="'+this.id+'" style="position:relative; width:'+w+'px; height:'+h+'px; overflow:hidden">')

    document.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:0;"></div>')
    document.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:-'+h+'px;"></div>')
    document.write('</div>')
    this.slideshowref=document.getElementById(this.id)
    this.canvases=[]
    this.canvases[0]=this.slideshowref.childNodes[0]
    this.canvases[1]=this.slideshowref.childNodes[1]
}

dropinslideshow.prototype.populatecanvas=function(canvas, imageindex){
    var imageHTML='<img src="'+this.imgarray[imageindex][0]+'" style="border: 0" />'
    if (this.imgarray[imageindex][1]!="")
        imageHTML='<a href="'+this.imgarray[imageindex][1]+'" target="'+this.imgarray[imageindex][2]+'">'+imageHTML+'</a>'
    canvas.innerHTML=imageHTML
}


dropinslideshow.prototype.animateslide=function(){
    if (this.curimagepos<0){ //if image hasn't fully dropped in yet
        this.curimagepos=this.curimagepos+this.slidedegree
        this.activecanvas.style.top=this.curimagepos+"px"
    }
    else{
        clearInterval(this.animatetimer)
        this.activecanvas.style.top=0
        this.setupnextslide()
        var slideshow=this
        setTimeout(function(){slideshow.rotateslide()}, this.delay)
    }
}


dropinslideshow.prototype.setupnextslide=function(){
    this.activecanvasindex=(this.activecanvasindex==0)? 1 : 0
    this.activecanvas=this.canvases[this.activecanvasindex]
    this.activecanvas.style.top=this.animatestartpos+"px"
    this.curimagepos=this.animatestartpos
    this.activecanvas.style.zIndex=(++this.zindex)
    this.curimageindex=(this.curimageindex<this.imgarray.length-1)? this.curimageindex+1 : 0
    this.populatecanvas(this.activecanvas, this.curimageindex)
}

dropinslideshow.prototype.rotateslide=function(){
    var slideshow=this
    if (this.isMouseover)
        setTimeout(function(){slideshow.rotateslide()}, 50)
    else
        this.animatetimer=setInterval(function(){slideshow.animateslide()}, this.slidedelay)
}

dropinslideshow.prototype.init=function(){
    var slideshow=this
    this.populatecanvas(this.canvases[this.activecanvasindex], 0)
    this.setupnextslide()
    this.slideshowref.onmouseover=function(){slideshow.isMouseover=1}
    this.slideshowref.onmouseout=function(){slideshow.isMouseover=0}
    setTimeout(function(){slideshow.rotateslide()}, this.delay)
}



// ****************************************************************************
// ÆË¾÷·¹ÀÌ¾î 
// ****************************************************************************
	function hidden_olt_pl(obj_olt,C_Type)
	{
		eval("document.all."+obj_olt+".style.display='none';");
		if(C_Type=="C"){
			eval("setCookie_pl('"+obj_olt+"', 'done' ,1 );")
		}
	}
	
	function setCookie_pl( name, value, expiredays ){
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}

	function Cookie_Check_pl(obj_olt,LN){
		cookiedata = document.cookie;
		if(eval("cookiedata.indexOf('"+obj_olt+"=done') <= 0") ){
			eval("var Off_X = "+obj_olt+".offsetWidth/2;");
			eval("var Off_Y = "+obj_olt+".offsetHeight/2;");
			var _x = (document.body.clientWidth/2 + document.body.scrollLeft) - Off_X + LN;
			
			eval("document.getElementById('"+obj_olt+"').style.posLeft=_x;");
			eval("document.getElementById('"+obj_olt+"').style.display='';");

		}else{
			eval("document.all."+obj_olt+".style.display='none';");
		}
	}


// ****************************************************************************
// ÆË¾÷·¹ÀÌ¾î 2
// ****************************************************************************

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");
  hotDog=isIE ? event.srcElement : e.target;
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

function notice_setCookie( name, value, expiredays )
{
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + '=' + escape( value ) + '; path=/; expires=' + todayDate.toGMTString() + ';'
 return;
}
function notice_getCookie( name )
{
  var nameOfCookie = name + "=";
  var x = 0;
  while ( x <= document.cookie.length )
  {
   var y = (x+nameOfCookie.length);
   if ( document.cookie.substring( x, y ) == nameOfCookie ) {
    if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
      endOfCookie = document.cookie.length;
    return unescape( document.cookie.substring( y, endOfCookie ) );
   }
   x = document.cookie.indexOf( " ", x ) + 1;
   if ( x == 0 ) break;
  }
  return "";
}


  //Çà»ç¸µÅ©(»óÇ°¸®½ºÆ®¿¡¼­¸¸ ¾²ÀÓ)
	function fn_detailev(ev_ym,ev_seq,good_cd,SALE_CD,LEFT_MENU){
	  
      location.href = '/I_Tour/index.asp?itc=detailev&ev_ym='+ev_ym+'&ev_seq='+ ev_seq +'&good_cd='+good_cd+'&SALE_CD='+SALE_CD+'&LEFT_MENU='+LEFT_MENU+ '&GOOD_TYPE_CD=' + good_cd.substring(0,1);
	}

  //Çà»ç¸µÅ©(»óÇ°¸®½ºÆ®¿¡¼­¸¸ ¾²ÀÓ)
	function fn_detail(good_cd,SALE_CD,LEFT_MENU){
	  
      location.href = '/I_Tour/index.asp?itc=detail&good_cd='+good_cd+'&SALE_CD='+SALE_CD +'&LEFT_MENU='+LEFT_MENU + '&GOOD_TYPE_CD=' + good_cd.substring(0,1);
	}


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];}
}
