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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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 MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_jumpMenu_blank(selObj,restore){ //v3.0
  eval("window.open='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function setPng24(obj) { 
  obj.width=obj.height=1; 
  obj.className=obj.className.replace(/\bpng24\b/i,''); 
  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
  obj.src='';  
  return ''; 
} 

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function isAccess(e) {
	
	var keynum;
	var ismouseClick = 1;
	
	if (window.event) {		//IE & Safari
		keynum = e.keyCode;
		
		//Safari의 경우 마우스클릭은 keynum 0 이 넘어옴
		if (event.button == 0 || keynum == 0){
			ismouseClick = 0;
		}		
		
	} else if ( e.which ){		// Netscape/Firefox/Opera
		keynum = e.which;
		
		if (keynum == 1) {
			ismouseClick = 0;
		}		
		
	}
	
	//마우스 클릭이거나 엔터키를 누른경우 true값 반환
	if ( ismouseClick == 0 || keynum == 13 ) {
		return true;
	} else {
		return false;
	}
}

// 좌측 펼침메뉴
/*--  document.all 객체 인식 못할 경우 사용  --*/
/*--  obj = getObject(objectId);  --*/
function getObject(objectId){ // checkW3C DOM, then MSIE 4, then NN 4.
	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 && document.layers[objectId]){	return document.layers[objectId]; }
	else{ return false; }
}
// 매뉴 숨김을 사용할 갯수
var _hiddenmenu = 15;

function userMenu(currMenu)
{
	// 객체 확인 :  브라우저별 객체 확인
	var Obj = getObject(currMenu);

	if (Obj.style.display == "block")	{ Obj.style.display = "none"; }
	else								{ Obj.style.display = "block"; }

	// 선택한 매뉴를 제외한 다른 매뉴는 숨김
	for(i=1; i <= _hiddenmenu; i++)
	{
		// 객체 확인
		var tObj = getObject("stmenu0"+i);
		// 특정 관리자 만이 볼수 있는 매뉴로 인한 확인
		if(tObj){ if( Obj != tObj ){ tObj.style.display = "none"; }}
	}
	return false
}

/* 폰트사이즈  */
//Zoom In & Zoom Out
var zoomRate = 10;            // 확대/축소시 증감률
var maxRate = 300;            //최대확대률
var minRate = 100;            //최소축소률


function GetCookie(name){
    if (document.cookie != "") {
        zoomc = document.cookie.split("; ");
        for (var i=0; i < zoomc.length; i++) {
            zoomv = zoomc[i].split("="); 
            if (zoomv[0] == name) {
                return  unescape(zoomv[1]);
            }
        }
    }else{
        return "";
    }
}
function SetCookie(name,value){
    document.cookie = name + "=" + escape (value)+";";
}
function zoom_body(contentid, how) {
    if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != "" && GetCookie("zoomVal") != "undefined"){
        //document.all[contentid].style.zoom = GetCookie("zoomVal");
		document.body.style.zoom = GetCookie("zoomVal");
        currZoom=GetCookie("zoomVal");
    }
    else{
        //document.all[contentid].style.zoom = '100%'; 
		document.body.style.zoom = '100%'; 
        currZoom = '100%';
    }
    if (((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) {
        return; 
    }
    if (how == "in") {
		//alert(document.body.style.zoom);
        //document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)+zoomRate+'%'
		document.body.style.zoom = parseInt(document.body.style.zoom)+zoomRate+'%';
    }
    else {
        //document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)-zoomRate+'%'
		document.body.style.zoom = parseInt(document.body.style.zoom)-zoomRate+'%';
    }
    SetCookie("zoomVal",document.body.style.zoom);
}

function PageScrap(uid,page,sm){

	if(!uid || uid == "null"){
		alert('로그인 하셔야합니다.');
	}else{
		if (confirm('현재 페이지를 스크랩하시겠습니까?'))
		{
			var objWin = window.open('/pgm/scrap/uaction.jsp?mode=uscrap&uid='+uid+'&page='+page+'&sm='+sm, 'scrapWindow', 'width=0,height=0,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	
			objWin.document.close();
	  }
	}
}


/*quickmenu*/
	String.prototype.toInteger = function() {
		return this.replace(/[^0-9]/g, '') * 1;
	}

	function followBanner(div_id, origin_top, limit_top, margin_top){
		var d, t, s, g, target_height;
		origin_top *= 1;
		limit_top *= 1;
		margin_top *= 1;
		
		d = document.getElementById(div_id);
		s = document.documentElement.scrollTop + "";
		
		target_height = s.toInteger() + margin_top;
		if(target_height < limit_top) {
			target_height = origin_top;
		}
		
		t = d.style.top.toInteger();
		
		if(t != target_height) {
			g = Math.ceil((t - target_height) / 5);
			if(g > 50) {
				g = 50;
			} else if (g < -50) {
				g = -50;
			}
			d.style.top = (t - g) + "px";
		}
		setTimeout("followBanner('"+div_id+"', '"+origin_top+"', '"+limit_top+"', '"+margin_top+"');", 1);
	}
	
	