var xhr;
var id;
//------------------------------------------------------------------------------
function get_post(url,dir,id)	
{
	this.id  = id;
	var post = '?dir='+dir;
	url=url+post;
	httpRequest(url,post,callback); 	 
}
//------------------------------------------------------------------------------
function callback(data)	{ document.getElementById(id).innerHTML = data;	}
//------------------------------------------------------------------------------
function loading()			{ document.getElementById(id).innerHTML = "Loading...";	}
//------------------------------------------------------------------------------
function httpRequest(url,post,func_ref)
{
	//loading();
	
	xhr = get_XMLHttpRequest();
	xhr.onreadystatechange = function()
	{ if(xhr.readyState==4 && xhr.status==200) func_ref(xhr.responseText); }	
	xhr.open("POST",url,true);
	xhr.send(post);
	
}
//------------------------------------------------------------------------------
function get_XMLHttpRequest()
{
	var xhr = null;
	if (window.XMLHttpRequest) 		xhr = new XMLHttpRequest();
	else if (window.ActiveXObject)	xhr = new ActiveXObject("Microsoft.XMLHTTP");
	else 							xhr = new ActiveXObject("Msxml2.XMLHTTP");
	return xhr;
}
//------------------------------------------------------------------------------
function toggle( id )
{
	var div = document.getElementById(id);
	if( div.style.display=='none' ) 	div.style.display = 'block';
	else								div.style.display = 'none';
}
//------------------------------------------------------------------------------
