var __sadmin;

function __build_content()
{
	__sadmin = new SAdmin();
	
	var ajax       = new AJAX(); 
	ajax.url       = "template/php_requests/index.php?task=build";
	ajax.response  = "json";
	ajax.onSuccess = __build_content_request;
	ajax.doRequest();
}

function __build_content_request(json)
{
	if(json.sadmin == 'yes')
		__sadmin.build();
}

function show_loading()
{
	document.getElementById('OV_loading').className = 'show_it';
	document.getElementById('overlay').className = 'show_it';
}

function hide_loading()
{
	document.getElementById('OV_loading').className = 'hide_it';
	document.getElementById('overlay').className = 'hide_it';
}

function __build_admin_box()
{
	document.getElementById('overlay').className = 'show_it';
	document.getElementById('sadmin').className = 'show_it';
	var dom = new Dom(document.getElementById('sadmin') );
	dom.delete_all_childs();
	
	dom.appendDiv(0, 'admin_box_inhalt');
	dom.appendDiv(0, 'admin_box_close');
	dom.appendBr(1);
	dom.appendA(1, '#', '', "__close('sadmin')", '', '');
	dom.appendText(2, 'close');
	
	return document.getElementById('admin_box_inhalt');
}

function __close(w)
{
	document.getElementById(w).className = 'hide_it';
	
	if(w == 'sadmin')
	{
		document.getElementById('overlay').className = 'hide_it';
	}
	
	if(w == 'picture')
	{
		document.getElementById('overlay').className = 'hide_it';
		document.onkeydown = null;
	}
}