
var url = "www.digitop.jp/demo/grant/";
var def_tax = 1.05;

/* 数値を3桁毎にカンマで区切る */
function formatNumber(num) {
	var s = "" + num; // 文字列型に変換
	var p = s.indexOf("."); // 小数点の位置を0オリジンで求める。
	if (p < 0) { // 小数点が見つからなかった時
		p = s.length; // 仮想的な小数点の位置とする
	}
	var r = s.substring(p, s.length); // 小数点の桁と小数点より右側の文字列。
	for (var i = 0; i < p; i++) { // (10 ^ i) の位について
		var c = s.substring(p - 1 - i, p - 1 - i + 1); // (10 ^ i) の位のひとつの桁の数字。
		if (c < "0" || c > "9") { // 数字以外のもの(符合など)が見つかった
			r = s.substring(0, p - i) + r; // 残りを全部付加する
			break;
		}
		if (i > 0 && i % 3 == 0) { // 3 桁ごと、ただし初回は除く
			r = "," + r; // カンマを付加する
		}
		r = c + r; // 数字を一桁追加する。
	}
	return r;
}

/* 別ウィンドウを開く */
function winMini(link){
    window.open(link,"","width=600,height=700,resizable=yes,dependent=yes");
}

/* カナ削除 */
function delKana(obj1, obj2){
	if (obj1 == '') {
		document.getElementById(obj2).value = '';
	}
}

/* 自動フリガナ入力フォーム - JavaScript */

var prevval = "";       // 最後の入力状況

var form1;
function get_ruby( eve, elem, dst ) {
	var newval = hira2kata(elem.value);
	if ( prevval == newval ) return;

	if ( ! form1 ) form1 = new JKL.Form( elem.form.id );
	if ( newval == "" ) {
		form1.setValue( dst, "" );
		prevval = "";
		return;
	}

	var addval = newval;
	for( var i=prevval.length; i>=0; i-- ) {
		if ( newval.substr(0,i) == prevval.substr(0,i) ) {
			addval = newval.substr(i);
			break;
		}
	}
	prevval = newval;

	var addruby = addval.replace( /[^ 　ぁあ-んア-ンァー]/g, "" );
	if ( addruby == "" ) return;

	form1.setValue( dst, form1.getValue(dst)+addruby );
}

var timer = false;
function fncOnload(){
	loopTimer();
}
function loopTimer(){
	get_ruby(false,frm.name,'ruby');
	timer = setTimeout("loopTimer()",30);
}

/* ひらがな→カタカナ変換 */
function is_hira(c) { return ((c >= 12353 && c <= 12435) || c == 12445 || c == 12446); }

function hira2kata(src) {
    var str = new String;
    var len = src.length;
    for (var i = 0; i < len; i++) {
        var c = src.charCodeAt(i);
        if (is_hira(c)) { 
            str += String.fromCharCode(c + 96);
        } else {
            str += src.charAt(i);
        } 
    }
    return str;
}

/* FAQ ページ内検索 */
function search(str){
	if (!str) return;
	find = document.body.createTextRange();
	if (!find.findText(str)) alert("「"+str+"」はありません");
	while (find.findText(str)){
		find.select();
		if(confirm("次を検索")) find.collapse(false);
		else break;
	}
}

/* 受注　URL指定して別画面起動 */
function newWindow(url){
	window.open(url,"","");
}

/* 受注　URL指定して別画面起動 パラメタをURLにくっつける*/
function newWindow2(url, name, value){
	url = url+"&"+name+"="+value;
	window.open(url,"","");
}

/* 受注　URL指定して別画面起動 パラメタをURLにくっつける*/
function newWindow3(url, name, prm){
	startIdx = prm.indexOf("[") + 1;
	endIdx   = prm.indexOf("]");
	value = prm.substring(startIdx, endIdx);

	url = url+"&"+name+"="+value;
	window.open(url,"","");
}

/* 数値の左zeroを削除 */
function LTrim(numChar) {
	var strFinal;
	var nLoop = 0;
	strTemp = numChar;
	strFinal = numChar;
	//LTRIM開始
	while (nLoop < strTemp.length) {
		if (strFinal.substring(0, 1) == " ") {
			strFinal = strTemp.substring(nLoop + 1, strTemp.length);
		} else if (strFinal.substring(0, 1) == "0") {
			strFinal = strTemp.substring(nLoop + 1, strTemp.length);
		} else {
			break;
		}
		nLoop++;
	}
	if (strFinal == '') {
		strFinal = 0;
	}
	return strFinal;
}

/* ボタン押下により、テキスト文代入 */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
     function storeCaret (textEl) {
       if (textEl.createTextRange)
         textEl.caretPos = document.selection.createRange().duplicate();
     }
     function insertAtCaret (textEl, text) {
       if (textEl.createTextRange && textEl.caretPos) {
         var caretPos = textEl.caretPos;
         caretPos.text =
           caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
             text + ' ' : text;
       }
       else
         textEl.value  = text;
     }

/* チェックボックスだったら全選択/全解除 */
function allcheck(flag){
	targetForm = document.formData;
	for(n = 0;n <= targetForm.length - 1;n ++){
		if(targetForm.elements[n].type == "checkbox"){
			targetForm.elements[n].checked = flag;
		}
	}
}

/* チェックボックスだったら全選択/全解除(オブジェクト指定) */
function allcheckSel(flag, obj){
	targetForm = document.formData;
	for(n = 0;n <= targetForm.length - 1;n ++){
		if(targetForm.elements[n].type == "checkbox"){
			if(targetForm.elements[n].name.match(obj)){
				targetForm.elements[n].checked = flag;
			}
		}
	}
}

/* モード変更しつつサブミット */
function clickSubmit1 (mode)
{
    document.formData.mode.value = mode;
    document.formData.submit();
}

/* リンク先変更しつつサブミット */
function clickSubmit2 (link)
{
    document.formData.action = link;
    document.formData.submit();
}

/* リンク先変更しつつサブミット 乱数付加バージョン　URLの後ろが、【unq】なのが前提です。*/
function clickSubmit2r (link)
{
    myD       = new Date();
    myHours   = myD.getHours();
    myMinutes = myD.getMinutes();
    mySeconds = myD.getSeconds();
    link = link + myHours + myMinutes + mySeconds;
    document.formData.action = link;
    document.formData.submit();
}

/* リンク先変更しつつモードを変更しつつサブミット */
function clickSubmit3 (mode, link)
{
    document.formData.mode.value = mode;
    document.formData.action = link;
    document.formData.submit();
}

