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 getNodeIndex(obj){
	var k = 0;
	while(obj.previousSibling){ k++; obj = obj.previousSibling; }
	return k;
}
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}); 
			};
		}
	}
}

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

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

/*** ¿ìÆí¹øÈ£ ÆË¾÷ ***/
function popupZipcode(rfunc){
	if (!rfunc) rfunc = "zipcode_return";
	window.open('/module/zipcode.php?rfunc='+rfunc,'','width=400,height=350,scrollbars=0');
}

/*** Ä®·»´õ ³¯ÀÚ ÀÌµ¿ ÇÔ¼ö ***/
function calChgDay(fm,idx){
	fm.add_date.value = idx;
	fm.submit();
}

/*** Ã¼Å©¹Ú½º ÀÏ°ý º¯°æ ***/
function chkrev(El,mode) {
	if (!El) return;
	if (!mode) mode = "rev";
	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;
	}
}
