<!--
/**
 * 
 */
function key_down_event (obj) {
	if ((obj.type == 'text' ||
		obj.type == 'select-list' ||
		obj.type == 'radio' ||
		obj.type == 'password') &&
		(event.keyCode == 13)) {
			event.keyCode = 9;
	}

	if ((obj.type == 'textarea') &&
		((event.ctrlKey)&&(event.keyCode == 13))) {
		event.keyCode = 9;
	}
}

/**
 * 
 */
function mouse_over_event (obj) {
	obj.focus();

	if (obj.type == 'text' ||
		obj.type == 'textarea' ||
		obj.type == 'password') {
		obj.select();
	}
}

/**
 * 
 */
function set_count_down_time (obj_id, count_down_time) {
	if (count_down_time<=0)  {
		
	} else {
		count_down_time-=1000;
		set_new_text_node(obj_id, count_down_time/1000);
		document.getElementById(obj_id).value = (count_down_time/1000);
		setTimeout("set_count_down_time('" + obj_id + "', "+count_down_time+")", 1000);
	}
}

/**
 * 
 */
function set_new_text_node (obj_id, text) {
		remove_child_node(obj_id);
		append_text_node(obj_id, text);
}

/**
 * 
 */
function append_text_node (obj_id, text) {
		var obj = document.getElementById(obj_id);
		txt_node = document.createTextNode(text);
		obj.appendChild(txt_node);
}

/**
 * 
 */
function remove_child_node (obj_id) {
	var obj = document.getElementById(obj_id);
	var ind = obj.childNodes.length;
	for (var i = ind - 1; i >= 0 ; i--) {
		obj.removeChild(obj.childNodes[i]);
	}
}

/**
 * 
 */
function set_element_value (src_id, src_value) {
	var src_obj = document.getElementById(src_id);
	set_object_value(src_obj, src_value);
}

/**
 * 
 */
function set_object_value (src_obj, src_value) {
	if (src_obj!=null) {
		if (src_obj.type == 'select') {
			var si = src_obj.selectedIndex;
			if (si >= 0) {
				src_obj.options[si].value = src_value;
			}
		}
		if (
			src_obj.type == 'file' ||
			src_obj.type == 'hidden' ||
			src_obj.type == 'password' ||
			src_obj.type == 'select' ||
			src_obj.type == 'select-one' ||
			src_obj.type == 'text' ||
			src_obj.type == 'textarea'
		) {
			src_obj.value = src_value;
		}
		if (
			src_obj.type == 'checkbox' ||
			src_obj.type == 'radio'
		) {
			if (src_obj.checked) {
				src_obj.value = src_value;
			}
		}
	}
}

/**
 * 
 */
function get_element_value (src_id) {
	var src_obj = document.getElementById(src_id);
	
	return get_object_value(src_obj);
}

/**
 * 
 */
function get_object_value (src_obj) {
	var src_value = "";
	
	if (src_obj!=null) {
		if (
			src_obj.type == 'select' ||
			src_obj.type == 'select-list'
		) {
			var si = src_obj.selectedIndex;
			if (si >= 0) {
				src_value = src_obj.options[si].value;
			}
		}
		if (
			src_obj.type == 'file' ||
			src_obj.type == 'hidden' ||
			src_obj.type == 'password' ||
			src_obj.type == 'select' ||
			src_obj.type == 'select-one' ||
			src_obj.type == 'text' ||
			src_obj.type == 'textarea'
		) {
			src_value = src_obj.value;
		}
		if (
			src_obj.type == 'checkbox' ||
			src_obj.type == 'radio'
		) {
			if (src_obj.checked) {
				src_value = src_obj.value;
			}
		}
	}
	
	return src_value;
}

/**
 * 
 */
function change_char() {
	var allcookies = document.cookie;
	var pos = allcookies.indexOf("language_id=");
	if (pos != -1) {
		var start=pos+12;
		var end = allcookies.indexOf(";", start);
		if (end == -1) end = allcookies.length;
		var value = allcookies.substring(start, end);
		value = unescape(value);
		if (value==2) {
			document.body.innerHTML=traditionalized(document.body.innerHTML);
		}
	}
}

/**
 * 
 */
function over_menu (src_id) {
	change_class(src_id, "menu_over");
}

/**
 * 
 */
function out_menu (src_id) {
	change_class(src_id, "menu_out");
}

/**
 * 
 */
function set_element_style(src_id, style_script) {
	var obj = document.getElementById(src_id);
	set_object_style(obj, style_script);
}

/**
 * 
 */
function set_object_style(obj, style_script) {
	if (!obj) return;
	obj.setAttribute("style", style_script);
	obj.style.cssText = style_script;
}

/**
 * 
 */
function show_element(src_id) {
	var obj = document.getElementById(src_id);
	show_object(obj);
}

/**
 * 
 */
function show_object(obj) {
	if (!obj) return;
	obj.setAttribute("style", "display:inline");
	obj.style.cssText = "display:inline";
}