/* リンク先変更しつつモードを変更しつつサブミット */
function clickSubmit3F (mode, link)
{
    document.formFind.modeF.value = mode;
    document.formFind.action = link;
    document.formFind.submit();
}

/* リンク先変更しつつモードを変更しつつサブミット キャンペーン専用！ */
function clickSubmit3C (mode, link)
{
    document.formData.screenMode.value = mode;
    document.formData.action = link;
    document.formData.submit();
}

/* リンク先変更しつつ別ウィンドウで開く */
function clickSubmit4 (link)
{
    document.formData.target = "_blank";
    document.formData.action = link;
    document.formData.submit();
}

/* リンク先指定して別ウィンドウを開く */
function clickNewWindow (link)
{
    strLink = document.formData.action;
    document.formData.target = "_blank"; 
    document.formData.action = link; 
    document.formData.submit(); 
    document.formData.target = "_main"; 
    document.formData.action = strLink; 
}

/* 確認メッセージ */
function clickCheckAndSubmit (mes, mode)
{
    var ret; 
    ret = confirm(mes); 
    if (ret == true) {
        document.formData.mode.value = mode;
        document.formData.submit();
    }
}

/* 画面倍率変更 */
function changeSize ()
{
    document.body.style.zoom = document.formSize.displaySize.value;
}

/* 日付チェック */
function checkInputDate (objYear, objMonth, objDay, argInp)
{
    if (objYear.value != "" && objMonth.value != "" && objDay.value != "") {
        res = checkDate (objYear.value, objMonth.value, objDay.value);
        return res;
    } else {
        if (argInp == "check") {
            alert ("日付が入力されていません");
            return false;
        }
    }
}

/* 日付チェック */
function checkDate (checkYear, checkMonth, checkDay)
{
    date_limit = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    if (!(checkMonth >= 1 && checkMonth <= 12)) {
        alert("存在しない日付が入力されています");
        return false;
    }

    if (!(checkYear % 4) && checkMonth == 2) {
        date_limit[1] = 29;
        if (!(checkYear % 100)) {
            if (checkYear % 400) {
                date_limit[1] = 28;
            }
        }
    }

    if (!(1 <= checkDay && date_limit[(checkMonth - 1)] >= checkDay)) {
        alert("存在しない日付が入力されています");
        return false;
    }

    return true;
}

/* 郵便番号一覧オープン */
function autoAddress (argMode, argUnq, argZip1, argZip2, argAddr, argProtocol)
{
    rdmSeed = new Date();
    argUnq = rdmSeed.getTime();
    if (argProtocol == "https") {
        strURL = "https://"+ url +"/system/zip/list/?unq="+argUnq+"&backMode="+argMode;
    } else {
        strURL = "http://"+ url +"/system/zip/list/?unq="+argUnq+"&backMode="+argMode;
    }
    if (argZip1 != "") { strURL = strURL+"&zip1="+argZip1; }
    if (argZip2 != "") { strURL = strURL+"&zip2="+argZip2; }
    if (argAddr != "") { strURL = strURL+"&addr="+escape(argAddr); }
    strURL = strURL+"&safe="+rdmSeed.getTime();
    window.open(strURL,'郵便番号一覧','directories=no,scrollbars=yes,location=no,menubar=no,toolbar=no');
}

