var r_alphabet = 'A-Za-z';
var r_number = '0-9';
var r_hangul_syllables = '가-힣';

String.prototype.toInt = function(flag) {
	return this.replace(eval("/[^" + r_number + "]/g"), '') * ((/^-/.test(this) && flag) ? -1 : 1);
}
String.prototype.toFloat = function(flag) {
	return this.replace(eval("/[^" + r_number + "]/\.g"), '') * ((/^-/.test(this) && flag) ? -1 : 1);
}
String.prototype.toAlphabet = function() {
	return this.replace(eval("/[^" + r_alphabet + " ]/g"), '');
}
String.prototype.toAlnum = function() {
	return this.replace(eval("/[^" + r_number + r_alphabet + "]/g"), '');
}
String.prototype.toKorean = function() {
	return this.replace(eval("/[^" + r_hangul_syllables + "]/g"), '');
}
String.prototype.toAlnumKorean = function() {
	return this.replace(eval("/[^" + r_number + r_alphabet + r_hangul_syllables + "]/g"), '');
}

String.prototype.lTrim = function() {
	return this.replace(/^[\s\t]+/, '');
}
String.prototype.rTrim = function() {
	return this.replace(/[\s\t]+$/, '');
}
String.prototype.trim = function() {
	return this.replace(/^[\s\t]+|[\s\t]+$/, '');
}
String.prototype.textAreaTrim = function() {
	return this.replace(/[\s\t]+\r\n/g, "\r\n");
}
String.prototype.denySpace = function() {
	return this.replace(/[\s\t\r\n]+/, '');
}

function getParentElementByTagName(tag, tagName)
{
	var pNode = tag.parentNode;
	while(pNode.tagName != tagName) {
		pNode = pNode.parentNode;
	}
	return pNode;
}

function getDirectChildsByName(tag, name)
{
	var tags = new Array();
	var i;
	for(i = 0; i < tag.childNodes.length; i ++) {
		if(tag.childNodes[i].name == name) {
			tags.push(tag.childNodes[i]);
		}
	}
	return tags;
}

function getElementsByNameFromParent(tag, name)
{
	var childs = tag.getElementsByTagName('*');
	var tags = new Array();
	var i;
	for(i = 0; i < childs.length; i ++) {
		if(childs[i].name == name) {
			tags.push(childs[i]);
		}
	}
	return tags;
}

function getNextElementByTagName(tag, tagName)
{
	var nNode = tag.nextSibling;
	while(nNode.nodeType != 1 || nNode.tagName != tagName) {
		nNode = nNode.nextSibling;
	}
	return nNode;
}

function getStatus() {
	var obj = new Object();
	obj.clientWidth = document.documentElement.clientWidth || document.body.clientWidth;
	obj.clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
	obj.offsetWidth = document.documentElement.offsetWidth || document.body.offsetWidth;
	obj.offsetHeight = document.documentElement.offsetHeight || document.body.offsetHeight;
	obj.offsetLeft = document.documentElement.offsetLeft || document.body.offsetLeft;
	obj.offsetTop = document.documentElement.offsetTop || document.body.offsetTop;
	obj.scrollWidth = document.documentElement.scrollWidth || document.body.scrollWidth;
	obj.scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
	obj.scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
	obj.scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
	return obj;
}

function getBounds(tag)
{
	var ret = new Object();
	if(document.all) {
		var rect = tag.getBoundingClientRect();
		ret.left = rect.left + (document.documentElement.scrollLeft || document.body.scrollLeft);
		ret.top = rect.top + (document.documentElement.scrollTop || document.body.scrollTop);
		ret.width = rect.right - rect.left;
		ret.height = rect.bottom - rect.top;
	} else {
		var box = document.getBoxObjectFor(tag);
		ret.left = box.x;
		ret.top = box.y;
		ret.width = box.width;
		ret.height = box.height;
	}
	return ret;
}

//Array, Object, Number

