function showAffectedCalcInds(ind_id)
{
	(window.open('/admin/indicator/edit/affected_calc.php?<?=$q_str?>indicator_id=' + ind_id, '_blank', 'width=400,height=300,resizable=1,scrollbars=1')).focus();
}

function showAffectedInds(ind_id)
{
	(window.open('/admin/indicator/report/affected_inds.php?<?=$q_str?>report_id=' + ind_id, '_blank', 'width=400,height=300,resizable=1,scrollbars=1')).focus();
}

function showAffectedAggrInds(ind_id)
{
	(window.open('/admin/indicator/aggr/affected_aggr.php?<?=$q_str?>indicator_id=' + ind_id, '_blank', 'width=400,height=300,resizable=1,scrollbars=1')).focus();
}

function show_affected_inds(ind_id)
{
	(window.open('/admin/rank/affected_inds.php?<?=$q_str?>r_id=' + ind_id, '_blank', 'width=400,height=300,resizable=1,scrollbars=1')).focus();
}

function show_affected_diagrams(ind_id)
{
	(window.open('/admin/indicator/group/affected_diagrams.php?<?=$q_str?>id=' + ind_id, '_blank', 'width=400,height=300,resizable=1,scrollbars=1')).focus();
}

// txt
function txtStoreCaret(textEl)
{
	if (textEl.createTextRange) 
		textEl.caretPos = document.selection.createRange().duplicate();
}

function txtKeyDown(textEl)
{
	if (window.event && window.event.keyCode == 9)
	{
		txtInsertText(textEl, '\t')
		window.event.returnValue = false
	}
}

function txtInsertText(txtarea, text)
{
	if (typeof(txtarea.selectionStart) != 'undefined')
		txtMozInsertText(txtarea, text)
	else if (txtarea.createTextRange && txtarea.caretPos)
	{
		var caretPos = txtarea.caretPos;
		caretPos.text = text + caretPos.text;
	} else
		txtarea.value += text;

	txtarea.focus()
}


// From http://www.massless.org/mozedit/
function txtMozInsertText(txtarea, text)
{
	var selLength = txtarea.textLength
	var selStart = txtarea.selectionStart
	var selEnd = txtarea.selectionEnd

	if (selEnd == 1 || selEnd == 2)
		selEnd = selLength

	var s1 = (txtarea.value).substring(0, selStart)
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength)

	txtarea.value = s1 + text + s3
	return
}


