
//**********************쿠키관련 함수 시작************************
function setCookie(sName,sVal,Expiretime) {
    var str=sName + "=" + escape(sVal) ;
    if(Expiretime!=null) 
        str+="; expires="+ Expiretime;

    document.cookie=str;    
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}


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)
      return getCookieVal (j);

    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) 
      break;
  }
  return null;
}

function showLayer() {
 var exp=new Date();
 var ExpireDate=exp.getTime()+(24*3600*1000);
 exp.setTime(ExpireDate);
 setCookie('skop_e','0',exp.toGMTString());
document.all.divMenu2.style.visibility = "visible";
}

function hideLayer() {   
   document.all.divMenu2.style.visibility = "hidden";
}


//*******************쿠키관련 함수 끝************************* 

/******************팝업창 하루동안 안뛰우기 시작*******************   

     var st = getCookie('skop_e');
//	 alert(st);
     if(st==null){
       a = window.open('./etc/pop_pf.html','','width=265,height=186, left=0, top=195');
        a.focus();
     }	

/*
    //자바스크립트 설정으로 하루동안 창안띄우는 소스(공지사항 레이어)

     var st = getCookie('skop');
     if(st==null){
        showLayer();
     }
     else{
	hideLayer();
     }  
//******************팝업창 하루동안 안뛰우기 끝*******************/


//******************* 레이어 처리 함수 시작 *******************

function getObject(objectId){
	if(document.getElementById && document.getElementById(objectId)){
		return document.getElementById(objectId);}
	else if(document.all && document.all(objectId)){
		return document.all(objectId);}
	else if(document.layers){
		return document.layers[objectId];}
	else 
		return false;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function showHideLayers() { //v3.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-1); i+=2) if ((obj=getObject(args[i]))!=null) { v=args[i+1];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//******************* 레이어 처리 함수 끝 *******************/


//******************* 페이지 오픈 관련 함수 시작 ******************* 

//캠퍼스맵 처리 함수
function c_map(){
	win=window.open('./etc/campusmap.html', 'campus_eng', 'width=820,height=600,scrollbars=1');
}

//검색
function ser()
{
     var s = document.ser;
     var key = s.keyword.value;
     if(s.keyword.value == "") {
        alert("keyword required!!");
        s.keyword.focus();
        return;
     }
   
	 
     s.submit();
 }

// 뉴스 & 공지 오픈
function open_news(url)
{
  window.open(url,"notics", 'scrollbars=yes,resizable=no,copyhistory=no,width=600,height=450')
}

function getObject(objectId){
	if(document.getElementById && document.getElementById(objectId)){
		return document.getElementById(objectId);}
	else if(document.all && document.all(objectId)){
		return document.all(objectId);}
	else if(document.layers){
		return document.layers[objectId];}
	else 
		return false;
}

// 교과과정 페이지 열기
function opengyoyuk(object){ 
	window.open('http://www.skku.edu/e-skku-s/SKKUClassSchedule_eng',object, 'scrollbars=yes,resizable=yes,copyhistory=no,width=820,height=600');
}

// 교과과정 페이지 열기(대학원)
function opengyoyuk_grd(object){ 
	window.open('http://www.skku.edu/e-skku-s/homeGyoyuk_graduate_eng',object, 'scrollbars=yes,resizable=yes,copyhistory=no,width=820,height=600');
}

// 
function open_map(){
	var win_map = window.open('/e-home-s/campusmap/swf/main_eng.jsp', 'map', 'scrollbars=no,resizable=no,copyhistory=no,width=995,height=750,top=0,left=0');
	win_map.focus();
}
//******************* 페이지 오픈 관련 함수 끝 *******************/ 


// 홈페이지 검색 스크립트
function search_frm() {
     var s = document.search_frm;
     var query = s.query.value;
     if(s.query.value == "") {
        alert("Enter keyword!!");
        s.query.focus();
        return;
     } // end if
     s.submit();
} // end search_frm
