var backfon = '';
var showed = '';
var body = '';
var bigDiv = '';
function viewBig(data) {
	if(backfon == '') backfon = document.getElementById('backfon');
	if(bigDiv == '') bigDiv = document.getElementById('bigDiv');
	if(body == '') body = document.getElementsByTagName('body')[0];
	if(data.indexOf('table') > -1){ bigDiv.style.width = '659px'; bigDiv.style.height = '500px'; height = 500; width = 659;}else{ bigDiv.style.width = '300px'; bigDiv.style.height = '300px'; height = 300; width = 300;}
	
	if(showed != '') hideDiv();
	backfon.style.height = getBodyHeight()+'px';
	backfon.style.width = getClientWidth()+'px';
//	bigDiv = document.createElement('DIV');
	bigDiv.innerHTML = '<div style="text-align: right;cursor: pointer;" onclick="hideDiv();">Закрыть</div>'+data;
//	body.appendChild(bigDiv);
//	bigDiv.setAttribute('style', 'width:659px;height:500px;z-index: 9999; text-align:center;border-bottom: #1e1e1e 1px solid; position: absolute; border-left: #1e1e1e 1px solid; padding-bottom: 10px; background-color: #fff; padding-left: 10px; padding-right: 10px; display: none; border-top: #1e1e1e 1px solid; top: 50%; cursor: pointer; border-right: #1e1e1e 1px solid; padding-top: 10px; left: 50%;');
	bigDiv.style.top = (getBodyScrollTop() + (getClientHeight() / 2) - (height / 2))+'px';
	bigDiv.style.left = ((getClientWidth() / 2) - (width / 2))+'px';
	bigDiv.style.display = '';
	backfon.style.display = '';
	showed = bigDiv;
}

function hideDiv() {
	//	body.removeChild(showed);
		bigDiv.style.display = 'none';
		backfon.style.display = 'none';
		showed = '';
}

function findOffsetHeight(e) {
    var res = 0;
    while ((res == 0) && e.parentNode) {
        e = e.parentNode;
        res = e.offsetHeight;
    }
    return res;
}

function getOffsetHeight(e) { return e.offsetHeight || e.style.pixelHeight || findOffsetHeight(e); }

function findOffsetWidth(e) {
    var res = 0;
    while ((res == 0) && e.parentNode) {
        e = e.parentNode;
        res = e.offsetWidth;
    }
    return res;
}

function getOffsetWidth(e) { return e.offsetWidth || e.style.pixelWidth || findOffsetWidth(e); }

function getBodyHeight() { return document.body.style.pixelHeight || document.body.scrollHeight || document.height; }
function getClientHeight() { return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight; }  //document.body.clientHeight;
function getClientWidth() { return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth; }
function getBodyScrollTop() { return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop); }

