
function showDate()
{
	var strUrl = '/_include/html/top_date.html';
	var strReturn = unescape(funXMLHTTPReturn("get", "text", strUrl)) ;
	document.write(strReturn);
}
function showSearch()
{
	document.write("<input type='text' name='query2' id='search' size='' class='inp_u' style='margin:0 2 0 5px; border-color:#CBCBCB; width:160px; height:19px; padding-top:2px;'> ");
	document.write("<input type='image' img src='http://images.joins.com/ui_jmn/jsunday07/images/btn_search03.gif' width='35' height='19' align='absmiddle' alt='°Ë»ö' onclick='javascript:search()' style='border:0px'>");
}
function search()
{
	var query= document.getElementById("search").value;
	document.location.href="http://sunday.joins.com/article/search_list.asp?query="+ query+"&news_source=61" ;
}

function showSearch2()
{
	document.write('<select class="topsearch01" ID="news_sch_top" NAME="news_sch"><option value="total" >ÅëÇÕ°Ë»ö</option><option value="content" >±â»çº»¹®°Ë»ö</option><option value="reporter" >ÀÛ¼ºÀÚ°Ë»ö</option><option value="title" >Á¦¸ñ°Ë»ö</option></select><input type="text" name="query2" id="search" size="" class="inp_u" style="margin:0 2 0 5px; border-color:#CBCBCB; width:160px; height:19px; padding-top:2px;">');
	document.write(" <input type='image' img src='http://images.joins.com/ui_jmn/jsunday07/images/btn_search03.gif' width='35' height='19' align='absmiddle' alt='°Ë»ö' onclick='javascript:search2()' style='border:0px'>");
}
function search2()
{
	var news_sch= document.getElementById("news_sch_top").value;
	var query= document.getElementById("search").value;
	document.location.href="http://sunday.joins.com/article/search_list.asp?query="+ query+"&news_source=61&news_sch="+news_sch;
}


function funXMLHTTPReturn(methodOPT, responseType, actionURL){

	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.Open(methodOPT, actionURL, false);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.Send();
	
	switch(responseType.toUpperCase())
	{
		case 'TEXT' :
			return xmlhttp.responseText ;
			break;
	
		case 'XML' :
			return xmlhttp.responseXML ;
			break;
	}
	
	xmlhttp = null;
	
}


