var cached_images = new Array();
var current_fact_id;

function d_lmClk(inObj)
{
	var aObj= inObj.getElementsByTagName('a');
	window.location.href = aObj[0].href;
}


function d_changeButtonState(objId, bgImg, inOffset)
{
	var offset = 1;
	if (inOffset == 1)
	{
		offset = 0;
	}
	inObj = document.getElementById(objId);
	inObj.style.backgroundImage='url(/i/' +bgImg+ '.png)';
	inObj.style.paddingLeft=inOffset + 'px';
	inObj.style.paddingTop=inOffset + 'px';
	inObj.style.paddingRight=offset + 'px';
	inObj.style.paddingBottom=offset + 'px';
}

function onLoadPage()
{
	cached_images[cached_images.length - 1] = new Image();
	cached_images[cached_images.length - 1].src = '/i/lm_button_on.png';
}

function reqFact(section, cmd, divId)
{
	callServer(null, '/gethtml.ajax.php?' + section + '/' + current_fact_id + '/' + cmd, null, null, readFact, document.getElementById(divId));
}

function readFact(obj, responseText, responseXML, statusCode, statusText) {
	if (statusCode==200 || statusCode==201) {
		response = responseXML.documentElement;  
		//alert(responseText);
		 obj.innerHTML = responseXML.getElementsByTagName('html')[0].firstChild.data;
		 current_fact_id = responseXML.getElementsByTagName('id')[0].firstChild.data;
	}
	else {
		obj.innerHTML = "<i>Загрузить информацию не удалось: "+statusText +"</i>";
	}
}

