
function lowCase(obj) {
obj.value = obj.value.toLowerCase();
}


//¹®ÀÚ¿­¿¡ °ø¹éÀÌ ÀÖ´ÂÁö °Ë»ç
function isNullInclude(str) {
var tmpStr;
len = str.length;

for ( i = 0 ; i < len ; i++ ) {
	tmpStr = str.charAt(i);
	//´º¶óÀÎ, ÅÇ, ½ºÆäÀÌ½º °Ë»ç
	if (tmpStr == "\n" || tmpStr == "\r" || tmpStr == "\t" || tmpStr == " ") return true;
}
return false;
}

function previewImgFile(fileObj) {
imgObj = fileObj;
if (CheckAttachExt(imgObj.value, allowExtArray) == true) {
	if(navigator.userAgent.indexOf("MSIE 7") > -1) {
		alert("MS IE 7.0 ¹öÁ¯ ÀÌÈÄºÎÅÍ´Â ÀÌ¹ÌÁö »çÀÌÁî Ã¼Å©°¡ µÇÁö ¾Ê½À´Ï´Ù.\n\nÁ¤È®ÇÑ ÀÌ¹ÌÁö »çÀÌÁî¸¦ ¾÷·Îµå ÇØÁÖ¼¼¿ä");
		attachAllow = true;
		return;
	}
	var chkObj = new Image;
	chkObj.src = "file:///" + imgObj.value

	if(typeof(attachImgWidth) != "undefined" && typeof(attachImgHeight) != "undefined") {
		if(chkObj.width != attachImgWidth) {
			alert(attachImgWidth + "*" + attachImgHeight + " ¸¸ ¿Ã·ÁÁÖ¼¼¿ä");
			imgObj.value = "";
		}
		else {
			if(chkObj.height != attachImgHeight) {
				alert(attachImgWidth + "*" + attachImgHeight + " ¸¸ ¿Ã·ÁÁÖ¼¼¿ä");
				imgObj.value = "";
			}
			else {
				//document.getElementById("previewImg_" + idx).innerHTML = "<img src='file:///" + imgObj.value + "' border='0' width='200'>";
				attachAllow = true;
			}
		}
	}
	else if(typeof(attachImgWidth) != "undefined") {
		if(chkObj.width != attachImgWidth) {
			alert("°¡·Î »çÀÌÁî°¡ " + attachImgWidth + "ÀÎ ÆÄÀÏ¸¸ ¿Ã·ÁÁÖ¼¼¿ä");
			imgObj.value = "";
		}
		else {
			//document.getElementById("previewImg_" + idx).innerHTML = "<img src='file:///" + imgObj.value + "' border='0' width='200'>";
			attachAllow = true;
		}
	}
	else if(typeof(attachImgHeight) != "undefined") {
		if(chkObj.height != attachImgHeight) {
			alert("¼¼·Î »çÀÌÁî°¡ " + attachImgHeight + "ÀÎ ÆÄÀÏ¸¸ ¿Ã·ÁÁÖ¼¼¿ä");
			imgObj.value = "";
		}
		else {
			//document.getElementById("previewImg_" + idx).innerHTML = "<img src='file:///" + imgObj.value + "' border='0' width='200'>";
			attachAllow = true;
		}
	}
	else {
		//document.getElementById("previewImg_" + idx).innerHTML = "<img src='file:///" + imgObj.value + "' border='0' width='200'>";
		attachAllow = true;
	}
}
else {
	alert("Ã·ºÎÆÄÀÏÀº È®ÀåÀÚ°¡ " + allowExtArray.join(" ") + "ÀÎ ÀÌ¹ÌÁö ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.");
}
}


//ÀÌ¸ÞÀÏ Á÷Á¢ÀÔ·Â --
function setMailServer(selObj,txtObj) {
	if(selObj.selectedIndex == 0) {
		txtObj.value = "";
		txtObj.readOnly = true;
		txtObj.focus();
	}
	else if(selObj.selectedIndex == selObj.length - 1) {
		txtObj.value = "";
		txtObj.readOnly = false;
		txtObj.focus();
	}
	else {
		txtObj.value = selObj.options[selObj.selectedIndex].text;
		txtObj.readOnly = true;
	}
}

