String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); }
String.prototype.str_replace = function(str1,str2){ return this.split(str1).join(str2); }
String.prototype.josa = function(nm) {
	var nm1 = nm.trim().substring(0, nm.trim().indexOf("/"));
	var nm2 = nm.trim().substring(nm.trim().indexOf("/") + 1, nm.trim().length);
	var a = this.substring(this.length - 1, this.length).charCodeAt();
	a = a - 44032;
	var jongsung = a % 28;
	return (jongsung) ? nm1 : nm2;
}

function removeNode(o){ return o.parentNode.removeChild(o); }

function popup(src,width,height) {
	var scrollbars = "1";
	var resizable = "no";
	if (typeof(arguments[3])!="undefined") scrollbars = arguments[3];
	if (arguments[4]) resizable = "yes";
	window.open(src,'','width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar=no,status=no,resizable='+resizable+',menubar=no');
}

function vLayer(obj,mode) {
	if (typeof(obj)!="object") obj = $(obj);
	if (typeof(obj)=="undefined" || obj==null) return;
	if (!mode) obj.style.display = (obj.style.display!="block") ? "block" : "none";
	else obj.style.display = mode;
}

/*** º»¹® ÀÌ¹ÌÁö Å©±â ¸®»çÀÌÂ¡ ***/
function innerImgResize(id)
{
	var objContents = $(id);
	if (!objContents) return;
	var innerWidth = objContents.clientWidth;
	var img = objContents.getElementsByTagName('img');
	for (var i=0;i<img.length;i++){
		if (img[i].width>innerWidth){
			img[i].height = img[i].height * innerWidth / img[i].width;
			img[i].width = innerWidth;

			img[i].title = "View Original Image!!";
			img[i].style.cursor = "pointer";

			img[i].onclick = function(){
				imgbox(this);
				//$j(this).lightBox({fixedNavigation:true}); 
			};
		}
	}
}

/* ÀÌ¸ÞÀÏ Select Box ¼±ÅÃ ÇÔ¼ö */
function set_email(obj,id){
	var ret = document.getElementsByName(id)[1];
	ret.value = obj.value;
}

/* ¿ìÆí¹øÈ£ °Ë»ö */
function popupZipcode(rfunc)
{
	var dir = "";
	if (arguments[1]) dir = arguments[1];
	window.open(dir+'../module/zipcode.php?rfunc='+rfunc,'','width=460,height=400,scrollbars=0');
}

/* ÀÚµ¿ ÄÞ¸¶ »ç¿ë */
function autoComma(obj){
	if (event.keyCode!=9) obj.value=comma(obj.value);
}

/* ¼ýÀÚÅ°¸¸ »ç¿ë */
function onlynumber() {
	var e = event.keyCode;
	window.status = e;
	if (e>=48 && e<=57) return;
	if (e==8 || e==13 || e==45 || e==46) return;
	event.returnValue = false;
}

/* Ã¼Å©¹Ú½º¹ÝÀü ÇÔ¼ö */
function chkBox(El,mode) {
	if (!El) return;
	if (typeof(El)!="object") El = document.getElementsByName(El);
	for (i=0;i<El.length;i++){
		El[i].checked = (mode=='rev') ? !El[i].checked : mode;
		if (El[i].disabled) El[i].checked = false;
	}
}

/*** ¼¿·ºÆ®¹Ú½º ÀÚµ¿¼±ÅÃ ÇÔ¼ö  ***/
function selectOptions(fm,arr){
	for (var i=0;i<arr.length;i++){
		for (var j=0;j<fm[arr[i]].options.length;j++){	
			fm[arr[i]].options[j].selected = true;
		}	
	}
}

/*** °Ô½ÃÆÇ ½ºÆÔ Ã¼Å© ***/
function chkSpam(fm,time){
	fm.skey.value = time;
}

