//************************************************************
//************************************************************
//************************************************************
//************************************************************
mapHtml = new Array(10);
mapHtml[0] = "mitsu";
mapHtml[1] = "saba";
mapHtml[2] = "numa";
mapHtml[3] = "yuki";
mapHtml[4] = "kaza";
mapHtml[5] = "mori";
mapHtml[6] = "tou1";
mapHtml[7] = "tou2";
mapHtml[8] = "sent";
mapHtml[9] = "tori";

mapName = new Array(10);
mapName[0] = "密林";
mapName[1] = "砂漠";
mapName[2] = "沼地";
mapName[3] = "雪山";
mapName[4] = "火山";
mapName[5] = "森丘";
mapName[6] = "塔（１）";
mapName[7] = "塔（２）";
mapName[8] = "战斗街";
mapName[9] = "砦";

monsName = new Array(74);
monsName[1] = "雌火龙";
monsName[2] = "黑龍";
monsName[3] = "精灵鹿";
monsName[4] = "苔猪";
monsName[5] = "大野猪";
monsName[6] = "大怪鸟";
monsName[7] = "老山龍";
monsName[8] = "砂龙王";
monsName[9] = "白猫";
monsName[10] = "山菜爷";
monsName[11] = "雄火龙";
monsName[12] = "食草龙";
monsName[13] = "黄速龙";
monsName[14] = "角龙";
monsName[15] = "电龙";
monsName[16] = "蓝速龙";
monsName[17] = "铠龙";
monsName[18] = "推车";
monsName[19] = "巨蜂";
monsName[20] = "毒怪鸟";
monsName[21] = "水龙";
monsName[22] = "岩龙";
monsName[23] = "黑猫";
monsName[24] = "爬虫";
monsName[25] = "甲壳草食龙";
monsName[26] = "一角龙";
monsName[27] = "蓝速龙王";
monsName[28] = "黄速龙王";
monsName[29] = "岩石";
monsName[30] = "红速龙";
monsName[31] = "红速龙王";
monsName[32] = "小猪";
monsName[33] = "麒麟";
monsName[34] = "砂龙";
monsName[35] = "白速龙";
monsName[36] = "红黑龍";
monsName[37] = "雌火龙【亚种】";
monsName[38] = "大怪鸟【亚种】";
monsName[39] = "毒怪鸟【亚种】";
monsName[40] = "黑狼鸟";
monsName[41] = "雄火龙【稀少种】";
monsName[42] = "雌火龙【稀少种】";
monsName[43] = "角龙【亚种】";
monsName[44] = "一角龙【亚种】";
monsName[45] = "电龙【亚种】";
monsName[46] = "水龙【亚种】";
monsName[47] = "铠龙【亚种】";
monsName[48] = "大名盾蟹";
monsName[49] = "雄火龙【亚种】";
monsName[50] = "岩山龍";
monsName[51] = "雪狮子王";
monsName[52] = "桃毛兽王";
monsName[53] = "金狮子";
monsName[54] = "钢龍";
monsName[55] = "砦蟹";
monsName[56] = "大雷光虫";
monsName[57] = "奇面族";
monsName[58] = "浮岳龍";
monsName[59] = "霞龍";
monsName[60] = "锈钢龍";
monsName[61] = "雪狮子";
monsName[62] = "桃毛兽";
monsName[63] = "蛇龙";
monsName[64] = "炎妃龍";
monsName[65] = "炎王龍";
monsName[66] = "小盾蟹";
monsName[67] = "将军镰蟹";
monsName[68] = "大野猪王";
monsName[69] = "雪山鹿";
monsName[70] = "波波";
monsName[71] = "祖龍";
monsName[72] = "浮岳龍";
monsName[73] = "小镰蟹";

hoshuName = new Array(6);
hoshuName[0] = "<B>确定报酬</B>";
hoshuName[1] = "基本报酬";
hoshuName[2] = "捕获追加报酬";
hoshuName[3] = "捕获追加报酬";
hoshuName[4] = "支线A达成报酬";
hoshuName[5] = "支线B达成报酬";

