<!--

	//-----------------------------------------------------------------------------
	// 정규식에 쓰이는 특수문자를 찾아서 이스케이프 한다.
	// @return : String
	//-----------------------------------------------------------------------------
	String.prototype.remove = function(pattern) {
		return (pattern == null) ? this : eval("this.replace(/[" + pattern.meta() + "]/g, \"\")");
	}

	//-----------------------------------------------------------------------------
	// 숫자와 영어만 허용 - arguments[0] : 추가 허용할 문자들
	// @return : boolean
	//-----------------------------------------------------------------------------
	String.prototype.isEngNum = function() {
		return (/^[0-9a-zA-Z,"_"]+$/).test(this.remove(arguments[0])) ? true : false;
	}

	//-----------------------------------------------------------------------------
	// 문자의 좌, 우 공백 제거
	// @return : String
	//-----------------------------------------------------------------------------
	String.prototype.trim = function() {
		return this.replace(/(^\s*)|(\s*$)/g, "");
	}

	//-----------------------------------------------------------------------------
	// 공백이나 널인지 확인
	// @return : boolean       (trim 함수가 꼭 있어야 함  자바스크립트는 trim 내장 함수가 없음)  
	//-----------------------------------------------------------------------------

	String.prototype.isBlank = function() {
		var blank = this.trim();
		for(var i = 0; i < blank.length; i++) {
			if ((blank.charAt(i) != "\t") && (blank.charAt(i) != "\n") && (blank.charAt(i)!="\r")) {
				return false;
			}
		}
		return true;
	}

	//-----------------------------------------------------------------------------
	// 영어만 허용 - arguments[0] : 추가 허용할 문자들
	// @return : boolean
	//-----------------------------------------------------------------------------

	String.prototype.isEng = function() {
		return (/^[a-zA-Z]+$/).test(this.remove(arguments[0])) ? true : false;
	}


//------------------- 편집기 ------------------------------------------------------
	

	function func_selection_txtarea_topic(obj,prefix,postfix){

				if (document.getSelection)    ts = document.getSelection();
				else if (document.selection)  ts = document.selection.createRange().text;
				else if (window.getSelection) ts = window.getSelection();
				
				if (ts != ""){ //IE
					document.selection.createRange().text = prefix + ts + postfix;
				}else {
					if (obj.selectionStart == obj.selectionEnd){
						if(/*@cc_on!@*/false){
							topic_write.focus();
							document.selection.createRange().duplicate().text = prefix + document.selection.createRange().duplicate().text + postfix;
							document.selection.createRange().select();
						}else{
							var s1 = obj.value.substring(0, obj.selectionStart);
							var s2 = obj.value.substring(obj.selectionStart);
							obj.value = s1 + prefix + postfix + s2;
						}
					}else{
						var s1 = obj.value.substring(0, obj.selectionStart);
						var s2 = obj.value.substring(obj.selectionStart, obj.selectionEnd);
						var s3 = obj.value.substring(obj.selectionEnd);
						obj.value = s1 + prefix + s2 + postfix + s3;
					}
				}

	}

		function func_selection_bbc_code(option){
			var txtarea_topic = document.topic_write.tex_content;
			
			txtarea_topic.focus();				

			if(option == 'b'){			
				func_selection_txtarea_topic(txtarea_topic,'[b]','[/b]');
			}if(option == 'u'){			
				func_selection_txtarea_topic(txtarea_topic,'[u]','[/u]');
			}else if(option == 'l'){
				func_selection_txtarea_topic(txtarea_topic,'[l]','[/l]');
			}else if(option == 'i'){				
				func_selection_txtarea_topic(txtarea_topic,'[i]','[/i]');
			}else if(option == 'color'){
				func_selection_txtarea_topic(txtarea_topic,'[color=#FF0000]','[/color]');
			}else if(option == 'url'){
				func_selection_txtarea_topic(txtarea_topic,'[url]','[/url]');
			}else if(option == 'url2'){
				func_selection_txtarea_topic(txtarea_topic,'[url=http://www.youfree.or.kr/]','[/url]');	
			}else if(option == 'email'){
				func_selection_txtarea_topic(txtarea_topic,'[email]youfree@modutech.co.k','[/email]');
			}else if(option == 'email2'){
				func_selection_txtarea_topic(txtarea_topic,'[email=youfree@modutech.co.kr]','[/email]');
			}else if(option == 'quote'){
				func_selection_txtarea_topic(txtarea_topic,'[quote=상대방 이름]','[/quote]');
			}else if(option == 'img'){
				func_selection_txtarea_topic(txtarea_topic,'[img=','경로]');
	
			}
		}

		function func_selection_SyntexHighlite(option,language){
			var txtarea_topic = document.topic_write.tex_content;
			txtarea_topic.focus();	
			func_selection_txtarea_topic(txtarea_topic,'[code='+language+']','[/code]');
			
		}