/**
 * 
 */
function hide_element(src_id) {
	var obj = document.getElementById(src_id);
	hide_object(obj);
}

/**
 * 
 */
function hide_object(obj) {
	if (!obj) return;
	obj.setAttribute("style", "display:none");
	obj.style.cssText = "display:none";
}

/**
 * 
 */
function change_class(src_id, class_name) {
	var src_obj = document.getElementById(src_id);
	change_object_class(src_obj, class_name);
}

/**
 *
 */
function change_object_class(src_obj, class_name) {
	if (!obj) return;
	src_obj.setAttribute("class", class_name);
	src_obj.setAttribute("className", class_name);
}

/**
 * 
 */
function nextControl() {
	if (event.keyCode == 13) {
		event.keyCode = 9;
	}
}

/**
 * 
 */
function nextControlCtrl() {
	if ((event.ctrlKey)&&(event.keyCode == 13)) {
		event.keyCode = 9;
	}
}

/**
 *
 */
function openWindowModel(url_text, target, width, height) {
	if (width==undefined) {
		width=360;
	}
	if (height==undefined) {
		height=300;
	}
	window.open(url_text, target, 'width='+width+', height='+height+', status=yes, scrollbars=yes, resizable=yes');
}

/**
 *
 */
function append_semicolon(souce_text, append_text) {

	souce_text = del_first_semicolon(souce_text, " ");

	souce_text = del_last_semicolon(souce_text, " ");
	
	if (souce_text.length > 0) {
		souce_text = del_first_semicolon(souce_text, ";");
		
		souce_text = del_last_semicolon(souce_text, ";");

		souce_text += ";"+append_text+";";
		
		souce_text = del_first_semicolon(souce_text, ";");

	} else {
		souce_text = append_text+";";
	}

	return souce_text;
}

/**
 *
 */
function del_first_semicolon(souce_text, find_text) {
	if (souce_text.charAt(0) == find_text) {
		souce_text = souce_text.substring(1, souce_text.length);
		
		souce_text = del_first_semicolon(souce_text, find_text);
	} else {
		return souce_text;
	}
	
	return souce_text;
}

/**
 *
 */
function del_last_semicolon(souce_text, find_text) {
	if (souce_text.charAt(souce_text.length - 1) == find_text) {
		souce_text = souce_text.substring(0, souce_text.length - 1);
		
		souce_text = del_last_semicolon(souce_text, find_text);
	} else {
		return souce_text;
	}
	
	return souce_text;
}

/**
 * 
 */
function set_focus(src_id) {
	var obj = document.getElementById(src_id);
	
	if (obj!=null) {
		obj.focus();
	}
}

/**
 * Generate date format yyyy-MM-dd
 */
function generateDate (obj) {
	dateText = obj.value
	
	if (dateText.length == 8) {	// String length 8 character.
		if (dateText.indexOf("-") < 1) {	// String text have "-"
//			alert(dateText.substr(0, 4)+"-"+dateText.substr(4, 2)+"-"+dateText.substr(6, 2));
			obj.value = dateText.substr(0, 4)+"-"+dateText.substr(4, 2)+"-"+dateText.substr(6, 2)
		}
	}
//	form[oRange[x][0]].value = 
}

function isDate(obj, alert_msg) {
//	obj = document.getElementById(src_id);
	if (obj==null) {
		return;
	}
	str = obj.value;
	if ((str == null)||(str.length == 0)||(str == "0000-00-00")) {
		return false;
	}
//	var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
	var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
	if(r==null) {
		alert(PENNYCMD.I18N.msg["error_date_format"]);
		obj.value="";
		obj.focus();
		return false;
	}
	var d = new Date(r[1], r[3]-1, r[4]);
	
	if (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]) {
		return true;
	} else {
		alert(alert_msg);
		obj.value="";
		obj.focus();
		return false;
	}
}

function set_cookie(sName, sValue, oExpires, sPath, sDomain, bSecure) {
	var sCookie = sName + "=" + encodeURIComponent(sValue);

	if (oExpires) {
		sCookie += "; expires=" + oExpires.toGMTString();
	}

	if (sPath) {
		sCookie += "; path=" + sPath;
	}

	if (sDomain) {
		sCookie += "; domain=" + sDomain;
	}

	if (bSecure) {
		sCookie += "; secure";
	}

	document.cookie = sCookie;
}

function get_cookie(sName) {

	var sRE = "(?:; )?" + sName + "=([^;]*);?";
	var oRE = new RegExp(sRE);
	
	if (oRE.test(document.cookie)) {
		return decodeURIComponent(RegExp["$1"]);
	} else {
		return null;
	}

}                

function delete_cookie(sName, sPath, sDomain) {
	var sCookie = sName + "=; expires=" + (new Date(0)).toGMTString();
	if (sPath) {
		sCookie += "; path=" + sPath;
	}

	if (sDomain) {
		sCookie += "; domain=" + sDomain;
	}
	
	document.cookie = sCookie;
}
-->