shopName = new Array(16);
shopName[0] = "江波村杂货店";
shopName[1] = "江波村调合店";
shopName[2] = "造访江波村的行商婆婆(1)";
shopName[3] = "造访江波村的行商婆婆(2)";
shopName[4] = "江波村工房";
shopName[5] = "江波村食材店";
shopName[6] = "江波村道具店";
shopName[7] = "科科特村的行商青年";
shopName[8] = "科科特村杂货店";
shopName[9] = "街门的随性杂货商";
shopName[10] = "街杂货店";
shopName[11] = "街食材店";
shopName[12] = "街调合店";
shopName[13] = "街道具店";
shopName[14] = "街斗技场杂货店";
shopName[15] = "街大老殿杂货店";

//******************************************************
bukiName = new Array(11);
bukiName[0] = "大剑";
bukiName[1] = "重弩";
bukiName[2] = "大锤";
bukiName[3] = "长枪";
bukiName[4] = "片手剑";
bukiName[5] = "轻弩";
bukiName[6] = "双剑";
bukiName[7] = "太刀";
bukiName[8] = "狩猎笛";
bukiName[9] = "铳枪";
bukiName[10] = "弓";
bukiHtml = new Array(11);
bukiHtml[0] = "sword.html";
bukiHtml[1] = "heavy.html";
bukiHtml[2] = "hammer.html";
bukiHtml[3] = "lance.html";
bukiHtml[4] = "blade.html";
bukiHtml[5] = "light.html";
bukiHtml[6] = "twin.html";
bukiHtml[7] = "tachi.html";
bukiHtml[8] = "shuryou.html";
bukiHtml[9] = "gunlance.html";
bukiHtml[10] = "yumi.html";

//      防具の場合,防具の種類 2:頭  3:胴  4:腕  5:腰  0:脚
boguName = new Array(6);
boguName[0] = "脚装备";
boguName[2] = "头装备";
boguName[3] = "胴装备";
boguName[4] = "腕装备";
boguName[5] = "腰装备";
boguHtml = new Array(6);
boguHtml[0] = "foot.html";
boguHtml[2] = "head.html";
boguHtml[3] = "armor.html";
boguHtml[4] = "arm.html";
boguHtml[5] = "waist.html";

