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,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

var article_fontSize = parseInt(getCookie("article_fontSizePx")); 		

function initFont() { 

	if (isNaN(article_fontSize) == true) {
		article_fontSize = 4;	
	}
	
	setFont(article_fontSize);
}

function setFont(article_fontSize) { 		
	
	document.getElementById("articleBody").className = "article0"+article_fontSize;
	//document.getElementById("articleBody").style.fontSize = article_fontSize+"pt";

	setFontCookie(article_fontSize);
}	

function setFontCookie(article_fontSize) {

	var expiry = new Date();
	var path = "/";
	var domain = ".joins.com";
	var secure = "";


	//expiry.setTime(expiry.getTime() + 90 * (24 * 60 * 60 * 1000));
	expiry.setDate(expiry.getDate() + 90);

	setCookie("article_fontSizePx",article_fontSize,expiry,path,domain,secure);
}	

//¸ÞÀÏ
function sendemail(retP) {

	var sWinName = "emailarticle";
	var cScroll = 0;
	var cResize = 0;
	var cTool = 0;
	var sWinopts = 'left='+0+', top='+0+', width='+370+',height='+495+', scrollbars='+cScroll+', resizable='+cResize;

	var theForm = document.frmSaveBlog;			
	window.open("about:blank",sWinName,sWinopts); 
	//theForm.action = "/email/email_article.asp?strTotalID="+retP;
	theForm.action = "http://article.joins.com/email/email_article.asp?Total_ID="+retP;
	theForm.target = sWinName;
	theForm.submit();

}

//ÀÎ¼â
function sendprint(aid,ctg) {

	var sWinName = "printarticle";
	var cScroll = 1;
	var cResize = 1;
	var cTool = 1;
	var sWinopts = 'left='+0+', top='+0+', width='+650+', scrollbars='+cScroll+', resizable='+cResize;
	//window.open('/2006/'+type+'/print.asp?AID='+aid,sWinName,sWinopts);	
	window.open('http://article.joins.com/article/print.asp?ctg='+ctg+'&AID='+aid,sWinName,sWinopts);	
}

//ºí·Î±×
function saveblog(aid,cid,master_code,gubun) {

	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;		
	
	var theForm = document.frmSaveBlog;			
	theForm.action = "http://blog.joins.com/center/joins/outbound_scrap_pre.asp";

	theForm.user_id.value = getCookie("Joins_MemID");

	var Blog = window.open("about:blank","Blog","toolbar=no, location=0, directory=no, status=no, menubar=no, scrollbars=no, resizable=yes, top=200, left=350, width=200, height=200");      
	theForm.target = "Blog";


	if ( document.getElementById("scrap")!=null) {
		if(isIE)	scrap.location.href="http://service2.joins.com/counter/article_count2006.asp?Total_ID="+aid+"&Ctg_ID="+cid+"&Master_Code="+master_code+"&gubun="+gubun;
	}

	theForm.submit();
}   

function fontPlus() {		        
	if (article_fontSize < 6) {
		article_fontSize = article_fontSize + 1; 
		setFont(article_fontSize); 
	}
}

function fontMinus() {
	if (article_fontSize > 1) {
		article_fontSize = article_fontSize - 1; 
		setFont(article_fontSize); 
	}
}   



// Elis ¸ð¹ÙÀÏ Àü¼Û
function sendmobile(aid,ctg) {

	var sWinName = "mobilearticle";
	var cScroll = 0;
	var cResize = 1;
	var cTool = 1;
	var sWinopts = 'left='+0+', top='+0+', width='+710+', height='+690+',  scrollbars='+cScroll+', resizable='+cResize;
	//window.open('http://article01.joins.com/cp/send_article.asp?ctg='+ctg+'&AID='+aid,sWinName,sWinopts);	
	window.open('http://ec.512.co.kr/web/link.jsp?mcode=10151&nid='+aid,sWinName,sWinopts);	
}
