function showId(object_id)
{
if (document.getElementById(object_id)) {
var obj = document.getElementById(object_id);
obj.style.display = 'block';
}
}
function hideId(object_id)
{
if (document.getElementById(object_id)) {
var obj = document.getElementById(object_id);
obj.style.display = 'none';
}
}
function getObj(object_id)
{
if (document.getElementById(object_id)) {
return document.getElementById(object_id);
} else {
return null;
}
}
function ecodePopup(url)
{
ECODE_WIDTH = 540;
ECODE_HEIGHT = 600;
window.open(url, "code_window", "width=" + ECODE_WIDTH + ",height=" + ECODE_HEIGHT + ",location=1,status=1,scrollbars=1,left=" + Math.round(screen.width / 2 - ECODE_WIDTH / 2) + ",top=" + Math.round(screen.height / 2 - ECODE_HEIGHT / 2));
}
function clearOptions(object_id)
{
if (document.getElementById(object_id)) {
var select_tag = document.getElementById(object_id);
for (var i = select_tag.length - 1; i > -1; i--) {
select_tag.remove(i);
}
}
}
function selectLastOption(object_id)
{
if (document.getElementById(object_id)) {
var select_tag = document.getElementById(object_id);
select_tag.selectedIndex = select_tag.length - 1;
}
}
function selectOption(object_id, option_value)
{
if (document.getElementById(object_id)) {
var select_tag = document.getElementById(object_id);
for (var i = select_tag.length - 1; i > -1; i--) {
if (option_value == select_tag.options[i].value) {
select_tag.selectedIndex = i;
break;
}
}
}
}
function appendOption(object_id, option_value, option_text)
{
if (document.getElementById(object_id)) {
var select_tag = document.getElementById(object_id);
var option_tag = document.createElement('option');
option_tag.value = option_value;
option_tag.text = option_text;
try {
select_tag.add(option_tag, null); // doesn't work in IE
} catch (err) {
select_tag.add(option_tag); // IE only
}
}
}