//---------------------------------- 프로젝트 아이디 중복확인  -------------------------------------------
	function id_check(){ 	
		var proj_id= eval(document.project_make_form.project_id); 
		var ref;
		if(proj_id.value.isBlank()) { 
			alert('프로젝트 아이디를  입력하신 후에 확인하세요!');               
			proj_id.focus(); 
			return;
		}else if(!proj_id.value.isEngNum()){
			alert('프로젝트 아이디는 영어와 숫자만 입력이 \n\n가능하고 특수문자나 공백이 들어갈수 없습니다.');   
			proj_id.focus(); 
			return;
		}else { 
			ref = "./proj_id_check.html?id=" + proj_id.value; 			
			window.open(ref,"hidden_Frame"); 
		}
	}
	//------------------------------------폴더 추가-------------------------------------------
	function document_regist(){
		if(document.getElementById('pro_name').value.isBlank()){
			alert("프로젝트 이름을 입력하세요");
			document.getElementById('pro_name').focus();
			return false;
	
		}else 	if(document.getElementById('pro_explan').value.isBlank()){
			alert("프로젝트 설명 란을  입력하세요");
			document.getElementById('pro_explan').focus();
			return false;
		}
		document.document_form.submit();     
	}
	//--------------------------------------파일 확장자 제한 -----------------------------------------
	function file_tail(File){

		var file_content = File.value;  //원래 파일이름
		var contentArray = file_content.split(".");

		var File = file_content.toLowerCase(); //파일 이름을 소문자로 변경한 값
		var FileArray = File.split(".");

		
		
		 if((FileArray[FileArray.length-1]!="gif")&&
			  (FileArray[FileArray.length-1]!="jpg")&&
			  (FileArray[FileArray.length-1]!="bmp")&&
			  (FileArray[FileArray.length-1]!="png")&&
			  (FileArray[FileArray.length-1]!="txt")&&
			  (FileArray[FileArray.length-1]!="html")&&			//이 외 의 확장자로는 파일을 등록 할 수 없다.
			  (FileArray[FileArray.length-1]!="doc")&&
			  (FileArray[FileArray.length-1]!="xls")&&
			  (FileArray[FileArray.length-1]!="ppt")&&
			  (FileArray[FileArray.length-1]!="zip")&&		
			  (FileArray[FileArray.length-1]!="hwp")&&
			  (FileArray[FileArray.length-1]!="pdf")&&
			  (FileArray[FileArray.length-1]!="xlsx")&&
			  (FileArray[FileArray.length-1]!="docx")&&
			  (FileArray[FileArray.length-1]!="")&&
			  (FileArray[FileArray.length-1]!="pptx"))
		{
			alert(contentArray[contentArray.length-1]+" 는 업로드 할 수 없는 확장자 입니다.");
			file_content = "";
				return false;
		}
		return true;
	}

	//--------------------------------------파일 추가------------------------------------------------
	function file_add(modify){

		var File = document.getElementById('file_content');

		
		if(document.getElementById('name').value.isBlank()){
			alert("파일 제목을 입력하세요");		
			document.getElementById('name').focus();
			return ;
		
	
		}else 	if(document.getElementById('explan').value.isBlank()){
			alert("파일설명 란을  입력하세요");
			document.getElementById('explan').focus();
			return ;
		}
		
		if(!modify){
			if(document.getElementById('file_content').value.isBlank()){
				alert("파일을 첨부해 주세요");
				document.getElementById('file_content').focus();
				return ;
			}
		}
		
		if(file_tail(File)){
			document.file_add_form.submit();		
		}
	
	}
	//-----------------------------------------폴더 삭제--------------------------------------
	function folder_delete(no){
		if(confirm("정말삭제하시겠습니까?\n\n폴더를 삭제하시면 해당하는 모든\n\n폴더와 파일이 같이 삭제됩니다")) {
					document.location.href="./document_folder_delete.html?no="+no; 
					
		}else{
			return;																			
		}

	}
	//-----------------------------------------파일 삭제--------------------------------------
	function file_delete(no){
		if(confirm("정말삭제하시겠습니까?")) {
					document.location.href="./document_file_delete.html?no="+no; 
		}else{
			return;															
		}

	}
	
	//-------------------------------------프로젝트 개설------------------------------------------

		function project_create(){

			var proj_id= eval(document.project_make_form.project_id); 

			  if(document.getElementById('ids').value != 1){	
					alert('"중복확인" 은(는) 반드시 하셔야 합니다.');
					document.getElementById('ids').focus();
					return false;
			 }else if(proj_id.value.isBlank()) { 
					alert('프로젝트 아이디를  입력해 주세요!');               
					proj_id.focus(); 
					return;
			}else if(!proj_id.value.isEngNum()){
				alert('프로젝트 아이디는 영어와 숫자만 입력이 \n\n가능하고 특수문자나 공백이 들어갈수 없습니다.');   
				proj_id.focus(); 
				return;
			}else 	if(document.getElementById('join_passwd').value.isBlank()){
				alert("SVN 비밀번호를  입력하세요");
				document.getElementById('join_passwd').focus();
				return ;
	
			}else 	if(document.getElementById('create_pro_name').value.isBlank()){	
				alert("프로젝트 이름을  입력하세요");
				document.getElementById('create_pro_name').focus();
				return false;
			}else 	if(document.getElementById('create_pro_purpose').value.isBlank()){
				alert("프로젝트 목적과 요약을  입력하세요");
				document.getElementById('create_pro_purpose').focus();
				return false;
			}else 	if(document.getElementById('create_pro_comment').value.isBlank()){
				alert("프로젝트 공개 설명을  입력하세요");
				document.getElementById('create_pro_comment').focus();
				return false;
			}
			
			document.project_make_form.submit();							
		}

	//--------------------------------------프로젝트 참여-----------------------------------------
		function project_join(){
				if(document.getElementById('join_passwd').value.isBlank()){
					alert("비빌번호를 입력하세요");
					document.getElementById('join_passwd').focus();
					return false;
				}else if(document.getElementById('join_purpose').value.isBlank()){
					alert("프로젝트 참여 목적과 요약을  입력하세요");
					document.getElementById('join_purpose').focus();
					return false;
				}else 	if(document.getElementById('join_comment').value.isBlank()){
					alert("본인 공개 설명을  입력하세요");
					document.getElementById('join_comment').focus();
					return false;
				}
			document.join_form.submit();							
		}

	//------------------------------------이슈 등록&수정--------------------------------------------

	function func_write(){

	var File = document.getElementById('file_content');

	var topic_write = document.topic_write;

		if(topic_write.topic_title.value.isBlank()){
			alert("제목을 입력해주세요");
			topic_write.topic_title.focus();
			return false;
		}else if(topic_write.tex_content.value.isBlank()){
			alert("내용을 입력해주세요");
			topic_write.tex_content.focus();
			return false;
		}
		if(file_tail(File)){//확장자 제한 하는 함수

			document.topic_write.submit();
	
		}
			
	}	


	//------------------------------------이슈 삭제--------------------------------------------
	function issue_delete(no){
		if(confirm("정말삭제하시겠습니까?")) {
					document.location.href="./issue_delete.html?seq="+no; 
		}else{
			return;															
		}

	}
