Jump to content

User:Ilovesabbath/refToolbar ko.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// [[:en:User:Mr.Z-man/refToolbar]] (2009년 1월 9일 현재판) 의 한국어 번역판
// Korean translation of [[:en:User:Mr.Z-man/refToolbar]] (2009-01-09)

var numforms = 0;
var wikEdAutoUpdateUrl;
function refbuttons() {
  if (mwCustomEditButtons && document.getElementById('toolbar') ) {
    button = document.createElement('a');
    button.href = "javascript:easyCiteMain()";
    button.title = "인용틀 넣기";
    buttonimage = document.createElement('img');
    buttonimage.src = "http://upload.wikimedia.org/wikipedia/commons/e/ea/Button_easy_cite.png";
    buttonimage.alt = "인용틀 넣기";
    button.appendChild(buttonimage);
    var toolbar = document.getElementById('toolbar');
    if (navigator.userAgent.indexOf('MSIE') == -1) {
      if (toolbar.style != null) {
        toolbar.style.height = 'auto';
      }
      else {
      	toolbar.setAttribute('style', 'margin-bottom: 6px; height: auto;');
      }
      toolbar.appendChild(button);
      citemain = document.createElement('div');
      citemain.style.display = 'none';
      citemain.style.margin = '0.2em 0 -0.2em 0';
      citemain.setAttribute('Id', 'citeselect');
      citemain.appendChild( addOption("citeWeb()", "웹 인용") );
      citemain.appendChild( addOption("citeNews()", "뉴스 인용") );
      citemain.appendChild( addOption("citeBook()", "서적 인용") );
      citemain.appendChild( addOption("citeJournal()", "저널 인용") );
      citemain.appendChild( addOption("citeNamedRef()", "재인용") );
      citemain.appendChild( addOption("dispErrors()", "에러 체크") );
      citemain.appendChild( addOption("hideInitial()", "취소") );
      toolbar.appendChild(citemain);
    }
    else {
      toolbar.appendChild(button);
      selection = '<div id="citeselect" style="display:none"><input type="button" value="웹 인용" onclick="citeWeb()" />'+
      '<input type="button" value="뉴스 인용" onclick="citeNews()" />'+
      '<input type="button" value="서적 인용" onclick="citeBook()" />'+
      '<input type="button" value="저널 인용" onclick="citeJournal()" />'+
      '<input type="button" value="재인용" onclick="citeNamedRef()" />'+
      '<input type="button" value="에러 체크" onclick="dispErrors()" />'+
      '<input type="button" value="취소" onclick="hideInitial()" /></div>';
      document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;
    }
  }
}
 
function addOption(script, text) {
  option = document.createElement('input');
  option.setAttribute('type', 'button');
  option.setAttribute('onclick', script);
  option.setAttribute("value", text);
  return option;
}
 
function hideInitial() {
  document.getElementById('citeselect').style.display = 'none';
  oldFormHide();
}
 
function oldFormHide() {
  if (numforms != 0) {
    document.getElementById('citediv'+numforms).style.display = 'none';
  }
  if (document.getElementById('errorform') != null) {
    document.getElementById('citeselect').removeChild(document.getElementById('errorform'));
  }
}
 
function easyCiteMain() {
  document.getElementById('citeselect').style.display = '';
}
 
function getTime() {
  var time = new Date();
  var nowdate = time.getUTCDate();
  if (nowdate<10) { nowdate = "0"+ nowdate.toString(); }
  var nowmonth = time.getUTCMonth()+1;
  if (nowmonth<10) { nowmonth = "0"+ nowmonth.toString(); }
  var nowyear = time.getUTCFullYear();
  newtime =  nowyear + '-' + nowmonth + '-' + nowdate;
  return (newtime);
}
 
function citeWeb() {
  citeNewsWeb("웹 인용");
}
function citeNews() {
  citeNewsWeb("뉴스 인용");
}
 