// ============================ Cookie °ü·Ã ÇÔ¼ö =============================0
    function delCookie(name,value,expires,path,domain,secure) {
      document.cookie = name + "=" + escape (value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
    }
    
    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));
    }
    
    function getCookie (name) {


		var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
		//alert(document.cookie) 
        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 getCookieA(uName,uName2){		//ÄíÅ°¿­ Áß¿¡ uName2ÀÇ °ªÀ» ±¸ÇÑ´Ù 

		var string = getCookie(uName);

		if(string==null) string="";
		
		// ¼öÁ¤ÄÚµå
		if(string==false) string="";  
	

    	var flag = string.indexOf(uName2+'=');
		if (flag != -1){ 
    		flag += uName2.length + 1
    		end = string.indexOf('&', flag) 
    
    		if (end == -1) end = string.length
    		return unescape(string.substring(flag, end))
    	}else{
			return ""
    	}
    	
    }    
// ============================ Cookie °ü·Ã ÇÔ¼ö =============================0



// ============================ ±âÅ¸ À¯Æ¿ ÇÔ¼ö =============================
    // 9. ÁÂÃø °ø¹é Á¦°Å ÇÔ¼ö
    function Ltrim(strValue){
        while (strValue.length>0){
    		if(strValue.charAt(0)==' '){
    			strValue=strValue.substring(1,strValue.length);              
    		}
    		else
    			return strValue;	    
        }
    	return strValue;
    }
    
    
    // 10. ¿ìÃø °ø¹é Á¦°Å ÇÔ¼ö
    function Rtrim(strValue){
        while (strValue.length>0){
    		if(strValue.charAt(strValue.length-1)==' '){
    			strValue=strValue.substring(0,strValue.length-1);              
    		}
    		else
    			return strValue;	    
    	}
    	return strValue;
    }
    
    
    // 11. ¾çÂÊ °ø¹é Á¦°Å ÇÔ¼ö
    function Trim(strValue){
       strValue = Ltrim(strValue);
       strValue = Rtrim(strValue);
       return strValue;
    }
    
    // "," ¾ø¾Ö´Â ÇÔ¼ö
    function ClearComma(value1){
    	return replace(value1,",","");
    }    
    

    // ReplaceÇÔ¼ö
    function replace(str,otxt,rtxt){
    	if(otxt==rtxt) return str;
    	while(str.indexOf(otxt)>0){
    		str = str.replace(otxt,rtxt);
    	}
    	return str;
    }
    
    
    // select boxÀÇ ¿É¼Çµé ¾ø¾Ö±â
    function DelOption(objname){
    	var obj = document.getElementById(objname);			  
    	while (obj.length>=1)
    		obj.options[0]=null;
    }
    
    // select box¿¡ option Ãß°¡
    function AddOption(objname,value,strtext){
    	var obj = document.getElementById(objname);			  
    	var optobj = new Option(strtext,value,true);
        obj.options[obj.length]=optobj;
    }
    
    // select boxÀÇ Æ¯Á¤ option ¼±ÅÃ
    function SetSelectOption(objname,selectvalue){
    	var obj = document.getElementById(objname);
    	var i;
    
    	for(i=0;i<obj.length;i++){
    		if(obj.options[i].value==selectvalue){			
    			obj.options[i].selected = true;			
    			return;
    		}
    	}
    }    
    


    // ÆË¾÷Ã¢ ¶ç¿ì±â
    function popupWindow(Url,windowName,Width,Height,scroll){
       if((scroll==null) || (scroll=="")){
    	   scroll = "no";
       }
       var win = window.open(Url,windowName,"toolbar=no,location=no,directory=no,status=no,menubar=no,scrollbars="+ scroll +",resizable=no,top=50,left=50,width="+ Width +",height="+ Height);
       if(win!=null) win.focus();
    }
    
    // ÆË¾÷Ã¢ ¶ç¿ì±â(top, left Ãß°¡)
    function popupWindow2(Url,windowName,Top,Left,Width,Height,scroll){
       if((scroll==null) || (scroll=="")){
    	   scroll = "no";
       }
       var win = window.open(Url,windowName,"toolbar=no,location=no,directory=no,status=no,menubar=no,scrollbars="+ scroll +",resizable=no,top="+Top+",left="+Left+",width="+ Width +",height="+ Height);
       if(win!=null) win.focus();
    }
    
    

	    
    
    // ¿øº»¹®ÀÚ¿­¿¡¼­ ÁöÁ¤ÇÑ ¹®ÀÚ¿­ÀÇ °¹¼ö
    function StringCount(sourceStr,findstr){
    	var result = 0;
    	var tmp = "";
    	tmp = sourceStr;
    	while(tmp.indexOf(findstr)>=0){
    		result++;
    		tmp = tmp.substring(tmp.indexOf(findstr)+1,tmp.length);
    	}
    	return result;
    }
    
    
    
    // ¹ÙÀÌÆ® Æ÷ÇÔ ±æÀÌÃ¼Å©
    function chkLen(obj,maxlen){    
        var str,msg; 
        var len = 0; 
        var temp; 
        var count = 0; 
    	var k;
    	
        msg = obj.value; 
        str = new String(msg); 
        len = str.length; 
        for (k=0 ; k<len ; k++){ 
            temp = str.charAt(k);
            if (escape(temp).length > 4){ 
                count += 2; 
            }else if (temp == 'r' && str.charAt(k+1) == 'n') { // rnÀÏ °æ¿ì 
                count += 2; 
            }else if (temp != 'n') { 
                count++; 
            } 
    		if(count>=maxlen){
    			alert(maxlen + "Byte±îÁö¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù");
    			obj.value = str.substring(0,k);
    			return;
    		}
        }
    }
    
    // ¹ÙÀÌÆ® ¼ö
    function getByte(strtext){    
        var str = new String(strtext); 
        var len = str.length; 
    	var k,temp,count=0;	
    
    	for (k=0 ; k<len ; k++){ 
            temp = str.charAt(k);
            if (escape(temp).length > 4){ 
                count += 2; 
            }else if (temp == 'r' && str.charAt(k+1) == 'n') { // rnÀÏ °æ¿ì 
                count += 2; 
            }else if (temp != 'n') { 
                count++; 
            } 
    	}
    	return count;
    }
    
    
    function CheckEssential(formobj, obj){
        var i;
        var tmpcnt;    
        
    	if((obj.type=="text") || (obj.type=="hidden") || (obj.type=="textarea") || (obj.type=="password")){
    		if(Trim(obj.value)=='')
    			return false;
    		else
    			return true;
    	}else if(obj.type=="select-one"){
    		if(obj.value=='')
    			return false;
    		else
    			return true;
    	
        }else if(obj.type=="radio"){	
            tmpcnt = getObjCnt(formobj, obj.name);
            if(tmpcnt==1){
                return obj.checked; 
            }else if(tmpcnt>1){            
                for(i=0;i<tmpcnt;i++){        
                    if(eval("document." + formobj.name + "." + obj.name + "[" + i + "]").checked){
                        return true;                   
                    }   
                }   
                return false;
            }
            return true;
        }
    }
    
    function CheckMaxLen(obj,maxlen){
    	if(getByte(obj.value)>maxlen)
    		return false;
    	else
    		return true;
    }
    
    function CheckNumeric(obj){
    	obj.value = ClearComma(obj.value);
    	if(isNaN(obj.value))
    		return false;
    	else
    		return true;
    }
    
    function CheckValid(formobj,obj){
    	var tmpstr = '';
    	var r_objname = '';
    	var r_maxlen  = 0;	
    	var r_essent  = false;
    	var r_numeric = false;
    
    	var txtvalid = obj.valid;
    	for(var i=0;i<txtvalid.split("|").length;i++){
    		tmpstr = txtvalid.split("|")[i];
    		if(tmpstr.substring(0,1)=="T"){        // ÀÔ·Â°ª ¸í
    			r_objname = tmpstr.split("=")[1];
    		}else if(tmpstr.substring(0,1)=="M"){  // ÃÖ´ë±æÀÌ
    			r_maxlen = tmpstr.split("=")[1];
    		}else if(tmpstr.substring(0,1)=="E"){  // ÇÊ¼öÇ×¸ñÀÓ
    			r_essent = true;
    		}else if(tmpstr.substring(0,1)=="N"){  // ¼ýÀÚ¸¸ ÀÔ·Â°¡´É
    			r_numeric = true;
    		}
    	}
    	if(r_essent){
    		if(!CheckEssential(formobj,obj)){
    			alert( '"' + r_objname + '" Àº(´Â) ÇÊ¼ö Ç×¸ñÀÔ´Ï´Ù ');
    			obj.focus();
    			return false;
    		}
    	}
    	if(parseInt(r_maxlen)>0){
    		if(!CheckMaxLen(obj,r_maxlen)){
    			alert('"' + r_objname + '" Àº(´Â) ÃÖ´ë '+ r_maxlen+' byte ±îÁö ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.\n\nÇöÀç±æÀÌ: ' + getByte(obj.value) + ' byte');
    			obj.focus();
    			return false;
    		}
    	}
    	if(r_numeric){
    		if(!CheckNumeric(obj)){
    			alert('"' + r_objname + '" Àº(´Â) ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.');
    			obj.focus();
    			return false;
    		}
    	}
    	return true;
    }
    
    
    // ÀÔ·Â°ªµé Ã¼Å©ÈÄ¿¡ true,false ¸®ÅÏ
    function checkForm(frmobj){
    	with(frmobj){
    		for(var i=0; i<elements.length; i++) {
    			if(elements[i].valid!=null){				
    				var ret = CheckValid(frmobj,elements[i]);
    				if(ret==false) return ret;
    			}
    		}
    		return true;
    	}
    }
    
    
    function ReplaceString(sTxt,sFindTxt1,sFindTxt2,sReplaceStr){    
    	var iLoc1 = sTxt.indexOf(sFindTxt1);    
    	if(iLoc1 < 0){	
    		return sTxt;
    	}    	
    	var	sTmp1 = sTxt.substring( 0,iLoc1 + sFindTxt1.length);
    	var	sTmp2 = sTxt.substring(iLoc1+sFindTxt1.length );
    	
    	var	iCnt = sTmp2.indexOf(sFindTxt2);     	
    	if(iCnt < 0 ){	
    		return sTxt;
    	}
    		
    	var	sTmp3 = sTmp2.substring(iCnt);
    	var	sTmp2 = sTmp2.substring(0,iCnt);
    	return sTmp1 + sReplaceStr + sTmp3;
    }
    
    function getStrBetween(sTxt,sStartTag,sEndTag){
      	var iLoc1 = sTxt.indexOf(sStartTag);    
      	var iLoc2 = sTxt.indexOf(sEndTag);
        
        return sTxt.substring(iLoc1,iLoc2-iLoc1+1);      	
        
    }
    
    // ±â»ç¾ÈÀÇ ÀÌ¹ÌÁö Resizing
    /*
    function setArticleImgSize(){
        if(document.readyState=="complete"){            
            if(document.all.autoresizeimg!=null){
                if(document.all.autoresizeimg.length==null)
                    resizeArticleImg(document.all.autoresizeimg);
                else{
                    for(i=0;i<document.all.autoresizeimg.length;i++){
                        resizeArticleImg(document.all.autoresizeimg[i]);
                    }
                }                    
            }
        }            
    }
    
    function resizeArticleImg(obj){
    	if(obj.maxwidth!=null)
	        if(obj.width>eval(obj.maxwidth)) obj.width=obj.maxwidth;
    	if(obj.maxheight!=null)
	        if(obj.height>eval(obj.maxheight)) obj.height=obj.maxheight;
	        
    }    
    var imgResizingtimer = setInterval("setArticleImgSize()",100);
    */
    
    function flash(url, width, height){
		document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+ width +"' height='"+ height +"' align='middle'>");
		//document.write("<param name='allowScriptAccess' value='sameDomain' />");
		document.write("<param name='movie' value='"+ url +"' />");
		document.write("<param name='quality' value='high' />");
		document.write("<param name='wmode' value='transparent' />");
		document.write("<param name='bgcolor' value='#ffffff' />");
		document.write("<embed src='"+ url +"' quality='high' wmode='transparent' bgcolor='#ffffff' width='"+ width +"' height='"+ height +"' name='en_cartoon' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
		document.write("</object>");
    }
    
    
//----------------------------------------------------
// ************** ±â»ç °ü·Ã ÇÔ¼ö ****************   
//----------------------------------------------------    
    var arrFontSize   = [12,14,16,18,20,24];
    var arrLineHeight = [19,21,23,27,30,32];

    var article_fontSize = parseInt(getCookie("article_fontSize"));

    function fontPlus() {		        
    	if (article_fontSize < (arrFontSize.length-1)) {
    		article_fontSize = article_fontSize + 1; 
    		setFont(article_fontSize); 
    	}
    }
    
    function fontMinus() {
    	if(article_fontSize > 0){
    		article_fontSize = article_fontSize - 1; 
    		setFont(article_fontSize); 
    	}
    }       

    function initFont(){ 

	    if (isNaN(article_fontSize) == true) {
		    article_fontSize = 2;	
	    }else if(eval(article_fontSize)>=arrFontSize.length){
	        article_fontSize = 2;	
        }
	    setFont(article_fontSize);
    }

    function setFont(article_fontSize){ 	
		            
	    document.getElementById("articleBody").style.fontSize = arrFontSize[article_fontSize]+"px";
	    document.getElementById("articleBody").style.lineHeight = arrLineHeight[article_fontSize] + "px";
	    setFontCookie(article_fontSize);
    }	

    function setFontCookie(article_fontSize) {

    	var expiry = new Date();
    	var path = "/";
    	var domain = document.domain;
    	var secure = "";
    	
	    expiry.setTime(expiry.getTime() + 90 * (24 * 60 * 60 * 1000));
	    setCookie("article_fontSize",article_fontSize,expiry,path,domain,secure);
    }    
    
    
    function ArticlePrint(){
        popupWindow("http://sunday.joins.com/article/print.asp","print",732,650,"yes");
    }

    function ArticlePrint2(){

        popupWindow("http://sunday.joins.com/article/print_20080318.asp","print",732,650,"yes");

    }

    function ArticleEmail(){
        popupWindow("http://sunday.joins.com/article/mail.asp","email",510,560,"no");
    }    

    function MoveList(toSite){

		if(toSite!=''){
			location.replace("http://sunday.joins.com/article/list.asp" + toSite );   		
		}else{
			location.replace("http://sunday.joins.com/article/list.asp");   				
		}
	}
    function createHttpRequest(){
        if(window.ActiveXObject){
            try{
                return new ActiveXObject("Msxml2.XMLHTTP");
            }catch(e){
                try{
                    return new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e2){
                    return null;
                }
            }       
        }else if(window.XMLHttpRequest){
            /*
            try{ 
                netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
            } catch (e){ 
                alert('Permission UniversalBrowserRead denied.');
            } 
            */               
            return new XMLHttpRequest();    
        }else{
            return null;    
        }    
    }
        
    
    
    // ¼­ºñ½º¸â¹ö È¸¿øÀ¸·Î °¡ÀÔµÇ¾ú´ÂÁö È®ÀÎ
    function CheckMemberReg(serviceflag){            
        if(serviceflag==null) serviceflag = "";
        
        if(getCookieA("MemArray","MemID")==""){
            location = "https://jjlogin.joins.com/login_sunday/login_id.asp?retURL="+ escape(location.href);
            return;
        }else{
            var xmlhttp = false;
            xmlhttp = createHttpRequest();    
            if(!xmlhttp) return "Your browser is not supported";            
    
            xmlhttp.open("GET", "http://sunday.joins.com/etc/member/check_register.asp?mode="+ serviceflag, false);
            xmlhttp.send(null);
            if(xmlhttp.responseText=="N"){
                popupWindow("/etc/member/agree.html","member",420,300,"no");
                return false;    
            }else    
                return true;
        }            
    }  
    

    