//--------------------------------------할당자 변경---------------------------------------------------

	function allot_js(new_broker){
		var oldBroker = document.getElementById('old_broker').value;
		 
		 if(oldBroker == new_broker.value){
			 alert("현재 할당자와 변경된 할당자가 같습니다.");
			return false;
		 }else{
			if(confirm("할당자를 변경 하시겠습니까?")) {
				document.allot_form.submit();
			}else{
				return;															
			}
		 }

	}

//--------------------------------------상태 변경---------------------------------------------------

	function status_js(nowStatus,changeStatus){
		if(nowStatus == changeStatus.value){
			alert("현재 상태와 변경된 상태가 같습니다.");
			return false;
		}else{
			if(confirm("상태를 변경 하시겠습니까?")) {
				document.status_form.submit();
			}else{
				return;															
			}
		}
	}

//-------------------------------------이슈 (댓글) 의견 달기 -------------------------------------------------------

function reply_regist(){
		if(document.getElementById('re_contents').value.isBlank()){
			alert("내용을 입력하세요");
			document.getElementById('re_contents').focus();         
			return false;	
		}
		document.issue_reply_form.submit();
	}

	//------------------------------------- 이슈노트 쓰기 -------------------------------------------------------


	function issueNote(){

		if(document.getElementById('issue_note_content').value.isBlank()){
			alert("내용을 입력하세요");
			document.getElementById('issue_note_content').focus();         
			return false;	
		}
		document.issue_note_form.submit();
	}


	//------------------------------------------ 검색 -----------------------------------------------------------

	function search_data(order_value) {
		document.getElementById('mode').value="search";
		if(order_value)document.getElementById('order').value=order_value;
		document.search_form.submit();
	}

	
	//------------------------------------------ 참여자 설명 입력 -----------------------------------------------------------

	function member_account() {
		if(document.getElementById('user_account').value.isBlank()){
			alert("내용을 입력하세요");
			document.getElementById('user_account').focus();         
			return false;	
		}
		document.account_form.submit();
		opener.document.location.reload();
	}

	//------------------------------------------프로젝트 탈퇴 --------------------------------------------------

	function withdraw(obj){
		alert(obj);
		if(confirm("정말 프로젝트 탈퇴를  하시겠습니까?")) {
			alert("관리자에게 탈퇴 요청 되었습니다.");
			location.href = "./project_withdraw.php?obj="+obj;
				
			}else{
				return;															
			}

	}
	//--------------------------------------- 회원 정보 수정 --------------------------------------------------------------------	

	function member_modify(join_id,page){
		//alert(join_id);
		location.href = "./mypage_user_modify.html?join_id="+join_id+"&page="+page;
	}
	//-------------------------------------- 카테고리 추가 -----------------------------------------------------------------	
/*
	function category_add(category){

		if(document.getElementById('category').value.isBlank()){
			alert("추가할 카테고리를 입력하세요.    ");
			document.getElementById('category').focus();         
			return false;	
		}
		document.catagory_form.submit();
		
	}   
	*/
	//---------------------------------------- 카테고리 수정 -------------------------------------------------------------------	

	

//-->
	