
// 프린트 기능 삽입	
	function Print() {
		window.open("/common/print.jsp", "print_open","width=800,height=700,top=0,left=0,noresizable,toolbar=no,status=no,scrollbars=yes,directory=no");
	}


// 스크랩 기능 삽입
	function Scrap(loc,path,title) {
		document.location.href = "/bbs/mypage/scrapsuccess.jsp?mode=insert&path="+loc+"&tit="+title+"&url="+path;
	}

// select 점프

function gojum(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// 폰트 크기 조절하는 스크립트 (v  2.0)-------------------------------------------------------------

//--- sh.k 추가.
// 숫자체크.
	function numCHK(obj){
		var comp="0123456789";
		string=obj.value;
		var len=string.length;
		if(len > 0){
			for(i=0;i<len;i++){
				if(comp.indexOf(string.substring(i,i+1))<0){
					alert("숫자만 입력해 주십시오.");
					obj.value=""
					obj.focus();
					return;
				}
			}
		}
	}
	
//금지어.
	var swear_words_arr=new Array("해커","섹스","나쁜놈","새끼","개새끼","18년","18놈","18","십새끼","씨방세","개시끼","저자","나쁜시끼","시베리안시끼","이놈의시끼","슈퍼관리자","수퍼마스터","미네르바","섹스","클럽","운영자","운영","웹운영","창녀","십창","누드","젖꼭지","섹시","폰섹","fuckyou","kissmyass","sex"); // 거부단어 목록
	var swear_alert_arr=new Array();
	var swear_alert_count=0;

	function reset_alert_count(){
		swear_alert_count=0;
	}

	function validate_user_text(){
		reset_alert_count();
		var compare_text = document.getElementById("name").value;
		for(var i=0; i<swear_words_arr.length; i++){
			for(var j=0; j<(compare_text.length); j++){
				if(swear_words_arr[i]==compare_text.substring(j,(j+swear_words_arr[i].length)).toLowerCase()){
				swear_alert_arr[swear_alert_count]=compare_text.substring(j,(j+swear_words_arr[i].length));
				swear_alert_count++;
				}
			}
		}
	
		if(swear_alert_count>0){
			alert("불량단어는 사용할수 없습니다.");
			document.getElementById("name").select();
			return false;
		}else{
			return true;
		}
	}
	function select_area(){
	document.getElementById("name").select();
	}
	
//메일주소CHANGE
	function If_emailChange(val){

		var email1 = document.getElementById("email1").value;
		var email2 = document.getElementById("email2").value;
		var email3 = document.getElementById("email3").value;
		var email = "";
		if (val=="other"){
			document.getElementById("email3").style.display = "";
		}else{
			document.getElementById("email3").style.display = "none";
			document.getElementById("email3").value = "";
		}
	}


//엔트키.	
	function enterCheck(e){
            
		e = e || window.event;
		var code = e.keyCode || e.which;
		if(code == 13) fncSearch();
		else return false;
            
	}
	


// 폰트 크기 조절하는 스크립트 (v  2.0)-------------------------------------------------------------


	//document.domain="codingmd";

	function setCookie(name,value,expires) { 
	document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString())) + "; path=/; domain=codingmd.com";
	}

	function getCookie(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while(i< clen) { var j = i + alen; if(document.cookie.substring(i,j)==arg){ var end = document.cookie.indexOf(";",j); if(end == -1) end = document.cookie.length; return unescape(document.cookie.substring(j,end)); } i=document.cookie.indexOf(" ",i)+1; if (i==0) break; } return null; }
	function getFontCookie() { 
			var fontSize = getCookie("news_font_size");
			try {
			if ( fontSize == null ) return 12; 
			if ( fontSize.length ) return parseInt(fontSize); 
			else return 12; 
			} catch (e) {
					return 12;
			}
	}
	var fontSize = getFontCookie();
	function scaleFont(val) {
			var content, lineHeight; 
			var content = document.getElementById("contents_txt"); 
			if (content == null) return;
			if (val > 0) { 
					if (fontSize <= 18) { 
							fontSize = fontSize + val; lineHeight = fontSize+Math.round(1.1*fontSize); 
							content.style.fontSize = fontSize + "px"; 
					}
		 } else { 
					if (fontSize > 12) { 
							fontSize = fontSize + val; lineHeight = fontSize+Math.round(1.1*fontSize); 
							content.style.fontSize = fontSize + "px";
					} else {
							lineHeight = fontSize+Math.round(1.1*fontSize);
							content.style.fontSize = fontSize + "px";
					}
			} 
			var mydate = new Date; 
			mydate.setDate(mydate.getDate()+1000); 
			setCookie("news_font_size", fontSize, mydate); 
	}
	// 폰트 크기 조절하는 스크립트 끝  (v 2.0)--------------------------------------------------------



	// 대메뉴활성화 값 각 페이지에서 넘겨받기
	function position(){
		return menu1;
	}

	// 이미지 플래쉬 대메뉴별 정의
	function imageswf(){
		if(menu1=="학교소개")
			titleswf="/swf/top_image00.swf";
		else if(menu1=="입학안내")
			titleswf = "/swf/top_image01.swf";
		else if(menu1=="학사정보")
			titleswf = "/swf/top_image02.swf";
		else if(menu1=="산학/연구")
			titleswf = "/swf/top_image03.swf";
		else if(menu1=="PR센터")
			titleswf = "/swf/top_image04.swf";
		else if(menu1=="회원")
			titleswf = "/swf/top_image05.swf";
		else if(menu1=="마이페이지")
			titleswf = "/swf/top_image06.swf";
    	else if(menu1=="공지/행사")
			titleswf = "/swf/top_image07.swf";
	}

	// 영문사이트 링크 정의
	function engloc(){
		if(engindex=="성의교정영문")
			loc ="/eng/";
		else if(engindex=="의전원영문")
			loc = "http://medicine.catholic.ac.kr/eng/"
		else if(engindex=="대학원영문")
			loc = "/eng/gscuk/"
        else if(engindex=="간호대학영문")
			loc = "http://nursing.catholic.ac.kr/eng/"
		document.location.href = loc;
	}

