// JavaScript Document
var ref;
var gcode;
var __edinet_lastlogin_uri;
var __edinet_lastlogin;
var __edinet_nowtime;
function login(code) {
	gcode = code;
  edinet_login('show();');
}
function edinet_login( eval_string ){
	var url = 'https://info.edinet.go.jp/login.do?loginType=1';
	var style = "top=0,left=0,width=100,height=100,resizable=no,scrollbars=no";
  if( __edinet_lastlogin_uri != null ){
    if( __edinet_lastlogin == 0 || ( __edinet_lastlogin + 590 < __edinet_nowtime ) ){
      ref = window.open(url, "login", style);
      setTimeout( eval_string+';ref.close();', 1500 );
    } else {
        eval( eval_string );
    }
    __edinet_lastlogin = __edinet_nowtime;
    ajax = new Ajax.Request( __edinet_lastlogin_uri, {} );
  } else {
    ref = window.open(url, "login", style);
    setTimeout( eval_string+';ref.close();', 1500 );
  }
}
function viewPrepare( id, no, kind, ordi ) {
	document.viewPrepare.id.value = id;
	document.viewPrepare.no.value = no;
	document.viewPrepare.kind.value = kind;
	document.viewPrepare.ordi.value = ordi;
	document.viewPrepare.pageIndex.value = "1";
  edinet_login('document.viewPrepare.submit();');
}
function show() {
	document.forms.codeCorpList.code.value = gcode;
	document.forms.codeCorpList.submit();
}
function enable(name) {
	tM = document.getElementById(name).style;
	tM.display = "block";
}
function disable(name) {
	tM = document.getElementById(name).style;
	tM.display = "none";
}
function hide(name) {
	tM = document.getElementById(name).style;
	tM.display = (tM.display == "none") ? "block" : "none";
}
function batch(what) {
	var i = 0;
	var el;
	while (el = document.getElementById("batch" + i)) {
		el.checked = (what == 1) ? "checked" : "";
		i++;
	}
	return false;
}
function encodeURL(str) {
  var character = '';
  var unicode   = '';
  var string    = '';
  var i         = 0;

  for (i = 0; i < str.length; i++) {
    character = str.charAt(i);
    unicode   = str.charCodeAt(i);

    if (character == ' ') {
      string += '+';
    } else {
      if (unicode == 0x2a || unicode == 0x2d || unicode == 0x2e || unicode == 0x5f || ((unicode >= 0x30) && (unicode <= 0x39)) || ((unicode >= 0x41) && (unicode <= 0x5a)) || ((unicode >= 0x61) && (unicode <= 0x7a))) {
        string = string + character;
      } else {
        if ((unicode >= 0x0) && (unicode <= 0x7f)) {
          character   = '0' + unicode.toString(16);
          string += '%' + character.substr(character.length - 2);
        } else if (unicode > 0x1fffff) {
          string += '%' + (oxf0 + ((unicode & 0x1c0000) >> 18)).toString(16);
          string += '%' + (0x80 + ((unicode & 0x3f000) >> 12)).toString(16);
          string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
          string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
        } else if (unicode > 0x7ff) {
          string += '%' + (0xe0 + ((unicode & 0xf000) >> 12)).toString(16);
          string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
          string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
        } else {
          string += '%' + (0xc0 + ((unicode & 0x7c0) >> 6)).toString(16);
          string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
        }
      }
    }
  }

  return string;
}
