﻿function XmlHttpcheck() {
	var xmlhttp = false;
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		try {
  			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
  			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlhttp;
}
var xmlobj = 0;
var preinp = "";

function GetData () {
	if (! xmlobj) {
		xmlobj = XmlHttpcheck();
	}
	if (! xmlobj || xmlobj.readyState == 1 || xmlobj.readyState == 2 || xmlobj.readyState == 3){
		return; 
	}
	var query = document.getElementById('inp');
	var inp = encodeURI(query.value);
	var s_res  = document.getElementById("s_res");

	if (inp == "") {
		s_res.style.display = "none";
	} else if (preinp != inp) {
		xmlobj.open("GET", "zip.cgi?" + inp, true);
		xmlobj.onreadystatechange = function() {
  			if (xmlobj.readyState == 4 && xmlobj.status == 200) {
				s_res.style.display = "block";
				s_res.innerHTML = xmlobj.responseText;
  			}
		}
		xmlobj.send(null)
	}
	preinp = inp;
}
function pwin(winName) {
  	subwin = window.open('',winName,'scrollbars=yes,width=600,height=200');
	subwin.focus();
}
function mwin(winName) {
  	subwin = window.open('',winName,'scrollbars=yes,width=800,height=500');
	subwin.focus();
}
var i=0
function Scroll(){
    if(i<1200){
        i=i+20;
        window.scroll(0,i);
        setTimeout("Scroll()",20)
    }else{
        i=0;
    }
}
onload = function () { setInterval("GetData()", 300); }
