var agt = navigator.userAgent.toLowerCase();
var ver = parseInt(navigator.appVersion);
var ie = ((agt.indexOf('msie') != -1) && (agt.indexOf('opera') == -1));
var ie5 = (ie && (ver == 4) && (agt.indexOf('msie 5.0')!= -1) );
var opera = (agt.indexOf("opera") != -1);
var opera8 = (agt.indexOf("opera 8") != -1);

var d = document;
var win;

// - position bottom (для IE5 Opera8)
function position_bottom()
{
	var e = (document.body ? document.body : document.documentElement);
	var m = document.getElementById('bodyBlock');
	var b = document.getElementById('bottom');

	if(e.clientHeight < m.clientHeight)
	{
		b.style.top = m.clientHeight - b.clientHeight;
	}
	else
	{
		b.style.top = e.clientHeight - b.clientHeight;
	}
}

if(ie5 || opera8)
{
	window.onload = function(){position_bottom();}
	window.onresize = function(){position_bottom();}
}

//*******************************************************************

var d = document
var win;

function newWin(url,w,h)
{
	var left = (screen.availWidth/2) - w/2;
	var top = 0;

	if(opera)
	{
		top = Math.floor((d.body.clientHeight/2) - h/2);
	}
	else
	{
		top = Math.floor((screen.availHeight/2) - h/2);
	}
	
	var features = 'width=' + w + ',height=' + h + ',scrollbars=1,status=no,resizable,left=' + left + ',top=' + top + ',screenX=' + left + ',screenY=' + top + '';
	win = window.open("" + url + "", "", features);
}
//*******************************************************************
