
// 프린트 기능 삽입	
	function Print() {
		var aaa = window.open("/eng/common/print.jsp", "print_open","width=800,height=700,top=0,left=0,noresizable,toolbar=no,status=yes,scrollbars=yes,directory=no");
	}


// 스크랩 기능 삽입
	function Scrap(loc,path,title) {
		document.location.href = "/bbs/mypage/scrapsuccess.jsp?mode=insert&path="+loc+"&tit="+title+"&url="+path;
	}


// iframe 자동 높이값 조절

	function autoheight (val){
		var hei = document.getElementById("frame_con");
		hei.style.height = val + "px";
	}


// select 점프

function gojum(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}




// 폰트 크기 조절하는 스크립트 (v  2.0)-------------------------------------------------------------


	

	function setCookie(name,value,expires) { 
//document.domain="songeui.catholic.ac.kr";
	document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString())) + "; path=/; domain=songeui.catholic.ac.kr";
	}

	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; 
        }
	
        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 false;
			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 engloc(){
		if(engindex=="songeui_kor")
			loc ="/";
		else if(engindex=="medicine_kor")
			loc = "http://medicine.catholic.ac.kr"
    	else if(engindex=="nursing_kor")
			loc = "http://nursing.catholic.ac.kr"
		else if(engindex=="gscuk_kor")
			loc = "/gscuk/"
		else if(engindex=="public_kor")
			loc = "http://songeui.catholic.ac.kr/sohmp "
		else if(engindex=="policy_kor")
			loc = "http://songeui.catholic.ac.kr/gsph"
		else if(engindex=="dental_kor")
			loc = "http://songeui.catholic.ac.kr/gscds"
		else if(engindex=="clinic_kor")
			loc = "http://songeui.catholic.ac.kr/gscn"
		else if(engindex=="life_kor")
			loc = "http://songeui.catholic.ac.kr/gslife"
		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';
}

// pr index tab
function listChaing2(vDiv, viewNo, nDivCnt)
{
	if ( !vDiv || !viewNo || !nDivCnt) return;

  var i;

	for( i=1 ; i <=nDivCnt ; i++)
	{
		document.getElementById(vDiv+i).style.display = 'none';
	}
    document.getElementById(vDiv+viewNo).style.display='block';
}


	// 대메뉴활성화 값 각 페이지에서 넘겨받기
	function position(){
		return menu1;
	}

	function position2(){
		return menu2;
	}

	function position3(){
		return menu3;
	}