function getXmlHttp(){
	var xmlhttp;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function GetLastProducts(type,t) {
	var v = new Date();	
	var page = '/last_products.php?type='+type+'&time='+t+'&v='+v.getTime();
	var xmlhttp = getXmlHttp();
	xmlhttp.open('GET', page, true);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				document.getElementById(type).innerHTML=xmlhttp.responseText;		
				//setTimeout(GetLastProducts, 3000);		
			}
		}
	}
	xmlhttp.send(null);
}


function Getequipment() {
	GetLastProducts("equipment",4000);
}

function Getsparepart() {
	GetLastProducts("sparepart",6000);
}

Getequipment();
Getsparepart();

