// ÄíÅ° ÀúÀå ¹× ÀÐ±â
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 SetCookie(name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : "/";
	var domain = (argc > 4) ? argv[4] : ".cafe24.com";
	var secure = (argc > 5) ? argv[5] : false;
	
	document.cookie = name + "=" + escape(value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}
function setCookie( name, value, expiredays )
{
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

// ³»¼³Á¤ ºÒ·¯¿Í Àû¿ëÇÏ±â, È®´ë, Ãà¼Òµî
var fontSize = eval(GetCookie('fontsize'));

if(fontSize == null) fontSize = 14;

function setFont(fontSize) { 
	obj = document.getElementById("view_body");
	obj.style.fontSize = fontSize + "px";
	SetCookie("fontsize", fontSize);
}

function fontPlus() { 
	if (fontSize < 20) {
		fontSize = fontSize + 1; 
		setFont(fontSize); 
	} 
}

function fontMinus() { 
	if (fontSize > 12) {
		fontSize = fontSize - 1; 
		setFont(fontSize); 
	} 
}
function view_setting() {
	setFont(fontSize);
}

function print_win(tbl,uid) {
	WIDTH = 660;
	HEIGHT= 500;
	URL = "/print.php?tbl=" + tbl + "&uid=" + uid;
	abs_left = screen.WIDTH / 2 - (WIDTH / 2);
	abs_top = screen.Height / 2 - (HEIGHT / 2);
        windowprops = "left=" + abs_left + " ,top=" + abs_top + ",width=" + WIDTH + ",height=" + HEIGHT + ",resizable=no,scrollbars=yes,status=no,menubar=no,toolbar=no,location=no,directories=no";
        pop_win = window.open(URL, "print" , windowprops);
        pop_win.focus();
}

function media_win(media_url) {
	WIDTH = 472;
	HEIGHT= 434;
	URL = "/media_player.php?media_url=" + media_url;
	abs_left = screen.WIDTH / 2 - (WIDTH / 2);
	abs_top = screen.Height / 2 - (HEIGHT / 2);
        windowprops = "left=" + abs_left + " ,top=" + abs_top + ",width=" + WIDTH + ",height=" + HEIGHT + ",resizable=no,scrollbars=no,status=no,menubar=no,toolbar=no,location=no,directories=no";
        pop_win = window.open(URL, "media" , windowprops);
        pop_win.focus();
}

function music_win(media_url) {
	WIDTH = 472;
	HEIGHT= 165;
	URL = "/music_player.php?media_url=" + media_url;
	abs_left = screen.WIDTH / 2 - (WIDTH / 2);
	abs_top = screen.Height / 2 - (HEIGHT / 2);
        windowprops = "left=" + abs_left + " ,top=" + abs_top + ",width=" + WIDTH + ",height=" + HEIGHT + ",resizable=no,scrollbars=no,status=no,menubar=no,toolbar=no,location=no,directories=no";
        pop_win = window.open(URL, "music" , windowprops);
        pop_win.focus();
}

function word_win(location, uid) {
	WIDTH = 472;
	HEIGHT= 458;
	URL = "/song_word.php?location=" + location + "&uid=" + uid;
	abs_left = screen.WIDTH / 2 - (WIDTH / 2);
	abs_top = screen.Height / 2 - (HEIGHT / 2);
        windowprops = "left=" + abs_left + " ,top=" + abs_top + ",width=" + WIDTH + ",height=" + HEIGHT + ",resizable=no,scrollbars=no,status=no,menubar=no,toolbar=no,location=no,directories=no";
        pop_win = window.open(URL, "word" , windowprops);
        pop_win.focus();
}

function scrap_win(tbl,uid) {
	WIDTH = 300;
	HEIGHT= 200;
	URL = "/scrap.php?tbl=" + tbl + "&uid=" + uid;
	abs_left = screen.WIDTH / 2 - (WIDTH / 2);
	abs_top = screen.Height / 2 - (HEIGHT / 2);
        windowprops = "left=" + abs_left + " ,top=" + abs_top + ",width=" + WIDTH + ",height=" + HEIGHT + ",resizable=no,scrollbars=no,status=no,menubar=no,toolbar=no,location=no,directories=no";
        pop_win = window.open(URL, "scrap" , windowprops);
        pop_win.focus();
}