var emailServer = new Array('hammir.com','hanmail.net','naver.com','yahoo.co.kr','empal.com','paran.com','hotmail.com','nate.com','dreamwiz.com','chollian.net','unitel.co.kr','kebe.com','hitel.com','netian.com','weppy.com','freechal.com','orgio.com','gmail.com');

function init(val) {
	setEmailServer(document.mainForm.mailServerSel,val);		
}

function setEmailServer(selObj, selectedVal) {

	var selIdx = 0;
	for(var i = 0; i < emailServer.length; ++i) {
		selObj.options[i + 1] = new Option(emailServer[i],emailServer[i]);
		if(emailServer[i] == selectedVal) selIdx = i + 1;
	}
	selObj.options[i + 1] = new Option('Á÷Á¢ÀÔ·Â','');

	if(selIdx > 0) selObj.selectedIndex = selIdx;
}

//ÀÌ¸ÞÀÏ Á÷Á¢ÀÔ·Â end--

//----------¾ÆÀÌµð ÀÔ·Â½Ã ¿µ¹®,¼ýÀÚ¸¸ Ã¼Å©
function onlyEngNum(objtext1) {
	var inText = objtext1.value;
	var ret;

	for (var i = 0; i < inText.length; i++) {
		ret = inText.charCodeAt(i);
		if ((ret > 122) || (ret < 48) || (ret > 57 && ret < 65) || (ret > 90 && ret < 97)) {
			alert("¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸À» ÀÔ·ÂÇÏ¼¼¿ä");
			objtext1.value = "";
			objtext1.focus();
			return false;
		}
	}
}

function goSubmit(val) {
	if(validate(val) == true) {
		val.submit();
	}
}

function goSubmitSub(val1, val2, val3, val4) {
	if(confirm(val2+"ÇÏ½Ã°Ú½À´Ï±î?")) {
		val1.seq.value = val3;
		if (val4 != null)
		{
			val1.main_useyn.value = val4.value;
		}
		val1.submit();
	} else {
		if (val4 != null)
		{
			val4.checked = !val4.checked;
		}
	}
}

function goDel(val) {
	if(confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		val.submit();
	}
}

function goImgDelSubmit(val, ids, setChars, splitChar) {
	setObjs(ids, setChars, splitChar);
	if(confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		if(validate(val) == true) {
			val.submit();
		}		
	}
}


//ÆË¾÷ ¿ÀÇÂ
function popOpen(url, popNM, width, height,etc) {
	if (etc == "")
	{
		etc = 	"scrollbars=no,resize=no"	
	}
	window.open(url, popNM, "width="+width+", height="+height+"," +etc);

}


//¿ìÆí¹øÈ£ ºÎ¸ðÃ¢À¸·Î º¸³»±â
function goZipcode(val1, val2) {
	var zipcode1, zipcode2, addr;
	zipcode1	=	val1.substring(0,3);
	zipcode2	=	val1.substring(3,6);
	addr		=	val2;
	
	opener.document.getElementById("zipcode1").setAttribute("value",zipcode1); 
	opener.document.getElementById("zipcode2").setAttribute("value",zipcode2); 
	opener.document.getElementById("addr1").setAttribute("value",addr); 
	self.close();

}

function setObjs(ids, setChars, splitChar){
	var ary		= ids.split(splitChar);
	var aryChar = setChars.split(splitChar);	
	
	var obj;
	
	for (i = 0; i < ary.length; i++){
		obj = document.getElementById(ary[i]);
		if (obj != null) {
			obj.value = aryChar[i];
		}
	}
	
}

function setObj(id, setChar){
	var obj;
	obj = document.getElementById(id);
	if (obj != null) {
		obj.value = setChar;
	}
}



//ÆË¾÷ »çÀÌÁî ¸®»çÀÌÁî
function OnLoad(width, height){
	var objBody = document.documentElement;
	self.resizeTo(width,height);

}

