|
|
|
 |
function getLocalizedString(key) {
try {
var ret = localizedStrings[key];
if (ret === undefined)
ret = key;
return ret;
} catch (ex) {}
return key;
}
function createXMLHttpRequest(cbFunc) {
var XMLhttpObject = null;
try{
XMLhttpObject = new XMLHttpRequest();
}catch(e){
try{
XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
return null;
}
}
}
if (XMLhttpObject) XMLhttpObject.onreadystatechange = cbFunc;
return XMLhttpObject;
}
function loadXMLFile() {
httpObj = createXMLHttpRequest(displayData);
if (httpObj) {
httpObj.open("GET","/english/common/IPv4_Exhaustion_Counter_XML.jsp",true);
httpObj.send(null);
}
}
function displayData() {
if ((httpObj.readyState == 4) && (httpObj.status == 200)) {
xmlData = httpObj.responseXML;
ipv4ListTags = xmlData.getElementsByTagName("ipv4");
xYearListTags = xmlData.getElementsByTagName("exhaustion_year");
xMonthListTags = xmlData.getElementsByTagName("exhaustion_month");
xDayListTags = xmlData.getElementsByTagName("exhaustion_day");
yYearListTags = xmlData.getElementsByTagName("start_year");
yMonthListTags = xmlData.getElementsByTagName("start_month");
yDayListTags = xmlData.getElementsByTagName("start_day");
zBlocksListTags = xmlData.getElementsByTagName("now_blocks");
zAddressListTags = xmlData.getElementsByTagName("ipv4address_per_block");
//
xYear = xYearListTags[0].childNodes[0].nodeValue;
xMonth = xMonthListTags[0].childNodes[0].nodeValue;
xDay = xDayListTags[0].childNodes[0].nodeValue;
yYear = yYearListTags[0].childNodes[0].nodeValue;
yMonth = yMonthListTags[0].childNodes[0].nodeValue;
yDay = yDayListTags[0].childNodes[0].nodeValue;
zBlocks = zBlocksListTags[0].childNodes[0].nodeValue;
zAddress = zAddressListTags[0].childNodes[0].nodeValue;
//
on_loaded();
}
}
var timer1 = null;
var timer2 = null;
var m = null;
var IPv4add = null;
var re = null;
var XTime =null;
var YTime = null;
var ZTime = null;
var zBlocks = null;
var kisan = null;
var kisannokori = null;
var gensho = null;
var keika = null;
var zanzon = null;
function startTimer() {
document.getElementById("Text001").innerHTML = getLocalizedString('N/A');
document.getElementById("Text002").innerHTML = getLocalizedString('N/A');
document.getElementById("Text003").innerHTML = "";
document.getElementById("Text004").innerHTML = getLocalizedString('N/A');
updateClock();
if (timer1 == null) {
timer1 = setInterval("updateClock();", 3600000);
}
if (timer2 != null) {
timer2 = setInterval("ViewAdd();",10);
}
}
function updateClock() {
loadXMLFile();
timer2 = 1;
}
function on_loaded(){
XTime = new Date(xYear,xMonth,xDay).getTime();
YTime = new Date(yYear,yMonth,yDay).getTime();
kisan = (zAddress *zBlocks);
kisannokori = (XTime-YTime)/1000;
gensho = kisan / kisannokori;
ZTimes = new Date().getTime();
ZTime = ZTimes + 1000*60*60*24*30;
var h = Math.floor((XTime-ZTime)/1000/86400);
if (h>0){
var i = h + getLocalizedString(' \day');
}
else
var i = getLocalizedString('Today(exhaustion?)');
ViewAdd();
document.getElementById("Text002").innerHTML = i;
document.getElementById("Text004").innerHTML = zBlocks + getLocalizedString('/256 blocks');
j = Math.floor(zBlocks/256*100);
if (j >= 0){
document.getElementById("Text003").innerHTML = j+"% ";
}
else
document.getElementById("Text003").innerHTML = "";
document.close();
}
function ViewAdd() {
ZTimes = new Date().getTime();
ZTime = ZTimes + 1000*60*60*24*30;
keika = (ZTime-YTime)/1000;
zanzon = kisan - (gensho*keika);
IPv4add = Math.floor(zanzon);
var l, m = '';
IPv4add = '' + IPv4add;
while ( (l = IPv4add.length) > 3 ) {
m = "," + IPv4add.substr( l - 3, 3 ) + m;
IPv4add = IPv4add.substr( 0, l - 3 );
}
IPv4add = '' + IPv4add + m;
if (document.getElementById("Text004").innerHTML ==getLocalizedString('Net Err')){
document.getElementById("Text001").innerHTML = getLocalizedString('N/A');
}
else
if (zanzon >0){
document.getElementById("Text001").innerHTML = IPv4add
}
else
document.getElementById("Text001").innerHTML = getLocalizedString('0(exhaustion?)');
document.close();
}
var localizedStrings = new Array;
localizedStrings['N/A'] = 'N/A';
localizedStrings['Net Err'] = 'Net Err';
localizedStrings['/256 blocks'] = '/256 blocks';
localizedStrings[' days'] = ' days';
localizedStrings['Today(exhaustion?)'] = 'Today(exhaustion?)';
localizedStrings['0(exhaustion?)'] = '0(exhaustion?)';
| Reserver blocks(IANA) |
|
|
|
| Until X-day(estimation) |
|
|
| Num of IPv4 Addresses |
|
|
|
|
|
|
|
|