// ³»¼³Á¤ ºÒ·¯¿Í Àû¿ëÇÏ±â, È®´ë, Ãà¼Òµî

var fontSize   = eval(getCookie('fontsize'));
var lineHeight = eval(getCookie('lineheight'));
if(fontSize == null)   fontSize   = 12;
if(lineHeight == null) lineHeight = 22;
if(fontSize == "0")      fontSize   = 12;
if(lineHeight == "0")    lineHeight = 22;

function setFont(fontSize) { 
	document.getElementById("setViewBody").style.fontSize = fontSize + "px";
	SetCookie("fontsize", fontSize, 1);
}

function setLineHeight(lineHeight) { 
	document.getElementById("setViewBody").style.lineHeight = lineHeight + "px";
	SetCookie("lineheight", lineHeight, 1);
}

function fontPlus() { 
	if (fontSize < 20) {
		fontSize = fontSize + 1; 
		setFont(fontSize); 
	} 
}

function fontMinus() { 
	if (fontSize > 10) {
		fontSize = fontSize - 1; 
		setFont(fontSize); 
	} 
}

function linePlus() { 
	if (lineHeight < 30) {
		lineHeight = lineHeight + 1; 
		setLineHeight(lineHeight); 
	} 
}

function lineMinus() { 
	if (lineHeight > 16) {
		lineHeight = lineHeight- 1; 
		setLineHeight(lineHeight); 
	} 
}

function view_bsetting() {
	fontSize = 14;
	lineHeight = 22;
	setFont(fontSize);
	setLineHeight(lineHeight);
}

function view_setting() {
	setFont(fontSize);
	setLineHeight(lineHeight);
}

function view_save() {
	obj = document.getElementById("setViewBody");
	SetCookie("fontsize", fontSize, 1);
	SetCookie("lineheight", lineHeight, 1);
	alert("³»¼³Á¤ÀÌ ÀúÀåµÇ¾ú½À´Ï´Ù. ÀÌÈÄ ·Î±×ÀÎ½Ã¿¡µµ Çö ¼³Á¤ÀÌ Àû¿ëµË´Ï´Ù.");
}


// ÄíÅ° ÀúÀå ¹× ÀÐ±â
function getCookie(name)
{ 
	var Found = false
	var start, end 
	var i = 0 

	// cookie ¹®ÀÚ¿­ ÀüÃ¼¸¦ °Ë»ö 
	while(i <= document.cookie.length)
	{ 
		start = i 
		end = start + name.length

	// name°ú µ¿ÀÏÇÑ ¹®ÀÚ°¡ ÀÖ´Ù¸é
		if(document.cookie.substring(start, end) == name)
		{ 
			Found = true
			break
		}
	
		i++
	} 

	// name ¹®ÀÚ¿­À» cookie¿¡¼­ Ã£¾Ò´Ù¸é 
	if(Found==true)
	{ 
		start=end+1 
		end=document.cookie.indexOf(";",start) 
		
		// ¸¶Áö¸· ºÎºÐÀÌ¶ó´Â °ÍÀ» ÀÇ¹Ì
		if(end< start) 
			end = document.cookie.length 
		
		// name¿¡ ÇØ´çÇÏ´Â value°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏÇÑ´Ù. 
		return document.cookie.substring(start,end) 
	}
	 
	// Ã£Áö ¸øÇß´Ù¸é 
	return "" 
} 

function SetCookie( name, value, expiredays )
{
    var todayDate = new Date();
    todayDate.setDate( todayDate.getDate() + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