/* 郵便番号返却 */
function returnZip (argMode, argPref, argZip1, argZip2, argAddr)
{
    var intPref;
    var argVal;

    /* 配送先はちょっと特殊だぜ */
    if (argMode.indexOf("tmo_address_b[")>=0) {
        if (argMode.substring(15, 16) == "]") {
            argVal = argMode.substring(14, 15);
        } else {
            argVal = argMode.substring(14, 16);
        }
        argMode = "tmo_address_b";
    }

    intPref = argPref.value;
    switch (argMode) {
        case "tcu_zip1":
        case "tcu_address1":
            window.opener.document.formData.tcu_zip1.value = argZip1.value;
            window.opener.document.formData.tcu_zip2.value = argZip2.value;
            window.opener.document.formData.tcu_pref.options[intPref].selected = true;
            window.opener.document.formData.tcu_address1.value = argAddr.value;
            break;
        case "tde_zip1":
        case "tde_address1":
            window.opener.document.formData.tde_zip1.value = argZip1.value;
            window.opener.document.formData.tde_zip2.value = argZip2.value;
            window.opener.document.formData.tde_pref.options[intPref].selected = true;
            window.opener.document.formData.tde_address1.value = argAddr.value;
            break;
        case "tmo_zip_b":
        case "tmo_address_b":
            /* intPref = intPref - 1; */
            var objName = "tmo_zip_b[" + argVal + "]";
            window.opener.document.getElementById(objName).value = argZip1.value;
            var objName = "tmo_zip_a[" + argVal + "]";
            window.opener.document.getElementById(objName).value = argZip2.value;
            var objName = "tmo_pref[" + argVal + "]";
            window.opener.document.getElementById(objName).options[intPref].selected = true;
            var objName = "tmo_address_b[" + argVal + "]";
            window.opener.document.getElementById(objName).value = argAddr.value;
            break;
        default:
            break;
    }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//---------------------------------------------------------
// 全角・半角変換 機能追加スクリプト
//
// 2005/2/26 Kazuhiko Arase
//
// String に、以下のメソッドを拡張します。
//
// ・半角Ascii変換
// toHankakuAscii()
//
// ・全角Ascii変換
// toZenkakuAscii()
//
// ・半角カナ変換
// toHankakuKana()
//
// ・全角カナ変換
// toZenkakuKana()
//
// ・半角変換
// toHankaku()
//
// ・全角変換
// toZenkaku()
//
// ・標準変換(半角Ascii, 全角カナ)
// toNormal()
//

function InstallZenHanConversion() {

    function ConversionMap() {
        this.map1 = {};
        this.map2 = {};
    }

    ConversionMap.prototype = {

        add : function(s1, s2) {

            if (!this.map1[s1]) {
                this.map1[s1] = s2;
            }

            if (!this.map2[s2]) {
                this.map2[s2] = s1;
            }
        },

        convert : function(s, reverse) {

            var map = !reverse? this.map1 : this.map2;

            var converted = "";

            for (var i = 0;i < s.length;i++) {

                if (i + 1 < s.length) {
                    var c = map[s.substring(i, i + 2)];
                    if (c) {
                        converted += c;
                        i++;
                        continue;
                    }
                }

                var c = map[s.substring(i, i + 1)];
                if (c) {
                    converted += c;
                    continue;
                }

                // 変換テーブルに該当無し
                converted += s.substring(i, i + 1);
            }

            return converted;
        }
    };

    //---------------------------------------------------------
    // 全角-半角 マッピング (ASCII)
    //

    var asciiMap = new ConversionMap();

    asciiMap.add(" ", "　");
    asciiMap.add("!", "！");

    // 2重引用符
    //asciiMap.add("\"", "zW");
    asciiMap.add("\"", "“");
    asciiMap.add("\"", "”");

    asciiMap.add("#", "＃");
    asciiMap.add("$", "＄");
    asciiMap.add("%", "％");
    asciiMap.add("&", "＆");
    asciiMap.add("'", "’");
    asciiMap.add("(", "（");
    asciiMap.add(")", "）");
    asciiMap.add("*", "＊");
    asciiMap.add("+", "＋");
    asciiMap.add(",", "，");
    asciiMap.add("-", "－");
    asciiMap.add(".", "．");
    asciiMap.add("/", "／");
    asciiMap.add("0", "０");
    asciiMap.add("1", "１");
    asciiMap.add("2", "２");
    asciiMap.add("3", "３");
    asciiMap.add("4", "４");
    asciiMap.add("5", "５");
    asciiMap.add("6", "６");
    asciiMap.add("7", "７");
    asciiMap.add("8", "８");
    asciiMap.add("9", "９");
    asciiMap.add(":", "：");
    asciiMap.add(";", "；");
    asciiMap.add("<", "＜");
    asciiMap.add("=", "＝");
    asciiMap.add(">", "＞");
    asciiMap.add("?", "？");
    asciiMap.add("@", "＠");
    asciiMap.add("A", "Ａ");
    asciiMap.add("B", "Ｂ");
    asciiMap.add("C", "Ｃ");
    asciiMap.add("D", "Ｄ");
    asciiMap.add("E", "Ｅ");
    asciiMap.add("F", "Ｆ");
    asciiMap.add("G", "Ｇ");
    asciiMap.add("H", "Ｈ");
    asciiMap.add("I", "Ｉ");
    asciiMap.add("J", "Ｊ");
    asciiMap.add("K", "Ｋ");
    asciiMap.add("L", "Ｌ");
    asciiMap.add("M", "Ｍ");
    asciiMap.add("N", "Ｎ");
    asciiMap.add("O", "Ｏ");
    asciiMap.add("P", "Ｐ");
    asciiMap.add("Q", "Ｑ");
    asciiMap.add("R", "Ｒ");
    asciiMap.add("S", "Ｓ");
    asciiMap.add("T", "Ｔ");
    asciiMap.add("U", "Ｕ");
    asciiMap.add("V", "Ｖ");
    asciiMap.add("W", "Ｗ");
    asciiMap.add("X", "Ｘ");
    asciiMap.add("Y", "Ｙ");
    asciiMap.add("Z", "Ｚ");
    asciiMap.add("[", "［");

    // 円記号
    //asciiMap.add("\\", "＼");
    asciiMap.add("\\", "￥");

    asciiMap.add("]", "］");
    asciiMap.add("^", "＾");
    asciiMap.add("_", "＿");

    // 単一引用符
    //asciiMap.add("`", "zV");
    asciiMap.add("`", "‘");
    asciiMap.add("`", "’");

    asciiMap.add("a", "ａ");
    asciiMap.add("b", "ｂ");
    asciiMap.add("c", "ｃ");
    asciiMap.add("d", "ｄ");
    asciiMap.add("e", "ｅ");
    asciiMap.add("f", "ｆ");
    asciiMap.add("g", "ｇ");
    asciiMap.add("h", "ｈ");
    asciiMap.add("i", "ｉ");
    asciiMap.add("j", "ｊ");
    asciiMap.add("k", "ｋ");
    asciiMap.add("l", "ｌ");
    asciiMap.add("m", "ｍ");
    asciiMap.add("n", "ｎ");
    asciiMap.add("o", "ｏ");
    asciiMap.add("p", "ｐ");
    asciiMap.add("q", "ｑ");
    asciiMap.add("r", "ｒ");
    asciiMap.add("s", "ｓ");
    asciiMap.add("t", "ｔ");
    asciiMap.add("u", "ｕ");
    asciiMap.add("v", "ｖ");
    asciiMap.add("w", "ｗ");
    asciiMap.add("x", "ｘ");
    asciiMap.add("y", "ｙ");
    asciiMap.add("z", "ｚ");
    asciiMap.add("{", "｛");
    asciiMap.add("|", "｜");
    asciiMap.add("}", "｝");
    asciiMap.add("~", "～");


    //---------------------------------------------------------
    // 全角-半角 マッピング (カタカナ)
    //


    var kanaMap = new ConversionMap();

    kanaMap.add("。", "｡");
    kanaMap.add("「", "｢");
    kanaMap.add("」", "｣");
    kanaMap.add("、", "､");
    kanaMap.add("・", "･");
    kanaMap.add("ヲ", "ｦ");

    kanaMap.add("ァ", "ｧ");
    kanaMap.add("ィ", "ｨ");
    kanaMap.add("ゥ", "ｩ");
    kanaMap.add("ェ", "ｪ");
    kanaMap.add("ォ", "ｫ");

    kanaMap.add("ャ", "ｬ");
    kanaMap.add("ュ", "ｭ");
    kanaMap.add("ョ", "ｮ");

    kanaMap.add("ッ", "ｯ");

    kanaMap.add("ー", "ｰ");

    kanaMap.add("ア", "ｱ");
    kanaMap.add("イ", "ｲ");
    kanaMap.add("ウ", "ｳ");
    kanaMap.add("エ", "ｴ");
    kanaMap.add("オ", "ｵ");

    kanaMap.add("カ", "ｶ");
    kanaMap.add("キ", "ｷ");
    kanaMap.add("ク", "ｸ");
    kanaMap.add("ケ", "ｹ");
    kanaMap.add("コ", "ｺ");

    kanaMap.add("ガ", "ｶﾞ");
    kanaMap.add("ギ", "ｷﾞ");
    kanaMap.add("グ", "ｸﾞ");
    kanaMap.add("ゲ", "ｹﾞ");
    kanaMap.add("ゴ", "ｺﾞ");

    kanaMap.add("サ", "ｻ");
    kanaMap.add("シ", "ｼ");
    kanaMap.add("ス", "ｽ");
    kanaMap.add("セ", "ｾ");
    kanaMap.add("ソ", "ｿ");

    kanaMap.add("ザ", "ｻﾞ");
    kanaMap.add("ジ", "ｼﾞ");
    kanaMap.add("ズ", "ｽﾞ");
    kanaMap.add("ゼ", "ｾﾞ");
    kanaMap.add("ゾ", "ｿﾞ");

    kanaMap.add("タ", "ﾀ");
    kanaMap.add("チ", "ﾁ");
    kanaMap.add("ツ", "ﾂ");
    kanaMap.add("テ", "ﾃ");
    kanaMap.add("ト", "ﾄ");

    kanaMap.add("ダ", "ﾀﾞ");
    kanaMap.add("ヂ", "ﾁﾞ");
    kanaMap.add("ヅ", "ﾂﾞ");
    kanaMap.add("デ", "ﾃﾞ");
    kanaMap.add("ド", "ﾄﾞ");

    kanaMap.add("ナ", "ﾅ");
    kanaMap.add("ニ", "ﾆ");
    kanaMap.add("ヌ", "ﾇ");
    kanaMap.add("ネ", "ﾈ");
    kanaMap.add("ノ", "ﾉ");

    kanaMap.add("ハ", "ﾊ");
    kanaMap.add("ヒ", "ﾋ");
    kanaMap.add("フ", "ﾌ");
    kanaMap.add("ヘ", "ﾍ");
    kanaMap.add("ホ", "ﾎ");

    kanaMap.add("バ", "ﾊﾞ");
    kanaMap.add("ビ", "ﾋﾞ");
    kanaMap.add("ブ", "ﾌﾞ");
    kanaMap.add("ベ", "ﾍﾞ");
    kanaMap.add("ボ", "ﾎﾞ");

    kanaMap.add("パ", "ﾊﾟ");
    kanaMap.add("ピ", "ﾋﾟ");
    kanaMap.add("プ", "ﾌﾟ");
    kanaMap.add("ペ", "ﾍﾟ");
    kanaMap.add("ポ", "ﾎﾟ");

    kanaMap.add("マ", "ﾏ");
    kanaMap.add("ミ", "ﾐ");
    kanaMap.add("ム", "ﾑ");
    kanaMap.add("メ", "ﾒ");
    kanaMap.add("モ", "ﾓ");

    kanaMap.add("ヤ", "ﾔ");
    kanaMap.add("ユ", "ﾕ");
    kanaMap.add("ヨ", "ﾖ");

    kanaMap.add("ラ", "ﾗ");
    kanaMap.add("リ", "ﾘ");
    kanaMap.add("ル", "ﾙ");
    kanaMap.add("レ", "ﾚ");
    kanaMap.add("ロ", "ﾛ");

    kanaMap.add("ワ", "ﾜ");
    kanaMap.add("ン", "ﾝ");

    kanaMap.add("ヴ", "ｳﾞ");


    kanaMap.add("゛", "ﾞ");
    kanaMap.add("゜", "ﾟ");

    kanaMap.add("ヰ", "ｲ");
    kanaMap.add("ヱ", "ｴ");
    kanaMap.add("ヮ", "ﾜ");
    kanaMap.add("ヵ", "ｶ");
    kanaMap.add("ヶ", "ｹ");



    String.prototype.toHankakuAscii = function() {
        return asciiMap.convert(this, true);
    }

    String.prototype.toZenkakuAscii = function() {
        return asciiMap.convert(this, false);
    }

    String.prototype.toHankakuKana = function() {
        return kanaMap.convert(this, false);
    }

    String.prototype.toZenkakuKana = function() {
        return kanaMap.convert(this, true);
    }

    String.prototype.toHankaku = function() {
        return this.toHankakuKana().toHankakuAscii();
    }

    String.prototype.toZenkaku = function() {
        return this.toZenkakuKana().toZenkakuAscii();
    }

    String.prototype.toNormal = function() {
        return this.toZenkakuKana().toHankakuAscii();
    }
}

// 機能インストール
InstallZenHanConversion();

/* テキストエリアのカーソル位置記憶 */
function memCursol (argObj)
{
    if (argObj.createTextRange)
        argObj.caretPos = document.selection.createRange().duplicate();
}

/* テキストエリアのカーソル位置に引数のテキストを代入 */
function insertToCursol (argObj, argText)
{
    if (argObj.createTextRange && argObj.caretPos) {
        var caretPos = argObj.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? argText+' ' : argText;
    } else {
        argObj.value  = argText;
    }
}

/* 数値を3桁ずつカンマ区切りに編集 */
function currency (argVal)
{
    var result;
    var str = "" + argVal;
    var ary;
    if(!(ary = str.match(/^([\+-]|)(\d+)(\.\d+|)$/)))
        return "";
    var int_part = ary[2];
    var len = int_part.length;
    var mod = (len - 1) % 3 + 1;
    result = int_part.substr(0, mod);
    for(var i = mod; i < len; i += 3)
        result += "," + int_part.substr(i, 3);
    result = ary[1] + result + ary[3];
    return result;
}


function calcPrice(_numAreaId,_price,_sendId,_subAreaId,_totalAreaId){
	
	if (document.getElementById(_numAreaId).value != parseInt(document.getElementById(_numAreaId).value)) {
		alert ('必要数量には半角数字で入力して下さい。');
		return(false);
	}

	var num = document.getElementById(_numAreaId).value;
	
	//小計
	if(num <= 3000){
		var price = _price["3000"];
		document.getElementById(_sendId).innerHTML = "900";
	}
	else if(3000 < num ){
		var price = _price["3001"];
		document.getElementById(_sendId).innerHTML = "0";
	}
	var sub = price * parseInt(document.getElementById(_numAreaId).value);
	
	document.getElementById(_subAreaId).innerHTML = addFigure(sub);
	
	//送料
	var send = subFigure(document.getElementById(_sendId).innerHTML);
	
	document.getElementById(_totalAreaId).innerHTML = addFigure( parseInt(sub) + parseInt(send) ) ;
	
}
/**
 * 3桁カンマ区切りで返す
*/
function addFigure(str) {
	var num = new String(str).replace(/,/g, "");
	while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
	return num;
}
/**
 * カンマ消してくれる
 */
function subFigure(str) {
	var num = new String(str).replace(/,/g, "");
	return num;
}

/* 画面半暗転＆ウェイトアニメーション表示 */
function showWaitAnime (pic)
{
    var d = document.createElement('div');
    d.id = 'XFlash';
    with (d.style) {
        position='absolute';
        if (document.compatMode == "CSS1Compat") {
            top = document.documentElement.scrollTop;
        } else {
            top = document.body.scrollTop;
        }
        left='0px';
        if (document.compatMode == "CSS1Compat") {
            width = document.documentElement.clientWidth+'pt';
            height = document.documentElement.clientHeight+'pt';
        } else {
            width = document.body.clientWidth+'pt';
            height = document.body.clientHeight+'pt';
        }
        backgroundColor='black';
        filter='alpha(opacity=50)';
        opacity='.5';
        zindex='9998';
    }
    document.body.appendChild(d);
    var o = document.createElement('img');
    if (document.compatMode == "CSS1Compat") {
        var oh = document.documentElement.scrollTop + (document.documentElement.clientHeight / 2);
    } else {
        var oh = document.body.scrollTop + (document.body.clientHeight / 2);
    }
    o.id = 'waiting';
//    o.src = pic;
    o.src = 'http://fuyouhin-recycle.com/system/images/wait30.gif';
    with (o.style) {
        position='absolute';
        top=oh+'px';
        left='50%';
        zindex='9999';
        border='solid 2px black';
        backgroundColor='white';
    }
    document.body.appendChild(o);
}

/* ページ管理画面　出したり消したり */
function open_close(id, aid)
{
	tObject = document.getElementById(id).style;
	if(tObject.display == 'block') {
		tObject.display = 'none';
		document.all[aid].innerHTML = '<img src="//'+url+'/system/images/icn_open.gif" alt="open" border="0">';
	} else {
		tObject.display = 'block';
		document.all[aid].innerHTML = '<img src="//'+url+'/system/images/icn_close.gif" alt="close" border="0">';
	}
}

/* ページプレビュー */
function previewPage (argTitle, argHTML, argID)
{
    rdmSeed = new Date();
    argUnq = rdmSeed.getTime();
    backUrl = document.formData.action;
    document.formData.action = "previewPage.php?id="+argID+"&amp;unq="+argUnq;
    document.formData.target = "_blank";
    document.formData.submit();
    document.formData.action = backUrl;
    document.formData.target = "_main";
}

/* 受注管理　発注者情報から届け先情報へ値をコピーする */
function custCopy(){
	document.getElementById("tmo_namekana").value = document.getElementById("tcu_namekana").value;
	document.getElementById("tmo_name").value     = document.getElementById("tcu_name").value;
	document.getElementById("tmo_zip1").value     = document.getElementById("tcu_zip1").value;
	document.getElementById("tmo_zip2").value     = document.getElementById("tcu_zip2").value;
	document.getElementById("tmo_pref").value     = document.getElementById("tcu_pref").value;
	document.getElementById("tmo_address1").value = document.getElementById("tcu_address1").value;
	document.getElementById("tmo_tel").value      = document.getElementById("tcu_tel").value;
	if (document.getElementById("tmo_address2")) {
		document.getElementById("tmo_address2").value = document.getElementById("tcu_address2").value;
	}
}

/////  ↓↓↓　受注管理　計算メソッドエリア　↓↓↓  /////

/* 全合計の計算 */
function totalSum(mode){
	var total = 0;
	var sendTotal = 0;
	var stampTotal = 0;
	var allTotal2 = 0;

	if (mode == 'parents') {
		for (i = 0; i < window.opener.document.formData.length; i++) {
			objName = window.opener.document.formData.elements[i].name;
			if (((objName.indexOf("priceSub", 0)) >= 0) || ((objName.indexOf("tso_separate", 0)) >= 0) || ((objName.indexOf("tst_price", 0)) >= 0)) {
				window.opener.document.formData.elements[i].value = window.opener.document.formData.elements[i].value.toHankakuAscii();
				if (window.opener.document.formData.elements[i].value.match(/[^0-9]-/g)) {
					window.opener.document.formData.elements[i].value = 0;
				} else {
					window.opener.document.formData.elements[i].value = LTrim(window.opener.document.formData.elements[i].value);
					if (window.opener.document.formData.elements[i].value) {
						if ((objName.indexOf("priceSub", 0)) >= 0) {
							total = total + parseInt(window.opener.document.formData.elements[i].value);
						} else if ((objName.indexOf("tso_separate", 0)) >= 0) {
							sendTotal = sendTotal + parseInt(window.opener.document.formData.elements[i].value);
						} else if ((objName.indexOf("tst_price", 0)) >= 0) {
							stampTotal = stampTotal + parseInt(window.opener.document.formData.elements[i].value);
						}
					}
				}
			}
		}

		//数値半角処理
		if (window.opener.document.getElementById("tmo_discount")) {
			window.opener.document.getElementById("tmo_discount").value   = window.opener.document.getElementById("tmo_discount").value.toHankakuAscii();
		}
		window.opener.document.getElementById("tmo_commission").value = window.opener.document.getElementById("tmo_commission").value.toHankakuAscii();
		//入力チェック(エラーなら強制的に0)
		if (window.opener.document.getElementById("tmo_discount")) {
			if (window.opener.document.getElementById("tmo_discount").value.match(/[^0-9]/g)) {
				window.opener.document.getElementById("tmo_discount").value = 0;
			} else if (!window.opener.document.getElementById("tmo_discount").value) {
				window.opener.document.getElementById("tmo_discount").value = 0;
			} else {
				window.opener.document.getElementById("tmo_discount").value = LTrim(window.opener.document.getElementById("tmo_discount").value);
			}
		}
		if (window.opener.document.getElementById("tmo_commission").value.match(/[^0-9]/g)) {
			window.opener.document.getElementById("tmo_commission").value = 0;
		} else if (!window.opener.document.getElementById("tmo_commission").value) {
			window.opener.document.getElementById("tmo_commission").value = 0;
		} else {
			window.opener.document.getElementById("tmo_commission").value = LTrim(window.opener.document.getElementById("tmo_commission").value);
		}
		//商品代金合計
		window.opener.document.getElementById("itemTotalDisp").innerHTML = formatNumber(parseInt(total));
		window.opener.document.getElementById("itemTotal").value         = parseInt(total);

		//送料合計
		window.opener.document.getElementById("sendDisp").innerHTML = formatNumber(parseInt(sendTotal));
		window.opener.document.getElementById("send").value         = parseInt(sendTotal);

		//全合計
		allTotal2 = parseInt(total)
				  + parseInt(sendTotal)
				  + parseInt(window.opener.document.getElementById("tmo_commission").value)
				;

		if (window.opener.document.getElementById("stamp")) {
			allTotal2 = allTotal2
				  + parseInt(stampTotal);
		}

		if (window.opener.document.getElementById("tmo_discount")) {
			allTotal2 = allTotal2
				  - parseInt(window.opener.document.getElementById("tmo_discount").value);
		}
		window.opener.document.getElementById("allTotal").value = parseInt(allTotal2);
		window.opener.document.getElementById("allTotalDisp").innerHTML = formatNumber(parseInt(allTotal2));

		//内税
		window.opener.document.getElementById("tax").value = parseInt(total) * 0.05;
		window.opener.document.getElementById("taxDisp").innerHTML = formatNumber(parseInt(parseInt(total) * 0.05));
	} else {
		for (i = 0; i < document.formData.length; i++) {
			objName = document.formData.elements[i].name;
			if (((objName.indexOf("priceSub", 0)) >= 0) || ((objName.indexOf("tso_separate", 0)) >= 0) || ((objName.indexOf("tst_price", 0)) >= 0)) {
				document.formData.elements[i].value = document.formData.elements[i].value.toHankakuAscii();
				if (document.formData.elements[i].value.match(/[^0-9]-/g)) {
					document.formData.elements[i].value = 0;
				} else {
					document.formData.elements[i].value = LTrim(document.formData.elements[i].value);
					if (document.formData.elements[i].value) {
						if ((objName.indexOf("priceSub", 0)) >= 0) {
							total = total + parseInt(document.formData.elements[i].value);
						} else if ((objName.indexOf("tso_separate", 0)) >= 0) {
							sendTotal = sendTotal + parseInt(document.formData.elements[i].value);
						} else if ((objName.indexOf("tst_price", 0)) >= 0) {
							stampTotal = stampTotal + parseInt(document.formData.elements[i].value);
						}
					}
				}
			}
		}

		//数値半角処理
		if (document.getElementById("tmo_discount")) {
			document.getElementById("tmo_discount").value   = document.getElementById("tmo_discount").value.toHankakuAscii();
		}
		document.getElementById("tmo_commission").value = document.getElementById("tmo_commission").value.toHankakuAscii();
		//入力チェック(エラーなら強制的に0)
		if (document.getElementById("tmo_discount")) {
			if (document.getElementById("tmo_discount").value.match(/[^0-9]/g)) {
				document.getElementById("tmo_discount").value = 0;
			} else if (!document.getElementById("tmo_discount").value) {
				document.getElementById("tmo_discount").value = 0;
			} else {
				document.getElementById("tmo_discount").value = LTrim(document.getElementById("tmo_discount").value);
			}
		}
		if (document.getElementById("tmo_commission").value.match(/[^0-9]/g)) {
			document.getElementById("tmo_commission").value = 0;
		} else if (!document.getElementById("tmo_commission").value) {
			document.getElementById("tmo_commission").value = 0;
		} else {
			document.getElementById("tmo_commission").value = LTrim(document.getElementById("tmo_commission").value);
		}
		//商品代金合計
		document.getElementById("itemTotalDisp").innerHTML = formatNumber(parseInt(total));
		document.getElementById("itemTotal").value         = parseInt(total);

		//送料合計
		document.getElementById("sendDisp").innerHTML = formatNumber(parseInt(sendTotal));
		document.getElementById("send").value         = parseInt(sendTotal);

		//全合計
		allTotal2 = parseInt(total)
				  + parseInt(sendTotal)
				  + parseInt(document.getElementById("tmo_commission").value)
				;
		if (document.getElementById("stamp")) {
			allTotal2 = allTotal2
				  + parseInt(stampTotal);
		}

		if (document.getElementById("tmo_discount")) {
			allTotal2 = allTotal2
				  - parseInt(document.getElementById("tmo_discount").value);
		}
		document.getElementById("allTotal").value = parseInt(allTotal2);
		document.getElementById("allTotalDisp").innerHTML = formatNumber(parseInt(allTotal2));

		//内税
		document.getElementById("tax").value = parseInt(total) / 105 * 5;
		document.getElementById("taxDisp").innerHTML = formatNumber(parseInt(parseInt(total) / 105 * 5));
	}
}

/* 受注　1レコード毎のトータル計算 */
function makePriceSub(prm, mode, mode2){
	if (mode2 == 'yes') {
		startIdx = prm.indexOf("[") + 1;
		endIdx   = prm.indexOf("]");
		id1 = prm.substring(startIdx, endIdx);
	} else {
		id1 = prm;
	}

	if (mode == 'parents') {
		//数値半角処理
		window.opener.document.getElementById("tso_amount["+id1+"]").value = window.opener.document.getElementById("tso_amount["+id1+"]").value.toHankakuAscii();
		window.opener.document.getElementById("tso_separate["+id1+"]").value = window.opener.document.getElementById("tso_separate["+id1+"]").value.toHankakuAscii();
		window.opener.document.getElementById("tso_price["+id1+"]").value  = window.opener.document.getElementById("tso_price["+id1+"]").value.toHankakuAscii();

		//入力チェック(エラーなら強制的に0)
		if (window.opener.document.getElementById("tso_amount["+id1+"]").value.match(/[^0-9]/g)) {
			window.opener.document.getElementById("tso_amount["+id1+"]").value = 0;
		} else if (!window.opener.document.getElementById("tso_amount["+id1+"]").value) {
			window.opener.document.getElementById("tso_amount["+id1+"]").value = 0;
		} else {
			window.opener.document.getElementById("tso_amount["+id1+"]").value = LTrim(window.opener.document.getElementById("tso_amount["+id1+"]").value);
		}
		if (window.opener.document.getElementById("tso_separate["+id1+"]").value.match(/[^0-9]/g)) {
			window.opener.document.getElementById("tso_separate["+id1+"]").value = 0;
		} else if (!window.opener.document.getElementById("tso_separate["+id1+"]").value) {
			window.opener.document.getElementById("tso_separate["+id1+"]").value = 0;
		} else {
			window.opener.document.getElementById("tso_separate["+id1+"]").value = LTrim(window.opener.document.getElementById("tso_separate["+id1+"]").value);
		}
		window.opener.document.getElementById("priceSub["+id1+"]").value = parseInt(window.opener.document.getElementById("tso_amount["+id1+"]").value) * parseInt(window.opener.document.getElementById("tso_price["+id1+"]").value);
	} else {
		//数値半角処理
		document.getElementById("tso_amount["+id1+"]").value = document.getElementById("tso_amount["+id1+"]").value.toHankakuAscii();
		document.getElementById("tso_separate["+id1+"]").value = document.getElementById("tso_separate["+id1+"]").value.toHankakuAscii();
		document.getElementById("tso_price["+id1+"]").value  = document.getElementById("tso_price["+id1+"]").value.toHankakuAscii();

		//入力チェック(エラーなら強制的に0)
		if (document.getElementById("tso_amount["+id1+"]").value.match(/[^0-9]/g)) {
			document.getElementById("tso_amount["+id1+"]").value = 0;
		} else if (!document.getElementById("tso_amount["+id1+"]").value) {
			document.getElementById("tso_amount["+id1+"]").value = 0;
		} else {
			document.getElementById("tso_amount["+id1+"]").value = parseInt(LTrim(document.getElementById("tso_amount["+id1+"]").value));
		}
		if (document.getElementById("tso_separate["+id1+"]").value.match(/[^0-9]/g)) {
			document.getElementById("tso_separate["+id1+"]").value = 0;
		} else if (!document.getElementById("tso_separate["+id1+"]").value) {
			document.getElementById("tso_separate["+id1+"]").value = 0;
		} else {
			document.getElementById("tso_separate["+id1+"]").value = parseInt(LTrim(document.getElementById("tso_separate["+id1+"]").value));
		}
		document.getElementById("priceSub["+id1+"]").value = parseInt(document.getElementById("tso_amount["+id1+"]").value) * parseInt(document.getElementById("tso_price["+id1+"]").value);
		document.getElementById("tso_priceDisp["+id1+"]").innerHTML = formatNumber(parseInt(document.getElementById("priceSub["+id1+"]").value));	//金額(表示用)
	}
	totalSum(mode);
}

/* 受注　顧客情報取得 */
function returnCustom(id1, mode, link){
	window.opener.document.getElementById("tcu_namekana").value        = document.getElementById("tcu_namekana["+id1+"]").value;
	window.opener.document.getElementById("tcu_id").value              = document.getElementById("tcu_id["+id1+"]").value;
	window.opener.document.getElementById("tcu_name").value            = document.getElementById("tcu_name["+id1+"]").value;
	window.opener.document.getElementById("tcu_zip1").value            = document.getElementById("tcu_zip1["+id1+"]").value;
	window.opener.document.getElementById("tcu_zip2").value            = document.getElementById("tcu_zip2["+id1+"]").value;
	window.opener.document.getElementById("tcu_pref").value            = document.getElementById("tcu_pref["+id1+"]").value;
	window.opener.document.getElementById("tcu_address1").value        = document.getElementById("tcu_address1["+id1+"]").value;
	window.opener.document.getElementById("tcu_address2").value        = document.getElementById("tcu_address2["+id1+"]").value;
	window.opener.document.getElementById("tcu_birth").value           = document.getElementById("tcu_birth["+id1+"]").value;
	window.opener.document.getElementById("tcu_tel").value             = document.getElementById("tcu_tel["+id1+"]").value;
//	window.opener.document.getElementById("tcu_cell").value            = document.getElementById("tcu_cell["+id1+"]").value;
//	window.opener.document.getElementById("tcu_fax").value             = document.getElementById("tcu_fax["+id1+"]").value;
	window.opener.document.getElementById("tcu_mail").value            = document.getElementById("tcu_mail["+id1+"]").value;
	window.opener.document.getElementById("mode").value                = mode;
	window.opener.document.getElementById("formData").action           = link;
	window.opener.document.formData.submit();
}

/* 受注　商品情報取得 */
function returnItem(id1, id2){
	var itemPrice = Math.round (parseInt(document.getElementById("mit_price["+id2+"]").value) * def_tax);
	window.opener.document.getElementById("tso_itemid["+id1+"]").value         = document.getElementById("mit_id["+id2+"]").value;			//商品ID(パラメタ用)
	window.opener.document.getElementById("tso_itemname["+id1+"]").value       = document.getElementById("mit_name["+id2+"]").value;		//商品名
	window.opener.document.getElementById("tso_amount["+id1+"]").value         = 1;														//数量
	window.opener.document.getElementById("tso_priceDisp["+id1+"]").innerHTML  = formatNumber(itemPrice);	//金額(表示用)
	window.opener.document.getElementById("tso_price["+id1+"]").value          = itemPrice;				//金額(計算用)

	makePriceSub(id1, 'parents', 'no');
}

/* 受注　商品情報取得 */
function returnDir(id1, id2){
	window.opener.document.getElementById("tso_itemid["+id1+"]").value         = document.getElementById("mit_id["+id2+"]").value;			//商品ID(パラメタ用)
	window.opener.document.getElementById("tso_itemname["+id1+"]").value       = document.getElementById("mit_name["+id2+"]").value;		//商品名
	window.opener.document.getElementById("tso_amount["+id1+"]").value         = 1;														//数量
	window.opener.document.getElementById("tso_priceDisp["+id1+"]").innerHTML  = formatNumber(parseInt(document.getElementById("mit_price["+id2+"]").value));	//金額(表示用)
	window.opener.document.getElementById("tso_price["+id1+"]").value          = parseInt(document.getElementById("mit_price["+id2+"]").value);				//金額(計算用)

	makePriceSub(id1, 'parents', 'no');
}

/* 受注　商品情報取消 */
function clearItem(prm){

	startIdx = prm.indexOf("[") + 1;
	endIdx   = prm.indexOf("]");
	id1 = prm.substring(startIdx, endIdx);

	document.getElementById("tso_itemid["+id1+"]").value         = '';		//商品ID(パラメタ用)
//	document.getElementById("tso_maker["+id1+"]").value          = '';		//メーカーID(パラメタ用)
	document.getElementById("tso_itemname["+id1+"]").value       = '';		//商品名
	document.getElementById("tso_amount["+id1+"]").value         = 0;		//数量
//	document.getElementById("tso_amount_old["+id1+"]").value     = 0;		//数量
	document.getElementById("tso_separate["+id1+"]").value       = 0;		//送料
	document.getElementById("tso_priceDisp["+id1+"]").innerHTML  = 0;		//金額(表示用)
	document.getElementById("tso_price["+id1+"]").value          = 0;		//金額(計算用)

	makePriceSub(id1, 'myself', 'no');
}

////////////////////////////////////////////////////////////////////////////////////////////////////
//TRのクローンを作成して追加

/* 
 	_tableId:追加するテーブルのID
 	tableの子要素には必ずtbodyをつけること
*/
function addTr2(_tableId){
	addTrClone2(_tableId);
}

/* 
 	_tableId:追加するテーブルのID
*/
function addTrClone2(_tableId){

	//テーブル行数取得(追加する対象のIDを入れて行数を取得
	var row = document.getElementById(_tableId).rows.length;
	//TRノードのクローン
	var cloneTR = document.getElementById(_tableId).rows[row-1].cloneNode(true);//行数-1にして行のクローン取得
	//クローンにIDもたせる
//	cloneTR.id = "TRID_"+row;
	
	var table_child = document.getElementById(_tableId).childNodes;

	var tbody_element;

	for( var i = 0; i < table_child.length; i++){
		if("TBODY" == table_child[i].tagName) {
			tbody_element = table_child[i];
			break;
		}
	}
	
	if("TBODY" == tbody_element.tagName) {
		document.getElementById(tbody_element.id).appendChild(cloneTR);
		changeTdObjectName(cloneTR,row);
	}else{
		alert("tbodyのIDが取得できません");
		alert(document.getElementById(_tableId).firstChild.tagName);
	}
}

//TDのnameをかえてく
function changeTdObjectName(_node,_num){
	var tr_list = _node.childNodes;

	for(var i = 0; i < tr_list.length; i++){ 
		td_list = tr_list.item(i).childNodes;
		childMake(td_list, _num);
	}
}

/* 自分の子供がいれば再帰呼び出しで終わりまでオブジェクトを探します */
function childMake(_list, _num){
	for(var j = 0; j < _list.length; j++ ){
		if((_list.item(j).name) || (_list.item(j).id)) {
			objChange(_list.item(j),_num);
		} else {
			obj1_list = _list.item(j).childNodes;
			childMake(obj1_list, _num);
		}
	}
}

/* コピーしたオブジェクトの情報書き換え */
function objChange(_obj, _num) {
	//name=[整数]なら整数をincrementしていく
	if (_obj.name) {
		//name書き換え
		if( "-1" != _obj.name.indexOf("[") ){
			_obj.name = _obj.name.replace(/[0-9]+/,_num);
		}
		//id書き換え
		if( "-1" != _obj.id.indexOf("[") ){
			_obj.id = _obj.id.replace(/[0-9]+/,_num);
		}
		//その他消したいobject
		if (((_obj.name.indexOf("tso_itemidDisp", 0)) >= 0) || 
			((_obj.name.indexOf("mit_nameDisp", 0)) >= 0)) {
			_obj.innerHTML = '';
		}
		if (((_obj.name.indexOf("tso_priceDisp", 0)) >= 0)) {
			_obj.innerHTML = '0';
		}
		if (((_obj.name.indexOf("tso_amount", 0)) >= 0) || 
			((_obj.name.indexOf("tso_price", 0)) >= 0) || 
			((_obj.name.indexOf("tso_separate", 0)) >= 0)) {
			_obj.value = '0';
		}
		if (((_obj.name.indexOf("tso_itemid", 0)) >= 0) || 
//			((_obj.name.indexOf("tso_maker", 0)) >= 0) || 
			((_obj.name.indexOf("tso_itemname", 0)) >= 0)) {
			_obj.value = '';
		}
	}
	//firefox用　_obj.name がダメみたい。主にdivのid書き換え
	if (_obj.id) {
		//id書き換え
		if( "-1" != _obj.id.indexOf("[") ){
			_obj.id = _obj.id.replace(/[0-9]+/,_num);
		}
		//その他消したいobject
		if (((_obj.id.indexOf("tso_itemidDisp", 0)) >= 0) || 
			((_obj.id.indexOf("mit_nameDisp", 0)) >= 0)) {
			_obj.innerHTML = '';
		}
		if (((_obj.id.indexOf("tso_priceDisp", 0)) >= 0)) {
			_obj.innerHTML = '0';
		}
		if (((_obj.id.indexOf("tso_amount", 0)) >= 0) || 
			((_obj.id.indexOf("tso_price", 0)) >= 0) || 
			((_obj.id.indexOf("tso_separate", 0)) >= 0)) {
			_obj.value = '0';
		}
		if (((_obj.id.indexOf("tso_itemid", 0)) >= 0) || 
//			((_obj.id.indexOf("tso_maker", 0)) >= 0) || 
			((_obj.id.indexOf("tso_itemname", 0)) >= 0)) {
			_obj.value = '';
		}
	}
	//hiddenのvalueはコピーしたくない
	try {
		if( "-1" != _obj.type.indexOf("hidden") ){
			_obj.value = "";
		}
	} catch(e) {
		//typeを見に行こうとしてエラーなら書き換えなくていいんじゃない？
	}
}


/* チェックボックスのトグル */
function changeCheckbox(_obj) {
	if (_obj.checked == true) {
		_obj.checked = false;
	} else {
		_obj.checked = true;
	}
}

/* オンライン申し込みの分岐処理 */
function dispConfirm(link1, link2){
	if(window.confirm('法人様と個人事業主様で、入力して頂く項目が異なります。'+'\n'+'法人様の場合は「OK」、個人事業主様の場合は「キャンセル」を'+'\n'+'クリックして下さい。')){
		var link = link1;
	} else {
		var link = link2;

	}
	document.formMove.action = link;
	document.formMove.submit();
}

/*　ローディング表示　*/
function LoadingMsg(){
    if(self.attachEvent || self.addEventListener){ var wimg = new Image();
        /*上からの表示位置 % かpxで */
        var PTop = '35%';

        /*表示する文字列 */
        var msgs ='Now Loading......';

        /*表示する『ロード中』画像 */
        wimg.src = 'http://fuyouhin-recycle.com/system/images/wait30.gif';

        /* 細かいCSS設定の調整は↓の１行。タグ打出し部分を調整 */
        document.write('<div id="Loadouter" style="top:',PTop,';position: absolute; width:95%; z-index: 100; color:#9999cc; text-align:center;"><table id="Loadinner" style="margin:auto; border:1px solid #aaaaaa; font-size: 13px; text-align:left;"><tr><td>',msgs,'</td></tr><tr><td><img src="',wimg.src,'" border=0></td></tr></table></div>');
        function by(id){ if(document.getElementById){ return document.getElementById(id).style; }; if(document.all){ return document.all(id).style ; }}
        function addEv(obj, type, func){ if(obj.addEventListener){ obj.addEventListener(type, func, false); }else{ if(obj.attachEvent) obj.attachEvent('on' + type, func); }}
        addEv(window, 'load', function(){by('Loadouter').display = 'none';});
    }
}

