/**
 * 팝업
 * @param url
 * @param name
 * @param option
 * @return
 */
	function winPop(url, name, option){
		window.open(url,name,option);
	}
	
	function volunteer_cal_pop(){
		winPop("/community/volunteer_calendar_pop.jsp","zip","width=460,height=500,scrollbars=yes")
	}
	
	function findZip(){
		winPop("/pop_up/find_address.jsp","zip","width=430,height=500,scrollbars=yes")
	}

	function experience_calendar_pop(cat){
		winPop("/management/experience/experience_calendar.jsp?cat="+cat,"id","width=700,height=400,scrollbars=yes")
	}
	
	function checkID(){
		winPop("/management/member/idcheck.jsp","id","width=400,height=200,scrollbars=yes")
	}
	
	function fileDown(fname, fdir)
	{
		var obj = document.jform;
		obj.fname.value	=	fname;
		obj.fdir.value	=	fdir;
		obj.method	=	"post";
		obj.action="/commonfile/fdown.jsp";
		obj.submit();
		obj.target="";
	}	
/**
 * 숫자인가 체크
 * @param the_num
 * @return
 */
	function is_valid_number(the_num){
		var anum=/(^\d+$)|(^\d+\.\d+$)/
		if (anum.test(the_num)){
			chkresult=true
		}else{
			chkresult=false
		}
		return chkresult
	}
 
 
	function createQuestion(_num, _div){

		$('.q_'+_div).remove();	//모두 삭제 한다
		alert(_div);
		for(i=0 ; i<_num ; i++){
			$("<div class='q_"+_div+"'><input type='text' name='sub_title_"+_div+"' id='sub_title_"+_div+"' size='50' >답<input type='radio' name='q_correct_"+_div+"'  id='q_correct_"+_div+"' value='"+(i+1)+"'></div>").appendTo("#"+_div);
		}
	}
	
	
	
	function addattribute(){
		f	=	document.jform;
		$('.quiz_sub').remove();	//모두 삭제 한다
		for(i=0 ; i<f.q_count.value ; i++){

			//$("<div class='foo'>내가 foo를 가졌다!</div>").appendTo("#question");
			data	=	"";
			data += "<table cellpadding=0 cellspacing=1 border=0 width=100% bgcolor='dddddd'>	";
			data += "	<tr bgcolor='f6f6f6' height='25'>	";
			data += "		<td width='100' align='center'>문제유형</td>	";
			data += "		<td>	";
			data += "			<select name='q_type_"+i+"' id='q_type_"+i+"' onChange='javascript:goDisabled()'>	"; 
			data += "				<option value='1'>주관식</option>	";
			data += "				<option value='2'>객관식</option>	";
			data += "			</select>	";
			data += "		</td>	";
			data += "	</tr>	";
			data += "	<tr bgcolor='f6f6f6' height='25'> 	";
			data += "		<td width='100' align='center'>문제입력</td>	";
			data += "		<td> 	";
			data += "			["+(i+1)+"]&nbsp;<input type='text' size=55 maxlength='200' name='question_"+i+"' id='question_"+i+"' >	";
			data += "		</td>	";
			data += "	</tr>	";
			data += "	<tr bgcolor='f6f6f6' height='25'> 	";
			data += "		<td width='100' align='center'>보기개수</td>	";
			data += "		<td>	";
			data += "			<select name='sub_count_"+i+"' id='sub_count_"+i+"' size='1' onChange=\"createQuestion(this.value,'div_question_"+i+"');\" >	"; 
			data += "				<option value='0'>선택</option>	";
			data += "				<option value='1'>1</option>	";
			data += "				<option value='2'>2</option>	";
			data += "				<option value='3'>3</option>	";
			data += "				<option value='4'>4</option>	";
			data += "				<option value='5'>5</option>	";
			data += "			</select>	";
			data += "			(해당항목의 보기개수를 선택해주세요)	";
			data += "		</td>	";
			data += "	</tr>	";
			data += "	<tr bgcolor='f6f6f6' height='25'> 	";
			data += "		<td width='100' align='center' valign='top'>보기입력</td>	";
			data += "		<td valign='top'>	";
			data += "			<div id='div_question_"+i+"'></div>	";
			data += "		</td>	";
			data += "	</tr>	";
			data += "</table><br/>	"; 
			$("<div class='quiz_sub'>"+data+"</div>").appendTo("#question");																									
		}		
	}
	
	
	var	xmlHttp	=	null;
	function createXMLHttpRequest() {
	
		if(window.ActiveXObject) {
			try{
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				}catch(e1){
					
				}			
			}
	
		}
	}



	
	function checkIDajax(id){
		
		if(id.length>=4 && id.length<=10 ){
			createXMLHttpRequest();
			
			var url = "/management/member/idcheck_ajax.jsp?user_id="+id;
			xmlHttp.open("GET", url, true);
			xmlHttp.onreadystatechange = idchkvalue;	//처리 함수로 이동
			xmlHttp.send(null);			
		}else{
			document.getElementById("id_text").innerText = "사용할수 없는 아이디 입니다.";
			document.getElementById("idchk").value	=	"N"
		}

	}

	function idchkvalue(){

		if (xmlHttp.readyState == 4) {

			if (xmlHttp.status == 200) {
				var message = xmlHttp.responseXML.getElementsByTagName("message").item(0).firstChild.nodeValue;
				
				if(message == "Y"){
					document.getElementById("id_text").innerText = "사용가능한 아이디 입니다.";
					document.getElementById("idchk").value	=	"Y"
				}else{
					document.getElementById("id_text").innerText = "사용할수 없는 아이디 입니다.";
					document.getElementById("idchk").value	=	"N"
				}
	        	  //alert(message+" : "+document.getElementById("id_text").innerHtml);
	        	  //alert(message+" : "+document.getElementById("id_text").innerText);
			}else{
				document.getElementById("id_text").innerText = "사용할수 없는 아이디 입니다.";
				document.getElementById("idchk").value	=	"N"
			}

		}else{
			document.getElementById("id_text").innerText = "사용할수 없는 아이디 입니다.";
			document.getElementById("idchk").value	=	"N"
		}
	}
	
	function volunteer_user_pop(yy){

		winPop("/management/volunteer/volunteer_user_list.jsp?req_date="+yy,"zip","width=600,height=500,scrollbars=yes")
	}
	
	function quiz_user_pop(seq, count){

		winPop("/management/quiz/quiz_user_list.jsp?q_seq="+seq+"&q_count="+count,"zip","width=600,height=500,scrollbars=yes")
	}
	
	function loginAlert(){
		alert("로그인 하셔야 사용 가능 합니다.");
		document.location.href	=	"/member/login.jsp";
	}
	
	function loginAlertUrl(_url){
		alert("로그인 하셔야 사용 가능 합니다.");
		document.location.href	=	"/member/login.jsp?RET_URL="+_url;
	}
	
	function sendLogin(){
		f	=	document.jform;
		if(f.user_id.value == ""){
			alert("아이디를 입력해주세요.");
			f.user_id.focus();
			return;
		}
		
		if(f.user_pass.value == ""){
			alert("비밀번호를 입력해주세요.");
			f.user_pass.focus();
			return;
		}
		
		f.action	=	"/member/login_proc.jsp";
		f.method	=	"post";
		f.submit();
	}
	