//****************************************************************
function ShowItemDetail()
{
  icode = document.location.search.substring(1);

//アイテムコード
  if (icode == "")  return;
  no = Number("0x"+icode);
  if (no < 0x0001  ||  no > 0x0398)  return;
  html = "";
  if (no == 0x0001) {
    html += "&lt;";
  } else {
    html += "<A href=\"items.html?" + SubHexNumber(no) + "\">&lt;</A>";
  }
  html += icode.toUpperCase();
  if (no == 0x0398) {
    html += "&gt;";
  } else {
    html += "<A href=\"items.html?" + AddHexNumber(no) + "\">&gt;</A>";
  }
  hitemcode.innerHTML = html;

//アイテム名
  hitemname.innerHTML = itemname[no];

//個数,レア,買値,売値
  data = itemspec[no];
  if (data.substring(0,3) == 255) {
    hitemkosu.innerHTML = "∞";
  } else {
    hitemkosu.innerHTML = Number(data.substring(0,3));
  }
  hitemrare.innerHTML = data.substring(3,4);
  if (Number(data.substring(4,9)) >= 0) {
    hitemkaiz.innerHTML = Number(data.substring(4,9)) + "ｚ";
  }
  hitemuriz.innerHTML = Number(data.substring(9,14)) + "ｚ";

//説明文
  hitemdesc.innerHTML = itemdesc[no];


  if (no > 0x031d)  return;

//****************************************************************
//采取

  hitemsaishu0.innerHTML = FormatSaishu(itemsaishu0[no], 0);
  hitemsaishu1.innerHTML = FormatSaishu(itemsaishu1[no], 0);
  hitemsaishu2.innerHTML = FormatSaishu(itemsaishu2[no], 0);
  hitemsaishu3.innerHTML = FormatSaishu(itemsaishu3[no], 1);
  hitemsaishu4.innerHTML = FormatSaishu(itemsaishu4[no], 1);
  hitemsaishu5.innerHTML = FormatSaishu(itemsaishu5[no], 1);


//****************************************************************
//剥取

  hitemhagi0.innerHTML = FormatHagi(itemhagi0[no]);
  hitemhagi1.innerHTML = FormatHagi(itemhagi1[no]);


//****************************************************************
//報酬
  hitemhoshu0.innerHTML = FormatHoushu(itemhoshu0[no]);
  hitemhoshu1.innerHTML = FormatHoushu(itemhoshu1[no]);


//****************************************************************
//調合・その他
//  0-0:  識別子  M:２種調合  X:３種調合
//                J:爺さん    K:マカ壷
//                S:ただの文字列 1-3:文字列の長さ 4-:文字列
//                G:(ドス)贪吃金枪鱼食べた結果出現するか
  data = itemchogo[no];
  html = "";
  ic = 0;
  while (ic < data.length) {
    if (ic > 0)  html += "<BR>";
    yflag = data.substring(ic,ic+1);

    if (yflag == "M") {
      html += FormatItemName(data.substring(ic+1,ic+4)) + " 与 ";
      html += FormatItemName(data.substring(ic+4,ic+7)) + " ２种调合而来";
      html += " （成功率" + Number(data.substring(ic+7,ic+10)) + "％）";
      if (data.substring(ic+10,ic+11) == 1)  html += "　【炼金】";
      ic = ic + 11;

    } else if (yflag == "X") {
      html += FormatItemName(data.substring(ic+1,ic+4)) + " 与 ";
      html += FormatItemName(data.substring(ic+4,ic+7)) + " 与 ";
      html += FormatItemName(data.substring(ic+7,ic+10)) + " ３种调合而来";
      html += " （成功率" + Number(data.substring(ic+10,ic+13)) + "％）";
      if (data.substring(ic+13,ic+14) == 1)  html += "　【炼金】";
      ic = ic + 14;

    } else if (yflag == "J") {
      kind = data.substring(ic+1,ic+2);			//爺さんの场所
      if (kind == 9) {
        html += "任意山菜爷处交付 ";
        html += FormatItemName(data.substring(ic+2,ic+5));
        numb = data.substring(ic+5,ic+7);
        if (numb > 1)  html += "×" + numb;
        html += " 后可获得";
      } else {
        html += mapName[kind] + "的山菜爷处交付 ";
        html += FormatItemName(data.substring(ic+2,ic+5));
        html += " 后可能获得";
      }
      ic = ic + 7;

    } else if (yflag == "K") {
      html += FormatItemName(data.substring(ic+1,ic+4));
      html += " 在";
      html += "<A href=\"../makalist.html#" + FixData(data.substring(ic+4,ic+6), 4) + "\">";
      html += "埋下一定时间后</A>可入手";
      ic = ic + 6;

    } else if (yflag == "S") {
      numb = Number(data.substring(ic+1,ic+4));		//文字列の長さ
      html += data.substring(ic+4, ic+4+numb);
      ic = ic + 4 + numb;

    } else if (yflag == "G") {
      html += FormatItemName(data.substring(ic+1,ic+4));
      html += " 吃下后未发生体力回复的情况下，";
      html += Number(data.substring(ic+4,ic+7)) + "％的概率可入手";
      ic = ic + 7;

    } else {
      alert("Illegal identification code");
      break;
    }
  }
  hitemchogo.innerHTML = html;


//****************************************************************
//購入
//  0-1:  購入场所番号
//
  data = itemkonyu[no];
  html = "";
  for (ic=0; ic<data.length; ic+=2) {
    shopNo = Number(data.substring(ic,ic+2));
    if (ic > 0)  html += "<BR>";
    html += shopName[shopNo] + " 处购入";
  }
  hitemkonyu.innerHTML = html;


//****************************************************************
//武具への用途
//  0-0:フラグ   W:武器  B:防具  S:装飾品
//  1-1:武器の場合,武器の種類 0:大剣 2:ハンマー 3:ランス 4:片手件 6:双剣 7:太刀 8:狩猟笛 9:ガンランス
//                            1:ヘヴィボウガン 5:ライトボウガン A:弓
//      防具の場合,防具の種類 2:頭  3:胴  4:腕  5:腰  0:脚
//      装飾品の場合未使用
//  2-4:武器/防具/装飾品No.
//  5-5:用途フラグ  0:生産  1:強化  2-7:レベルアップ
//  6-7:必要個数
//以後は強化の場合のみで強化元データ
//  8-8:武器の種類/防具の種類
//  9-11:武器/防具No.
//****************************************************************
  data = itemyoto0[no];
  html = "";
  ic = 0;
  while (ic < data.length) {
    yflag = data.substring(ic+5,ic+6);		//用途フラグ
//武器の場合
    if (data.substring(ic,ic+1) == "W") {
      if (yflag == 1) {
        html += FormatBukiName(data.substring(ic+8,ic+12));
        html += " 至 ";
      }
      html += FormatBukiName(data.substring(ic+1,ic+5));
      if (yflag == 0) {
        html += " 的生产所必要";
      } else if (yflag == 1) {
        html += " 的强化所必要";
      }
      html += "　（" + Number(data.substring(ic+6,ic+8)) + "个）<BR>";

//防具の場合
    } else if (data.substring(ic,ic+1) == "B") {
      kind = Number(data.substring(ic+1,ic+2));
      html += boguName[kind] + " ";
      if (yflag == 1) {
        html += FormatBoguName(data.substring(ic+8,ic+12));
        html += " 至 ";
      }
      html += FormatBoguName(data.substring(ic+1,ic+5));
      if (yflag == 0) {
        html += " 的生产所必要";
      } else if (yflag == 1) {
        html += " 的强化所必要";
      } else if (yflag >= 2) {
        html += " 等级" + yflag + " 的升级所必要";
      }
      html += "　（" + Number(data.substring(ic+6,ic+8)) + "个）<BR>";

//装飾品の場合
    } else if (data.substring(ic,ic+1) == "S") {
      html += FormatSoshName(data.substring(ic+1,ic+5));
      html += " 的生产所必要";
      html += "　（" + Number(data.substring(ic+6,ic+8)) + "个）<BR>";
    }
//次のデータ
    if (yflag == 1) {
      ic = ic + 12;
    } else {
      ic = ic + 8;
    }
  }
  hitemyoto0.innerHTML = html;

//****************************************************************
//その他の用途
//  0-0:  識別子  M:２種調合  X:３種調合
//                J:爺さん
//                S:ただの文字列 1-3:文字列の長さ 4-:文字列
//                G:(ドス)贪吃金枪鱼食べた結果出現するアイテム

  data = itemyoto1[no];
  html = "";
  ic = 0;
  while (ic < data.length) {
    if (ic > 0)  html += "<BR>";
    yflag = data.substring(ic,ic+1);		//識別子
    if (yflag == "J") {
      kind = data.substring(ic+1,ic+2);			//爺さんの场所
      if (kind == 9) {
        html += "任意山菜爷处，将";
        numb = Number(data.substring(ic+2,ic+4));
        if (numb > 1)  html += numb + "个";
        html += "交付后可获得 ";
        html += FormatItemName(data.substring(ic+4,ic+7));
        html += " ";
      } else {
        html += mapName[kind] + "的山菜爷处交付可获得 ";
        html += FormatItemName(data.substring(ic+4,ic+7));
        numb = data.substring(ic+7,ic+10);
        if (numb > 0)  html += " 或 " + FormatItemName(numb);
        numb = data.substring(ic+10,ic+13);
        if (numb > 0)  html += " 或 " + FormatItemName(numb);
        numb = data.substring(ic+13,ic+16);
        if (numb > 0)  html += " 或 " + FormatItemName(numb);
        html += " ";
      }
      ic = ic + 16;

    } else if (yflag == "M") {				//2種調合に使える
      html += FormatItemName(data.substring(ic+8,ic+11));
      html += " 一同进行２种调合后可做成 ";
      html += FormatItemName(data.substring(ic+1,ic+4));
      html += " （成功率";
      html += Number(data.substring(ic+4,ic+7)) + "％）";
      if (data.substring(ic+7,ic+8) == 1)  html += "　【炼金】";
      ic = ic + 11;

    } else if (yflag == "X") {				//3種調合に使える
      html += FormatItemName(data.substring(ic+8,ic+11));
      html += " 与 ";
      html += FormatItemName(data.substring(ic+11,ic+14));
      html += " 一同进行３种调合后可做成 ";
      html += FormatItemName(data.substring(ic+1,ic+4));
      html += " （成功率";
      html += Number(data.substring(ic+4,ic+7)) + "％）";
      if (data.substring(ic+7,ic+8) == 1)  html += "　【炼金】";
      ic = ic + 14;

    } else if (yflag == "K") {				//塊系が何になるか
      html += "在武具店生产时，";
      html += Number(data.substring(ic+5,ic+7)) + "％的概率做成 ";
      html += FormatBukiName(data.substring(ic+1,ic+5));
      html += " ";
      ic = ic + 7;

    } else if (yflag == "G") {				//(ドス)贪吃金枪鱼食べた結果出現するアイテム
      html += "吃下后未发生体力回复的情况下，";
      html += Number(data.substring(ic+1,ic+4)) + "％的概率获得 ";
      html += FormatItemName(data.substring(ic+4,ic+7));
      html += " ";
      ic = ic + 7;

    } else if (yflag == "S") {
      numb = Number(data.substring(ic+1,ic+4));		//文字列の長さ
      html += data.substring(ic+4, ic+4+numb);
      ic = ic + 4 + numb;
    }
  }
  hitemyoto1.innerHTML = html;
}

