// ===============================================================================
//	@Programe ID		: jsUserFunction.php
//	@Programe Name	: 위아 전용 자바스크립트 함수
// ===============================================================================*/

	//이메일 선택
	function ReadLock(formName, elm1, elm2)
	{
		var form  = eval("document." + formName + "." + elm1);
		var form2 = eval("document." + formName + "." + elm2);
		var str = form2.options[form2.selectedIndex].value

		if(str == ""){
			form.value = "";
			form.readOnly = false;
			form.focus();
		}else{
			form.value = str;
			form.readOnly = true;				
		}
	}
							
	//전체선택/해제
	var AllorNothing = false;
	function CheckAll(obj)
	{
		var cnt = document.getElementsByName("check").length;

		if(cnt > 0){
			var cntBox = obj.check.length;	

			if (AllorNothing == false)
			{
				AllorNothing = true;
			}
			else
			{
				AllorNothing = false;
			}

			if(cntBox >= 2)
			{
				for (i = 0; i < cntBox; i ++)
				{
					obj.check[i].checked = AllorNothing;
				}
			}
			else
			{
				obj.check.checked = AllorNothing;
			}
		}
	}

	//쿠키 저장하기
	function setCookie( name, value, expiredays )
	{
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
	}

	//쿠키 가져오기
	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 bluring()
	{
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}

	document.onfocusin=bluring;