// Àü¿ªº¯¼ö¿Í »ó¼ö¸¦ Á¤ÀÇÇÑ´Ù.
var XJSV_ACTIVATE = true;
var XJSV_VALIDATION_ACTIVATE = true;
var XJSV_MAGIC_QUOTE_ON = true;
var XJSV_ESCAPE_ON      = false;
var XJSV_CSS_PLAINED = true;
var XJSV_DISABLSUBMIT_ONSUBMIT = true;
var XJSV_ERASE_VALUE_DISABLE = true;
var XJSV_DYNAMIC_SEND_VALUE = true;

var XJSV_SHOW_STYLE = "inline";

var XJSV_REQUIRED_IGNORE_WHITESPACE = true;
var XJSV_MSG_PREFIX     = "ÀÔ·Â¿À·ù ¹ß»ý : ";
var XJSV_MSG_UNKNOWN    = "ÁöÁ¤µÇÁö ¾ÊÀº ¿¡·¯ÀÔ´Ï´Ù. \n°ü¸®ÀÚ¿¡°Ô ¿¡·¯ ¹ß»ý»óÈ²À» ¾Ë·ÁÁÖ½Ê½Ã¿ä";
var XJSV_DEFAULT_DATE_MASK = "9999-99-99";
var XJSV_DEFAULT_HOUR_MIN_MASK = "99:99";  //½Ã°£:ºÐ ¸¶½ºÅ© Ãß°¡
var XJSV_DEFAULT_PSN_MASK  = "999999-9999999";
var XJSV_DEFAULT_CSN_MASK  = "999-99-99999";
var XJSV_DEFAULT_NUM_FILTER       = "[0-9]";
var XJSV_DEFAULT_ALPHA_FILTER     = "[A-Za-z]";
var XJSV_DEFAULT_ALNUM_FILTER     = "[A-Za-z0-9]";
var XJSV_DEFAULT_FLOAT_FILTER     = "[0-9\\.\\-\\+]";
var XJSV_DEFAULT_INTEGER_FILTER     = "[0-9\\-\\+]";
var XJSV_DEFAULT_HEXA_FILTER       = "[a-fA-F0-9]";
var XJSV_DEFAULT_LO_ALPHA_FILTER  = "[a-z]";
var XJSV_DEFAULT_UP_ALPHA_FILTER  = "[A-Z]";

