function goHome()
{
    document.location = "/";
}

function trim(txt){
	if (txt == '')
		return '';
	//txt = txt.replace (' ','');
	txt = txt.replace (/\s+/g, ' ');		// 
	txt = txt.replace (/^\s*|\s*$/g, "");	// trim
	txt = txt.replace ("*","");
	txt = txt.replace (" ","+");
	return txt;
}

function goARSearch() {
  var f = document.search_form;

  
  if(trim(f.searchStr.value)==""){
  	 alert("°Ë»ö¾î¸¦ ÀÔ·Â ÇÏ¿© ÁÖ½Ê½Ã¿ä.");
  	 f.searchStr.focus();
  	 return;
  }else{
	f.tmpsearchStr.value = trim(f.searchStr.value);
	
	f.submit();
  }
}

function login_function() {
   var fam;

   var id = getCookieLogin("MEM_ID");
   var name = getCookieLogin("MEM_NAME");
   var str_name = "";
      
//   str_name = name + " ´Ô È¯¿µÇÕ´Ï´Ù.";

   if (id==""){
       fam = '\
           <li class="line_none"><a Onclick="goSubscription()" style="cursor:pointer">±¸µ¶½ÅÃ»</a></li>\
           <li><a Onclick="goLogin()" style="cursor:pointer;">·Î±×ÀÎ</a></li>\
           <li><a href="/members/member_reg.htm">È¸¿ø°¡ÀÔ</a></li>\
       ';
   }else{
       fam = '\
          <li class="line_none">'+str_name+'</li>\
          <li><a Onclick="goSubscription()" style="cursor:pointer">±¸µ¶½ÅÃ»</a></li>\
          <li><a Onclick="goLogOut()" style="cursor:pointer">·Î±×¾Æ¿ô</a></li>\
          <li><a href="/members/member_form.htm?mode=edit">Á¤º¸¼öÁ¤</a></li>\
       ';
   }
   
   login_frm.innerHTML = fam;
}

function goLogin() {

	document.location = "/members/login.htm";
}

function goLogOut() {
  document.location = "/members/logout.htm";
}

function chkIDPattern(id)
{
    var txtID = id;

    //¾ÆÀÌµð ±æÀÌ 4 ÀÌ»ó
    if (txtID.length < 4 )
    {
       alert("ÀÔ·ÂÇÑ ¾ÆÀÌµð°¡ 4ÀÚ¸®º¸´Ù Âª½À´Ï´Ù.");                       
       return false;
    }
    
    //¾ÆÀÌµð ±æÀÌ 15 ÀÌÇÏ
    if(txtID.length > 15)
    {
       alert("ÀÔ·ÂÇÑ ¾ÆÀÌµð°¡ 15ÀÚ¸®¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù.");                       
       return false;
    }    
    
    chk0 = /(^[a-zA-Z]+$)/; 
    chk1 = /^[a-zA-Z\d]{8,12}$/g;  //a-z¿Í 0-9ÀÌ¿ÜÀÇ ¹®ÀÚ°¡ ÀÖ´ÂÁö È®ÀÎ
    chk2 = /[a-zA-Z]/i;  //Àû¾îµµ ÇÑ°³ÀÇ a-z È®ÀÎ
    chk3 = /\d/;  //Àû¾îµµ ÇÑ°³ÀÇ 0-9 È®ÀÎ
    
	  if (!chk0.test(txtID.substring(0,1))) { 
	  	alert("¾ÆÀÌµð Ã¹±ÛÀÚ´Â ¿µ¹®ÀÌ¾î¾ßÇÕ´Ï´Ù.");
	  	return false;
	  }
	    
    if(chk2.test(txtID) == false || chk3.test(txtID) == false)
    {
       alert("¾ÆÀÌµð´Â ¿µ¹®, ¼ýÀÚ°¡ Á¶ÇÕµÇ¾î¾ß ÇÕ´Ï´Ù.")
       return false;
    }
    //»ç¿ë°¡´ÉÇÑ ¹®ÀÚ Ã¼Å©
    var ableCharacter = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_#*^@";

    for (var i = 0; i < txtID.length; i++)  
    {  
       if(txtID.charAt(i) ==" ")
       {
          alert("Çã¿ëµÇÁö ¾Ê´Â ¹®ÀÚ¸¦ ÀÔ·Â ÇÏ¼Ì½À´Ï´Ù.[°ø¹é(½ºÆäÀÌ½º)]");
          return false;
       }
       else if (ableCharacter.indexOf(txtID.charAt(i)) == -1) 
       {
          alert("Çã¿ëµÇÁö ¾Ê´Â ¹®ÀÚ¸¦ ÀÔ·Â ÇÏ¼Ì½À´Ï´Ù.["+txtID.charAt(i)+"]");
          return false;
       }
     }
         
    return true;
}

