var iList = new Object();

function loadimages(k)
{
	var url = "v.aspx?sid=" + k;
	var req = null;
	if(window.XMLHttpRequest)
	{ 
		req = new XMLHttpRequest(); 
	}
	else if(window.ActiveXObject)
	{ 
		try
		{ 
			req = new ActiveXObject("Msxml2.XMLHTTP"); 
		} 
		catch(e)
		{ 
			try
			{ 
				req = new ActiveXObject("Microsoft.XMLHTTP"); 
			} 
			catch(e)
			{
			} 
		} 
	}
	if(req != null)
	{ 
		req.open("GET", url, true); 
		req.onreadystatechange = function()
		{ 
			if(req.readyState == 4) 
			{
				if(req.status == 200) 
				{
					if(req.responseXML != null)
					{ 
						if(req.responseXML.documentElement != null)
						{
							//var startTime = new Date();
							var imageList = req.responseXML.documentElement.getElementsByTagName("Img");
							var imagePreList = new Object();
							var count = imageList.length;

							for(y = 0; y < count; y++)
							{
									var c = imageList[y];
									var nA = c.getElementsByTagName("P")[0].firstChild.data.split("/");
									var naLength = nA.length-1;
									if(nA.length > 0 && nA[naLength])
									{
										imagePreList[nA[naLength]] = c;
									}
							}
							var ar = iList[k];
							if(ar)
							{
								var arLength = ar.length;
	 							for(x = 0; x < arLength; x++)
								{
									try
									{
										var c = imagePreList[ar[x].n];
										ri(c.getElementsByTagName("P")[0].firstChild.data, c.getElementsByTagName("W")[0].firstChild.data, c.getElementsByTagName("H")[0].firstChild.data, c.getElementsByTagName("Idx")[0].firstChild.data, c.getElementsByTagName("F")[0].firstChild.data, ar[x].p);
									}
									catch(e)
									{
									} 
								}
							}
							//var end = (new Date() - startTime);
							//alert(end);
						}
					}
				}
			} 
		} 
		req.send(null); 
	}
	else
	{
		alert("Ihr Browser unterstützt XMLHttpRequest nicht. Es können keine Bilder angezeigt werden.");
	}
}

function ImgObj (n,p) {
	this.n = n;
	this.p = p;
}

function ri(u, w, h, idxStr, f, p)
{	
	var idx = idxStr.split("-");
	var pElem = document.getElementById(p);
	if(pElem == null)
		return;
	var line = document.createElement("div");
	line.style.backgroundImage = "url('" + imgPath + u + "')";
	line.style.width = w + "px";
	line.style.height = f + "px";
	line.style.position = "relative";
	line.style.fontSize = 0;
	
	var pos = "0px ";
	var idxLength = idx.length;
	for(i = 0; i < idxLength; i++)
	{
		var tmp = line.cloneNode(false);
		tmp.style.backgroundPosition = pos + (h-idx[i]) + "px";
		pElem.appendChild(tmp);
	}
}

