//Simple function to load extra content before another div
var scroll_page;
var scroll_count;
var scroll_data;
//var scroll_more;

function scroller_init(n,data)
{
	//scroll_more = document.getElementById("scroll_more");
	count = n;
	scroll_page = n;
	
	scroll_data = data;
	//scroll_more.onmousedown = loadContent;
}

function loadContent(count)
{
	// Obtain an XMLHttpRequest instance
	var req = newXMLHttpRequest();
	
	req.onreadystatechange = function()
	{
		// If the request's status is "complete"
		if(req.readyState == 4)
		{
			// Check that a successful server response was received
			if(req.status == 200)
			{
				var tempDiv = document.createElement("DIV");
				
				var tempText = req.responseText.split("#");
				tempDiv.innerHTML = tempText[1];
				
				var scroll_more = document.getElementById("scroll_more");
				var scroll_holder = document.getElementById("scroll_holder");
				
				scroll_holder.removeChild(scroll_more);
				
				while(tempDiv.firstChild)
				{
					scroll_holder.appendChild(tempDiv.firstChild);
					//scroll_holder.parentNode.insertBefore(tempDiv.firstChild,scroll_more);
				}
				
				if(tempText[0] == "END")
				{
					
				}
				else
				{
					scroll_page += count;
				}
			}
			else
			{
				// An HTTP problem has occurred
				alert("HTTP error: " + req.statusText);
			}
		}
	}
	
	req.open("GET", scroll_data+"?count="+count, true);
	
	req.send(null);
}
