   function formcheck(areacount) {
      if (document.main_form.submit_flag.value == '0') { return false; }

      if (areacount == "0") { return true; }

      if (document.main_form.imagemode1[0].checked == true) {
         if (document.main_form.m1_titleimageyn.value == "2") {
            if (document.main_form.jegong_image1.value == document.main_form.m1_titleimage.value) {
               alert('영역1의 제공 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }
      if (document.main_form.imagemode1[2].checked == true) {
         if (document.main_form.m1_titleimageyn.value != "2") {
            if (!document.main_form.user_image1.value) {
               alert('영역1의 사용자 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }

      if (document.main_form.imagemode1[1].checked == true) {
         if (document.main_form.iconmode1[0].checked == true) {
            if (document.main_form.m1_titleiconyn.value == "2") {
               if (document.main_form.jegong_icon1.value == document.main_form.m1_titleicon.value) {
                  alert('영역1의 제공 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
         if (document.main_form.iconmode1[2].checked == true) {
            if (document.main_form.m1_titleiconyn.value != "2") {
               if (!document.main_form.user_icon1.value) {
                  alert('영역1의 사용자 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
      }
     
      if (areacount == "1") { return true; }
      

      if (document.main_form.imagemode2[0].checked == true) {
         if (document.main_form.m2_titleimageyn.value == "2") {
            if (document.main_form.jegong_image2.value == document.main_form.m2_titleimage.value) {
               alert('영역2의 제공 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }
      if (document.main_form.imagemode2[2].checked == true) {
         if (document.main_form.m2_titleimageyn.value != "2") {
            if (!document.main_form.user_image2.value) {
               alert('영역2의 사용자 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }

      if (document.main_form.imagemode2[1].checked == true) {
         if (document.main_form.iconmode2[0].checked == true) {
            if (document.main_form.m2_titleiconyn.value == "2") {
               if (document.main_form.jegong_icon1.value == document.main_form.m2_titleicon.value) {
                  alert('영역2의 제공 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
         if (document.main_form.iconmode2[2].checked == true) {
            if (document.main_form.m2_titleiconyn.value != "2") {
               if (!document.main_form.user_icon2.value) {
                  alert('영역2의 사용자 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
      }
     
      if (areacount == "2") { return true; }
      
      if (document.main_form.imagemode3[0].checked == true) {
         if (document.main_form.m3_titleimageyn.value == "2") {
            if (document.main_form.jegong_image3.value == document.main_form.m3_titleimage.value) {
               alert('영역3의 제공 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }
      if (document.main_form.imagemode3[2].checked == true) {
         if (document.main_form.m3_titleimageyn.value != "2") {
            if (!document.main_form.user_image3.value) {
               alert('영역3의 사용자 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }

      if (document.main_form.imagemode3[1].checked == true) {
         if (document.main_form.iconmode3[0].checked == true) {
            if (document.main_form.m3_titleiconyn.value == "2") {
               if (document.main_form.jegong_icon3.value == document.main_form.m3_titleicon.value) {
                  alert('영역3의 제공 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
         if (document.main_form.iconmode3[2].checked == true) {
            if (document.main_form.m3_titleiconyn.value != "2") {
               if (!document.main_form.user_icon3.value) {
                  alert('영역3의 사용자 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
      }
     
      if (areacount == "3") { return true; }
      
      if (document.main_form.imagemode4[0].checked == true) {
         if (document.main_form.m4_titleimageyn.value == "2") {
            if (document.main_form.jegong_image4.value == document.main_form.m4_titleimage.value) {
               alert('영역4의 제공 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }
      if (document.main_form.imagemode4[2].checked == true) {
         if (document.main_form.m4_titleimageyn.value != "2") {
            if (!document.main_form.user_image4.value) {
               alert('영역4의 사용자 이미지가 선택되지 않았습니다.');
               return false;
            }
         }
      }

      if (document.main_form.imagemode4[1].checked == true) {
         if (document.main_form.iconmode4[0].checked == true) {
            if (document.main_form.m4_titleiconyn.value == "2") {
               if (document.main_form.jegong_icon4.value == document.main_form.m4_titleicon.value) {
                  alert('영역4의 제공 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
         if (document.main_form.iconmode4[2].checked == true) {
            if (document.main_form.m4_titleiconyn.value != "2") {
               if (!document.main_form.user_icon4.value) {
                  alert('영역4의 사용자 아이콘이 선택되지 않았습니다.');
                  return false;
               }
            }
         }
      }
     
      return true;
   }	

   function changesubmit(flag) {
      document.main_form.submit_flag.value = flag;
   }

   function change_radio(mode, image) {
      if (image == "image1") { document.main_form.imagemode1[mode].checked = true; }
      if (image == "icon1")  { document.main_form.iconmode1[mode].checked  = true; }
      if (image == "image2") { document.main_form.imagemode2[mode].checked = true; }
      if (image == "icon2")  { document.main_form.iconmode2[mode].checked  = true; }
      if (image == "image3") { document.main_form.imagemode3[mode].checked = true; }
      if (image == "icon3")  { document.main_form.iconmode3[mode].checked  = true; }
      if (image == "image4") { document.main_form.imagemode4[mode].checked = true; }
      if (image == "icon4")  { document.main_form.iconmode4[mode].checked  = true; }

      if (image == "menubgimagemode1")  { document.main_form.menubgimagemode1[mode].checked  = true; }
   }

   function selectcolor(color) {
      var selectedcolor;
      changesubmit('0');
      selectedcolor = window.showModalDialog("navigator.php?contents=admin&usemode=select_color","","dialogwidth=265px; dialogheight:265px; center:yes; resizable:no; status:no; help=yes; scroll=yes;");
      if (selectedcolor) {
         if (color == 'm1_fontcolor')      { document.main_form.m1_fontcolor.value      = selectedcolor; }
         if (color == 'm1_titlebgcolor')   { document.main_form.m1_titlebgcolor.value   = selectedcolor; }
         if (color == 'm1_titlelicolor')   { document.main_form.m1_titlelicolor.value   = selectedcolor; }
         if (color == 'm1_mfontcolor')     { document.main_form.m1_mfontcolor.value     = selectedcolor; }
         if (color == 'm1_mcolor1')        { document.main_form.m1_mcolor1.value        = selectedcolor; }
         if (color == 'm1_mcolor2')        { document.main_form.m1_mcolor2.value        = selectedcolor; }

         if (color == 'm2_fontcolor')      { document.main_form.m2_fontcolor.value      = selectedcolor; }
         if (color == 'm2_titlebgcolor')   { document.main_form.m2_titlebgcolor.value   = selectedcolor; }
         if (color == 'm2_titlelicolor')   { document.main_form.m2_titlelicolor.value   = selectedcolor; }
         if (color == 'm2_mfontcolor')     { document.main_form.m2_mfontcolor.value     = selectedcolor; }
         if (color == 'm2_mcolor1')        { document.main_form.m2_mcolor1.value        = selectedcolor; }
         if (color == 'm2_mcolor2')        { document.main_form.m2_mcolor2.value        = selectedcolor; }

         if (color == 'm3_fontcolor')      { document.main_form.m3_fontcolor.value      = selectedcolor; }
         if (color == 'm3_titlebgcolor')   { document.main_form.m3_titlebgcolor.value   = selectedcolor; }
         if (color == 'm3_titlelicolor')   { document.main_form.m3_titlelicolor.value   = selectedcolor; }
         if (color == 'm3_mfontcolor')     { document.main_form.m3_mfontcolor.value     = selectedcolor; }
         if (color == 'm3_mcolor1')        { document.main_form.m3_mcolor1.value        = selectedcolor; }
         if (color == 'm3_mcolor2')        { document.main_form.m3_mcolor2.value        = selectedcolor; }

         if (color == 'm4_fontcolor')      { document.main_form.m4_fontcolor.value      = selectedcolor; }
         if (color == 'm4_titlebgcolor')   { document.main_form.m4_titlebgcolor.value   = selectedcolor; }
         if (color == 'm4_titlelicolor')   { document.main_form.m4_titlelicolor.value   = selectedcolor; }
         if (color == 'm4_mfontcolor')     { document.main_form.m4_mfontcolor.value     = selectedcolor; }
         if (color == 'm4_mcolor1')        { document.main_form.m4_mcolor1.value        = selectedcolor; }
         if (color == 'm4_mcolor2')        { document.main_form.m4_mcolor2.value        = selectedcolor; }

         if (color == 'memberbgcolor')     { document.main_form.memberbgcolor.value     = selectedcolor; }
         if (color == 'membertextcolor')   { document.main_form.membertextcolor.value   = selectedcolor; }

         if (color == 'menubgcolor')       { document.main_form.menubgcolor.value       = selectedcolor; }
         if (color == 'menufontcolor1')    { document.main_form.menufontcolor1.value    = selectedcolor; }
         if (color == 'menubackcolor1')    { document.main_form.menubackcolor1.value    = selectedcolor; }
         if (color == 'menufontcolor2')    { document.main_form.menufontcolor2.value    = selectedcolor; }
         if (color == 'menubackcolor2')    { document.main_form.menubackcolor2.value    = selectedcolor; }

         if (color == 'main_bgcolor')      { document.main_form.main_bgcolor.value      = selectedcolor; }

         if (color == 'footer_bgcolor')    { document.main_form.footer_bgcolor.value    = selectedcolor; }
         if (color == 'popupimage_u')      { document.main_form.popupimage_u.value      = selectedcolor; }
         if (color == 'intro_bgcolor')     { document.main_form.intro_bgcolor.value     = selectedcolor; }
         if (color == 'pagemain_bgcolor')  { document.main_form.pagemain_bgcolor.value  = selectedcolor; }
         if (color == 'menu_bgcolor')      { document.main_form.menu_bgcolor.value  = selectedcolor; }
      }
	}

   function selectimage(gubun, image1, image2, image3, image) {
      var selectedimage, page = 0;
      changesubmit('0');
      while (page > -1) {
         selectedimage = window.showModalDialog("navigator.php?contents=admin&usemode=select_image&category=" + gubun + "&range=" + page,"","dialogwidth=720px; dialogheight:600px; center:yes; resizable:no; status:no; help=yes; scroll=yes;");
         if (selectedimage) {
            if (selectedimage.length < 4) {
               page = selectedimage;
               }
            else { page = -1; }
         }
         else { page = -1; }
      }
      if (selectedimage) {
         if (image.substring(0, 4)  == "icon") {
            document[image1].src = selectedimage;
         }
         else {
            if (image == "menubgimagemode" || image == "modimage1" || image == "modicon1") { document[image1].src = selectedimage; }
            else {
               document[image1].src = selectedimage + "_1.gif";
               document[image2].src = selectedimage + "_2.gif";
               document[image3].src = selectedimage + "_3.gif";
            }
         }
         
         if (image == "image1") { document.main_form.jegong_image1.value = selectedimage; }
         if (image == "icon1")  { document.main_form.jegong_icon1.value  = selectedimage; }
         if (image == "image2") { document.main_form.jegong_image2.value = selectedimage; }
         if (image == "icon2")  { document.main_form.jegong_icon2.value  = selectedimage; }
         if (image == "image3") { document.main_form.jegong_image3.value = selectedimage; }
         if (image == "icon3")  { document.main_form.jegong_icon3.value  = selectedimage; }
         if (image == "image4") { document.main_form.jegong_image4.value = selectedimage; }
         if (image == "icon4")  { document.main_form.jegong_icon4.value  = selectedimage; }

         if (image == "menubgimagemode")  { document.main_form.menubgimage.value = selectedimage; }
         if (image == "modicon1")         { document.main_form.icon_menu.value   = selectedimage; }
         if (image == "modimage1")        { document.main_form.image_menu1.value = selectedimage; }
      }
	}
