function OpenWin (URL)
{
	window.open(URL, 'Window');
}

function ShowElement (strId, booBlock)
{
	if (typeof(booBlock) != 'boolean') {booBlock = true;}
	var strDisplay = 'block'; if (booBlock == false) {strDisplay = 'inline';}
	document.getElementById(strId).style.display = strDisplay;
}

function HideElement (strId)
{
	document.getElementById(strId).style.display = 'none';
}

function ShowHideElement (strId, booBlock)
{
	if (typeof(booBlock) != 'boolean') {booBlock = true;}
	
	if (document.getElementById(strId).style.display == 'none')
	{
		ShowElement(strId);
		ShowElement('hide_' + strId, booBlock);
		HideElement('show_' + strId);
	}
	else
	{
		HideElement(strId);
		HideElement('hide_' + strId);
		ShowElement('show_' + strId, booBlock);
	}
}

function InsertText (strId, strObject)
{
	var objField = document.getElementById(strId);
	strObject = strObject + ' ';
	
	if (document.selection) // IE
	{
		var intLenght;
		objField.focus();
		sel = document.selection.createRange();
		intLenght = sel.strObject.lenght;
		sel.strObject = strObject;
		if (strObject.length == 0)
		{
			sel.moveStart('character', strObject.length);
			sel.moveEnd('character', strObject.length); 
		}
		else
		{
			sel.moveStart('character', - strObject.length + intLenght);
		}
		sel.select();
	}
	else if (objField.selectionStart || objField.selectionStart == '0') // Mozilla & Netscape
	{
		var intStartPosition = objField.selectionStart;
		var intEndPosition = objField.selectionEnd;
		objField.value = objField.value.substring(0, intStartPosition) + strObject + objField.value.substring(intEndPosition, objField.value.length);
		objField.selectionStart = intStartPosition + strObject.length;
		objField.selectionEnd = intStartPosition + strObject.length;
		objField.scrollTop = objField.scrollHeight;
	}
	else
	{
		objField.value += strObject;
	}
	
	objField.focus();
}