/* 
select box setting
obj			: select µÈ combo box
target		: setting ÇÒ combo box
aryVal		: option value °ª
aryText		: option text °ª
selVal		: select µÉ target combo box value
defaultVal	: Ã¹¹øÂ° option value(ex, ¼±ÅÃ)
defaultTex	: Ã¹¹øÂ° option text(ex, '')

¹è¿­ ¿¹Á¦
aryVal = new Array();
aryVal[0] = new Array();
aryText = new Array();
aryText[0] = new Array();
aryVal[0][0]= "0"
aryText[0][1] = "°ª";
*/
function setSubCombo(obj,target, aryVal, aryText, selVal, defaultText, defaultVal) {
	selIndex = new Number(obj.selectedIndex-1);

	if (selIndex < 0 ) {
			target.value = 0;
	} else {
		target.length = 0;
		var total_length = aryVal[selIndex].length;
		
		target.options[0] = new Option(defaultText, defaultVal);
		for(i = 0 ; i < total_length ; i ++){
			target.options[i+1] = new Option(aryText[selIndex][i], aryVal[selIndex][i]);
			if (aryVal[selIndex][i] == selVal) target.options[i+1].selected = true;
		}
	}
}


//id Ã¼Å©
function fn_id_check(val) {	

	if(document.mainForm.mem_id.value != "" && document.mainForm.mem_id.value.length >= 4 ) {
		document.subForm.mem_id.value = document.mainForm.mem_id.value;
		if(val == "pop") {			
			popOpen('','idPopup','500','245');
			document.subForm.submit();
		} else {
			document.subForm.submit();
		}

	} else {
		alert("¾ÆÀÌµð¸¦ 4ÀÚ ÀÌ»ó Á¤È®È÷ ÀÔ·ÂÇÏ¼¼¿ä.");
		document.mainForm.mem_id.focus();
	}
}

function excel_download(query_type,file_name){
	location.href="/_SfcManager/lib/excel_download.asp?query_type="+query_type+"&file_name="+file_name
}


//¸¶¿ì½º ·Ñ¿À¹öÀÌ¹ÌÁö
var currentOn;

function ImgOn(imgEl)
{
	var name = imgEl.src;
	if( name.indexOf("on.gif") <= 0 ) {
		imgEl.src = name.replace(".gif", "on.gif");
	} else {
		currentOn = imgEl;
	}
}

function ImgOut(imgEl)
{
	if( currentOn != imgEl ) {
		imgEl.src = imgEl.src.replace("on.gif", ".gif");
	}
}

function Format_comma(val1){
	var newValue = val1+""; //¼ýÀÚ¸¦ ¹®ÀÚ¿­·Î º¯È¯
	var len = newValue.length; 
	var ch="";
	var j=1;
	var formatValue="";
 
	// ÄÞ¸¶Á¦°Å 
	newValue = newValue.replace(/\,/gi, ' ');
 
	// commaÁ¦°ÅµÈ ¹®ÀÚ¿­ ±æÀÌ
	len = newValue.length;
	
	for(i=len ; i>0 ; i--){
		ch = newValue.substring(i-1,i);
		formatValue = ch + formatValue;

		if ((j%3) == 0 && i>1 ){
			formatValue=","+formatValue;
		}
		j++
	}
	return formatValue;
}

function Format_NoComma(val1){
  return (val1+"").replace(/\,/gi, '');
}
			
function onlyNumber(){
   if((event.keyCode<48)||(event.keyCode>57))event.returnValue=false;
}


function getCookie(name){
        var nameOfCookie = name + "=";
        var x = 0;
        while(x <= document.cookie.length)
        {
                var y = (x + nameOfCookie.length);
                if(document.cookie.substring(x,y) == nameOfCookie)
                {
                        if((endOfCookie = document.cookie.indexOf(";",y)) == -1)
                                endOfCookie = document.cookie.length;
                        return unescape(document.cookie.substring(y,endOfCookie));
                }
                x = document.cookie.indexOf(" ",x) + 1;
                if(x == 0)
                        break;
        }
        return "";
}

// ÆË¾÷
function pop(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=no,status=1'); } //Popup(½ºÅ©·Ñ¹Ù¾øÀ½)
function pops(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=yes'); } //Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)
function newwin(url){ window.open(url,'new','location=1,directories=1,resizable=1,status=1,toolbar=1,menubar=1,scrollbars=1') } //NewPopup(½ºÅ©·Ñ¹Ù¾øÀ½)


function isValidateArae(num){
	if(num == "") return true;
	//¼Ò¼öÁ¡ 2ÀÚ¸®±îÁö¸¸ ÀÔ·ÂµÇ°Ô
	var numRegEx = /^[0-9]+\.?([0-9]){0,2}$/;
	return numRegEx.test(num);
}