function chkPassPattern(pass)
{
    var txtPassword = pass;


    //ºñ¹Ð¹øÈ£ ±æÀÌ 6 ÀÌ»ó
    if (pass.length < 6 )
    {
       alert("ÀÔ·ÂÇÑ ºñ¹Ð¹øÈ£°¡ 6ÀÚ¸®º¸´Ù Âª½À´Ï´Ù.");                       
       return false;
    }

    //ºñ¹Ð¹øÈ£ ±æÀÌ 15 ÀÌÇÏ
    if(pass.length > 15)
    {
       alert("ÀÔ·ÂÇÑ ºñ¹Ð¹øÈ£°¡ 15ÀÚ¸®¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù.");                       
       return false;
    }
    //¼ýÀÚ ±âÈ£ Á¶ÇÕ
    
    chk1 = /^[a-zA-Z\d]{8,12}$/g;  //a-z¿Í 0-9ÀÌ¿ÜÀÇ ¹®ÀÚ°¡ ÀÖ´ÂÁö È®ÀÎ
    chk2 = /[a-zA-Z]/i;  //Àû¾îµµ ÇÑ°³ÀÇ a-z È®ÀÎ
    chk3 = /\d/;  //Àû¾îµµ ÇÑ°³ÀÇ 0-9 È®ÀÎ
    if(chk2.test(pass) == false || chk3.test(pass) == false)
    {
       alert("ºñ¹Ð¹øÈ£´Â ¿µ¹®, ¼ýÀÚ°¡ Á¶ÇÕµÇ¾î¾ß ÇÕ´Ï´Ù.")
       return false;
    }
    //»ç¿ë°¡´ÉÇÑ ¹®ÀÚ Ã¼Å©
    var ableCharacter = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&*^@";

    for (var i = 0; i < pass.length; i++)  
    {  
       if(pass.charAt(i) ==" ")
       {
          alert("Çã¿ëµÇÁö ¾Ê´Â ¹®ÀÚ¸¦ ÀÔ·Â ÇÏ¼Ì½À´Ï´Ù.[°ø¹é(½ºÆäÀÌ½º)]");
          return false;
       }
       else if (ableCharacter.indexOf(pass.charAt(i)) == -1) 
       {
          alert("Çã¿ëµÇÁö ¾Ê´Â ¹®ÀÚ¸¦ ÀÔ·Â ÇÏ¼Ì½À´Ï´Ù.["+pass.charAt(i)+"]");
          return false;
       }
     }

    //4ÀÚ¸® ÀÌ»ó ¿¬¼ÓµÊ
    var cnt=0,cnt2=1,cnt3=1;
    var temp="";

    for(i=0;i < pass.length;i++)
    {
        temp_pass1 = pass.charAt(i);

        //alert("temp_pass1="+temp_pass1);
        //ttt = temp_pass1.charCodeAt(0);
        next_pass = (parseInt(temp_pass1.charCodeAt(0)))+1;
        //alert("next_pass="+next_pass);
        temp_p = pass.charAt(i+1);
        temp_pass2 = (parseInt(temp_p.charCodeAt(0)));
        //alert("temp_pass2="+temp_pass2);
        if (temp_pass2 == next_pass)
            cnt2 = cnt2 + 1;
        else
            cnt2 = 1;

        if (temp_pass1 == temp_p)
            cnt3 = cnt3 + 1;
        else
            cnt3 = 1;
        
        if (cnt2 > 2) break;
        if (cnt3 > 2) break;
    }

    if (cnt2 > 2)//abcd, 1234 µî »ç¿ëºÒ°¡
    {

        alert("ºñ¹Ð¹øÈ£´Â ¿¬¼ÓµÈ ¹®ÀÚ³ª ¼øÂ÷ÀûÀÎ ¼ýÀÚ¸¦ 3°³ÀÌ»ó »ç¿ëÇØ¼­´Â ¾ÈµË´Ï´Ù.");                       
        return false;
    }
    if (cnt3 > 2)//aaaa µî »ç¿ëºÒ°¡
    {
        alert("ºñ¹Ð¹øÈ£´Â ¹Ýº¹µÈ(¿¬¼ÓµÈ) ¹®ÀÚ/¼ýÀÚ¸¦ 3°³ÀÌ»ó »ç¿ëÇØ¼­´Â ¾ÈµË´Ï´Ù.");                       
        return false;
    }    
    //µî·ÏµÈ Áßº¹ ºÒ°¡
    else 
    	return true;
    	
    return true;
}


