function setCookie(name,value,expires) {
	document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString()));
}

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){
			var end = document.cookie.indexOf(";",j);
			if(end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(j,end));
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}

function MenuChange( layerID ) {
    news_objs[0] != null ? "" : news_getObjs();
    if( layerID == news_objs[0].id ) {
        news_objs[0].style.display = "";
        news_objs[1].style.display = "none";
        news_objs[2].style.display = "none";
    } else if( layerID == news_objs[1].id ) {
        news_objs[0].style.display = "none";
        news_objs[1].style.display = "";
        news_objs[2].style.display = "none";
    } else if( layerID == news_objs[2].id ) {
        news_objs[0].style.display = "none";
        news_objs[1].style.display = "none";
        news_objs[2].style.display = "";
    }
}

function search() {
        if(document.searchform.kw.value == '')
        {
                alert('°Ë»ö ¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
                return false;
        }
        return true;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function getFontCookie() {
	var cookie = getCookie("cur_font_size");
	if ( cookie == null ) return 13;
	if ( cookie.length ) return cookie;
	else return 13;
}

function scaleFont(val) {
	var content, lineHeight;
	content = document.getElementById("content");
	if (val > 0){
		if (fontSize <= 18) {
			fontSize = fontSize + val;
			lineHeight = fontSize+Math.round(1.1*fontSize);
			content.style.fontSize = fontSize + "px";
		}
		
	} else {
		if (fontSize > 13) {
			fontSize = fontSize + val;
			lineHeight = fontSize+Math.round(1.1*fontSize);
			content.style.fontSize = fontSize + "px";
		}
	}
	var mydate = new Date;
	mydate.setDate(mydate.getDate()+1000);
	setCookie("cur_font_size", fontSize, mydate);
}
var fontSize = parseInt(getFontCookie());


// ±â»ç¸ÞÀÏº¸³»±â
function GisaMail(uid) {
        var Cookievalue;
        var urls = location.host + location.pathname + location.search;
        Cookievalue = GetCookie('mlogin_cookie');
        if(Cookievalue == "") {
                alert("È¸¿ø·Î±×ÀÎÀ» ÇÏ¼Å¾ß º¼¼ö ÀÖ´Â ÆäÀÌÁö ÀÔ´Ï´Ù.");
                location.href="http://member.hankooki.com/member/login.php?path=0635&url=" + urls;
        }else{
                mailurl = "http://www.hankooki.com/common/GisaMail/GisaMailForm.php?uid="+uid;
                window.open(mailurl, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=100,top=10,width=602,height=390');
        }
}




// ÇÁ¸°Æ®
function PrintOpen(srcurl){
        printurl = "http://weekly.hankooki.com/service/print/Print.php?po="+srcurl;
        window.open(printurl, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=100,top=10,width=700,height=758');
}

var ad_rlast = "";
document.write("<iframe id=view_chk src=\"http://weekly.hankooki.com/js/ad/view_check.htm\" frameborder=0 marginwidth=0 marginheight=0 topmargin=0 style=\"width:0;height:0\" scrolling=\"no\"></iframe>");




function loadGisaUtil(wh)		// iframe ¹æ½ÄÀ¸·Î php¿¡¼­ ¸®½ºÆ® ÆäÀÌÁö ºÒ·¯¿È.  xml ÆÄÀÏ »ý¼º
{ 
	var gisa_util = "";
	gisa_util = gisa_util + "<table width='' border='0' cellpadding='0' cellspacing='0'>";
	gisa_util = gisa_util + "<tr>";
	gisa_util = gisa_util + "<td><a href=\"javascript:scaleFont(1);\"><img src='http://img.hankooki.com/weekly/200603/icon_large.gif' border='0'></a></td>";
	gisa_util = gisa_util + "<td><a href=\"javascript:scaleFont(-1);\"><img src='http://img.hankooki.com/weekly/200603/icon_little.gif' border='0'></a></td>";


	gisa_util = gisa_util + "<td><a href=\"javascript:PrintOpen('"+gsurl+"')\"><img src='http://img.hankooki.com/weekly/200603/etc_img20.gif' border='0'></a></td>";


//	gisa_util = gisa_util + "<td><a href=\"javascript:PrintOpen('"+gsurl+"')\"><img src='http://img.hankooki.com/weekly/200603/icon_print.gif' border='0'></a></td>";

/*
	gisa_util = gisa_util + "<td><a href=\"javascript:GisaMail('"+uid+"')\"><img src='http://img.hankooki.com/weekly/200603/icon_sendingmail.gif' border='0'></a></td>";
*/

	gisa_util = gisa_util + "</tr>";
	gisa_util = gisa_util + "</table>";

	if(document.getElementById(wh)) {
		document.getElementById(wh).innerHTML = gisa_util;		
	}

}

