//search submit check
function isbbs_search(theform){

  if(!theform.s_nick.checked && !theform.s_title.checked && !theform.s_contents.checked){
    alert("°Ë»öÇÒ Ç×¸ñÀ» ¼±ÅÃÇÏ¼¼¿ä.");
    theform.s_title.focus();
    return false;
  }

  if(!theform.search_str.value){
    alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
    theform.search_str.focus();
    return false;
  }

  return true;
}


//comment submit check
function issubmit_reply(theform){
  if(!theform.comment.value){
    alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
    theform.comment.focus();
    return false;
  }

  return true;
}

//write submit check
function issubmit_write(theform){
  var str = "";
  var total = theform.category_total.value;

  for(var i=0;i<=total-1;i++){
    if(document.getElementById("chk"+i).alt == 1){
      str+= document.getElementById("chk"+i).title + ",";
    }
  }

  if(str) str = ",,"+str;

  theform.cat.value = str;

  if(!theform.title.value){
    alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
    theform.title.focus();
    return false;
  }

  if(!theform.contents.value){
    alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
    theform.contents.focus();
    return false;
  }

  return true;
}

//admin select action mode checke
function issubmit_select(theform){
  var choice = theform.ischoice.options[theform.ischoice.selectedIndex].value;
  var num = theform.isnum.options[theform.isnum.selectedIndex].value;

  if(!choice){
    alert("Ç×¸ñ(ÀÌµ¿,¼û±è,»èÁ¦)À» ¼±ÅÃÇÏ¼¼¿ä.");
    return false;
  }

  if(choice == 1 && !num){
    alert("ÀÌµ¿ÇÒ Ä«Å×°í¸®¸¦ ¼±ÅÃÇÏ¼¼¿ä.");
    return false;
  }

  return true;
}

//object top location
function getRealOffsetTop(o){ 
  return o ? o.offsetTop + getRealOffsetTop(o.offsetParent) : 0; 
}

//object left location
function getRealOffsetLeft(o){ 
  return o ? o.offsetLeft + getRealOffsetLeft(o.offsetParent) : 0; 
}

//image preview
function srcprv(src,theme){
  var div = document.getElementById("div_image");
  var str = "";

  if(!src){
    div.innerHTML = "";
    return;
  }

  div.style.top = getRealOffsetTop(theme);
  div.style.left = getRealOffsetLeft(theme);

  var setstr = '<img style="border:#e4e4e4 4px solid; cursor:pointer;" onclick=document.getElementById("div_image").innerHTML=""; border=0 src="'+src+'">';

  str = setstr;

  div.innerHTML = str;
}

function ismore_check(cur,tar){
  document.getElementById(cur).style.display = "none";
  document.getElementById(tar).style.display = "inline";
}

function ismove_check(theme,cur){
  var num = theme.options[theme.selectedIndex].value;

  if(num == 1) document.getElementById(cur).style.display = "inline";
  else document.getElementById(cur).style.display = "none";
}

//memo modify
function memo_mod(nm,theme){
  var theform = document.frm_ins;

  theform.act.value = "mod";
  theform.isnm.value = nm;
  theform.btn_submit.value = "¼öÁ¤ ÇÏ±â";

  theform.comment.value = document.getElementById(theme).innerHTML;
  alert("³»¿ë ¼öÁ¤ÈÄ ¼öÁ¤ÇÏ±â ¹öÆ°À» ´©¸£¼¼¿ä.");
  theform.comment.focus();
}

function chk_selectall(){
  var theform = document.frm_select;
  var i = 0;
  
  if(theform.chk_select.value == 0){
    for(i=0; i<theform.elements.length; i++) {
      var element = theform.elements[i];
      if(element.name.indexOf('chk') == 0) element.checked = 1;
    }
    theform.chk_select.value = 1;
  }
  else{
    for(i=0; i<theform.elements.length; i++) {
      var element = theform.elements[i];
      if(element.name.indexOf('chk') == 0) element.checked = 0;
    }
    theform.chk_select.value = 0;
  }
}

// yes check
function delete_data(url){
  if(confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){location=url;}
}