// 인풋 숫자만 입력
	onkeypress="onlyNumber();"
function onlyNumber(){
   if((event.keyCode<48)||(event.keyCode>57))
      event.returnValue=false;
}

String.prototype.ltrim = function() {
  var re = /\s*((\S+\s*)*)/;
  return this.replace(re, "$1");
 }

 String.prototype.rtrim = function() {
  var re = /((\s*\S+)*)\s*/;
  return this.replace(re, "$1");
 }

 String.prototype.trim = function() {
  return this.ltrim().rtrim();
 }
 
String.prototype.n2b = function() {
    return this.replace("","&nbsp;");
}

String.prototype.b2n = function() {
    return this.replace("&nbsp;","");
}

function chkSpecialChr(val){
    for (var i=0; i < val.length; i++) { 
    ch_char = val.charAt(i);
    ch = ch_char.charCodeAt();
        if( (ch >= 33 && ch <= 47) || (ch >= 58 && ch <= 64) || (ch >= 91 && ch <= 96) || (ch >= 123 && ch <= 126) ) {
            return false;
        }
    }
    return true;
}

function getX(val){
    sw=screen.availWidth;
    return (sw - val)/2;
}

function getY(val){
    sh=screen.availHeight;
    return (sh - val)/2;
}

function chkDate(str){
      if( str.length == 8 ){ 
          vDate = new Date();
          vDate.setFullYear(str.substring(0, 4));
          vDate.setMonth(str.substring(4, 6)-1);  /* -- -1을 해주었숩니당 --*/
          vDate.setDate(str.substring(6));

          if( vDate.getFullYear() != str.substring(0, 4) ||
          vDate.getMonth()    != (str.substring(4, 6)-1) ||  /* -- -1을 해주었숩니당 --*/
          vDate.getDate()     != str.substring(6) ){

              return false;
          }
          return true
      }
}
    
    
function  getEndOfMonthDay( yy, mm )
{
    var max_days=0;
    if(mm == 1)
    {
        max_days = 31 ;
    }
    else if(mm == 2)
    {
        if ((( yy % 4 == 0) && (yy % 100 != 0)) || (yy % 400 == 0))  max_days = 29;
        else                                                         max_days = 28;
    }
    else if (mm == 3)   max_days = 31;
    else if (mm == 4)   max_days = 30;
    else if (mm == 5)   max_days = 31;
    else if (mm == 6)   max_days = 30;
    else if (mm == 7)   max_days = 31;
    else if (mm == 8)   max_days = 31;
    else if (mm == 9)   max_days = 30;
    else if (mm == 10)  max_days = 31;
    else if (mm == 11)  max_days = 30;
    else if (mm == 12)  max_days = 31;
    else                return '';

    return max_days;
}

// index tab
function listChaing(viewNo)
{
  var i;
	for( i=1 ; i <=3 ; i++)
	{
		document.getElementById("list"+i).style.display = 'none';
	}
    document.getElementById("list"+viewNo).style.display='block';
}


	// 대메뉴활성화 값 각 페이지에서 넘겨받기
	function position(){
		return menu1;
	}

	function position2(){
		return menu2;
	}

	function position3(){
		return menu3;
	}
	
  function If_professorPr(_value) {

    _form=document.pform;
    _form.p_no.value = _value;
    _form.method = "post";
    _form.target = "professordetail";
    _form.action = "/common/professor_detail.jsp"

    myWin = window.open("","professordetail",'toolbar=0, menubar=0, resizable=0, scrollbars=1, status=0, width=757,height=700, top=0,left=0');
    myWin.focus();
    _form.submit();
  }