var zoomRate = 20;
var maxRate = 300;
var minRate = 100;
document.body.style.zoom = '100%'; 
var currZoom = '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 GoZoom(){
        if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
            document.body.style.zoom = GetCookie("zoomVal");
            currZoom=GetCookie("zoomVal");
        }
        else{
            document.body.style.zoom = '100%'; 
            currZoom = '100%';
        }
    }
//window.onload=GoZoom;
    //Zoom In & Zoom Out
    function zoomInOut(contentid, how) {

/*        if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
            document.body.style.zoom = GetCookie("zoomVal");
            currZoom=GetCookie("zoomVal");
        }
        else{
			document.body.style.zoom = '100%'; 
			currZoom = '100%';
        }
*/
        if (((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) 
		{
            return; 
        }
        if (how == "in") 
		{
            document.body.style.zoom = parseInt(document.body.style.zoom)+zoomRate+'%';
			currZoom = parseInt(currZoom)+zoomRate+'%';
		}
        else 
		{
            document.body.style.zoom = parseInt(document.body.style.zoom)-zoomRate+'%'
			currZoom = parseInt(currZoom)-zoomRate+'%';
		}
       // SetCookie("zoomVal",document.body.style.zoom);
    }

    //    +, - key event
    /*document.onkeypress = getKey;
    
    function getKey(keyStroke) {
        isNetscape=(document.layers);
        eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
        which = String.fromCharCode(eventChooser).toLowerCase();
        which2 = eventChooser;

        var el=event.srcElement;

        if ((el.tagName != "INPUT") && (el.tagName != "TEXTAREA"))        //input,textarea ¾È¿¡¼­ÀÇ +.-°ªÀº ½ÇÇà¾ÈµÇµµ·Ï
        {            
            if(which == "+" )
                zoomInOut('zoom', 'in');
            else if(which == "-" )
                zoomInOut('zoom', 'out');
        }
    }
    */
    function jsiPrint()
    {
        var width = 730;
        var height = 350;
        var x, y;
        var screen_width  = screen.width;
        var screen_height = screen.height;
        x = (screen_width  / 2) - (width  / 2);
        y = (screen_height / 2) - (height / 2);
        var pop = window.open ( "./for_print.jsp","print","width=" + width + ", height=" + height + ", left=" + x + ", top=" + y + ", toolbar=no, status=no, menubar=no, scrollbars=yes, resizable=yes");
        pop.focus();
        return;
    }
        

//ÆùÆ®Å©±â 
function zoomInOut2(a) {
	var defaultFontSize = 1;//em
	var minFontSize = 1;//em
	var maxFontSize = 2;//em
	obj = document.getElementById("contents");
	var objFontSize = obj.style.fontSize;
	var objLineHeight = obj.style.lineHeight;

	if (!objFontSize) { objFontSize = parseFloat(defaultFontSize)+"em"; }
	var checkFontSize = (Math.round(12*parseFloat(objFontSize))+(a*2))/12;
	if (checkFontSize >= maxFontSize) { checkFontSize = maxFontSize; obj.style.fontSize = checkFontSize+"em"; }
	else if (checkFontSize <= minFontSize) { checkFontSize = minFontSize; obj.style.fontSize = checkFontSize+"em";  }
	else { obj.style.fontSize = checkFontSize+"em"; }
//	alert(checkFontSize);
}

function zoomInOutM(a) {
	var defaultFontSize = 1;//em
	var minFontSize = 1;//em
	var maxFontSize = 2;//em
	obj = document.getElementById("mContain");
	var objFontSize = obj.style.fontSize;
	var objLineHeight = obj.style.lineHeight;

	if (!objFontSize) { objFontSize = parseFloat(defaultFontSize)+"em"; }
	var checkFontSize = (Math.round(12*parseFloat(objFontSize))+(a*2))/12;
	if (checkFontSize >= maxFontSize) { checkFontSize = maxFontSize; obj.style.fontSize = checkFontSize+"em"; }
	else if (checkFontSize <= minFontSize) { checkFontSize = minFontSize; obj.style.fontSize = checkFontSize+"em";  }
	else { obj.style.fontSize = checkFontSize+"em"; }
//	alert(checkFontSize);
}

function zoomInOutM2(a) {
	var defaultFontSize = 1;//em
	var minFontSize = 1;//em
	var maxFontSize = 2;//em
	obj = document.getElementById("mContain01");
	var objFontSize = obj.style.fontSize;
	var objLineHeight = obj.style.lineHeight;

	if (!objFontSize) { objFontSize = parseFloat(defaultFontSize)+"em"; }
	var checkFontSize = (Math.round(12*parseFloat(objFontSize))+(a*2))/12;
	if (checkFontSize >= maxFontSize) { checkFontSize = maxFontSize; obj.style.fontSize = checkFontSize+"em"; }
	else if (checkFontSize <= minFontSize) { checkFontSize = minFontSize; obj.style.fontSize = checkFontSize+"em";  }
	else { obj.style.fontSize = checkFontSize+"em"; }
//	alert(checkFontSize);
}