function citeNewsWeb(templatename) {
  oldFormHide();
  template = templatename;
  var legend;
  if (template == "웹 인용") {
    legend = "웹 인용 입력";
  } else {
    legend = "뉴스 인용 입력";
  }
  newtime = getTime();
  numforms++;
  form = '<div id="citediv'+numforms+'">'+
    '<fieldset><legend>'+legend+'</legend>'+
    '<table cellspacing="5">'+
    '<input type="hidden" value="'+template+'" id="template">'+
    '<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="url"></td>'+
    '<td width="120"><label for="title">&nbsp;제목: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="제목"></td></tr>'+
    '<tr><td width="120"><label for="last">&nbsp;성: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="성"></td>'+
    '<td width="120"><label for="first">&nbsp;이름: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="이름"></td></tr>'+
    '<tr><td width="120"><label for="coauthors">&nbsp;공저자: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="공저자"></td>'+
    '<td width="120"><label for="date">&nbsp;작성일자(YYYY-MM-DD): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="작성일자"></td></tr>'+
    '<tr><td width="120"><label for="work">&nbsp;작품명: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="작품명"></td>'+
    '<td width="120"><label for="publisher">&nbsp;출판사: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="출판사"></td></tr>'+
    '<tr><td width="120"><label for="pages">&nbsp;쪽: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="쪽"></td>'+
    '<td width="120"><label for="language">&nbsp;언어: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="언어"></td></tr>'+
    '<tr><td width="120"><label for="accessdate">&nbsp;확인일자(YYYY-MM-DD): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="확인일자" value="'+ newtime +'"></td>'+
    '<td width="120"><label for="refname">&nbsp;주석이름(재인용시 필요): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="refname"></td></tr>'+
    '</table>'+
    '<input type="button" value="입력 완료" onClick="addcites()">'+
 '</fieldset></div>';
   document.getElementById('citeselect').innerHTML += form;
}
 
function citeBook() {
  oldFormHide();
  template = "서적 인용";
  numforms++;
  form = '<div id="citediv'+numforms+'">'+
    '<fieldset><legend>서적 인용 입력</legend>'+
    '<table cellspacing="5">'+
    '<input type="hidden" value="'+template+'" id="template">'+
    '<tr><td width="120"><label for="last">&nbsp;성: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="성"></td>'+
    '<td width="120"><label for="first">&nbsp;이름: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="이름"></td></tr>'+
    '<tr><td width="120"><label for="coauthors">&nbsp;공저자: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="공저자"></td>'+
    '<td width="120"><label for="others">&nbsp;기타제작자: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="기타"></td></tr>'+
    '<tr><td width="120"><label for="title">&nbsp;제목: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="제목"></td>'+
    '<td width="120"><label for="editor">&nbsp;편집자: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="편집자"></td></tr>'+
    '<tr><td width="120"><label for="publisher">&nbsp;출판사: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="출판사"></td>'+
    '<td width="120"><label for="location">&nbsp;출판위치: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="출판위치"></td></tr>'+
    '<tr><td width="120"><label for="date">&nbsp;발행일자(YYYY-MM-DD): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="발행일자"></td>'+
    '<td width="120"><label for="edition">&nbsp;판: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="판"></td></tr>'+
    '<tr><td width="120"><label for="series">&nbsp;시리즈: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="series"></td>'+
    '<td width="120"><label for="volume">&nbsp;권: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="volume"></td></tr>'+
    '<tr><td width="120"><label for="pages">&nbsp;쪽: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="쪽"></td>'+
    '<td width="120"><label for="chapter">&nbsp;장: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="장"></td></tr>'+
    '<tr><td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="isbn"></td>'+
    '<td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="oclc"></td></tr>'+
    '<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="url"></td>'+
    '<td width="120"><label for="accessdate">&nbsp;확인일자(YYYY-MM-DD): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="확인일자"></td></tr>'+
    '<tr><td width="120"><label for="language">&nbsp;언어: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="언어"></td>'+
    '<td width="120"><label for="refname">&nbsp;주석이름(재인용시 필요): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="refname"></td></tr>'+
    '</table>'+
    '<input type="button" value="입력 완료" onClick="addcites()">'+
 '</fieldset></div>';
   document.getElementById('citeselect').innerHTML += form;
}
 