// ( ) [ ] { } < > " ' ` ~  $ ! # % ^ & @  , . ; :  \ / |  * = - ?
var XJSV_DEFAULT_SPECIAL_CHAR  = /(\(|\)|\[|\]|\{|\}|\<|\>|\"|\'|\`|\~|\$|\!|\#|\%|\^|\&|\@|\,|\.|\;|\:|\\|\/|\||\*|\=|\-|\?)*/g;
var XJSV_DEFAULT_WHITE_SPACE   = /\s/g;

var XJSV_DEFAULT_SKIN_DIR = "http://img.sbsgolf.com/www/submit/";
var XJSV_BALLOON_BGCOLOR = "white";
var XJSV_BALLOON_FORECOLOR = "black";

//// Global Variables for balloon assistant
var xjs_balloon_dek;               //
var xjs_balloon_Xoffset=0;        // modify these values to ...
var xjs_balloon_Yoffset=0;       // change the popup position.
var xjs_balloon_yyy=-1000;

//// Global Variables for detecting browser
var xjs_is_iex = null;      //if Browser is Internet Explorer
var xjs_is_nav = null;      //if Browser is Netscape
var xjs_is_old_nav = null;  //if Browser is old version of Netscape

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   Form °´Ã¼
///
////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.initialize()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : formÀÇ method ¹× event¸¦ redefineÇÏ°í formÀÌ °¡Áö´Â °¢ elements¿¡ °ü·ÃµÈ ÃÊ±âÈ­ ÀÛ¾÷À» ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function ff_initialize(){
	if (this.onsubmit) this.oldSubmit = this.onsubmit;

	this.onsubmit = fe_onsubmit;
	this.disableSubmitOnSubmit = fm_disable_submit_on_submit;
	this.fireSubmit = fm_fire_submit;

	this.validate = fm_validate;

	this.unMasking = fm_un_masking;
	this.masking = fm_masking;

	this.enable = fm_enable;
	this.disable = fm_disable;

	this.show = fm_show;
	this.hide = fm_hide;
	this.checking = fm_checking;
	this.unChecking = fm_unChecking;
	this.getNextFocus = fm_get_next_focus;
	this.getPreFocus = fm_get_pre_focus;

	this.escape = fm_escape;
	this.unEscape = fm_unescape;

	this.magicQuoteAdd = fm_magic_quote_add;
	this.magicQuoteErase = fm_magic_quote_erase;

	this.fireSubmitInputTypeObj = new Object;
	this.setSubmitInputTypeObj = fm_set_submit_input_type_ojb;
	this.createHiddenInputType = fm_create_hidden_input_type;
	this.addSendValue = fm_add_send_value;

	for(var idx=0; idx < this.elements.length ; idx++){
		this.elements[idx].initialize = em_initialize;
		this.elements[idx].initialize(this);
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.ff_initialize_form() 2005-06-16 Ãß°¡
// ´ë»ó°´Ã¼ : »õ·Î »ý¼ºµÇ´Â form °´Ã¼(this)
// ³»    ¿ë : »õ·Î »ý¼ºµÇ´Â formÀÇ method ¹× event¸¦ redefineÇÏ°í formÀÌ °¡Áö´Â °¢ elements¿¡ °ü·ÃµÈ ÃÊ±âÈ­ ÀÛ¾÷À» ¼öÇàÇÑ´Ù.
// PRAMETER : form //½ÃÀÛ elementÀÇ row_num//, ÇÑrowÀÇ element °¹¼ö // ig_el :Ã³À½ µé¾î°¥ (ÃÊ±âÈ­ ½ÃÅ³ÇÊ¿ä¾ø´Â) ¼ýÀÚ
// 
//////////////////////////////////////////////////////////

function ff_initialize_form(frm, selected_row, tot_el, ig_el){
	var st_num = (selected_row+1) * tot_el + ig_el
	alert(st_num);
	for(var idx= st_num ; idx < st_num + tot_el; idx++){ // ÃÊ±âÈ­ÇÒ elementµé
	    alert(frm.elements[idx].name);
		frm.elements[idx].initialize = em_initialize;
		frm.elements[idx].initialize(this);
	}
}


//////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : form.onsubmit()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// °Ý¹ß½Ã±â : Fires when a form is about to be submitted.
// ¸® ÅÏ °ª : boolean(false only) ÀÌº¥Æ®¸¦ false½ÃÅ²´Ù.
// ³»    ¿ë : formÀÌ submitµÇ¾úÀ»¶§, fireSubmit()À» ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function fe_onsubmit() {
	this.fireSubmit();
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.fireSubmit()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// °Ý¹ß½Ã±â : Fires when a form is about to be submitted.
// ¸® ÅÏ °ª : boolean(false only) ÀÌº¥Æ®¸¦ false½ÃÅ²´Ù.
// ³»    ¿ë : validate ¹× user_onsubmitµîÀ» ¼öÇàÇÏ°í ½ÇÁ¦ÀÇ submit()À» °Ý¹ßÇÑ´Ù.
//////////////////////////////////////////////////////////

function fm_fire_submit() {
	if (!this.validate()) {
		if (event) event.returnValue = false;
		return false;
	}

	if ( this.getAttribute("confirm") && !confirm(this.getAttribute("confirm")) ) {
		if (event) event.returnValue = false;
		return false;
	}

	this.unMasking();

	if (this.oldSubmit && this.oldSubmit() == false)  {
		if (event) event.returnValue = false;
		return false;
	}

	if (XJSV_MAGIC_QUOTE_ON) this.magicQuoteAdd();
	if (XJSV_ESCAPE_ON) this.escape();
	if (XJSV_DYNAMIC_SEND_VALUE && event && event.type=="submit") this.addSendValue();
	if (XJSV_DISABLSUBMIT_ONSUBMIT) this.disableSubmitOnSubmit();
	if (!event || event.type != 'submit') this.submit();
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.validate()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ¸ðµç elementÀÇ validate ÇÔ¼ö¸¦ È£ÃâÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_validate(){
	if (!XJSV_VALIDATION_ACTIVATE) return true;

	for(var idx=0; idx < this.elements.length ; idx++){
		if (this.elements[idx].validate && this.elements[idx].validate() == false ) {
			return false;
		}
	}

	return true;
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.masking()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : ¸ðµç element¸¦ maskingÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_masking(){
	for(var idx=0; idx < this.elements.length ; idx++)
	if (this.elements[idx].masking) this.elements[idx].masking();
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.unMasking()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : ¸ðµç elementÀÇ mask¸¦ ¾ø¾Ø´Ù.(submitµÇ´Â ½ÇÁ¦ value·Î ¸¸µç´Ù.)
//////////////////////////////////////////////////////////
function fm_un_masking(){
	for(var idx=0; idx < this.elements.length ; idx++){
		if (this.elements[idx].stripMasking)  this.elements[idx].stripMasking();
		else if (this.elements[idx].unMasking) this.elements[idx].unMasking();
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.disable(fields)
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ÆÄ¶ó¸ÞÅÍ : fields : Disable½ÃÅ³ elementsÀÇ name
// ³»    ¿ë : fields¿¡ ÇØ´çÇÏ´Â element¸¦ Disable½ÃÅ²´Ù.
//////////////////////////////////////////////////////////
function fm_disable(fields){
	var node = null;
	var ss = fields.split(",");
	for(var j in  ss )  {
		if ( ss[j] == "" || !this.elements[ss[j]]) continue;
		node = this.elements[ss[j]];

		if (typeof(node.name) == "undefined") {
			for (idx = 0 ; idx<node.length ; idx++)
			if (node[idx].disable) node[idx].disable();
		}else{
			if (node.disable) node.disable();
		}
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.enable(fields)
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ÆÄ¶ó¸ÞÅÍ : fields : Enable½ÃÅ³ elementsÀÇ name
// ³»    ¿ë : fields¿¡ ÇØ´çÇÏ´Â element¸¦ Enable½ÃÅ²´Ù.
//////////////////////////////////////////////////////////
function fm_enable(fields){
	var node = null;
	var ss = fields.split(",");
	for(var j in  ss )  {
		if ( ss[j] == "" || !this.elements[ss[j]]) continue;
		node = this.elements[ss[j]];

		if (typeof(node.name) == "undefined") {
			for (idx = 0 ; idx<node.length ; idx++)
				if (node[idx].enable) node[idx].enable();
		}else{
			if (node.enable) node.enable();
		}
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.show(fields)
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ÆÄ¶ó¸ÞÅÍ : fields : ShowÇÒ  elementsÀÇ name
// ³»    ¿ë : fields¿¡ ÇØ´çÇÏ´Â element¸¦ ShowÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_show(fields){
	var node = null;
	var ss = fields.split(",");
	for(var j in  ss )  {
		if ( ss[j] == "" || !this.elements[ss[j]]) continue;
		node = this.elements[ss[j]];

		if (typeof(node.name) == "undefined") {
			for (idx = 0 ; idx<node.length ; idx++)
				if (node[idx].show) node[idx].show();
		}else{
			if (node.show) node.show();
		}
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.hide(fields)
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ÆÄ¶ó¸ÞÅÍ : fields : ShowÇÒ  elementsÀÇ name
// ³»    ¿ë : fields¿¡ ÇØ´çÇÏ´Â element¸¦ HideÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_hide(fields){
	var node = null;
	var ss = fields.split(",");
	for(var j in  ss )  {
		if ( ss[j] == "" || !this.elements[ss[j]]) continue;
		node = this.elements[ss[j]];

		if (typeof(node.name) == "undefined") {
			for (idx = 0 ; idx<node.length ; idx++)
				if (node[idx].hide) node[idx].hide();
		}else{
			if (node.hide) node.hide();
		}
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.escape()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : ¸ðµç elementÀÇ value°ªÀ» ÀÎÄÚµùÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_escape(){
	for(var idx=0; idx < this.elements.length ; idx++){
		var node = this.elements[idx];
		if ( (  node.type != "button" && node.type != "submit" && node.type != "reset" ) && node.value)
			node.value = escape(node.value);
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.unEscape()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : ¸ðµç elementÀÇ value°ªÀ» µðÄÚµùÇÑ´Ù
//////////////////////////////////////////////////////////
function fm_unescape(){
	for(var idx=0; idx < this.elements.length ; idx++){
		if (this.elements[idx].value)
			this.elements[idx].value = unescape(this.elements[idx].value);
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.magicQuoteAdd()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : ¸ðµç elementÀÇ value°ª¿¡ Magic Quote¸¦ ´õÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_magic_quote_add(){
	for(var idx=0; idx < this.elements.length ; idx++){
		if (this.elements[idx].value && this.elements[idx].magicQuoteAdd)
			this.elements[idx].value = this.elements[idx].magicQuoteAdd();
	}
}


//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.magicQuoteErase()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : ¸ðµç elementÀÇ value°ª¿¡¼­ Magic Quote¸¦ »«´Ù.
//////////////////////////////////////////////////////////
function fm_magic_quote_erase(){
	for(var idx=0; idx < this.elements.length ; idx++){
		if (this.elements[idx].value && this.elements[idx].magicQuoteErase)
			this.elements[idx].value = this.elements[idx].magicQuoteErase();
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.disableSubmitOnSubmit()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : XJSV_DISABLSUBMIT_ONSUBMITÀÌ ¼³Á¤µÇ¾î ÀÖÀ¸¸é submit½Ã¿¡ ¸ðµç submit¹öÆ°À» disable½ÃÅ²´Ù.
//////////////////////////////////////////////////////////
function fm_disable_submit_on_submit(){
	for(var idx=0; idx < this.elements.length ; idx++){
		if (this.elements[idx].type == "submit" || this.elements[idx].type == "image")  {
			this.elements[idx].disable();
		}
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.createHiddenInputType()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ÆÄ¶ó¸ÞÅÍ : inputName »ý¼ºÇÒ hidden input-typeÀÇ name
//            inputName »ý¼ºÇÒ hidden input-typeÀÇ value
// ³»    ¿ë : form¿¡ inputNameÀÇ input°´Ã¼(hidden)À» dynamicÇÏ°Ô »ý¼ºÇÏ°í value°ªÀ» inputValue·Î ¼³Á¤ÇÑ´Ù.
//            ÀÌ¹Ì °°Àº ÀÌ¸§ÀÇ input°´Ã¼°¡ ÀÖ´Â °æ¿ì¿¡´Â value°ª¸¸À» inputValue·Î ¼³Á¤ÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_create_hidden_input_type(inputName, inputValue){
	var oElement = null;

	if (typeof(eval("this."+inputName))== "undefined") { //input ojbect is not exist
		var oHid=document.createElement("input");
		oHid.type = "hidden";
		oHid.id = inputName;
		oHid.name = inputName;
		this.insertBefore(oHid);
		oElement = oHid;
	} else {
		oElement = eval("this."+inputName);
	}
	oElement.value = inputValue;
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.setSubmitInputTypeObj()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : submitÀ» fireÇÑ input °´Ã¼(sumit/images)¸¦ formÀÇ attribute·Î ¼¼ÆÃÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_set_submit_input_type_ojb(obj){
	this.fireSubmitInputTypeObj = obj;
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.addSendValue()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ³»    ¿ë : form¿¡ send_value·Î Á¤ÀÇµÈ ¹®ÀÚ¿­À» »ç¿ëÇÏ¿© hidden°ªµéÀ» ¼¼ÆÃÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_add_send_value(){
	var type = this.fireSubmitInputTypeObj.type;

	if (!( type == "submit" || type == "image" )) return;

	var pStr = this.fireSubmitInputTypeObj.getAttribute("send_value");

	if (pStr == null || pStr =="" ) return;

	var ss = pStr.split("&");
	for(var j in  ss )  {
		if ( ss[j] == "" ) continue;
			var tt = ss[j].split("=");
			this.createHiddenInputType(tt[0],tt[1]);
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.checking()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ÆÄ¶ó¸ÞÅÍ : objName : check elementÀÇ ÀÌ¸§
// ³»    ¿ë : formÀÌ °¡Áö°í ÀÖ´Â checkbox È¤Àº radio¹öÆ°Áß ÀÌ¸§°ú ÀÏÄ¡ÇÏ´Â°ÍÀ» checkÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_checking(objName){
	for(var idx=0; idx < this.elements.length ; idx++){
		if ( this.elements[idx].name == objName && this.elements[idx].type == "checkbox" || this.elements[idx].type == "radio" ) this.elements[idx].checking();
	}
}

//////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.unChecking()
// ´ë»ó°´Ã¼ : form °´Ã¼(this)
// ÆÄ¶ó¸ÞÅÍ : objName : unCheckÇÒ elementÀÇ ÀÌ¸§
// ³»    ¿ë : formÀÌ °¡Áö°í ÀÖ´Â checkbox È¤Àº radio¹öÆ°Áß ÀÌ¸§°ú ÀÏÄ¡ÇÏ´Â°ÍÀ» uncheckÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_unChecking(objName){
	for(var idx=0; idx < this.elements.length ; idx++){
		if ( this.elements[idx].name == objName &&  this.elements[idx].type == "checkbox" || this.elements[idx].type == "radio" ) this.elements[idx].unChecking();
	}
}

////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.getNextFocus()
// ´ë»ó°´Ã¼ : form °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : selfObj : ÇöÀç focus¸¦ °¡Áö°í ÀÖ´Â °´Ã¼ (element)
//           objName : next·Î focusÇÒ °´Ã¼ÀÇ name
// ¸® ÅÏ °ª : Ã£¾ÆÁø next focus °´Ã¼.
// ³»    ¿ë : next·Î focusÇÒ °´Ã¼¸¦ Ã£¾Æ returnÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_get_next_focus(selfObj, objName){
	if (objName) return typeof( this.elements[objName].name) == "undefined" ? this.elements[objName][0] : this.elements[objName];

	var selfEleIndex = this.elements.length;

	for(var idx=0; idx < this.elements.length ; idx++){
		if ( this.elements[idx] == selfObj ) {
			selfEleIndex = idx;
			holdIndex = idx;
			break;
		}
	}

	do{
		selfEleIndex ++;
		var focusObj = this.elements[selfEleIndex];
		if (selfEleIndex >= this.elements.length ) selfEleIndex = 0;
		if ( selfEleIndex == holdIndex ) break;

	} while ( typeof(focusObj) == 'undefined' || focusObj.readonly || focusObj.isAttribute("lable" ) || focusObj.style.display == "none" || (focusObj.type && focusObj.type=='hidden'));

	if (selfEleIndex >= this.elements.length) selfEleIndex = 0;

	return this.elements[selfEleIndex];
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : form.getPreFocus()
// ´ë»ó°´Ã¼ : form °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : selfObj : ÇöÀç focus¸¦ °¡Áö°í ÀÖ´Â °´Ã¼ (element)
//           objName : pre·Î focusÇÒ °´Ã¼ÀÇ name
// ¸® ÅÏ °ª : Ã£¾ÆÁø pre focus °´Ã¼.
// ³»    ¿ë : pre·Î focusÇÒ °´Ã¼¸¦ Ã£¾Æ returnÇÑ´Ù.
//////////////////////////////////////////////////////////
function fm_get_pre_focus(selfObj, objName){
	if (objName) return typeof( this.elements[objName].name) == "undefined" ? this.elements[objName][0] : this.elements[objName];

	var selfEleIndex = this.elements.length;

	for(var idx=0; idx < this.elements.length ; idx++){
		if ( this.elements[idx] == selfObj ) {
			selfEleIndex = idx;
			holdIndex = idx;
			break;
		}
	}

	do{
		selfEleIndex --;
		var focusObj = this.elements[selfEleIndex];
		if (selfEleIndex < 0  ) selfEleIndex = this.elements.length - 1 ;
		if ( selfEleIndex == holdIndex ) break;
	} while ( typeof(focusObj) == 'undefined' || focusObj.readonly || focusObj.isAttribute("lable" ) || focusObj.style.display == "none" || (focusObj.type && focusObj.type=='hidden'));

	if (selfEleIndex < 0 ) selfEleIndex =  this.elements.length -1 ;

	return this.elements[selfEleIndex];
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   element °´Ã¼
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.initialize(parent)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ðÅ¬·¡½º (form)
// ³»    ¿ë : elementÀÇ method, event ¹× attribute¸¦ redefineÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_initialize(parent){
	//constant data;
	this.parent = parent; //Parent - form
	this.hideValue = ""; //use this when enable/disable, show/hide
	this.impotence = false; //use this XJSV_DISABLSUBMIT_ONSUBMIT is true and user use back button

	//store original events and redirct events;
	if (this.onkeypress) this.old_onkeypress = this.onkeypress;
	if (this.onkeyup) this.old_onkeyup = this.onkeyup;
	if (this.onfocus) this.old_onfocus = this.onfocus;
	if (this.onblur) this.old_onblur = this.onblur;
	if (this.onchange) this.old_onchange = this.onchange;
	if (this.onclick) this.old_onclick = this.onclick;
	if (this.onmouseover) this.old_onmouseover = this.onmouseover;
	if (this.onmouseout) this.old_onmouseout = this.onmouseout;

	this.onkeypress = null;  //used for only filter
	this.onkeyup = null;  //used for only auto_focus
//	onkeyupÀÌº¥Æ®°¡ ¾ÈµÇ¼­ ¼öÁ¤ÇÔ... 20030102 by ÀÌÁÖÃ¶..
//	this.onkeypress = ee_on_key_press;	//º¯°æ
//	this.onkeyup = ee_on_key_up;		//º¯°æ

	this.onfocus = ee_on_focus;
	this.onblur = ee_on_blur;
	this.onchange = ee_on_change;
	this.onclick = ee_on_click;
	this.onmouseover = ee_on_mouse_over;
	this.onmouseout = ee_on_out;

	//Method for UI - Controller
	this.uiContollerFactory = em_uic_factory;
	this.applyUic = em_apply_uic;
	this.enableUic = em_enable_uic;

	this.uicCss = em_uic_css;
	this.uicFilter = em_uic_filter;
	this.uicMask = em_uic_mask;

	this.strippers = new Array;
	this.addStripper = em_add_stripper;
	this.stripping = em_stripping;

	this.assistants = new Array;
	this.addAssistant = em_add_assistant;
	this.assistantShow = em_assistant_show;
	this.assistantKill = em_assistant_kill;

	//data & event redirct for filter;
	this.xjs_filter = null;

	//data & event redirct for mask;
	this.xjs_mask = null;
	this.masking = null;
	this.unMasking = null;
	this.stripMasking = null;

	//data & method for validation
	this.validators = new Array;
	this.validatorFactory = em_validator_factory;
	this.enableValidator = em_enable_validator;
	this.addValidator = em_add_validator;
	this.validate = em_validate;

	//data & method for Dynamic UI - Handler
	this.uich = new Array;
	this.duihFactory = em_duih_factory;
	this.enableDuih = em_enable_duih;
	this.addDuih = em_add_duih;
	this.fireDuih = em_fire_duih;

	//Method for Utilities
	this.enable = em_enable;
	this.disable = em_disable;
	this.getByte = em_getByte;

	this.show = em_show;
	this.hide = em_hide;
	this.checking = em_checking;
	this.unChecking = em_unChecking;
	this.makeReadOnly = em_make_read_only;
	this.storeValue = em_store_value;
	this.restoreValue = em_restore_value;

	this.isAttribute = em_is_attribute;
	this.isAttrValue = em_is_attribute_value;

	this.magicQuoteAdd = em_magic_quote_add;
	this.magicQuoteErase = em_magic_quote_erase;

	//Execute method for Initialize
	this.uiContollerFactory();
	this.validatorFactory();
	this.duihFactory();
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   element °´Ã¼ User Events
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onkeypress()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the user presses an alphanumeric key.
// ¸® ÅÏ °ª : boolean(false only) ÀÌº¥Æ®¸¦ false½ÃÅ²´Ù.
// ³»    ¿ë : Å°°¡ ´­¸±¶§ element.xjs_filter¿¡ ÀÇ°ÅÇÏ¿© Å°ÀÔ·ÂÀ» ¸·´Â´Ù.
//////////////////////////////////////////////////////////
function ee_on_key_press(){
	if (this.xjs_filter) {
		var sKey = String.fromCharCode(event.keyCode);
		var re = new RegExp(this.xjs_filter);

		// Enter´Â Å°°Ë»ç¸¦ ÇÏÁö ¾Ê´Â´Ù.
		if(sKey!="\r" && !re.test(sKey)) event.returnValue=false;
	}

	if (this.old_onkeypress) this.old_onkeypress();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onkeyup()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the user presses an alphanumeric key.
// ¸® ÅÏ °ª : boolean(false only) ÀÌº¥Æ®¸¦ false½ÃÅ²´Ù.
// ³»    ¿ë : Å°°¡ ´­¸±¶§ auto_focus¸¦ Ã¼Å©ÇÑ´Ù.
//////////////////////////////////////////////////////////
function ee_on_key_up(){
	if ( event.keyCode !=9 && event.keyCode !=16  && this.isAttribute("auto_focus") && this.value.length >= this.getAttribute("maxlength") ) {
		var nextItem = this.parent.getNextFocus(this);
		nextItem.focus();
	}

	if (this.old_onkeyup) this.old_onkeyup();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onfocus()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the element receives the focus.
// ³»    ¿ë : element¿¡ Æ÷Ä¿½º°¡ µé¾î¿À¸é masking ¹× select¸¦ ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function ee_on_focus(){
	if ( this.assistants.length && this.assistantShow ) this.assistantShow("status_bar");

		if (this.readOnly || this.isAttribute("lable" ) || this.style.display == "none" ) {
			this.blur();
			this.parent.getNextFocus(this).focus();
		}

	if ( this.value && !this.readOnly) {
		if ( ( this.type == "text" || this.type == "password" ) && this.unMasking)
			this.unMasking();
		if ( ( this.type == "text" || this.type == "password" ) && this.select)
			this.select();
	}

	if(this.old_onfocus) this.old_onfocus();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onblur()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the object element the input focus.
// ³»    ¿ë : element°¡ Æ÷Ä¿½º¸¦ ÀÒÀ¸¸é unmasking ¹× Duih¸¦ ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function ee_on_blur(){
	if ( this.assistants.length && this.assistantKill ) this.assistantKill("status_bar");

	if ( ( this.type == "text" || this.type == "password" || this.type == "textarea" || this.type == "file") && this.fireDuih)
		this.fireDuih();

	if ( this.value ) {
		if ( ( this.type == "text" || this.type == "password" ) && this.masking)
			this.masking();
		if ( ( this.type == "text" || this.type == "password" || this.type == "textarea" || this.type == "file") && this.stripping)
			this.stripping();
	}

	if(this.old_onblur ) this.old_onblur();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onchange()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the contents of the object or selection have changed.
// ³»    ¿ë : elementÀÇ ³»¿ëÀÌ ¹Ù²î¸é Duih¸¦ ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function ee_on_change(){
	if ( ( this.type == "select-one" || this.type == "select-multiple" ) && this.fireDuih)
		this.fireDuih();

	if(this.old_onchange ) this.old_onchange();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onclick()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the user clicks the left mouse button on the object.
// ³»    ¿ë : element¸¦ Å¬¸¯ÇÏ¸é Duih¸¦ ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function ee_on_click(){
	if ( ( this.type == "radio" || this.type == "checkbox" ) && this.fireDuih)
		this.fireDuih();

		if ( this.type == "submit" )
			this.parent.setSubmitInputTypeObj(this);

	if(this.old_onclick ) this.old_onclick();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onmouseover()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the user clicks the left mouse button on the object.
// ³»    ¿ë : element¸¦ Å¬¸¯ÇÏ¸é Duih¸¦ ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function ee_on_mouse_over(){
	if ( this.assistants.length && this.assistantShow ) this.assistantShow("balloon");

	if(this.old_onmouseover ) this.old_onmouseover();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : element.onmouseout()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// °Ý¹ß½Ã±â : Fires when the user clicks the left mouse button on the object.
// ³»    ¿ë : element¸¦ Å¬¸¯ÇÏ¸é Duih¸¦ ¼öÇàÇÑ´Ù.
//////////////////////////////////////////////////////////
function ee_on_out(){
	if ( this.assistants.length && this.assistantKill ) this.assistantKill("balloon");

	if(this.old_onmouseout ) this.old_onmouseout();
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.isAttribute(attr)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : attr : element°¡ °¡Áø attribute
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  element°¡ ÁÖ¾îÁø attribute¸¦ °¡Áö´ÂÁö Ã¼Å©ÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_is_attribute(attr){
	return ( this.getAttribute(attr) != null ) ? true : false;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.isAttrValue(attr)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : attr : element°¡ °¡Áø attribute
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  element°¡ ÁÖ¾îÁø attribute¸¦ °¡Áö´Â°í °ªÀ» °¡Áö´ÂÁö Ã¼Å©ÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_is_attribute_value(attr){
	return ( this.getAttribute(attr)  ) ? true : false;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.getByte()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ¸® ÅÏ °ª : valueÀÇ byte°ª
// ³»    ¿ë : ´ë»ó elementÀÇ valueÀÇ byte°ªÀ» ±¸ÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_getByte(){
	if (typeof(this.value) == "undefined" || typeof(this.value.length) == "undefined" ) return 0;

	var str = this.value;

	var len=0, j;

	for (i=0, j=str.length; i<j; i++, len++){
		if ( (str.charCodeAt(i)<0)||(str.charCodeAt(i)>127) ){
			len = len+1;
		}
	}

	return len;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.enable()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : element¸¦ enable½ÃÅ°°í °ªÀ» º¹±¸½ÃÅ²´Ù.
//////////////////////////////////////////////////////////
function em_enable(){
	if (!this.isAttribute("disabled")) return;

	switch (this.type) {
		case "text" :
		case "password" :
		case "textarea" :
		case "select-one" :
		case "select-multiple" :
		case "image" :
		case "file" :
			this.restoreValue();
			this.removeAttribute("disabled");
			this.style.backgroundColor = "#ffffff";
		break;

		case "radio" :
		case "checkbox" :
			this.restoreValue();
			this.removeAttribute("disabled");
		break;

		case "button" :
		case "submit" :
		case "reset" :
			this.removeAttribute("disabled");
			this.style.backgroundColor = "#dfdfde";
		break;

		default :
		break;
	}
	this.impotence = false;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.disable()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : element¸¦ disable½ÃÅ°°í °ªÀ» ¾ø¾Ø´Ù.
//////////////////////////////////////////////////////////
function em_disable(){
	if (this.getAttribute("disabled")) return;

	switch (this.type) {
		case "text" :
		case "password" :
		case "textarea" :
		case "select-one" :
		case "select-multiple" :
		case "image" :
		case "file" :
			this.storeValue();
			this.setAttribute("disabled",true);
			this.style.backgroundColor = "#cccccc";
		break;

		case "radio" :
		case "checkbox" :
			this.storeValue();
			this.setAttribute("disabled",true);
		break;


		case "button" :
		case "submit" :
		case "reset" :
			this.setAttribute("disabled",true);
			this.style.backgroundColor = "#cccccc";
		break;

		default :
		break;
	}

	this.impotence = true;


}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.show()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : element¸¦ showÇÏ°í °ªÀ» º¹±¸½ÃÅ²´Ù.
//////////////////////////////////////////////////////////
function em_show(){
	if (this.style.display == XJSV_SHOW_STYLE ) return;

	switch (this.type) {
		case "text" :
		case "password" :
		case "textarea" :
		case "button" :
		case "submit" :
		case "reset" :
		case "radio" :
		case "checkbox" :
		case "select-one" :
		case "select-multiple" :
		case "image" :
		case "file" :
			this.restoreValue();
			this.style.display = XJSV_SHOW_STYLE;
		break;

		default :
		break;
	}

	this.impotence = false;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.hide()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : element¸¦ hide½ÃÅ°°í °ªÀ» ¾ø¾Ø´Ù.
//////////////////////////////////////////////////////////
function em_hide(){
	if (this.style.display == "none" ) return;

	switch (this.type) {
		case "text" :
		case "password" :
		case "textarea" :
		case "button" :
		case "submit" :
		case "reset" :
		case "radio" :
		case "checkbox" :
		case "select-one" :
		case "select-multiple" :
		case "image" :
		case "file" :
			this.storeValue();
			this.style.display = "none";
		break;

		default :
		break;
	}
	this.impotence = true;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.checking()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : element(checkBox, radio)¸¦ checkingÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_checking(){
	switch (this.type) {
		case "checkbox" :
		case "radio" :
			this.checked  = true;
		break;

		default :
		break;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.unchecking()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : element(checkBox, radio)¸¦ uncheckingÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_unChecking(){
	switch (this.type) {
		case "checkbox" :
		case "radio" :
			this.checked  = false;
		break;

		default :
		break;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.makeReadOnly()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : flag : trueÀÌ¸é readonly, falseÀÌ¸é writerableÀÌ´Ù.
// ³»    ¿ë : elementÀÇ readOnly¼Ó¼ºÀ» ¼³Á¤ÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_make_read_only(flag){
	if (flag) {
		if (this.readOnly || this.getAttribute("disabled")) return;
	} else {
		if (!this.readOnly || !this.isAttribute("disabled")) return;
	}
	switch (this.type) {
		case "text" :
		case "password" :
		case "textarea" :
		if (flag) {
			this.readOnly = true;
			this.style.backgroundColor = "white";
		} else {
			this.readOnly = false;
			this.style.backgroundColor = "#ffffff";
		}
		break;

		default :
		break;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.storeValue()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ´ë»ó  element°¡ hide/disableµÇ¾úÀ»¶§ value°ªÀ» ÀúÀåÇÏ°í Áö¿î´Ù.
//////////////////////////////////////////////////////////
function em_store_value(){
	if (!XJSV_ERASE_VALUE_DISABLE) return;
	if (this.value == "" || this.value == null ) return;
	this.hideValue = this.value;
	this.value = "";
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.restoreValue()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ´ë»ó  element°¡ show/enableµÇ¾úÀ»¶§ value°ªÀ» restoreÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_restore_value(){
	if (!XJSV_ERASE_VALUE_DISABLE) return;
	if (this.hideValue == "" || this.hideValue == null ) return;
	this.value = this.hideValue;
	this.hideValue = "";
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.magicQuoteAdd()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ´ë»ó  elementÀÇ value°ª¿¡ Magic Quote¸¦ ´õÇÑ´Ù.
// ¸® ÅÏ °ª : value°ª¿¡ Magic Quote¸¦ ´õÇÑ String
//////////////////////////////////////////////////////////
function em_magic_quote_add(){
	if (!this.value) return ; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	magicquote = this.value;
	magicquote = magicquote.replace(/\\/ig ,"\\\\");
	magicquote = magicquote.replace(/\'/ig ,"\\'");
	magicquote = magicquote.replace(/\"/ig ,"\\\"");

	return magicquote;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.magicQuoteErase()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ´ë»ó  elementÀÇ value°ª¿¡¼­ Magic Quote¸¦ »«´Ù.
// ¸® ÅÏ °ª : value°ª¿¡ Magic Quote¸¦ »« String
//////////////////////////////////////////////////////////
function em_magic_quote_erase(){
	if (!this.value) return ; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	reverse = this.value;
	reverse = reverse.replace(/\\\"/ig ,"\"");
	reverse = reverse.replace(/\\'/ig ,"\'");
	reverse = reverse.replace(/\\\\/ig ,"\\");

	return reverse;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.validate()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : °¢ element¿¡ µî·ÏµÈ validatorµéÀ» ¸ðµÎ Ã¼Å©ÇÏ°í
 //           Á¤»óÀûÀÌ¶ó¸é ¹è°æ»öÀ» Èò»öÀ¸·Î ¹Ù²Û´Ù.
//////////////////////////////////////////////////////////
function em_validate(){
	if ( this.validators && !this.validators.length ) return true;

	for(var idx=0; idx < this.validators.length ; idx++){
		if (!this.impotence && this.validators[idx].validate && this.validators[idx].validate() == false ) {
			return false;
		}
	}

	if (this.type != "radio" && this.type != "checkbox" ) this.style.backgroundColor = "white";
	else this.style.backgroundColor = "";

	return true;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.stripping()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : °¢ element¿¡ µî·ÏµÈ stripperµéÀ» ¸ðµÎ fireÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_stripping(){
	if ( !this.strippers.length ) return true;

	for(var idx=0; idx < this.strippers.length ; idx++){
		if (this.strippers[idx].stripping)
			this.strippers[idx].stripping();
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.assistantShow(xjs_key)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : showÇÒ assistantÀÇ Á¾·ù
// ³»    ¿ë : °¢ element¿¡ µî·ÏµÈ assistantµéÀ» ¸ðµÎ show ÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_assistant_show(xjs_key){
	if ( !this.assistants.length ) return true;

	for(var idx=0; idx < this.assistants.length ; idx++){
		if (this.assistants[idx].show && this.assistants[idx].xjs_key == xjs_key )
			this.assistants[idx].show();
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.assistantKill(xjs_key)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : showÇÒ assistantÀÇ Á¾·ù
// ³»    ¿ë : °¢ element¿¡ µî·ÏµÈ assistantµéÀ» ¸ðµÎ kill ÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_assistant_kill(xjs_key){
	if ( !this.assistants.length ) return true;

	for(var idx=0; idx < this.assistants.length ; idx++){
		if (this.assistants[idx].kill && this.assistants[idx].xjs_key == xjs_key )
			this.assistants[idx].kill();
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.fireDuih()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : °¢ element¿¡ µî·ÏµÈ duih¸¦ Fire½ÃÅ²´Ù.
//////////////////////////////////////////////////////////
function em_fire_duih(){
	if ( !this.uich.length ) return;

	for(var idx=0; idx < this.uich.length ; idx++)
		if (this.uich[idx].fireOnEvent) this.uich[idx].fireOnEvent();
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   element °´Ã¼ ¸Þ¼Òµå - Dynamic UI Handler
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.duihFactory()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ´ë»ó  elementÀÇ type°ú ÁÖ¾îÁø attribute¿¡ µû¶ó ÇÊ¿äÇÑ
//            Dynamic UI Handler ¸¦ »ç¿ë °¡´ÉÇÏ°Ô ÇÑ´Ù.
//////////////////////////////////////////////////////////
function  em_duih_factory(){
	switch (this.type) {
		case "text" :
		case "password" :
		case "textarea" :
		case "radio" :
		case "checkbox" :
		case "select-one" :
		case "select-multiple" :
		case "file" :
			if ( this.isAttrValue("enable_fields") )  this.enableDuih("enable_fields");
			if ( this.isAttrValue("show_fields") )    this.enableDuih("show_fields");
			if ( this.isAttrValue("disable_fields") ) this.enableDuih("disable_fields");
			if ( this.isAttrValue("hide_fields") )    this.enableDuih("hide_fields");
		break;

		default :
		break;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.enableDuih(xjs_key)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : xjs_key : ÁÖ¾îÁø duih¿ë attribute
// ³»    ¿ë : ÁÖ¾îÁø attribute¿¡ µû¶ó ÇÊ¿äÇÑ dui-handler¸¦ element¿¡ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_enable_duih(xjs_key){
	switch(xjs_key){
		case "enable_fields" :
			this.addDuih(new xo_dui_handler(this, "enable_fields", "enable_values"));
		break;
		case "show_fields" :
			this.addDuih(new xo_dui_handler(this, "show_fields", "show_values"));
		break;
		case "disable_fields" :
			this.addDuih(new xo_dui_handler(this, "disable_fields", "disable_values"));
		break;
		case "hide_fields" :
			this.addDuih(new xo_dui_handler(this, "hide_fields", "hide_values"));
		break;

		default :
		break;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.addDuih(uichObj)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : uichObj : element¿¡ ºÙÀ» dui-handler °´Ã¼
// ³»    ¿ë : ÁÖ¾îÁø dui-handler °´Ã¼¸¦ element¿¡ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_add_duih(uichObj){
	this.uich[this.uich.length] = uichObj;
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   Dynamic UI Handler °´Ã¼ & ¸Þ¼Òµå
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_handler(parent, xjs_key, xjs_value)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
//            xjs_key : Àû¿ëÇÒ elementÀÇ names (ex : disable_fields)
//            xjs_value : °Ý¹ß½ÃÅ³ °ª (ex : disable_values)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ dui-handler °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_dui_handler(parent, xjs_key, xjs_value){
	this.parent = parent;
	this.xjs_key = xjs_key;
	this.xjs_doFields = parent.getAttribute(xjs_key);
	this.xjs_ifValues =  parent.isAttribute(xjs_value) ? parent.getAttribute(xjs_value) : null ;

	this.fireOnEvent = xm_fire_on_event;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_dui_handler.fireOnEvent()
// ´ë»ó°´Ã¼ : this : duih °´Ã¼ (xo_dui_handler)
// ³»    ¿ë : ÀÌº¥Æ® ¹ß»ý½Ã ´ë»ó  elementÀÇ duih°´Ã¼·Î¼­ÀÇ dynamic ui handlingÀ» ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_fire_on_event(){
	var flag = false;

	if (( this.parent.type == "checkbox" || this.parent.type == "radio" )){
		if ( this.parent.checked)
			flag = true;
	}else{
		if (this.xjs_ifValues)  {
			var ss;
			ss = this.xjs_ifValues.split(",");
			for(var j in  ss )
				if (this.parent.value == ss[j]) flag = true;
		} else {
			if ( this.parent.value.length > 0 )
				flag = true;
		}
	}

	if (flag) {
		switch(this.xjs_key)  {

			case "enable_fields" :
				this.parent.parent.enable(this.xjs_doFields);
			break;
			case "disable_fields" :
				this.parent.parent.disable(this.xjs_doFields);
			break;
			case "show_fields" :
				this.parent.parent.show(this.xjs_doFields);
			break;
			case "hide_fields" :
				this.parent.parent.hide(this.xjs_doFields);
			break;
			default :
			break;
		}

	} else {
		switch(this.xjs_key)  {
			case "enable_fields" :
				this.parent.parent.disable(this.xjs_doFields);
			break;
			case "disable_fields" :
				this.parent.parent.enable(this.xjs_doFields);
			break;
			case "show_fields" :
				this.parent.parent.hide(this.xjs_doFields);
			break;
			case "hide_fields" :
				this.parent.parent.show(this.xjs_doFields);
			break;
			default :
			break;
		}
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   element °´Ã¼ ¸Þ¼Òµå - UI-Contoller Factory
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.uiContollerFactory()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ´ë»ó  elementÀÇ type°ú ÁÖ¾îÁø attribute¿¡ µû¶ó ÇÊ¿äÇÑ UI-Contoller¸¦ »ç¿ë °¡´ÉÇÏ°Ô ÇÑ´Ù.
//////////////////////////////////////////////////////////
function  em_uic_factory(){
	switch (this.type) {

		case "text" :
			if ( this.isAttribute("plain-box") || XJSV_CSS_PLAINED ) this.applyUic("plain-box");
			if ( this.isAttribute("required") )  this.applyUic("required");
			if ( this.isAttribute("right") )     this.applyUic("right");
			if ( this.isAttribute("center") )     this.applyUic("center"); //Ãß°¡ 2005-05-13 by ljc
			if ( this.isAttrValue("filter") )    this.applyUic("filter");
			if ( this.isAttribute("integer") )    this.applyUic("integer");
			if ( this.isAttribute("float") )    this.applyUic("float");
			if ( this.isAttribute("hexa") )    this.applyUic("hexa");
			if ( this.isAttribute("credit_card") )    this.applyUic("credit_card");
			if ( this.isAttribute("alphabetic") )    this.applyUic("alphabetic");
			if ( this.isAttribute("numeric") )    this.applyUic("numeric");
			if ( this.isAttribute("alpha_numeric") )    this.applyUic("alpha_numeric");
			if ( this.isAttrValue("mask") )      this.applyUic("mask");
			if ( this.isAttribute("money") )     this.applyUic("money");
			if ( this.isAttribute("dollar") )    this.applyUic("dollar");
			if ( this.isAttribute("date") )      this.applyUic("date");
			if ( this.isAttribute("hour_min") )      this.applyUic("hour_min");

			if ( this.isAttribute("psn") )    this.applyUic("psn");
			if ( this.isAttribute("csn") )    this.applyUic("csn");
			if ( this.isAttribute("trim") )    this.enableUic("trim");
			if ( this.isAttribute("strip_special_char") )    this.enableUic("strip_special_char");
			if ( this.isAttribute("strip_white_space") )    this.enableUic("strip_white_space");
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("readonly_this") )    this.applyUic("readonly_this");
			if ( this.isAttrValue("ime") )    this.applyUic("ime");
			if ( this.isAttribute("auto_focus") )    this.enableUic("auto_focus");
			if ( this.isAttribute("lable") )    this.applyUic("lable");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "password" :
			if ( this.isAttrValue("plain-box") || XJSV_CSS_PLAINED ) this.applyUic("plain-box");
			if ( this.isAttribute("required") )  this.applyUic("required");
			if ( this.isAttribute("right") )     this.applyUic("right");
			if ( this.isAttrValue("filter") )    this.applyUic("filter");
			if ( this.isAttribute("integer") )    this.applyUic("integer");
			if ( this.isAttribute("float") )    this.applyUic("float");
			if ( this.isAttribute("hexa") )    this.applyUic("hexa");
			if ( this.isAttribute("credit_card") )    this.applyUic("credit_card");
			if ( this.isAttribute("alphabetic") )    this.applyUic("alphabetic");
			if ( this.isAttribute("numeric") )    this.applyUic("numeric");
			if ( this.isAttribute("alpha_numeric") )    this.applyUic("alpha_numeric");
			if ( this.isAttribute("psn") )    this.applyUic("psn");
			if ( this.isAttribute("csn") )    this.applyUic("csn");
			if ( this.isAttribute("trim") )    this.enableUic("trim");
			if ( this.isAttribute("strip_special_char") )    this.enableUic("strip_special_char");
			if ( this.isAttribute("strip_white_space") )    this.enableUic("strip_white_space");
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("readonly_this") )    this.applyUic("readonly_this");
			if ( this.isAttrValue("ime") )    this.applyUic("ime");
			if ( this.isAttribute("auto_focus") )    this.enableUic("auto_focus");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "textarea" :
			if ( this.isAttrValue("plain-box") || XJSV_CSS_PLAINED ) this.applyUic("plain-box");
			if ( this.isAttribute("required") )  this.applyUic("required");
			if ( this.isAttribute("trim") )    this.enableUic("trim");
			if ( this.isAttribute("strip_special_char") )    this.enableUic("strip_special_char");
			if ( this.isAttribute("strip_white_space") )    this.enableUic("strip_white_space");
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("readonly_this") )    this.applyUic("readonly_this");
			if ( this.isAttrValue("ime") )    this.applyUic("ime");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "radio" :
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "checkbox" :
			if ( this.isAttribute("required") )  this.applyUic("required");
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "select-one" :
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "select-multiple" :
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "file" :
			if ( this.isAttrValue("plain-box") || XJSV_CSS_PLAINED ) this.applyUic("plain-box");
			if ( this.isAttribute("required") )  this.applyUic("required");
			if ( this.isAttribute("trim") )    this.enableUic("trim");
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		case "submit" :

		case "button" :

		case "reset" :

		case "image" :
			if ( this.isAttrValue("plain-box") || XJSV_CSS_PLAINED ) this.applyUic("plain-box");
			if ( this.isAttrValue("balloon") )      this.enableUic("balloon");
			if ( this.isAttrValue("status_bar") )      this.enableUic("status_bar");
			if ( this.isAttribute("disable_this") )    this.applyUic("disable_this");
			if ( this.isAttribute("hide_this") )    this.applyUic("hide_this");
			if ( this.isAttribute("show_this") )    this.applyUic("show_this");
			if ( this.isAttribute("focus_this") )  this.applyUic("focus_this");
		break;

		default :
		break;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.applyUic(xjs_key)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : xjs_key : ÁÖ¾îÁø UI-Contoller(UIC)¿ë attribute
// ³»    ¿ë : ÁÖ¾îÁø attribute¿¡ µû¶ó ÇÊ¿äÇÑ UIC¸¦ element¿¡ Àû¿ëÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_apply_uic(xjs_key){
	switch(xjs_key) {
		case "plain-box" :
			switch(this.type) {
				case "text" :

				case "password" :
					this.uicCss("xjs_edit_box");
				break;

				case "button" :

				case "reset" :

				case "submit" :
					this.uicCss("xjs_button");
				break;

				case "select" :
					this.uicCss("xjs_select");
				break;

				case "file" :

				case "textarea" :
					this.uicCss("xjs_plain");
				break;

				default :
				break;
			}
		break;

		case "required" : //means "required" willbe activate
			this.uicCss("xjs_required");
		break;

		case "right" :
			this.uicCss("xjs_right" );
		break;

		case "center" :
			this.uicCss("xjs_center" );
		break;

		case "filter" :
			this.uicFilter(this.getAttribute("filter"));
		break;

		case "integer" :
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_INTEGER_FILTER);
		break;

		case "float" :
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_FLOAT_FILTER);
		break;

		case "hexa" :
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_HEXA_FILTER);
		break;

		case "credit_card" :
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

		case "alphabetic" :
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_ALPHA_FILTER);
		break;

		case "numeric" :
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

		case "alpha_numeric" :
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_ALNUM_FILTER);
		break;

		case "mask" :
			this.uicMask(this.getAttribute("mask"));
		break;

		case "money" :
			this.uicMask(null, em_money_masking);
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

		case "dollar" :
			this.uicMask(null, em_dollar_masking);
			if ( !this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

		case "date" :
			this.isAttrValue("mask") ? this.uicMask(this.getAttribute("mask")) : this.uicMask(XJSV_DEFAULT_DATE_MASK);
			if (!this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

//		½Ã°£:ºÐ Ãß°¡ 2005-05-13 by ljc
		case "hour_min" :
			this.isAttrValue("mask") ? this.uicMask(this.getAttribute("mask")) : this.uicMask(XJSV_DEFAULT_HOUR_MIN_MASK);
			if (!this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

		case "psn" :
			this.isAttrValue("mask") ? this.uicMask(this.getAttribute("mask")) : this.uicMask(XJSV_DEFAULT_PSN_MASK);
			if (!this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

		case "csn" :
			this.isAttrValue("mask") ? this.uicMask(this.getAttribute("mask")) : this.uicMask(XJSV_DEFAULT_CSN_MASK);
			if (!this.isAttrValue("filter") ) this.uicFilter(XJSV_DEFAULT_NUM_FILTER);
		break;

		case "disable_this" :
			this.disable();
		break;

		case "hide_this" :
			this.hide();
		break;

		case "show_this" :
			this.show();
		break;

		case "focus_this" :
			if (this.focus) this.focus();
		break;

		case "readonly_this" :
			this.makeReadOnly(true);
		break;

		case "ime" :
			switch(this.getAttribute("ime")) {
				case "kor" :
					this.uicCss("xjs_imeKor");
				break;
				case "eng" :
					this.uicCss("xjs_imeEng");
				break;
				case "engOnly" :
					this.uicCss("xjs_imeDis");
				break;
			}
		break;

		case "lable" :
			this.uicCss("xjs_lable");
		break;

		default :
		break;
	}
}


/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.enableUic(xjs_key)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : xjs_key : ÁÖ¾îÁø UI-Controller ¿ë attribute
// ³»    ¿ë : ÁÖ¾îÁø attribute¿¡ µû¶ó ÇÊ¿äÇÑ UIC¸¦ element¿¡ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_enable_uic(xjs_key){
	switch(xjs_key){

		case "trim" :
			this.addStripper(new xo_trim(this));
		break;

		case "strip_special_char" :
			this.addStripper(new xo_strip_special_char(this));
		break;

		case "strip_white_space" :
			this.addStripper(new xo_strip_white_space(this));
		break;

		case "balloon" :
			this.addAssistant(new xo_balloon(this));
		break;

		case "status_bar" :
			this.addAssistant(new xo_status_bar(this));
		break;

		case "auto_focus" :
			this.onkeyup = ee_on_key_up;
		break;

		default :
		break;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.addStripper(stripperObj)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : stripperObj : element¿¡ ºÙÀ» Stripper °´Ã¼
// ³»    ¿ë : ÁÖ¾îÁø Stripper °´Ã¼¸¦ element¿¡ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_add_stripper(stripperObj){
	this.strippers[this.strippers.length] = stripperObj;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.addAssistant(assistantObj)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : assistantObj : element¿¡ ºÙÀ» assistant °´Ã¼
// ³»    ¿ë : ÁÖ¾îÁø assistant °´Ã¼¸¦ element¿¡ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_add_assistant(assistantObj){
	this.assistants[this.assistants.length] = assistantObj;
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   element °´Ã¼ ¸Þ¼Òµå - UI-Contoller Method
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.uicCss(attr)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : attr : element¿¡ Àû¿ëÇÒ CSS Class_name
// ³»    ¿ë : ÁÖ¾îÁø CSS Class_nameÀ» element¿¡ Àû¿ëÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_uic_css(attr){
	if (!this.isAttrValue("className") ) {
		this.setAttribute("className", attr);
		return;
	}

	var old_class = this.getAttribute("className");

	if (old_class.indexOf(attr) == -1 )
		this.setAttribute("className", old_class + " " + attr);
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.uicFilter(filter)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : filter : element¿¡ Àû¿ëÇÒ Filter Reg Exp.
// ³»    ¿ë : ±âÁ¸ filter°¡ ¾ø´Ù¸é ÁÖ¾îÁø filter¸¦ element¿¡ ¼¼ÆÃÇÏ°í
//            onkeypress ÀÌº¥Æ®¸¦ redirectÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_uic_filter(filter){
	if (this.xjs_filter) return;

	this.xjs_filter = filter;
	this.onkeypress = ee_on_key_press;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.uicMask(mask, maskHdl, unmaskHdl, maskStripHdl)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : mask, maskHdl, unmaskHdl, maskStripHdl (¿ª¼øÀ¸·Î »ý·«°¡´É)
//           mask          : element¿¡ Àû¿ëÇÒ mask Reg Exp.
//           maskHdl       : element¿¡ Àû¿ëÇÒ masking method - default : em_masking
//           unmaskHdl     : element¿¡ Àû¿ëÇÒ masking method - default : em_unMasking
//           maskStripHdl  : element¿¡ Àû¿ëÇÒ masking method - default : null
// ³»    ¿ë : ÁÖ¾îÁø mask¸¦ element¿¡ ¼¼ÆÃÇÏ°í
//            masking handler¸¦ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_uic_mask(mask, maskHdl, unmaskHdl, maskStripHdl){
	if (this.xjs_mask) return;

	this.xjs_mask = mask;

	this.masking     = (maskHdl) ? maskHdl : em_masking;
	this.unMasking   = (unmaskHdl) ? unmaskHdl : em_unMasking;
	this.maskStriper = maskStripHdl ? maskStripHdl : null ; //unmasking°ª°ú ½ÇÁ¦ ³Ñ°Ü¾ß ÇÒ °ªÀÌ ´Ù¸¥ °æ¿ì¸¦ ´ëºñ(reserved).
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   element °´Ã¼ ¸Þ¼Òµå - UI-Contoller Event Redirector
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.masking()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ÀÏ¹ÝÀûÀÎ maskingÀ» ´ã´çÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_masking() {
	if (!this.xjs_mask) return;

	var sStr = this.value.replace( /(\/|\$|\^|\*|\(|\)|\+|\.|\?|\\|\{|\}|\||\[|\]|-|:)/g,"");
	var tStr="";
	var idx;
	var jdx=0;
	var tLen = sStr.length +1 ;
	for(var idx=0; idx< sStr.length; idx++){
		tStr += sStr.charAt(idx);
		jdx++;
		if (jdx < this.xjs_mask.length && this.xjs_mask.charAt(jdx)!="9" ) tStr += this.xjs_mask.charAt((jdx++));
	}

	this.value = tStr;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.masking()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : money¿¡ °ü·ÃµÈ maskingÀ» ´ã´çÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_money_masking() {
	var sMoney = this.value.replace(/,/g,"");
	var tMoney = "";
	var i;
	var j=0;
	var tLen =sMoney.length;

	if (tLen <= 3 ) return ;

	for(i=0;i<tLen;i++){
		if (i!=0 && ( i % 3 == tLen % 3) ) tMoney += ",";
		if(i < tLen ) tMoney += sMoney.charAt(i);
	}

	this.value = tMoney;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.masking()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : dollar¿¡ °ü·ÃµÈ maskingÀ» ´ã´çÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_dollar_masking() {
	var sMoney = this.value.replace(/(\,|\.)/g,"");

	if ( sMoney.length <= 2 ) return sMoney;

	var fir_sMoney = sMoney.substr(0, sMoney.length - 2);
	var sec_sMoney = sMoney.substr(sMoney.length - 2, 2);

	var tMoney="";
	var i;
	var j=0;
	var tLen =fir_sMoney.length;

	if (fir_sMoney.length <= 3 ) return fir_sMoney + "." + sec_sMoney;

	for(i=0;i<tLen;i++){
		if (i!=0 && ( i % 3 == tLen % 3) )     tMoney += ",";
		if(i < fir_sMoney.length ) tMoney += fir_sMoney.charAt(i);
	}

	this.value = tMoney + "." + sec_sMoney;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.unMasking()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : element¿¡ °ü·ÃµÈ maskingÀ» Á¦°ÅÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_unMasking() {
	if (this.vaue =="") return;
	this.value = this.value.replace(/(\,|\.|\-|\/)/g,"");
}

///////////////////////////////////////////////////////////////////////////////////////////////
///
///   UI-Contoll User °´Ã¼ & ¸Þ¼Òµå (stripper)
///
////////////////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_trim(parent) (trim - trailing space Á¦°Å)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ trim UIC °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_trim(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "trim";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.stripping = xm_trim_stripping;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_trim.stripping()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_trim)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ strippingÀ» ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_trim_stripping(){
	if (!this.parent.value) return ; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	switch (this.xjs_value) {

		case "left" :
			tsTarget = this.parent.value.replace(/^\s*/,"");
		break;

		case "right" :
			tsTarget = this.parent.value.replace(/\s*$/,"");
		break;

		default :
			tsTarget = this.parent.value.replace(/^\s*/ ,"").replace(/\s*$/ ,"");
		break;
	}

	this.parent.value = tsTarget;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_strip_special_char(parent)
//              (strip_special_char - special_char Á¦°Å)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ strip_special_char UIC °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_strip_special_char(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "strip_special_char";

	//validation method
	this.stripping = xm_special_char_stripping;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_strip_special_char.stripping()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_strip_special_char)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ strippingÀ» ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_special_char_stripping(){
	if (!this.parent.value) return ; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var specialRegExp = XJSV_DEFAULT_SPECIAL_CHAR;
	tsTarget = this.parent.value.replace(specialRegExp,"");

	this.parent.value = tsTarget;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_strip_white_space(parent)
//             (strip_white_space - trailing space Á¦°Å)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ strip_white_space UIC °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_strip_white_space(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "strip_white_space";

	//validation method
	this.stripping = xm_white_space_stripping;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_strip_white_space.stripping()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_strip_white_space)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ strippingÀ» ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_white_space_stripping(){
	if (!this.parent.value) return ; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var whiteSpaceRegExp = XJSV_DEFAULT_WHITE_SPACE;
	tsTarget = this.parent.value.replace(whiteSpaceRegExp, "");

	this.parent.value = tsTarget;
}

///////////////////////////////////////////////////////////////////////////////////////////////
///
///   UI-Contoll User °´Ã¼ & ¸Þ¼Òµå (assistant)
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_balloon(parent) (balloon - Ç³¼±µµ¿ò¸»)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ balloon UIC °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_balloon(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "balloon";
	this.xjs_value = parent.getAttribute(this.xjs_key);
	this.xjs_skin = parent.getAttribute("balloon_skin");

	//validation method
	this.show = xm_balloon_show;
	this.kill = xm_balloon_kill;
	this.getSkin = xm_balloon_get_skin;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_balloon.show()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_balloon)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ show ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_balloon_show(){

	if ( xjs_balloon_dek.visibility =="visible" ) return;

	if (!xjs_is_old_nav) {

		xjs_balloon_yyy = xjs_balloon_Yoffset;

		if (xjs_is_nav) {
			xjs_balloon_dek.document.write(this.getSkin(this.xjs_value));
			xjs_balloon_dek.document.close();
			xjs_balloon_dek.visibility="visible"
		}

		if (xjs_is_iex) {
			document.all("xjs_dek").innerHTML = (this.getSkin(this.xjs_value));
			xjs_balloon_dek.visibility="visible";
		}

	} else {
		alert(msg);
		return;
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_balloon.kill()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_balloon)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ kill ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_balloon_kill(){
	if (xjs_balloon_dek.visibility == "hidden" ) return;

	if (!xjs_is_old_nav) {
		xjs_balloon_yyy=-1000;
		xjs_balloon_dek.visibility="hidden";
	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_balloon.getSkin()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_balloon)
// ¸® ÅÏ °ª : string : Å×ÀÌºíÀ» Æ÷ÇÔÇÑ balloon skin(html)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ balloon skinÀ» ¸®ÅÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_balloon_get_skin(content){
/*	var default_skin = false;
	var dir = XJSV_DEFAULT_SKIN_DIR;
	var skin = new Array (dir+"bar_a.gif", dir+"bar_b.gif", dir+"bar_c.gif");

	if (this.xjs_skin) {
		var skin_index = parseInt(this.xjs_skin.substring(4,6),10);
	if ( skin_index <= 0 || skin_index > skin.length) default_skin = true;
	} else {
		default_skin = true;
	}

	if (default_skin) {
		content = "<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0  bgcolor='" + XJSV_BALLOON_BGCOLOR + "' > " +
		"<TR><TD ALIGN=left nowrap>" +
		"<font color='" +  XJSV_BALLOON_FORECOLOR + "'>" + content + "</font>" +
		"</TD></TR>" +
		"</TABLE>";
	} else { //has skin
		content = "<table border='0' cellspacing='0' cellpadding='0' bgcolor='" + XJSV_BALLOON_BGCOLOR + "' > " +
		"<tr><td align='right'><img src='"+ skin[0] +"'></td>" +
		"<td background='"+ skin[1] +"' nowrap>" +
		"<font color='" +  XJSV_BALLOON_FORECOLOR + "'>" + content + "</font>" +
		"</td>" +
		"<td ><img src='"+ skin[2] +"'></td></tr>" +
	"</table>";
	}

	return content;
*/
  var default_skin = false;
  var skin_index = 0;
 
  var dir = XJSV_DEFAULT_SKIN_DIR;
  var skin = new Array ( new Array(dir+"bar01a.gif", dir+"bar01b.gif", dir+"bar01c.gif"),
                         new Array(dir+"bar01a.gif", dir+"bar01b.gif", dir+"bar01c.gif"),
                         new Array(dir+"bar02a.gif", dir+"bar02b.gif", dir+"bar02c.gif"),
                         new Array(dir+"bar03a.gif", dir+"bar03b.gif", dir+"bar03c.gif"),
                         new Array(dir+"bar04a.gif", dir+"bar04b.gif", dir+"bar04c.gif"),
                         new Array(dir+"bar05a.gif", dir+"bar05b.gif", dir+"bar05c.gif"),
                         new Array(dir+"bar06a.gif", dir+"bar06b.gif", dir+"bar06c.gif"),
                         new Array(dir+"bar07a.gif", dir+"bar07b.gif", dir+"bar07c.gif"),
                         new Array(dir+"bar08a.gif", dir+"bar08b.gif", dir+"bar08c.gif"),
                         new Array(dir+"bar09a.gif", dir+"bar09b.gif", dir+"bar09c.gif"),
                         new Array(dir+"bar10a.gif", dir+"bar10b.gif", dir+"bar10c.gif")
                         );

    if (this.xjs_skin) {
        var skin_index = parseInt(this.xjs_skin.substring(4,6),10);
        if ( skin_index <= 0 || skin_index > skin.length) default_skin = true;
    } else { 
        default_skin = true; 
    }

    if (default_skin) {
        content = "<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0  bgcolor='" + XJSV_BALLOON_BGCOLOR + "' > " +
              "<TR><TD ALIGN=left nowrap>" +
              "<font color='" +  XJSV_BALLOON_FORECOLOR + "'>" +
              content +
              "</font>" +
              "</TD></TR>" +
              "</TABLE>";
    } else { //has skin
        content = "<table border='0' cellspacing='0' cellpadding='0' bgcolor='" + XJSV_BALLOON_BGCOLOR + "' > " +
            "<tr><td align='right'><img src='"+ skin[skin_index][0] +"'></td>" +
            "<td background='"+ skin[skin_index][1] +"' nowrap>" +
            "<font color='" +  XJSV_BALLOON_FORECOLOR + "'>" +
            content +
            "</font>" +
            "</td>" +
            "<td ><img src='"+ skin[skin_index][2] +"'></td></tr>" +
            "</table>";     
    }    
    
    return content;

}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_status_bar(parent) (status_bar - »óÅÂ¹Ù)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ status_bar UIC °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_status_bar(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "status_bar";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.show = xm_status_bar_show;
	this.kill = xm_status_bar_kill;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_status_bar.show()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_status_bar)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ show ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_status_bar_show(){
	window.status = this.xjs_value ;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_status_bar.kill()
// ´ë»ó°´Ã¼ : this : UIC °´Ã¼ (xo_status_bar)
// ³»    ¿ë : ´ë»ó  elementÀÇ UIC°´Ã¼·Î¼­ÀÇ kill ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_status_bar_kill(){
	window.status = "" ;
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   element °´Ã¼ ¸Þ¼Òµå - Validator Factory
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.validatorFactory()
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ³»    ¿ë : ´ë»ó elementÀÇ type°ú ÁÖ¾îÁø attribute¿¡ µû¶ó ÇÊ¿äÇÑ Validator¸¦ »ç¿ë °¡´ÉÇÏ°Ô ÇÑ´Ù.
//////////////////////////////////////////////////////////
function  em_validator_factory(){
	switch (this.type) {

		case "text" :
			if ( this.isAttribute("required") )   this.enableValidator("required");
			if ( this.isAttrValue("minlength") )  this.enableValidator("minlength");
			if ( this.isAttrValue("minvalue") )       this.enableValidator("minvalue");
			if ( this.isAttrValue("maxvalue") )       this.enableValidator("maxvalue");
			if ( this.isAttrValue("minbyte") )  this.enableValidator("minbyte");
			if ( this.isAttrValue("maxbyte") )  this.enableValidator("maxbyte");
			if ( this.isAttribute("alphabetic") )       this.enableValidator("alphabetic");
			if ( this.isAttribute("numeric") )       this.enableValidator("numeric");
			if ( this.isAttribute("alpha_numeric") )       this.enableValidator("alpha_numeric");
			if ( this.isAttribute("integer") )       this.enableValidator("integer");
			if ( this.isAttribute("float") )       this.enableValidator("float");
			if ( this.isAttribute("hexa") )       this.enableValidator("hexa");
			if ( this.isAttribute("date") )       this.enableValidator("date");
			if ( this.isAttribute("hour_min") )       this.enableValidator("hour_min");
			if ( this.isAttribute("psn") )       this.enableValidator("psn");
			if ( this.isAttribute("csn") )       this.enableValidator("csn");
			if ( this.isAttribute("email") )       this.enableValidator("email");
			if ( this.isAttribute("advanced_email") ) this.enableValidator("advanced_email");
			if ( this.isAttribute("domain") )       this.enableValidator("domain");
			if ( this.isAttribute("credit_card") )       this.enableValidator("credit_card");
			if ( this.isAttrValue("mask") )       this.enableValidator("mask");
			if ( this.isAttrValue("reg_exp") )       this.enableValidator("reg_exp");
			if ( this.isAttrValue("is_value") )       this.enableValidator("is_value");
		break;

		case "password" :
			if ( this.isAttribute("required") )   this.enableValidator("required");
			if ( this.isAttrValue("minlength") )  this.enableValidator("minlength");
			if ( this.isAttrValue("minlength") )  this.enableValidator("minlength");
			if ( this.isAttrValue("minvalue") )       this.enableValidator("minvalue");
			if ( this.isAttrValue("maxvalue") )       this.enableValidator("maxvalue");
			if ( this.isAttrValue("minbyte") )  this.enableValidator("minbyte");
			if ( this.isAttrValue("maxbyte") )  this.enableValidator("maxbyte");
			if ( this.isAttribute("alphabetic") )       this.enableValidator("alphabetic");
			if ( this.isAttribute("numeric") )       this.enableValidator("numeric");
			if ( this.isAttribute("alpha_numeric") )       this.enableValidator("alpha_numeric");
			if ( this.isAttribute("integer") )       this.enableValidator("integer");
			if ( this.isAttribute("float") )       this.enableValidator("float");
			if ( this.isAttribute("hexa") )       this.enableValidator("hexa");
			if ( this.isAttribute("psn") )       this.enableValidator("psn");
			if ( this.isAttribute("csn") )       this.enableValidator("csn");
			if ( this.isAttribute("credit_card") )       this.enableValidator("credit_card");
			if ( this.isAttrValue("reg_exp") )       this.enableValidator("reg_exp");
			if ( this.isAttrValue("is_value") )       this.enableValidator("is_value");
		break;

		case "textarea" :
			if ( this.isAttribute("required") )   this.enableValidator("required");
			if ( this.isAttrValue("minlength") )  this.enableValidator("minlength");
			if ( this.isAttrValue("minbyte") )  this.enableValidator("minbyte");
			if ( this.isAttrValue("maxbyte") )  this.enableValidator("maxbyte");
		break;

		case "checkbox" :

		case "file" :
			if ( this.isAttribute("required") )   this.enableValidator("required");
		break;

		default :
		break;
	}
}


/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.enableValidator(xjs_key)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : xjs_key : ÁÖ¾îÁø validator¿ë attribute
// ³»    ¿ë : ÁÖ¾îÁø attribute¿¡ µû¶ó ÇÊ¿äÇÑ Validator¸¦ element¿¡ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_enable_validator(xjs_key){
	switch(xjs_key){

		case "required" : //means "required" willbe activate
			this.addValidator(new xo_required(this));
		break;

		case "minlength" :
			this.addValidator(new xo_min_length(this));

		case "minvalue" :
			this.addValidator(new xo_min_value(this));
		break;

		case "maxvalue" :
			this.addValidator(new xo_max_value(this));
		break;

		case "minbyte" :
			this.addValidator(new xo_min_byte(this));
		break;

		case "maxbyte" :
			this.addValidator(new xo_max_byte(this));
		break;

		case "alphabetic" :
			this.addValidator(new xo_alphabetic(this));
		break;

		case "numeric" :
			this.addValidator(new xo_numeric(this));
		break;

		case "alpha_numeric" :
			this.addValidator(new xo_alpha_numeric(this));
		break;

		case "integer" :
			this.addValidator(new xo_integer(this));
		break;

		case "float" :
			this.addValidator(new xo_float(this));
		break;

		case "hexa" :
			this.addValidator(new xo_hexa(this));
		break;

		case "date" :
			if ( !this.isAttrValue("mask") ) this.addValidator(new xo_mask(this, XJSV_DEFAULT_DATE_MASK));
			this.addValidator(new xo_date(this));
		break;

		case "hour_min" :
			if ( !this.isAttrValue("mask") ) this.addValidator(new xo_mask(this, XJSV_DEFAULT_HOUR_MIN_MASK));
			this.addValidator(new xo_hour_min(this));
		break;


		case "psn" :
			if ( !this.isAttrValue("mask") ) this.addValidator(new xo_mask(this, XJSV_DEFAULT_PSN_MASK));
			this.addValidator(new xo_psn(this));
		break;

		case "csn" :
			if ( !this.isAttrValue("mask") ) this.addValidator(new xo_mask(this, XJSV_DEFAULT_CSN_MASK));
			this.addValidator(new xo_csn(this));
		break;

		case "email" :
			this.addValidator(new xo_email(this));
		break;

		case "advanced_email" :
			this.addValidator(new xo_advanced_email(this));
		break;

		case "domain" :
			this.addValidator(new xo_domain(this));
		break;

		case "credit_card" :
			this.addValidator(new xo_credit_card(this));
		break;

		case "mask" :
			this.addValidator(new xo_mask(this));
		break;

		case "reg_exp" :
			this.addValidator(new xo_reg_exp(this));
		break;

		case "reg_exp" :
			this.addValidator(new xo_reg_exp(this));
		break;

		case "is_value" :
			this.addValidator(new xo_is_value(this));
		break;

		default :
		break;

	}
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : element.addValidator(validatorObj)
// ´ë»ó°´Ã¼ : element °´Ã¼ (this)
// ÆÄ¶ó¸ÞÅÍ : validatorObj : element¿¡ ºÙÀ» validator °´Ã¼
// ³»    ¿ë : ÁÖ¾îÁø validator °´Ã¼¸¦ element¿¡ µî·ÏÇÑ´Ù.
//////////////////////////////////////////////////////////
function em_add_validator(validatorObj){
	this.validators[this.validators.length] = validatorObj;
}

///////////////////////////////////////////////////////////////////////////////////////////////
///
///   Validation User °´Ã¼ & ¸Þ¼Òµå (validator)
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_required(parent) (required - ÇÊ¼öÀÔ·Â)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ ÇÊ¼öÀÔ·Â validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_required(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "required";

	//validation method
	this.validate = xm_required_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_required.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_required)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_required_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	var regExp_whiteSpace = /^[\s]*$/;

	if (!this.parent.value)
		flag = false;

	if(XJSV_REQUIRED_IGNORE_WHITESPACE && regExp_whiteSpace.test(this.parent.value))
		flag = false;

	if (this.parent.type == "checkbox" && !this.parent.checked )
		flag = false;

	//Validation Logic for required!
	if (!flag) {
		msg = "ÇÊ¼öÀÔ·ÂÀÔ´Ï´Ù";
		this.setMessage(msg);
		if(XJSV_REQUIRED_IGNORE_WHITESPACE)
			this.parent.value = this.parent.value.replace( /(\s)/g,"");
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_min_length(parent) (minlength - ÃÖ¼ÒÀÚ¸®¼ö Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_min_length)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ minlength validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_min_length(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "minlength";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_min_length_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_min_length.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_min_length)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_min_length_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	//Validation Logic for Min Legnth..
	if (tsTarget.length <  this.xjs_value ) {
		flag = false;
		msg = "ÀÔ·ÂµÈ Ç×¸ñÀÇ ÀÚ¸´¼ö°¡ ³Ê¹« ÀÛ½À´Ï´Ù. \nÃÖ¼Ò " + this.xjs_value + "ÀÚ¸®ÀÌ»óÀÔ´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_min_byte(parent) (minbyte - ÃÖ¼Òbyte Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_min_byte)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ minbyte validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_min_byte(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "minbyte";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_min_byte_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_min_byte.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_min_byte)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_min_byte_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.getByte();

	//Validation Logic for Min Legnth..
	if (tsTarget <  this.xjs_value ) {
		flag = false;
		msg = "ÀÔ·ÂµÈ Ç×¸ñÀÇ ÀÚ¸´¼ö°¡ ³Ê¹« ÀÛ½À´Ï´Ù. \nÃÖ¼Ò " + this.xjs_value + "ÀÚ¸®ÀÌ»óÀÔ´Ï´Ù.";
		msg += "\n (ÇÑ±Û ÇÑ±ÛÀÚ¸¦ 2ÀÚ¸®·Î °è»ê)";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_max_byte(parent) (maxbyte - ÃÖ¼Òbyte Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_max_byte)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ maxbyte validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_max_byte(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "maxbyte";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_max_byte_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_max_byte.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_max_byte)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_max_byte_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.getByte();

	//Validation Logic for max Legnth..
	if (tsTarget >  this.xjs_value ) {
		flag = false;
		msg = "ÀÔ·ÂµÈ Ç×¸ñÀÇ ÀÚ¸´¼ö°¡ ³Ê¹« Å®´Ï´Ù. \nÃÖ´ë " + this.xjs_value + "ÀÚ¸®ÀÌÇÏ ÀÔ´Ï´Ù.";
		msg += "\n (ÇÑ±Û ÇÑ±ÛÀÚ¸¦ 2ÀÚ¸®·Î °è»ê)";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_min_value(parent) (minvalue - ÃÖ¼Ò°ª Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_min_value)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ minvalue validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_min_value(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "minvalue";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_min_value_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_min_value.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_min_value)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_min_value_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = parseFloat(this.parent.value);

	//Validation Logic for Min Legnth..
	if (tsTarget <  this.xjs_value ) {
		flag = false;
		msg = "ÀÔ·ÂµÈ Ç×¸ñÀÇ °ªÀÌ ³Ê¹« ÀÛ½À´Ï´Ù. ";
		msg += "\nÇöÀç°ªÀº " + parseFloat(this.parent.value) + " ÀÔ´Ï´Ù. ";
		msg += "\nÃÖ¼Ò " + this.xjs_value + " ÀÌ»óÀÇ °ªÀÌ¶ó¾ß ÇÕ´Ï´Ù.  ";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_max_value(parent) (maxvalue - ÃÖ´ë°ª Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_max_value)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ maxvalue validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_max_value(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "maxvalue";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_max_value_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_max_value.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_max_value)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_max_value_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	//  var tsTarget = this.parent.value;
	var tsTarget = parseFloat(this.parent.value);

	//Validation Logic for max Legnth..
	if (tsTarget >  this.xjs_value ) {
		flag = false;
		msg = "ÀÔ·ÂµÈ Ç×¸ñÀÇ °ªÀÌ ³Ê¹« Å®´Ï´Ù. ";
		msg += "\nÇöÀç°ªÀº " + parseFloat(this.parent.value) + " ÀÔ´Ï´Ù. ";
		msg += "\nÃÖ´ë " + this.xjs_value + " ÀÌÇÏÀÇ °ªÀÌ¶ó¾ß ÇÕ´Ï´Ù.  ";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_mask(parent, defaultMask) (mask - ¸¶½ºÅ©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_mask)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
//            defaultMask : µðÆúÆ®·Î »ç¿ëÇÒ ¸¶½ºÅ© - ¾øÀ¸¸é mask attribute °ªÀ» °¡Á®¿Â´Ù.
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ mask validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_mask(parent, defaultMask){
	//constant data;
	this.parent = parent;
	this.xjs_key = "mask";
	this.xjs_value = (defaultMask) ?
		defaultMask : parent.getAttribute(this.xjs_key) ;

	this.parent.xjs_mask  = this.xjs_value; //important!

	//validation method
	this.validate = xm_mask_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_mask.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_mask)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_mask_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª¾Æ ¾ø´Â °æ¿ì Pass

	if (!this.xjs_value) return flag;    //µî·ÏµÈ Mask°¡ ¾ø´Â °æ¿ì Pass

	if (this.parent.unMasking) this.parent.unMasking();  //Validate¸¦ À§ÇØ¼­ RemaskingÇÑ´Ù.
	if (this.parent.masking) this.parent.masking();

	//Validation Logic for Mask..
	var sPattern=this.parent.xjs_mask.replace(/(\$|\^|\*|\(|\)|\+|\.|\?|\\|\{|\}|\||\[|\])/g,"\\$1");
		sPattern=sPattern.replace(/9/g ,"\\d");
		sPattern=sPattern.replace(/x/ig,".");
		sPattern=sPattern.replace(/z/ig,"\\d?");
		sPattern=sPattern.replace(/a/ig,"[A-Za-z]");

	var re=new RegExp("^"+sPattern+"$");

	if(!re.test(this.parent.value))  {
		flag = false;
		msg = "Àß¸øµÈÀÔ·ÂÀÔ´Ï´Ù \n " + this.xjs_value + "Çü½ÄÀÌ¾î¾ß ÇÕ´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_date(parent) (date - ³¯Â¥Ã¼Å©)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ date validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_date(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "date";

	//validation method
	this.validate = xm_date_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_hour_min(parent) (xo_hour_min - ½Ã°£Ã¼Å©) //2005-05-13 Ãß°¡
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ date validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////

function xo_hour_min(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "hour_min";

	//validation method
	this.validate = xm_hour_min_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}



/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_date.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_date)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_date_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ªÀÌ ¾ø´Â °æ¿ì´Â Pass

	//Validation Logic for Date..
	var iYear = null;
	var iMonth = null;
	var iDay = null;
	var iDaysInMonth = null;

	var sDate=this.parent.value.replace(/(\,|\.|\-|\/)/g,"");
	var sFormat="YYYYMMDD";  //¾ÆÁ÷±îÁö YYYYMMDDÀÇ ÇüÅÂ¸¸ Áö¿øÇÑ´Ù. --;
	var aDaysInMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);

	//¿ÏÀüÇÑ ³¯Â¥ÀÇ ÀÔ·ÂÀÌ µé¾î¿Â °æ¿ìÀÌ´Ù.
	if ( sDate.length != 8 ) flag = false ;

	if (flag) {
		iYear  = eval(sDate.substr(0,4));
		iMonth = eval(sDate.substr(4,2));
		iDay   = eval(sDate.substr(6,2));
		if (!isNum(iYear) || !isNum(iMonth) || !isNum(iDay) )
			flag = false ;
	}

	if (flag) {
		iDaysInMonth = (iMonth != 2) ? aDaysInMonth[iMonth-1] : (( iYear%4 == 0 && iYear%100 != 0 || iYear % 400==0 ) ? 29 : 28 );
		if( iDay==null || iMonth==null || iYear==null  || iMonth > 12 || iMonth < 1 || iDay < 1 || iDay > iDaysInMonth )
			flag = false ;
	}

	if (!flag) {
		msg = "³¯Â¥ÀÔ·ÂÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}


/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_hour_min.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_hour_min)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////

function xm_hour_min_validate(){
	var flag = true; //true when validation successful.
/**	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ªÀÌ ¾ø´Â °æ¿ì´Â Pass

	//Validation Logic for Date..
	var iYear = null;
	var iMonth = null;
	var iDay = null;
	var iDaysInMonth = null;

	var sDate=this.parent.value.replace(/(\,|\.|\-|\/)/g,"");
	var sFormat="YYYYMMDD";  //¾ÆÁ÷±îÁö YYYYMMDDÀÇ ÇüÅÂ¸¸ Áö¿øÇÑ´Ù. --;
	var aDaysInMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);

	//¿ÏÀüÇÑ ³¯Â¥ÀÇ ÀÔ·ÂÀÌ µé¾î¿Â °æ¿ìÀÌ´Ù.
	if ( sDate.length != 8 ) flag = false ;

	if (flag) {
		iYear  = eval(sDate.substr(0,4));
		iMonth = eval(sDate.substr(4,2));
		iDay   = eval(sDate.substr(6,2));
		if (!isNum(iYear) || !isNum(iMonth) || !isNum(iDay) )
			flag = false ;
	}

	if (flag) {
		iDaysInMonth = (iMonth != 2) ? aDaysInMonth[iMonth-1] : (( iYear%4 == 0 && iYear%100 != 0 || iYear % 400==0 ) ? 29 : 28 );
		if( iDay==null || iMonth==null || iYear==null  || iMonth > 12 || iMonth < 1 || iDay < 1 || iDay > iDaysInMonth )
			flag = false ;
	}

	if (!flag) {
		msg = "³¯Â¥ÀÔ·ÂÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.";
		this.setMessage(msg);
	}
*/
	return flag;

}





/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_psn(parent) (psn - ÁÖ¹Îµî·Ï ¹øÈ£ Ã¼Å©)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ psn validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_psn(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "psn";

	//validation method
	this.validate = xm_psn_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_psn.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_psn)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_psn_validate(){
	var flag = true; //true when validation successful.
	var msg = "";
	var sum = 0;

	if (!this.parent.value) return flag; //ÀÔ·Â°ªÀÌ ¾ø´Â °æ¿ì´Â Pass

	var psNumber = this.parent.value.replace(/(\,|\.|\-|\/)/g,"");

	for (idx = 0, jdx=2; jdx < 10; idx++, jdx++) {
		sum = sum + ( psNumber.charAt(idx) * jdx );
	}

	for (idx = 8, jdx=2; jdx < 6; idx++, jdx++) {
		sum = sum + ( psNumber.charAt(idx) * jdx );
	}

	var nam = sum % 11;
	var checkDigit = 11 - nam ;

	checkDigit = (checkDigit >= 10 ) ? checkDigit-10:checkDigit;

	if ( !isNum(psNumber) || psNumber.charAt(12) != checkDigit)  {
		flag = false;
		msg = "ÀÔ·ÂÇÑ ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_csn(parent) (csn - »ç¾÷ÀÚ µî·Ï ¹øÈ£ Ã¼Å©)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ csn validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_csn(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "csn";

	//validation method
	this.validate = xm_csn_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_csn.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_csn)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_csn_validate(){
	var flag = true; //true when validation successful.
	var msg = "";
	var sum = 0;

	if (!this.parent.value) return flag; //ÀÔ·Â°ªÀÌ ¾ø´Â °æ¿ì´Â Pass

	var csNumber = this.parent.value.replace(/(\,|\.|\-|\/)/g,"");
	var checkArray = new Array(1,3,7,1,3,7,1,3,5);

	for(idx=0 ; idx < 9 ; idx++)
		sum += csNumber.charAt(idx) * checkArray[idx];

	sum = sum + ((csNumber.charAt(8) * 5 ) / 10);

	var nam = Math.floor(sum) % 10;

	var checkDigit = ( nam == 0 ) ? 0 : 10 - nam;

	if ( !isNum(csNumber) || csNumber.charAt(9) != checkDigit)  {
		flag = false;
		msg = "ÀÔ·ÂÇÑ »ç¾÷ÀÚ µî·Ï¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_advanced_email(parent) (advanced_email - °í±Þ Email Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_advanced_email)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ advanced_email validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_advanced_email(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "advanced_email";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_advanced_email_validation;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_advanced_email.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_advanced_email)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_advanced_email_validation(){
	//this core script from http://javascript.internet.com/forms/email-address-validation.html
	//customize by TKshin.

	var flag = true;
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	//Validation Logic for email
	var checkTLD=1;  //wether check well-known domain & two-letter contry domain
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	var atom=validChars + '+';

	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	var tsTarget = this.parent.value;

	var matchArray = tsTarget.match(emailPat);

	if (!matchArray) {
		msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. ";
		this.setMessage(msg);
		return false;
	}

	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++)
		if (user.charCodeAt(i)>127) {
			msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \n»ç¿ëÀÚ ÀÌ¸§ ºÎºÐ¿¡ invalid character°¡ ÀÖ½À´Ï´Ù. ";
			this.setMessage(msg);
			return false;
		}


	for (i=0; i<domain.length; i++)
		if (domain.charCodeAt(i)>127) {
			msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \nµµ¸ÞÀÎ ÀÌ¸§ ºÎºÐ¿¡ invalid character°¡ ÀÖ½À´Ï´Ù. ";
			this.setMessage(msg);
			return false;
		}

	if (!user.match(userPat)) { // user is not valid
		msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \n»ç¿ëÀÚ ÀÌ¸§ ºÎºÐÀÌ Àß¸øµÇ¾ú½À´Ï´Ù. ";
		this.setMessage(msg);
		return false;
	}

	// IP AddressÇüÅÂÀÇ Email Ã¼Å©  E.g. joe@[123.124.233.4] is a legal e-mail address */
	var IPArray=domain.match(ipDomainPat);
	if (IPArray) {
		for (var i=1;i<=4;i++)
			if (IPArray[i]>255) {
				msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \nIP address ºÎºÐÀÌ Àß¸øµÇ¾ú½À´Ï´Ù. ";
				this.setMessage(msg);
				return false;
			}
		return true;
	}

	// symbolic ÇüÅÂÀÇ Domain name Ã¼Å©
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;

	for (i=0;i<len;i++)
		if (domArr[i].search(atomPat)==-1) {
			msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \nDomain name ºÎºÐÀÌ Àß¸øµÇ¾ú½À´Ï´Ù. ";
			this.setMessage(msg);
			return false;
		}

	// TLD Ã¼Å©
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \nDomain nameÀÌ ¾Ë·ÁÁø µµ¸ÞÀÎÀÌ ¾Æ´Õ´Ï´Ù. ";
		this.setMessage(msg);
		return false;
	}

	if (len<2) {
		msg = "ÀÌ¸ÞÀÏ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \nhost nameÀÌ ¾ø½À´Ï´Ù.";
		this.setMessage(msg);
		return false;
	}

	return true;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_email(parent) (email - simple Email Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_email)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ email validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_email(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "email";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_email_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_email.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_email)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_email_validate(){
	//this core script from http://tech.irt.org/articles/js049/index.htm
	//customize by TKshin.

	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;
	var regExpEmail = /^\w+((-|\.)\w+)*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,4}$/;

	if(!regExpEmail.test(tsTarget)) {
		flag = false;
		msg = "ÀÌ¸ÞÀÏ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_domain(parent) (domain - µµ¸ÞÀÎ ÁÖ¼Ò Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_domain)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ domain validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_domain(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "domain";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_domain_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_domain.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_email)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_domain_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;
	var regExpDomain = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,4}$/;

	if(!regExpDomain.test(tsTarget)) {
		flag = false;
		msg = "µµ¸ÞÀÎ Çü½ÄÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_float(parent) (float Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_float)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ float validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_float(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "float";

	//validation method
	this.validate = xm_float_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_float.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_float)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_float_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;
	var regExp_Float1 = /^(\+|\-|\d*)\d+$/;
	var regExp_Float2 = /^(\-|\+|\d*)\d+(\.|\d)\d*$/;

	if(!regExp_Float1.test(tsTarget) && !regExp_Float2.test(tsTarget)) {
		flag = false;
		msg = "½Ç¼öÇü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
		this.setMessage(msg);
	}

	this.parent.value = parseFloat(tsTarget);

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_integer(parent) (integer Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_integer)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ integer validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_integer(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "integer";

	//validation method
	this.validate = xm_integer_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_integer.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_integer)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_integer_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	var regExp_Integer = /^(\+|\-|\d*)\d+$/;

	if(!regExp_Integer.test(tsTarget)) {
		flag = false;
		msg = "Á¤¼öÇü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
		this.setMessage(msg);
	}

	this.parent.value = parseInt(tsTarget);

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_hexa(parent) (hexa Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_hexa)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ hexa validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_hexa(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "hexa";

	//validation method
	this.validate = xm_hexa_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_hexa.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_hexa)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_hexa_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	var regExp_hexa = /^[a-fA-F0-9]+$/;
	if(!regExp_hexa.test(tsTarget)) {
	  flag = false;
	  msg = "16Áø¼ö(Hexa)Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
	  this.setMessage(msg);
	}

	this.parent.value = parseInt(tsTarget, 16).toString(16);

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_alphabetic(parent) (alphabetic Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_alphabetic)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ alphabetic validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_alphabetic(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "alphabetic";

	//validation method
	this.validate = xm_alphabetic_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_alphabetic.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_alphabetic)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_alphabetic_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	var regExp_alphabetic = /^[a-zA-Z]+$/;
	if(!regExp_alphabetic.test(tsTarget)) {
	  flag = false;
	  msg = "alphabeticÇü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
	  this.setMessage(msg);
	}

	return flag;
}

//////////////////////////////////////////////////////////
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ numeric validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_numeric(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "numeric";

	//validation method
	this.validate = xm_numeric_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_numeric.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_numeric)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_numeric_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	var regExp_numeric = /^[0-9]+$/;
	if(!regExp_numeric.test(tsTarget)) {
		flag = false;
		msg = "numeric Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_alpha_numeric(parent) (alpha_numeric Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_alpha_numeric)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ alpha_numeric validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_alpha_numeric(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "alpha_numeric";

	//validation method
	this.validate = xm_alpha_numeric_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_alpha_numeric.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_alpha_numeric)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_alpha_numeric_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	var regExp_alpha_numeric = /^[a-zA-Z0-9]+$/;

	if(!regExp_alpha_numeric.test(tsTarget)) {
		flag = false;
		msg = "alphabetic È¤Àº numeric Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_credit_card(parent) (credit_card Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_credit_card)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ credit_card validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_credit_card(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "credit_card";

	//validation method
	this.validate = xm_credit_card_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_credit_card.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_credit_card)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_credit_card_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	var sum = 0;
	var mul = 1;
	var len = tsTarget.length;

	// Encoding only works on cards with less than 19 digits
	if (len.length > 19)
		flag = false;

	for (var idx = 0; idx < len; idx++) {
		var digit = tsTarget.substring(len-idx-1,len-idx);
		var tproduct = parseInt(digit ,10)*mul;
		if (tproduct >= 10)
			sum += (tproduct % 10) + 1;
		else
			sum += tproduct;
		if (mul == 1)
			mul++;
		else
			mul--;
	}

	if ((sum % 10) != 0)
		flag = false;

	if(!flag) {
		msg = "Credit Card ¹øÈ£ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_reg_exp(parent) (reg_exp Ã¼Å©)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_reg_exp)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ regualr expression validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_reg_exp(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "reg_exp";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_reg_exp_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_reg_exp.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_reg_exp)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_reg_exp_validate(){
	var flag = true; //true when validation successful.
	var msg = "";

	if (!this.parent.value) return flag; //ÀÔ·Â°ª ¾ø´Â °æ¿ì´Â Pass

	var tsTarget = this.parent.value;

	var regularExpression =new RegExp(this.xjs_value);

	//alert(regularExpression.source);

	if(!regularExpression.test(tsTarget)) {
		flag = false;
		msg = "Regular Expression Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù. \nÇü½ÄÀÌ " + this.xjs_value + "¿¡ ÀûÇÕÇØ¾ß ÇÕ´Ï´Ù.";
		this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// °´ Ã¼ ¸í : xo_is_value(parent) (is_value - µ¿ÀÏ°ª Ã¼Å©)
// ÆÄ¶ó¸ÞÅÍ : parent : ºÎ¸ð °´Ã¼ (element °´Ã¼)
// ³»    ¿ë : element°´Ã¼¿¡ µî·ÏµÉ µ¿ÀÏ°ª Ã¼Å©  validator °´Ã¼¸¦ Á¤ÀÇÇÑ´Ù.
//////////////////////////////////////////////////////////
function xo_is_value(parent){
	//constant data;
	this.parent = parent;
	this.xjs_key = "is_value";
	this.xjs_value = parent.getAttribute(this.xjs_key);

	//validation method
	this.validate = xm_is_value_validate;

	//Pseudo-inheritance Method
	this.setMessage = xm_common_message;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : xo_is_value.validate()
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (xo_is_value)
// ¸® ÅÏ °ª : boolean(true / false)
// ³»    ¿ë : ´ë»ó  elementÀÇ validateor°´Ã¼·Î¼­ÀÇ validate¸¦ ÇÑ´Ù.
//////////////////////////////////////////////////////////
function xm_is_value_validate(){
	var flag = true; //true when validation successful.
	var msg = "";
	var compateItem = eval(this.xjs_value);

	if (typeof(compateItem) == "undefined") {
		msg = this.parent.name + "¿¡¼­ÀÇ is_value »ç¿ëÀÌ Æ²·È½À´Ï´Ù. is_value¿¡ ÇØ´çÇÏ´Â ÀÔ·ÂÇÊµå°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		this.setMessage(msg);
		return false;

	}

	if ( flag && this.parent.value != compateItem.value )
		flag = false;

	//Validation Logic for required!
	if (!flag) {
		msg = "ÀÔ·ÂÇÑ °ªÀÌ " + compateItem.name + "Ç×¸ñÀÇ °ª°ú Æ²¸³´Ï´Ù.";
	this.setMessage(msg);
	}

	return flag;
}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : *.setMessage(msg)  (pseudo-inheritance)
// ´ë»ó°´Ã¼ : this : validator °´Ã¼ (*)
// ÆÄ¶ó¸ÞÅÍ : msg  : Ãâ·ÂÇÒ ¸Þ¼¼Áö
// ³»    ¿ë : »ç¿ëÀÚ¿¡°Ô msg¸¦ alert ¹Ú½ºÇüÅÂ·Î º¸ÀÌ°í ¹è°æ»ö»óÀ» ³ë¶õ»öÀ¸·Î º¯°æÇÑ´Ù.
//            itemname ÀÌ ¾ø´Ù¸é name °ªÀ» Ãâ·Â
//////////////////////////////////////////////////////////
function xm_common_message(msg){
	if ( this.parent.isAttribute("itemname") )
		msg = XJSV_MSG_PREFIX +  "Ç×¸ñ¸í(" + this.parent.getAttribute("itemname") + ")\n" + msg;
	else {
		if ( this.parent.isAttrValue("name") )
			msg = XJSV_MSG_PREFIX +  "Ç×¸ñ¸í(" + this.parent.getAttribute("name") + ")\n" + msg;
		else
			msg = XJSV_MSG_PREFIX + msg;
	}

	alert (msg);
	this.parent.style.backgroundColor = "yellow";
	this.parent.focus();

	return ;
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   NON °´Ã¼ Utility ¸Þ¼Òµå
///
////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : initializeXjsv()
// ³»    ¿ë : ¸ðµç formÀÇ initialize method¸¦ È£ÃâÇÑ´Ù.
//////////////////////////////////////////////////////////
function initializeXjsv(){

	xjs_is_iex=(document.all);

	for ( var idx = 0 ; idx < document.forms.length ; idx++)  {
		document.forms[idx].initialize = ff_initialize;
		document.forms[idx].initialize();
	}

	//codes for balloon assistant
	document.writeln("<DIV ID='xjs_dek' CLASS='xjs_dek'></DIV>");
	//xjs_balloon_dek.overflow="hidden";

	if (navigator.appName=="Netscape")
		(document.layers) ? xjs_is_nav = true : xjs_is_old_nav = true;

//	if (!xjs_is_old_nav) {
//		xjs_balloon_dek = (xjs_is_nav) ? document.xjs_dek : xjs_dek.style;
//		if (xjs_is_nav) document.captureEvents(event.MOUSEMOVE);
//		document.onmousemove = de_get_mouse;
//	}

	if (this.onload) this.oldOnLoad = this.onload;
	this.onload = de_onload;
	this.onunload  = de_on_unload;

}

/////////////////////////////////////////////////////////
// ¸Þ¼Òµå¸í : setXjsvOption()
// ³»    ¿ë : XjsvÀÇ OptionÀ» DynamicÇÏ°Ô ¼¼ÆÃÇÑ´Ù.
//////////////////////////////////////////////////////////
function setXjsvOption(opt, value) {
	var command = opt + "=" + value;
	eval(command);
	alert(command);
	alert(XJSV_ERASE_VALUE_DISABLE);
}




/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : window.onload()
// ÆÄ¶ó¸ÞÅÍ : e : ÀÌº¥Æ®
// ³»    ¿ë : windowÀÇ onload ÀÌº¥Æ®¸¦ °¡·ÎÃ¦´Ù.
//////////////////////////////////////////////////////////
function de_onload(){
	for ( var idx = 0 ; idx < document.forms.length ; idx++)
		if (this.document.forms[idx].masking) document.forms[idx].masking();

	if (XJSV_MAGIC_QUOTE_ON)
		for ( var idx = 0 ; idx < document.forms.length ; idx++)
			if (this.document.forms[idx].magicQuoteErase) document.forms[idx].magicQuoteErase();

	if (XJSV_ESCAPE_ON)
		for ( var idx =  0 ; idx < document.forms.length ; idx++)
			if (this.document.forms[idx].unEscape) document.forms[idx].unEscape();

	if (this.oldOnLoad) this.oldOnLoad();
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : window.onunload()
// ÆÄ¶ó¸ÞÅÍ : e : ÀÌº¥Æ®
// ³»    ¿ë : windowÀÇ onload ÀÌº¥Æ®¸¦ °¡·ÎÃ¦´Ù.
//////////////////////////////////////////////////////////
function de_on_unload(){
	for ( var idx = 0 ; idx < document.forms.length ; idx++) {
		for(var jdx=0; jdx < document.forms[idx].elements.length ; jdx++){
			if ( document.forms[idx].elements[jdx].strippers.length > 0 ) {
				for (var kdx =0; kdx < document.forms[idx].elements[jdx].strippers.length ; kdx++) {
					delete document.forms[idx].elements[jdx].strippers[kdx];
				}
			}
			if ( document.forms[idx].elements[jdx].assistants.length > 0 ) {
				for (var kdx =0; kdx < document.forms[idx].elements[jdx].assistants.length ; kdx++) {
					delete document.forms[idx].elements[jdx].assistants[kdx];
				}
			}
			if ( document.forms[idx].elements[jdx].validators.length > 0 ) {
				for (var kdx =0; kdx < document.forms[idx].elements[jdx].validators.length ; kdx++) {
					delete document.forms[idx].elements[jdx].validators[kdx];
				}
			}
			if ( document.forms[idx].elements[jdx].uich.length > 0 ) {
				for (var kdx =0; kdx < document.forms[idx].elements[jdx].uich.length ; kdx++) {
					delete document.forms[idx].elements[jdx].uich[kdx];
				}
			}
		}
	}
}

/////////////////////////////////////////////////////////
// ÀÌº¥Æ®¸í : document.onmousemove()
// ÆÄ¶ó¸ÞÅÍ : e : ÀÌº¥Æ®
// ³»    ¿ë : documentÀÇ  onmousemove¸¦ °¡·ÎÃ¦´Ù.
//////////////////////////////////////////////////////////
function de_get_mouse(e){
	var x = (xjs_is_nav) ? e.pageX : event.x+document.body.scrollLeft;xjs_balloon_dek.left=x+xjs_balloon_Xoffset;
	var y = (xjs_is_nav) ? e.pageY : event.y+document.body.scrollTop;xjs_balloon_dek.top=y+xjs_balloon_yyy;
}

////////////////////////////////////////////////////////////////////////////////////////////////
///
///   xjsv ÃÊ±âÈ­ ÇÔ¼ö È£Ãâ.
///
////////////////////////////////////////////////////////////////////////////////////////////////

if (XJSV_ACTIVATE) initializeXjsv();


////////////////////////////////////////////////////////////////////////////////////////////////
///
///³¯Â¥ Filter ÇÔ¼ö È£Ãâ..
///
////////////////////////////////////////////////////////////////////////////////////////////////

var dFilterStep

function dFilterStrip (dFilterTemp, dFilterMask) {
	dFilterMask = replace(dFilterMask,'#','');
	for (dFilterStep = 0; dFilterStep < dFilterMask.length++; dFilterStep++) {
			dFilterTemp = replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),'');
	}
	return dFilterTemp;
}

function dFilterMax (dFilterMask) {
	dFilterTemp = dFilterMask;
	for (dFilterStep = 0; dFilterStep < (dFilterMask.length+1); dFilterStep++) {
		if (dFilterMask.charAt(dFilterStep)!='#') {
			dFilterTemp = replace(dFilterTemp,dFilterMask.charAt(dFilterStep),'');
		}
	}
	return dFilterTemp.length;
}

function dFilter (key, textbox, dFilterMask) {
	dFilterNum = dFilterStrip(textbox.value, dFilterMask);
	if (key==9) {
		return true;
	} else if (key==8&&dFilterNum.length!=0) {
		dFilterNum = dFilterNum.substring(0,dFilterNum.length-1);
	} else if ( ((key>47&&key<58)||(key>95&&key<106)) && dFilterNum.length<dFilterMax(dFilterMask) ) {
		if (key>95&&key<106) {
			key = key - 48;
		}
		dFilterNum=dFilterNum+String.fromCharCode(key);
	}

	var dFilterFinal='';
	for (dFilterStep = 0; dFilterStep < dFilterMask.length; dFilterStep++) {
		if (dFilterMask.charAt(dFilterStep)=='#') {
			if (dFilterNum.length!=0) {
				dFilterFinal = dFilterFinal + dFilterNum.charAt(0);
				dFilterNum = dFilterNum.substring(1,dFilterNum.length);
			} else {
				dFilterFinal = dFilterFinal + "";
			}
		} else if (dFilterMask.charAt(dFilterStep)!='#') {
			dFilterFinal = dFilterFinal + dFilterMask.charAt(dFilterStep);
		}
	}

	textbox.value = dFilterFinal;
	return false;
}

function replace(fullString,text,by) {
	var strLength = fullString.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) return fullString;

	var i = fullString.indexOf(text);
	if ((!i) && (text != fullString.substring(0,txtLength))) return fullString;
	if (i == -1) return fullString;

	var newstr = fullString.substring(0,i) + by;

	if (i+txtLength < strLength)
		newstr += replace(fullString.substring(i+txtLength,strLength),text,by);

	return newstr;
}

//¿ìÆí¹øÈ£°Ë»öÆË¾÷---------------------------------------------------
function zip(zip, add1)
{
	zip_url ="/html/bo/common/zipcode.do?cmd=zipcode&gubun=front&dong=" ;
	window.open(zip_url, 'zip','width=517,height=425,marginwidth=0,marginheight=0,resizable=0,scrollbars=yes,noresize');
}


function setAddress(zip1, zip2, addr1, addr2){
	f = document.bu_frm ;
	f.co_rec_zip1.value = zip1;
	f.co_rec_zip2.value = zip2;
	f.co_rec_addr1.value = addr1;
	f.co_rec_addr2.value = addr2;
}


//ÀüÃ¼ element 
function total_obj(){
	total = 0 ;
	for ( var idx = 0 ; idx < document.forms.length ; idx++) {
		for(var jdx=0; jdx < document.forms[idx].elements.length ; jdx++){
			total = total +1 ;
		}
	}
	return total ;
}

//Hidden °ªÀÇ °¹¼ö
function total_hidden(){
	total = 0 ; 
	for ( var idx = 0 ; idx < document.forms.length ; idx++) {
		for(var jdx=0; jdx < document.forms[idx].elements.length ; jdx++){
			obj = document.forms[idx].elements[jdx];
			if(obj.type=="hidden"){
				total = total +1 ;
			}
		}
	}
	return total ;
}

//Æ¯Á¤ element  ±îÁö element °¹¼ö
function total_pre_cnt(obj, str){
	total = 0 ; 
	for(var jdx=0; jdx < obj.elements.length ; jdx++){
		sel = obj.elements[jdx];
		
		if(sel.type!="hidden"){
			
		}
		total = total +1 ;
		
		if(sel.name == str){
			break ;
		}
	}
	return total ;
}
