<!--

/**
* Common functions. 
*
* 'browser.js' should be included already.
*
* @package Api
* @subpackage JavaScript
*/

/*
* Opens popup window in center of the screen.
*/
function openPopup( url, name, width, height, prop )
{
	var left = Math.floor( screen.availWidth / 2 ) - Math.floor( width / 2 );
	var top = Math.floor( screen.availHeight / 2 ) - Math.floor( height / 2 );
	if ( ! prop ) prop = 'location=no,resizable=yes,menubar=no,status=yes,scrollbars=yes'
	
	var win = window.open( url, name, 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',' + prop );
		
	if ( win ) win.focus();
	
	return win;
}

/*
* Shows text in statusbar of window.
*/
function statusText( txt )
{
	window.status = txt;
	
	return true;
}

/*
* Sets source of image.
*/
function setImg( img, newsrc )
{
	document.images[img].src = newsrc;
}

/*
* Sets HTML of some object.
*/
function setHTML( targetframe, obj_id, html )
{
	if ( ! IS_MOZ && ! IS_IE ) return;
	if ( ! targetframe ) return;
	
	var obj = targetframe.document.getElementById( obj_id );
	if ( ! obj ) return;
	
	obj.innerHTML = html;
}

//-->