function citeJournal() {
  oldFormHide();
  template = "저널 인용";
  numforms++;
  form = '<div id="citediv'+numforms+'">'+
    '<fieldset><legend>저널 인용 입력</legend>'+
    '<table cellspacing="5">'+
    '<input type="hidden" value="'+template+'" id="template">'+
    '<tr><td width="120"><label for="last">&nbsp;성: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="성"></td>'+
    '<td width="120"><label for="first">&nbsp;이름: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="이름"></td></tr>'+
    '<tr><td width="120"><label for="coauthors">&nbsp;공저자: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="공저자"></td>'+
    '<td width="120"><label for="date">&nbsp;작성일자(YYYY-MM-DD): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="작성일자"></td></tr>'+
    '<tr><td width="120"><label for="title">&nbsp;제목: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="제목"></td>'+
    '<td width="120"><label for="journal">&nbsp;저널: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="저널"></td></tr>'+
    '<tr><td width="120"><label for="publisher">&nbsp;출판사: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="출판사"></td>'+
    '<td width="120"><label for="location">&nbsp;출판위치: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="출판위치"></td></tr>'+
    '<tr><td width="120"><label for="volume">&nbsp;권: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="volume"></td>'+
    '<td width="120"><label for="issue">&nbsp;호: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="issue"></td></tr>'+
    '<tr><td width="120"><label for="pages">&nbsp;쪽: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="쪽"></td>'+
    '<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="issn"></td></tr>'+
    '<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="oclc"></td>'+
    '<td width="120"><label for="language">&nbsp;언어: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="언어"></td></tr>'+
    '<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="url"></td>'+
    '<td width="120"><label for="accessdate">&nbsp;확인일자(YYYY-MM-DD): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="확인일자"></td></tr>'+
    '<tr><td width="120"><label for="refname">&nbsp;주석이름(재인용시 필요): </label></td>'+
      '<td width="400"><input type="text" style="width:100%" id="refname"></td></tr>'+
    '</table>'+
    '<input type="button" value="입력 완료" onClick="addcites()">'+
 '</fieldset></div>';
   document.getElementById('citeselect').innerHTML += form;
}
 
function addcites(template) {
  cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');
  var citebegin = '<ref';
  var citename = '';
  var citeinner = '';
  for (var i=0; i<cites.length-1; i++) {
    if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id != "template") {
      citeinner += "|" + cites[i].id + "=" + cites[i].value;
    }
    else if (cites[i].value != '' && cites[i].id == "refname" && cites[i].id != "template") {
      citebegin += ' name="' + cites[i].value + '"';
    }
    else if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id == "template") {
      citename = '>{{' + cites[i].value;
    }
  }
  cite = citebegin + citename + citeinner + "}}</ref>";
  insertTags(cite, '', '');
  document.getElementById('citediv'+numforms).style.display = 'none';
}
 
function getNamedRefs(calls) {
  if (typeof(wikEdUseWikEd) != 'undefined') {
    if (wikEdUseWikEd == true) {
      WikEdUpdateTextarea();
    }
  }
  text = document.getElementById('wpTextbox1').value;
  var regex;
  if (calls) {
    regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?\/ *?>/gi //'
  } else {
    regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?>/gi //'
  }
  var namedrefs = new Array();
  var i=0;
  var nr=true;
  do {
    ref = regex.exec(text);
    if(ref != null){
      if (ref[5]) {
        namedrefs[i] = ref[5];
      } else if (ref[3]) {
        namedrefs[i] = ref[3];
      } else {
        namedrefs[i] = ref[6];
      }
      i++;
    } else {
      nr=false;
    }
  } while (nr==true);
  return namedrefs;
}
 
function citeNamedRef() {
  namedrefs = getNamedRefs(false);
  if (namedrefs == '') {
    oldFormHide();
    numforms++;
    out = '<div id="citediv'+numforms+'"><fieldset>'+
      '<legend>재인용 입력</legend>이 문서에는 이름 붙인 주석(<tt>&lt;ref name="Name"&gt;</tt>)이 없습니다</fieldset></div>';
    document.getElementById('citeselect').innerHTML += out;
  }
  else {
    oldFormHide();
    numforms++;
    form = '<div id="citediv'+numforms+'">'+
      '<fieldset><legend>재인용 입력</legend>'+
      '<table cellspacing="5">'+
      '<tr><td><label for="namedrefs">&nbsp;재인용할 주석 선택: </label></td>'+
            '<td><select name="namedrefs" id="namedrefs">';
    for (var i=0;i<namedrefs.length;i++) {
      form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';
    }
    form+= '</select>'+
      '</td></tr></table>'+
      '<input type="button" value="Add citation" onClick="addnamedcite()">'+
      '</fieldset></div>';
     document.getElementById('citeselect').innerHTML += form;
  }
}
 