function encodeURL(str){
    var s0, i, s, u;
    s0 = "";                // encoded str
    for (i = 0; i < str.length; i++){   // scan the source
        s = str.charAt(i);
        u = str.charCodeAt(i);          // get unicode of the char
        if (s == " "){s0 += "+";}       // SP should be converted to "+"
        else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
                s0 = s0 + s;            // don't escape
            }
            else {                  // escape
                if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }
                else if (u > 0x1fffff){     // quaternary byte format (extended)
                    s0 += "%" + (0xf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else if (u > 0x7ff){        // triple byte format
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else {                      // double byte format
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    } 
    return s0;
} 

function twitter(twittertitle,twitterurl) {

   twittertitle = encodeURL(twittertitle);
   twitterurl = encodeURL(twitterurl);

	window.open('http://twitter.com/share?text='+ twittertitle + '&url=' + twitterurl,'twitterSend','width=400, height=350');
}

function facebook(facebooktitle,facebookurl) {

   facebooktitle = encodeURL(facebooktitle);
   facebookurl = encodeURL(facebookurl);

	window.open('http://www.facebook.com/sharer.php?u=' + facebookurl + '&t=' + facebooktitle,'facebookSend','width=1000, height=580');
	
}

function me2Day(me2title,me2url,me2tag) {

   me2title = encodeURL(me2title);
   me2url = encodeURL(me2url);
   me2tag = encodeURL(me2tag);

	window.open('http://me2day.net/posts/new?new_post[body]='+'"'+me2title+'"'+':'+me2url+'&new_post[tags]='+me2tag,'me2day');
}

function changetabs(idname, tabmax, active, aclass) {
	 for (i=1; i <= tabmax; i++){
	 	  document.getElementById(idname+"link"+i).className=aclass+i;
	 	  document.getElementById(idname+"content"+i).style.display = 'none';
	 }
	 
	 document.getElementById(idname+"link"+active).className=aclass+active+' p'+active;
	 document.getElementById(idname+"content"+active).style.display = 'block';
}

function changetabs2(idname, tabmax, active, aclass) {
	 for (i=1; i <= tabmax; i++){
	 	  document.getElementById(idname+"link"+i).className="";
	 	  document.getElementById(idname+"content"+i).style.display = 'none';
 	  
	 }
	 
	 document.getElementById(idname+"link"+active).className=aclass;
	 document.getElementById(idname+"content"+active).style.display = 'block';
}

function SubMenuChange(menu_num)
{
	var cur_obj = document.getElementById("menu"+menu_num);
	for(var i=0; i<5; i++){
		 var obj = document.getElementById("menu"+i);
		 if(i==menu_num){
		    obj.style.display = "";
		 }else{
		 	  obj.style.display = "none";	
		 }
	}
}

function SubMenuClear(menu_num)
{
	if(menu_num!=""){
		 var cur_obj = document.getElementById("menu"+menu_num);
	   cur_obj.style.display = "none";	
  }else{
	   for(var i=0; i<5; i++){
	   	  var obj = document.getElementById("menu"+i);
        obj.style.display = "none";	
	   }
  }
}

function chMultimediaTab(menu_num)
{
	var cur_obj = document.getElementById("multi_"+menu_num);
	var cur_link_obj = document.getElementById("multi_link_tab"+menu_num);

	cur_link_obj.className = "over";

	for(var i=0; i<3; i++){
		 var obj = document.getElementById("multi_"+i);
		 var l_obj = document.getElementById("multi_link_tab"+i);
		 if(i==menu_num){
		    obj.style.display = "";
		 }else{
		 	  obj.style.display = "none";	
		 	  l_obj.className = "";
		 }
	}
}

function goLinkURL()
{
   var f = document.link_form;
   
   var link_url = f.link_url.value;
   if(link_url!=""){
     var win = open(link_url);
   }
}


//////////// ¼îÇÎ¸ô
function add_cart(){
   var form = document.sub_form;
   
   if(form.quantity.value==""){
      alert("¼ö·®Àº 1°³ ÀÌ»ó ½ÅÃ»ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
      form.quantity.focus();
      return;   
   }
   
   form.mode.value = "add";
   
   form.action = "/bookmall/book_cart_action.htm";
   form.submit();
}

function goAddCart(bookcode){
   var form = document.sub_form;
   
   form.bookcode.value = bookcode;
      
   form.action = "/bookmall/book_cart_action.htm";
   form.submit();
}

function goShopOrder(){
   var form = document.sub_form;
   
   document.location = "/bookmall/book_order.htm";

}

function goShopCart(){
   document.location = "/bookmall/book_cart.htm";
}
///////////////////////



function goArticleList(ar_part1, ar_type)
{
	  if(ar_type=="2")
       document.location = "/article/ar_list.htm?ar_part2="+ar_part1+"&ar_type="+ar_type;
    else
    	 document.location = "/article/ar_list.htm?ar_part1="+ar_part1+"&ar_type="+ar_type;
}

function goArticleDetail(ar_id)
{
    document.location = "/article/ar_detail.htm?ar_id="+ar_id;
}
function goJacmokDetail(ar_id)
{
    document.location = "/jacmok/ar_detail.htm?ar_id="+ar_id;
}
function goCowDetail(ar_id)
{
    document.location = "/cow/ar_detail.htm?ar_id="+ar_id;
}
function goNongkiDetail(ar_id)
{
    document.location = "/nongki/ar_detail.htm?ar_id="+ar_id;
}
function goAssoDetail(ar_id)
{
    document.location = "/article/ar_asso_detail.htm?ar_id="+ar_id;
}

function goDownloadList(class_nm,class_val)
{
    document.location = "/board/download_list.htm?class_nm="+class_nm+"&class_val="+class_val;
}

function goDownloadDetail(class_nm,class_val,no)
{
    document.location = "/board/download_detail.htm?class_nm="+class_nm+"&class_val="+class_val+"&no="+no;
}

function goArticleBest(b_type)
{
    document.location = "/article/ar_best.htm?b_type="+b_type;
}

function goNPlusDetail(cateNo, ar_id)
{
    document.location = "/nplus/ar_detail.htm?cateNo="+cateNo+"&ar_id="+ar_id;
}

function goLifeCateList(cateNo)
{
    document.location = "/nplus/ar_list.htm?cateNo="+cateNo;
}

function goLifeFoodList(cateNo)
{
    document.location = "/nplus/ar_list.htm?part_type="+part_type;
}

function goLifeDetail(cateNo, ar_id)
{
    document.location = "/nplus/ar_detail.htm?cateNo="+cateNo+"&ar_id="+ar_id;
}

function goSeIndex()
{
    document.location = "/project/se_index.htm";
}

function goProjectList(se_id)
{
    document.location = "/project/ar_se_list.htm?se_id="+se_id;
}

function goProjectDetail(se_id, ar_id)
{
    document.location = "/project/ar_se_detail.htm?se_id="+se_id+"&ar_id="+ar_id;
}


function goPhotoNewsList(photo_type)
{
    document.location = "/photonews/index.htm?photo_type="+photo_type;
}

function goPhotoNewsDetail(photo_type,ar_id,page)
{
    document.location = "/photonews/index.htm?photo_type="+photo_type+"&ar_id="+ar_id+"&page="+page;
}

function goMovieNewsList(movie_type)
{
    document.location = "/movienews/index.htm?movie_type="+movie_type;
}

function goMovieNewsDetail(movie_type,movie_id,page)
{
    document.location = "/movienews/index.htm?movie_type="+movie_type+"&movie_id="+movie_id+"&page="+page;
}

function goNoticeDetail(board, no)
{
    document.location = "/board/notice_detail.htm?board="+board+"&no="+no;
}
function goNoticeshopDetail(board, no)
{
    document.location = "/bookmall/notice/notice_detail.htm?board="+board+"&no="+no;
}
function goNoticeList(board)
{
    document.location = "/board/notice_list.htm?board="+board;
}

function goZisangDetail(board, no)
{
    document.location = "/zisang/index.htm?mode=detail&board="+board+"&no="+no;
}

function goZisangList(board)
{
    document.location = "/zisang/index.htm?board="+board;
}

function goAsso()
{
	  window.open("/asso/");
}

function goJohapelected()
{
	  document.location = "/johapelected_new/";
}

function goBookMall()
{
	  document.location = "/bookmall/";
}

function goBookMallCate(groupcode1)
{
	  document.location = "/bookmall/book_list.htm?groupcode1="+groupcode1;
}

function goBookMallDetail(groupcode1,bookcode)
{
	  document.location = "/bookmall/book_detail.htm?groupcode1="+groupcode1+"&bookcode="+bookcode;
}

function goJangPR()
{
	  document.location = "/jangpr/koreattle.htm/";
}

function goMZineCZine()
{
    window.open("http://www.i-child.co.kr/");
}

function goMZineJZine()
{
    window.open("http://www.nongmin.com/jzine/");
}

function goMZineDZine()
{
    window.open("http://www.i-child.co.kr/dzine/");
}

function goMZineAZine()
{
    window.open("http://www.i-child.co.kr/azine/");
}

function goMZineCARDetail(ar_id)
{
    window.open("http://www.i-child.co.kr/mcontent/mcontent_view.htm?smenu=sub21&stitle=subtitle1_1&page=1&s_cd=2000&ar_id="+ar_id);
}

function goMZineJARDetail(ar_id)
{
    window.open("http://www.nongmin.com/jzine/sub21/sub1_1.php?smenu=sub21&stitle=subtitle21_1&page=&s_cd=1000&ar_id="+ar_id);
}

function goMZineDARDetail(ar_id)
{
    window.open("http://www.nongmin.com/dzine/sub21/sub1_1.php?smenu=sub21&stitle=subtitle21_1&page=&s_cd=1000&ar_id="+ar_id);
}

function goMZineAARDetail(ar_id)
{
    window.open("http://www.nongmin.com/azine/sub21/sub1_1.php?smenu=sub21&stitle=subtitle21_1&page=&s_cd=1000&ar_id="+ar_id);
}

// ±â»çÁ¦º¸
function goInformWrite()
{
    var id = getCookieLogin("MEM_ID");
    
    if(id==""){
    	 alert("·Î±×ÀÎÀ» ÇÏ¼Å¾ß ÀÌ¿ë °¡´É ÇÕ´Ï´Ù.");
    	 return;
    }	
    document.location = "/inform/inform.htm";
}

// µ¶ÀÚÅõ°í
function goProfferWrite()
{
    var id = getCookieLogin("MEM_ID");
    
    if(id==""){ 
    	 alert("·Î±×ÀÎÀ» ÇÏ¼Å¾ß ÀÌ¿ë °¡´É ÇÕ´Ï´Ù.");
    	 return;
    }	
    	
    document.location = "/inform/proffer.htm";
}


// ÀÌºÏ ¼­ºñ½º
function goEBookFarmN(){
   window.open('http://ebook.nongmin.com/ecatalog.asp?Dir=1&catimage=','','top=100,left=200,width=1050,height=800');
}
function goStorybook(){
   window.open('/ebook/book_svc/nongstory/view.htm','','top=100,left=200,width=1050,height=800');
}
function goStorybook1(){
   window.open('/ebook/book_svc/02_zelkova/view.htm','','top=100,left=200,width=1050,height=800');
}
function goStorybook2(){
   window.open('/ebook/book_svc/03_zelkova/view.htm','','top=100,left=200,width=1050,height=800');
}
function goStorybook3(){
   window.open('/ebook/book_svc/04_zelkova/view.htm','','top=100,left=200,width=1050,height=800');
}
function goStorybook4(){
   window.open('/ebook/book_svc/05_zelkova/view.htm','','top=100,left=200,width=1050,height=800');
}

// ÀÌºÏ ¼­ºñ½º ³¡

//// ³óºä
function goNongView(n_type){
   document.location = "/nongview/?sstit="+n_type;	
}
function goNongViewDetail(ar_cate1,ar_id){
	 window.open("/nongview/ar_detail.htm?ar_cate1="+ar_cate1+"&ar_id="+ar_id,'','top=100,left=200,width=900,height=700,scrollbars=yes,resizable=yes"');
}

function TodayPhotoChange(obj_id, ar_id, img_title, img_src)
{
    var img_obj = document.getElementById(obj_id);
    var title_obj = document.getElementById(obj_id+"_title");
    var link_obj1 = document.getElementById(obj_id+"_link1");
    var link_obj2 = document.getElementById(obj_id+"_link2");
    
    img_obj.src = img_src;
    title_obj.innerHTML = img_title;
    link_obj1.href = "/photonews/index.htm?ar_id="+ar_id;
    link_obj2.href = "/photonews/index.htm?ar_id="+ar_id;
}

function TodayMovieChange(obj_id, ar_id, img_title, img_src)
{
    var img_obj = document.getElementById(obj_id);
    var title_obj = document.getElementById(obj_id+"_title");
    var link_obj1 = document.getElementById(obj_id+"_link1");
    var link_obj2 = document.getElementById(obj_id+"_link2");
    
    img_obj.src = img_src;
    title_obj.innerHTML = img_title;
    link_obj1.href = "/photonews/index.htm?ar_id="+ar_id;
    link_obj2.href = "/photonews/index.htm?ar_id="+ar_id;
}

function SearchArticleCheck( )
{
   var form = document.topsearch_frm;
           
   if(form.key.value==""){
      alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
      form.key.focus();
      return;
   }

   form.submit();
}

// ´Ü¼ø ¸µÅ©
function goPDFURL(){
   window.open("http://pdf1.nongmin.com","PDF"); 
}
function goSubscription() {
	 var w = window.open("/ncompany/sub4/sub1.php?smenu=sub4&stitle=subtitle4_1", "subscription");
}
function goCompanyInfo() {
	 var w = window.open("/ncompany/", "Company");
}
function goADInfo() {
	 var w = window.open("/ncompany/sub3/sub1.php?smenu=sub3&stitle=subtitle3_1", "ADInfo");
}
function goEmailInfo() {
	 var w = window.open("/ncompany/sub1/sub5.php?smenu=sub1&stitle=subtitle1_5", "EamilInfo");
}
function goArticleToday() {
	 document.location = "/article/ar_list_today.htm";
}
function goSiteMap() {
	 document.location = "/sitemap/";
}
function goShinchoon() {
	 var w = window.open("/literature/shinchoon/", "goShinchoon","width=900,height=600,scrollbars=yes,resizable=no");
}
function goYoungnong() {
	 var w = window.open("/literature/youngnong/", "goYoungnong","width=900,height=800,scrollbars=yes,resizable=no");
}
function goVACDic() {
	 document.location = "/infoarea/vacdic.htm";
}
function goCarToon1() {
	 document.location = "/cartoon/";
}
function goCarToon2() {
	 document.location = "/cartoon/cartoon_etc.htm?board=cow";
}
function goCarToon3() {
	 document.location = "/cartoon/cartoon_etc.htm?board=salija";
}
function goFlashMovie() {
   document.location = "/flashmovie/";
}

function checkNumber()
{
  var objEv = event.srcElement;
  var num ="0123456789";
  
  event.returnValue = true;
 
  for (var i=0;i<objEv.value.length;i++)
  {
    if(-1 == num.indexOf(objEv.value.charAt(i)))
      event.returnValue = false;
  }
 
  if (!event.returnValue)
    objEv.value="";
}
//
// Sub ID               : OnlyNum
// Description  : ¼ýÀÚ Å°º¸µå¸¸ Àû¿ëµÊ
// Param                : obj ÇØ´çtext°´Ã¼
// Return               : 
//
function OnlyNum(obj)
{
        if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 13 || (event.keyCode >= 37 && event.keyCode <= 40) || event.keyCode == 46) {

        } else {
                event.returnValue = false
        }
}

function IsNumeric(checkStr)
{
   for(i = 0;  i < checkStr.length;  i++)
   {
           ch = checkStr.charAt(i);
           if(ch < "0" || ch > "9")
                   return (false);
   }
 
   return (true);
}

function IsAlpaNumeric(checkStr)
{
   for(i = 0;  i < checkStr.length;  i++)
   {
           ch = checkStr.charAt(i);
           if( (ch < "0" || ch > "9") && (ch < "a" || ch > "z") && (ch < "A" || ch > "Z"))
                   return (false);
   }
 
   return (true);
}

function getCookieLogin(name) {
   var nameOfCookie = name + "=";
   var x = 0

   while ( x <= document.cookie.length ) {
     var y = (x+nameOfCookie.length);
     if ( document.cookie.substring( x, y ) == nameOfCookie ) {
        if ( (endOfCookie=document.cookie.indexOf( ";",y )) == -1 )
           endOfCookie = document.cookie.length;
             return unescape( document.cookie.substring(y, endOfCookie ) );
     }
     x = document.cookie.indexOf( " ", x ) + 1;
     if ( x == 0 )
        break;
   }
   return "";
}
function CheckSerno(s1, s2)
{
   var sum;
   var k, k2;
   var minus;

   sum = 0;

   k = parseFloat(s2.charAt(6));
   sum += parseFloat(s1.charAt(0)) * 2;
   sum += parseFloat(s1.charAt(1)) * 3;
   sum += parseFloat(s1.charAt(2)) * 4;
   sum += parseFloat(s1.charAt(3)) * 5;
   sum += parseFloat(s1.charAt(4)) * 6;
   sum += parseFloat(s1.charAt(5)) * 7;

   sum += parseFloat(s2.charAt(0))  * 8;
   sum += parseFloat(s2.charAt(1))  * 9;
   sum += parseFloat(s2.charAt(2))  * 2;
   sum += parseFloat(s2.charAt(3))  * 3;
   sum += parseFloat(s2.charAt(4))  * 4;
   sum += parseFloat(s2.charAt(5))  * 5;
   sum += 0;

   sum = sum % 11;
   minus = 11 - sum;
   k2 = minus % 10;
   if(k2 != k)
           return false;
   else
           return true;
}
// ============================ 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 setCookieVal(name,value,expiredays) {
   var todayDate = new Date();
   todayDate.setDate(todayDate.getDate() + expiredays);
   document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

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 check_msglen(frm,id,lenStr)
{
        var length = calculate_msglen(document.getElementById(frm).value);
        document.getElementById(id).innerHTML = length;

        if (length > lenStr) {
                alert("ÃÖ´ë "+lenStr+" ¹ÙÀÌÆ®±îÁö ³²±â½Ç ¼ö ÀÖ½À´Ï´Ù.\r\nÃÊ°úµÈ " + (length - lenStr) + "¹ÙÀÌÆ®´Â ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
                document.getElementById(frm).value = assert_msglen(document.getElementById(frm).value, lenStr, id);
        }
}
function calculate_msglen(message)
{
        var nbytes = 0;
        for (i=0; i<message.length; i++) {
                var ch = message.charAt(i);
                if (escape(ch).length > 4) {
                        nbytes += 2;
                } else if (ch != "\r") {
                        nbytes++;
                }
        }
        return nbytes;
}
function assert_msglen(message, maximum, id)
{
        var inc = 0;
        var nbytes = 0;
        var msg = "";
        var msglen = message.length;
        for (i=0; i<msglen; i++) {
                var ch = message.charAt(i);
                if (escape(ch).length > 4) {
                        inc = 2;
                } else if (ch != "\r") {
                        inc = 1;
                }
                if ((nbytes + inc) > maximum) {
                        break;
                }
                nbytes += inc;
                msg += ch;
        }
        document.getElementById(id).innerHTML = nbytes;
        return msg;
}

function view_image_details(what) { 
   var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=10,height=10'); 
   imgwin.focus(); 
   imgwin.document.open(); 
   imgwin.document.write("<html>\n"); 
   imgwin.document.write("<head>\n"); 
   imgwin.document.write("<title></title>\n"); 
   
   imgwin.document.write("<sc"+"ript>\n"); 
   imgwin.document.write("function resize() {\n"); 
   imgwin.document.write("pic = document.il;\n"); 
   //imgwin.document.write("alert(eval(pic).height);\n"); 
   imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n"); 
   imgwin.document.write("  if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 20; myWidth = eval(pic).width + 12;\n"); 
   imgwin.document.write("  } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n"); 
   imgwin.document.write("  clearTimeout();\n"); 
   imgwin.document.write("  var height = screen.height;\n"); 
   imgwin.document.write("  var width = screen.width;\n"); 
   
   imgwin.document.write("  if (myWidth > width){\n"); 
   imgwin.document.write("     myWidth = width; \n"); 
   imgwin.document.write("     eval(pic).width = width; \n"); 
   imgwin.document.write("  }\n"); 
   imgwin.document.write("  if (myHeight > height){\n"); 
   imgwin.document.write("     myHeight = height \n"); 
   imgwin.document.write("  }\n"); 
   
   imgwin.document.write("  var leftpos = width / 2 - myWidth / 2;\n"); 
   imgwin.document.write("  var toppos = height / 2 - myHeight / 2; \n"); 
   imgwin.document.write("  self.moveTo(leftpos, toppos);\n"); 
   imgwin.document.write("  self.resizeTo(myWidth, myHeight);\n"); 
   imgwin.document.write("}else setTimeOut(resize(), 100);}\n"); 
   imgwin.document.write("</sc"+"ript>\n"); 
   
   imgwin.document.write("</head>\n"); 
   imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n'); 
   imgwin.document.write("<a href='javascript:window.close()'><img border=0 src="+what+" xwidth=100 xheight=9 name=il onload='resize();'></a>\n"); 
   
   imgwin.document.write("</body>\n"); 
   imgwin.document.close(); 
} 

function closeSitemap()
{
	 var obj_top = document.getElementById("map_button");
	 var obj_map = document.getElementById("map_box");
	 
	 obj_map.style.display = 'none';
	 
	 obj_top.innerHTML = "<h3 class=\"map_close\"><a onclick=\"javascript:openSitemap()\" style=\"cursor:pointer\">³ó¹Î´åÄÄ »çÀÌÆ®¸Ê ¿­±â</a></h3>";
}

function openSitemap()
{
	 var obj_top = document.getElementById("map_button");
	 var obj_map = document.getElementById("map_box");
	 
	 obj_map.style.display = '';
	 
	 obj_top.innerHTML = "<h3 class=\"map_close\"><a onclick=\"javascript:closeSitemap()\" style=\"cursor:pointer\">³ó¹Î´åÄÄ »çÀÌÆ®¸Ê ¿­±â</a></h3>";
}