//---------------------------------
function FormatItemName(tdata)
{
  thtml = "";
  tbno = Number(tdata);
  if (tbno == 0) {
    thtml += "<A href=../jisanlist.html target=\"_blank\">某些物品</A>";
  } else {
    thtml += "<A href=\"items.html?" + Fix16Data(tbno,4).toLowerCase() + "\" target=\"_blank\">";
    thtml += itemname[tbno] + "</A>";
  }
  return thtml;
}

//---------------------------------
function FormatBukiName(tdata)
{
  thtml = "";
  tkind = Number("0x"+tdata.substring(0,1));
  thtml += bukiName[tkind] + " ";
  tbno = Number(tdata.substring(1,4));
  thtml += "<A href=\"../bugu/" + bukiHtml[tkind] + "#" + FixData(tbno, 4) + "\">";
  if (tkind == 1  || tkind == 5  ||  tkind == 10) {
    thtml += gunname[tbno] + "</A>";
  } else {
    thtml += kenname[tbno] + "</A>";
  }
  return thtml;
}

//---------------------------------
function FormatBoguName(tdata)
{
  thtml = "";
  tkind = Number("0x"+tdata.substring(0,1));
  tbno = Number(tdata.substring(1,4));
  thtml += "<A href=\"../bugu/";
  thtml += boguHtml[tkind];
  thtml += "#" + FixData(tbno, 4) + "\">";
  if (tkind == 0) {
    thtml += footname[tbno];
  } else if (tkind == 2) {
    thtml += headname[tbno];
  } else if (tkind == 3) {
    thtml += armorname[tbno];
  } else if (tkind == 4) {
    thtml += armname[tbno];
  } else if (tkind == 5) {
    thtml += waistname[tbno];
  }
  thtml += "</A>";
  return thtml;
}

