
function initlastbuy()
{
	var t = getelement("lastbuy");
	if(t)
	{
		for(x=0;x<6;x++)
			t.appendChild(document.createElement("div"));
		
		for(x=0;x<t.childNodes.length;x++)
		{
			var e = t.childNodes[x];
			if(e.tagName == "DIV")
			{
				e.empty = true;
				e.className = "topprods";
			}
		}
	}
}
initlastbuy();

SAddEvent(null,"load",tshopinit);

function tshopinit()
{
	var topprods = getelement("lastbuy");
	if(topprods)
	{
		var system_i2 = new TSystem();
		system_i2.push_last(new Array(path+"topshop.php","",reload_img2));
	}
}

function reload_img2(xml_val)
{
	var tree = xml2json.parser(xml_val,"",false);
	var topprods = getelement("lastbuy");
	if(topprods)
	{
		var c=0;
		for(x=0;x<topprods.childNodes.length;x++)
		{
			var t = topprods.childNodes[x];
			if(t.tagName == "DIV" && t.empty)
			{
				t.empty = false;
				//t.innerHTML += tree.products[c++].product.name;
				var da = document.createElement("a");
				var di = document.createElement("img");
				var df1 = document.createElement("font");
				var df2 = document.createElement("font");
				di.src = tree.products[c].img.src;
				di.title = "tbm";
				df1.innerHTML = tree.products[c].product.name;
				df2.innerHTML = tree.products[c].product.price;
				df2.className = "price";
				da.appendChild(di);
				da.href = tree.products[c].a.href;
				t.appendChild(da);
				t.appendChild(df1);
				t.appendChild(df2);
				//t.onclick = da.href;//function(){ alert('x'); }
				c++;
			}
		}
	}
	/*for(x=0;x<tree.products.length;x++)
	{
		//alert(tree.products[x].product.name);
	}*/
}