//이메일 체크	
	var VC_inValidEmail = function(obj)
	{
	 var target = obj.value;
	 if (target.indexOf("@", 0) < 2 || target.indexOf(".", 0) < 4 || target.length < 6 ) {
	  alert("이메일 형식이 아닙니다.   ");
	  obj.focus();  
	  return true;
	 }
	 return false;
	}
	
	
	function goList(_page){
		f	=	document.jform;
	           
		f.method	=	"post";
		f.action	=	_page;
		f.submit();		
	}
	
	function gosite(_gubun){
		if($("#"+_gubun+" option:selected").val() == ""){
			alert("이동할 사이트를 선택해 주세요.")
		}else{
			var openwin = window.open("about:blank");
			openwin.location.href = $("#"+_gubun+" option:selected").val();
		}

	}
	 function ebook_login(){

			document.ebook_form.submit();
	}
	 
	 
	// 화면 확대 축소
	 var zoomRate = 10;
	 var curRate = 100;
	 var minRate = 100;
	 var maxRate = 200;

	 function zoomInOut(value) {

	 	var browserEl = navigator.userAgent.toLowerCase();
	 	if(browserEl.indexOf('firefox')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - 크기조정 - 확대/축소를 이용하세요."); }
	 	else if(browserEl.indexOf('opera')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - zoom을 이용하세요."); }
	 	/*else if(browserEl.indexOf('safari')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - 텍스트크게/작게를 이용하세요."); }*/
	 	if (((value == "plus")&&(curRate >= maxRate))||((value == "minus") && (curRate <= minRate))) {
	 	    return;
	 	}  
	 	if (value == "plus") {
	 		curRate = parseInt(curRate) + parseInt(zoomRate);
	 	} else if (value == "minus") {
	 		curRate = parseInt(curRate) - parseInt(zoomRate);
	 	} else {
	 		curRate = 100;
	 	}
	 	
	 	
	 	if(document.getElementById('wrap')) document.getElementById('wrap').style.zoom = curRate + '%';
//	 	if(document.getElementById('wrapper')) document.getElementById('wrapper').style.zoom = curRate + '%';
	 	//2009-10-15 종태 템플릿마다 최상위 id가 달라 body에 액션을 줌
	 	//document.body.style.zoom = curRate + '%';  
	 }
	 
	 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 onLoadChangeBgStyle(target){
		
		if(getCookie("bgClassName")){
			document.body.id = getCookie("bgClassName");
			}

	}


	function changeClassName(name){


			if(name) {
				document.body.id  = name;
			}else{
				document.body.id  = '';
				name = null;
			}
			
			//alert(document.body.id);

			setCookie("bgClassName", name, 1);
	}
//도서관 회원이 아닐경우 alert
	function noLibmemerAler(){
		alert("도서관 관외대출 회원만 가능 합니다\n관외 대출 회원일경우 회원 정보 수정에서\n도서관 회원 대출 번호를 입력해 주세요.");
	}
	
	function checkEmail(_email){
        var regExp = /[a-z0-9]{1,}@[a-z0-9-]{1,}\.[a-z0-9]{2,}/i;
        if(!regExp.test(_email))
        {
               return false;
         }else{
        	 return true;
         }
		
	}