//---------------------------------
function FormatSoshName(tdata)
{
  thtml = "";
  thtml += "装饰品 ";
  tbno = Number(tdata.substring(1,4));
  thtml += "<A href=\"../bugu/soushoku.html#" + FixData(tbno, 4) + "\">";
  thtml += soshname[tbno] + "</A>";
  return thtml;
}



//****************************************************************
//  采取発掘用のhtml構文生成
//  0-1:  マップ番号
//  2-3:  区域番号 (00:BC  15:隠し)
//  4-5:  ポイント番号
//  6-8:  昼の確率
//  9-11: 夜の確率
//****************************************************************
function FormatSaishu(tdata, tcla)
{
  thtml = "";
  for (ic=0; ic<tdata.length; ic+=12) {
    mapNo = Number(tdata.substring(ic,ic+2));
    areaNo = Number(tdata.substring(ic+2,ic+4));
    ptsNo = Number(tdata.substring(ic+4,ic+6));
    prob1 = Number(tdata.substring(ic+6,ic+9));
    prob2 = Number(tdata.substring(ic+9,ic+12));

    if (ic > 0)  thtml += "<BR>";
    thtml += "<A href=\"../stpickmap/";
    thtml += mapHtml[mapNo];
    if (tcla == 1) {
      thtml += "h";
    }
    thtml += ".html#" + FixData(areaNo, 2) + "d\">";
    thtml += mapName[mapNo];
    if (areaNo == 0) {
      thtml += "　营地-" + ptsNo;
    } else if (areaNo == 15) {
      thtml += "　隐藏区域-" + ptsNo;
    } else {
      thtml += "　区域 " + areaNo + "-" + ptsNo;
    }
    thtml += "</A>";

    if (prob1 > 0)  thtml += "　　昼 " + prob1 + "％";
    if (prob2 > 0)  thtml += "　　夜 " + prob2 + "％";
  }
  return thtml;
}

