function checkAll(form_name, checkbox_name, chb_status) {
	for(var i = 0; i < document.forms[form_name].elements.length; i++) {
		var obj = document.forms[form_name].elements[i];
		if(obj.name.indexOf(checkbox_name) == 0)
		{
			obj.checked = chb_status;
		}
	}
}

function confirmCommand(message) {
	return confirm(unescape(message));
}

function openPopup(url, width, height) {
	var _screenwidth = screen.width;
	var _screenheight = screen.height;

	_width = width + 20;
	_height = height + 20;

	if(_width > _screenwidth)
	{
		_width = _screenwidth;
		_height = _screenwidth * (_height / _width);
	}
	if(_height > _screenheight)
	{
		_width = _screenheight * (_width / _height);
		_height = _screenheight;
	}

	var _posx = (_screenwidth / 2) - (_width / 2);
	var _posy = (_screenheight / 2) - (_height / 2);

	w = window.open(url, 'picture', 'width=' + _width + ',height=' + _height + ',left=' + _posx + ',top = ' + _posy + ',dependent=yes');
	w.focus();
}

function getPositionLeft(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	} else if (obj.x) curleft += obj.x;
	return curleft;
}

function getPositionTop(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if (obj.y) curtop += obj.y;
	return curtop;
}