function addnamedcite() {
  name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;
  ref = '<ref name="'+name+'" />';
  insertTags(ref, '', '');
  document.getElementById('citediv'+numforms).style.display = 'none';
}
 
function getAllRefs() {
  if (typeof(wikEdUseWikEd) != 'undefined') {
    if (wikEdUseWikEd == true) {
      WikEdUpdateTextarea();
    }
  }
  text = document.getElementById('wpTextbox1').value;
  regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"
  var allrefs = new Array();
  var i=0;
  var nr=true;
  do {
    ref = regex.exec(text);
    if(ref != null){
      if (ref[0].search(/[^\s]{150}/) != -1) {
        ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");
      }
      ref[0] = ref[0].replace(/</g, "&lt;");
      ref[0] = ref[0].replace(/>/g, "&gt;");
      allrefs[i] = ref[0];
      i++;
    } else {
      nr=false;
    }
  } while (nr==true);
  return allrefs;
}
 
function NRcallError(namedrefs, refname) {
  for (var i=0; i<namedrefs.length; i++) {
    if (namedrefs[i] == refname) {
      return true;
    }
  }
  return false;
}
 
function errorCheck() {
  var allrefs = getAllRefs();
  var allrefscontent = new Array();
  var samecontentexclude = new Array();
  var sx=0;
  var templateexclude = new Array();
  var tx=0;
  var skipcheck = false;
  var namedrefcalls = getNamedRefs(true);
  for (var i=0; i<allrefs.length; i++) {
    allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8");  //"
  }
  var namedrefs = getNamedRefs(false);
  var errorlist = new Array();
  var q=0;
  unclosed = document.getElementById('unclosed').checked;
  samecontent = document.getElementById('samecontent').checked;
  templates = document.getElementById('templates').checked;
  repeated = document.getElementById('repeated').checked;
  undef = document.getElementById('undef').checked;
  for (var i=0; i<allrefs.length; i++) {
    if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {
      errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
      errorlist[q] += '<td width="25%">닫혀있지 않은 <tt>&lt;ref&gt;</tt> 태그가 있습니다</td></tr>';
      q++;
    }
    if (samecontent) {
      for (var d=0; d<samecontentexclude.length; d++) {
        if (allrefscontent[i] == samecontentexclude[d]) {
          skipcheck = true;
        }
      }
      var p=0;
      while (p<allrefs.length && !skipcheck) {
        if (allrefscontent[i] == allrefscontent[p] && i != p) {
          errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';
          errorlist[q] += '<td width="25%">같은 내용의 주석들은 같은 이름을 사용하여 재인용해야 합니다. <a href="http://ko.wikipedia.org/wiki/위키백과:출처_밝히기">출처 밝히기</a>를 참고하세요</td></tr>';
          q++;
          samecontentexclude[sx] = allrefscontent[i]
          sx++;
          break;
        }
        p++;
      }
     skipcheck=false;
    }
    if (templates) {
      if (allrefscontent[i].search(/인용\|/i) == -1 && allrefscontent[i].search(/인용 \|/i) == -1 && allrefscontent[i].search(/\{\{citation/i) == -1 && allrefscontent[i].search(/\{\{Comic (book|strip) reference/i) == -1 && allrefscontent[i].search(/\{\{Editorial cartoon reference/i) == -1 && allrefscontent[i].search(/\{\{harv/i) == -1) {
        for (var x=0; x<templateexclude.length; x++) {
          if (allrefscontent[i] == templateexclude[x]) {
            skipcheck = true;
          }
        }
        if (!skipcheck) {
          errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
          errorlist[q] += '<td width="25%"><a href="http://ko.wikipedia.org/wiki/틀:인용">인용틀</a>을 사용하지 않은 주석이 있습니다</td></tr>';
          q++;
          templateexclude[tx] = allrefscontent[i];
          tx++;
        }
        skipcheck = false;
      }
    }
  }
  if (repeated) {
    var repeatnameexclude = new Array();
    var rx=0;
    for (var k=0; k<namedrefs.length; k++) {
      for (var d=0; d<repeatnameexclude.length; d++) {
        if (namedrefs[k] == repeatnameexclude[d]) {
          skipcheck = true;
        }
      }
      var z=0;
      while (z<namedrefs.length && !skipcheck) {
        if (namedrefs[k] == namedrefs[z] && k != z) {
          errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';
          errorlist[q] += '<td width="25%">같은 이름을 갖고 있지만 서로 다른 내용의 주석이 있습니다. <a href="http://ko.wikipedia.org/wiki/위키백과:출처_밝히기">출처 밝히기</a>를 참고하세요</td></tr>';
          q++;
          repeatnameexclude[rx] = namedrefs[z];
          rx++;
          break;
        }
        z++;
      }
     skipcheck = false;
    }
  }
  if (undef) {
    var undefexclude = new Array();
    var ux=0;
    for (var p=0; p<namedrefcalls.length; p++) {
      for (var d=0; d<undefexclude.length; d++) {
        if (allrefscontent[i] == undefexclude[d]) {
          skipcheck = true;
        }
      }
      if (!skipcheck) {
        if (!NRcallError(namedrefs, namedrefcalls[p])) {
          errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';
          errorlist[q] += '<td width="25%">정의되지 않은 이름으로 재인용했습니다. <a href="http://ko.wikipedia.org/wiki/위키백과:출처_밝히기">출처 밝히기</a>를 참고하세요</td></tr>';
          q++;
          undefexclude[ux] = namedrefs[p];
          ux++;
        }
      }
      skipcheck = false;
    }
 }
  if (q > 0) {
    return errorlist;
  } else {
    return 0;
  }
}
 
function dispErrors() {
  oldFormHide();
  form = '<div id="errorform"><fieldset>'+
    '<legend>에러 체크</legend>'+
    '<b>다음 사항을 체크합니다:</b><br/>'+
    '<input type="checkbox" id="unclosed" /> 닫혀있지 않은 <tt>&lt;ref&gt;</tt> 태그<br/>'+
    '<input type="checkbox" id="samecontent" /> 같은 내용을 담고 있는 주석<br/>'+
    '<input type="checkbox" id="templates" /> <a href="http://ko.wikipedia.org/wiki/틀:인용">인용틀</a>을 사용하지 않은 주석<br/>'+
    '<input type="checkbox" id="repeated" /> 같은 이름의 다른 주석<br/>'+
    '<input type="checkbox" id="undef" /> 없는 이름으로 재인용한 주석<br/>'+
    '<input type="button" id="errorchecksubmit" value="체크 시작" onclick="doErrorCheck()"/>'+
    '</fieldset></div>';
  document.getElementById('citeselect').innerHTML += form;
}
 
function doErrorCheck() {
  var errors = errorCheck();
  document.getElementById('citeselect').removeChild(document.getElementById('errorform'));
  if (errors == 0) {
    if (numforms != 0) {
      document.getElementById('citediv'+numforms).style.display = 'none';
    }
    numforms++;
    out = '<div id="citediv'+numforms+'"><fieldset>'+
      '<legend>에러 체크</legend>에러가 발견되지 않았습니다</fieldset></div>';
    document.getElementById('citeselect').innerHTML += out;
  }
  else {
    if (numforms != 0) {
      document.getElementById('citediv'+numforms).style.display = 'none';
    }
    numforms++;
    form = '<div id="citediv'+numforms+'">'+
      '<fieldset><legend>에러 체크</legend>'+
      '<table border="1px">';
    for (var i=0; i<errors.length; i++) {
      form+=errors[i];
    }
    form+= '</table>'+
      '</fieldset></div>';
     document.getElementById('citeselect').innerHTML += form;
  }
}
 
hookEvent("load", refbuttons);