// Определение браузера
IE = (document.all); // Internet Explorer?
NC = (document.layers); // Netscape?
Opera = (document.getElementById); // Opera?

var dom = document.getElementById;
var iex = document.all;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

function getElement ( name )
	{
	var el = dom ? document.getElementById(name) : iex ? document.all[name] : ns4 ? eval ( 'document.' + name ) : false;
	return el;
	}
	
function getHeight() 
	{ // Получаем высоту рабочей области браузера
	if (IE || Opera) send = document.body.clientHeight;
	if (NC) send = window.innerHeight;
	return send;
	}

function getWidth() 
	{ // Получаем ширину рабочей области браузера
	if (IE || Opera) send = document.body.clientWidth;

	if (NC) send = window.innerWidth;
	return send;
	}

function open_frame ( type_frame , width , height , e , txt )
	{
	//my_form = document.to_frame;
	my_form = getElement ( "to_frame" );
	my_form.popup_action.value = type_frame;
	my_form.popup_caption.value = txt;
	my_form.submit();

	//my_fr = document.all["my_frame"];
	my_fr = getElement ( "my_frame" );
	my_fr.style.visibility = "visible";
	my_fr.style.width = width;
	my_fr.style.height = height;
/*
	if ( event || e )
		{
	        mouseX = (ns4||ns5) ? e.pageX : window.event.clientX + document.body.scrollLeft;
		mouseY = (ns4||ns5) ? e.pageY : window.event.clientY + document.body.scrollTop;
		offY_popup = -150;
		offX_popup = - width - 50;

		top_sz = (ns4) ? mouseY + offY_popup : mouseY + offY_popup + "px";
		top_sz = top_sz < 0 ? 100 : top_sz;

		left_sz = (ns4) ? mouseX + offX_popup : mouseX + offX_popup;
		left_sz = left_sz < 0 ? 0 : left_sz;
		if ( left_sz == 0 ) left_sz = 300;
		}
	else
		{
		left_sz = parseInt ( ( screen.availWidth / 2 ) - ( width / 2 ) );
		top_sz = parseInt ( ( screen.availHeight / 2 ) - ( height / 2 ) ) - 100;
		}
*/

	left_sz = parseInt ( ( getWidth() / 2 ) - ( width / 2 ) );
	top_sz = parseInt ( ( getHeight() / 2 ) - ( height / 2 ) );
	
	my_fr.style.top = top_sz;
	my_fr.style.left = left_sz;
	}