function selectTab(event, ctrl, tab, cookieid)
{
    cancelAction(event);

    ctrl_tabs = document.getElementById(ctrl);
	new_tab = document.getElementById(ctrl + "_" + tab);

    if (!new_tab || String(new_tab.className).match(/\bactive\b/))
        return;

    old_tab = findChild(ctrl_tabs, "div", "Tab_active");

    labels = findChild(ctrl_tabs, "ul", "TabLabels");
    old_tab_label = findChild(labels, "li", "active");

    if (old_tab)
    {
		classRemove(old_tab, "active");
		classRemove(old_tab, "Tab_active");
    }
    if (old_tab_label)
		classRemove(old_tab_label, "active");

	new_tab_label = document.getElementById(ctrl + "_label_" + tab);

	if (new_tab)
	{
		classAdd(new_tab, "active");
		classAdd(new_tab, "Tab_active");
	}
	if (new_tab_label)
	{
		classAdd(new_tab_label, "active");
	}

	document.cookie = cookieid + "=" + tab;
}