//****************************************************************
//  剥取用のhtml構文生成
//  0-1:  怪物コード
//  2-2:  種類(0:本体 1:尻尾 2:落し物 3:背部 4:(キング) 5:落し物 1 6:落し物 2 7:落し物 3)
//  3-5:  確率
//****************************************************************
function FormatHagi(tdata)
{
  thtml = "";
  for (ic=0; ic<tdata.length; ic+=6) {
    monsNo = Number(tdata.substring(ic,ic+2));
    kind = Number(tdata.substring(ic+2,ic+3));
    prob = Number(tdata.substring(ic+3,ic+6));

    if (ic > 0)  thtml += "<BR>";
    thtml += "<A href=\"../monslist/mons" + Fix16Data(monsNo, 2) + ".html\">";
    thtml += monsName[monsNo] + "</A>";

    if (kind == 0) {
      thtml += " 剥取入手";
    } else if (kind == 1) {
      thtml += " 的尾巴剥取入手";
    } else if (kind == 2) {
      thtml += " 的掉落物采集入手";
    } else if (kind == 3) {
      thtml += " 的背部剥取入手";
    } else if (kind == 4) {
      thtml += "（王） 剥取入手";
    } else if (kind == 5) {
      thtml += " 的掉落物１采集入手";
    } else if (kind == 6) {
      thtml += " 的掉落物２采集入手";
    } else if (kind == 7) {
      thtml += " 的掉落物３采集入手";
    }
    thtml += "　（" + prob + "％）";
  }
  return thtml;
}

//****************************************************************
//  クエスト報酬用のhtml構文生成
//  0-2:クエ一連番号
//  3-5:確率
//  6-8:報酬名文字列長さ
//  9- :報酬名
//****************************************************************
function FormatHoushu(tdata)
{
  thtml = "";
  ic = 0;
  while (ic < tdata.length) {
    if (ic > 0)  thtml += "<BR>";
    tqno = Number(tdata.substring(ic,ic+3));
    prob = Number(tdata.substring(ic+3,ic+6));
    seas = Number(tdata.substring(ic+6,ic+7));		//季节
    numb = Number(tdata.substring(ic+7,ic+10));		//文字長さ

    if (tqno < 500) {					//通常のクエスト
      tqnm = quename[tqno];
      if (tqnm.charAt(0) == 0) {
        thtml += "离线☆";
      } else {
        thtml += "线上★";
      }
      thtml += tqnm.charAt(1) + " ";

      thtml += "<IMG src=\"../images/season" + seas + "a.gif\" border=\"0\">" + " ";

      thtml += "<A href=\"../";
      if (tqnm.charAt(0) == 0) {
        thtml += "off";
      } else {
        thtml += "on";
      }
      thtml += "quest/rem" + tqnm.charAt(1) + ".html#" + tqnm.substring(2,6) + "\">";
      thtml += tqnm.substring(6) + "</A>" + " 的 ";
      if (numb >= 900) {
        thtml += hoshuName[numb-900];
        numb = 0;
      } else {
        thtml += tdata.substring(ic+10,ic+10+numb);
      }
      thtml += "　（" + prob + "％）";

    } else {
      tqnm = vquename[tqno-500];
      thtml += "活动任务 ";
      thtml += "<A href=\"../evquest/evrem" + FixData(tqno-500,2) + ".html\">";
      thtml += tqnm + "</A>" + " 的 ";
      if (numb >= 900) {
        thtml += hoshuName[numb-900];
        numb = 0;
      } else {
        thtml += tdata.substring(ic+10,ic+10+numb);
      }
      thtml += "　（" + prob + "％）";
    }
    ic = ic + 10 + numb;
  }
  return thtml;
}

//****************************************************************
//  %0?d で書式化
//****************************************************************
function FixData(numb, nc)
{
  ttmp = "00000000" + numb;
  tk = ttmp.length;
  ttmp = ttmp.substring(tk-nc,tk);
  return ttmp;
}

//****************************************************************
//  %0?x で書式化
//****************************************************************
function Fix16Data(numb, nc)
{
  ttmp = "00000000"+numb.toString(16);
  tk = ttmp.length;
  ttmp = ttmp.substring(tk-nc, tk);
  return ttmp;
}




function AddHexNumber(numb)
{
  ttmp = "0000"+(numb+1).toString(16);
  tk = ttmp.length;
  return ttmp.substring(tk-4,tk);
}

function SubHexNumber(numb)
{
  ttmp = "0000"+(numb-1).toString(16);
  tk = ttmp.length;
  return ttmp.substring(tk-4,tk);
}

