﻿function linkZoneBtn(){
	var root = KR('#linkZoneBtn');
	var btn = root.child("li > a");
	var div = root.child("li > div");
	var close = root.find('span.closeBtn a')

	root.child("li > a").evt('click', function () {
	    div.nth(this.n).show().animate({ opacity: 1 }, 0.5);
	});
	close.evt('click',function(){
		div.css({opacity:0.01}).hide()
	})
		div.css({opacity:0.01}).hide()
}

		
var popTimer,popLength ,popupNum
function popupzon(){
	var start = function(){
		popTimer = setInterval(function(){
			var now = popupNum%popLength;
			KR('#popupBtnBox').child('li >a')[now].focus();
			popupNum++;
		},10000)
	}
	KR('#popupBtnBox').child('li img').each(function(){
		this.onmouseover = function(){
			clearInterval(popTimer);
			this.onmouseout = function(){
				start();
			}
		}	
	});
	start();
};

    
    var zoomRate = 10;
    var maxRate = 160;
    var minRate = 100;

    //initZoomDisplay();     
	
	function zoomInOut(contentid, how) {			
			
		if(gCookie("zoomVal") != null && gCookie("zoomVal") != ""){
			document.all[contentid].style.zoom = gCookie("zoomVal");
			//document.body.style.zoom = gCookie("zoomVal");
			currZoom=gCookie("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") {
			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+'%'
		}

        sCookie("zoomVal", document.all[contentid].style.zoom, 1);
	}

	function sCookie( name, value, expiredays ){
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" ;
	}
	
	function gCookie( name )
	{
	        var nameOfCookie = name + "=";
	        var x = 0;
	        while ( x <= document.cookie.length )
	        {
	                var y = (x+nameOfCookie.length);
	                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
	                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
	                                endOfCookie = document.cookie.length;
	                        return unescape( document.cookie.substring( y, endOfCookie ) );
	                }
	                x = document.cookie.indexOf( " ", x ) + 1;
	                if ( x == 0 )
	                        break;
	        }
	        return "";
	    }

	function dCookie(cookieName) {
	    var expireDate = new Date();
	    //어제 날짜를 쿠키 소멸 날짜로 설정한다.
	    expireDate.setDate(expireDate.getDate() - 1);
	    document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
	}

	
	function GoZoom(contentid){
		if(gCookie("zoomVal") != null && gCookie("zoomVal") != ""){
			document.all[contentid].style.zoom = gCookie("zoomVal");
			//document.body.style.zoom = gCookie("zoomVal");
			currZoom=gCookie("zoomVal");
		}
		else{
			document.all[contentid].style.zoom = '100%'; 
			//document.body.style.zoom = '100%'; 
			currZoom = '100%';
		}
	}
	
	function initZoomDisplay(){
		var currZoom = "100%" ;		
		if(gCookie("zoomVal") != null && gCookie("zoomVal") != ""){
			currZoom=gCookie("zoomVal");
		}
        //document.body.style.zoom = currZoom;
		document.all[contentid].style.zoom = currZoom;
	};
