var time_on  = null;
var menu_item;
var time_cnt = 1000;

function show_menu(id_menu)
{
    if (time_on)
    {
        clearTimeout(time_on);
        hide_menu(menu_item);
    }
    document.getElementById(id_menu).style.visibility="visible";
}

function timeout_hide(id_menu)
{
    menu_item = id_menu;
    time_on = setTimeout("hide_menu('" + id_menu + "')", time_cnt);
}

function hide_menu(id_menu)
{
    document.getElementById(id_menu).style.visibility="hidden";
}

function highlight(obj)
{
    obj.className = "menubar_highlight";
}

function back_show(obj)
{
    obj.className = "menubar_norm";
}

function load_page(number)
{
    document.list_pages.page.value = number;
    document.list_pages.submit();
}

function next_page()
{
    document.list_pages.page.value = ++document.list_pages.page.value;
    document.list_pages.submit();
}

function prev_page()
{
    document.list_pages.page.value = --document.list_pages.page.value;
    document.list_pages.submit();
}

function load_list(number)
{
    document.list_pages.list.value = number;
    document.list_pages.submit();
}

/*function show_window(src,wid,heit)
{
   pars = "menubar=no, toolbar=no, scrollbars=no , width=" + wid + ", height=" + heit;
   window.open(src, "Picture", pars);
}*/

function check_inp(obj)
{
    var inp = obj.value;
    if (inp == "")
    {
        alert ("Please enter search query.");
        return false;
    }
    document.search.submit();
}

function show_window(sPicURL, path) 
{
    if (!path)
    {
        path = "../templates/includes/popup.htm";
    }
    window.open(path + "?"+sPicURL, "",
    "resizable=1,HEIGHT=200,WIDTH=200");
}

function make_frame_content()
{
    new_height = window.newslet_frame.document.body.scrollHeight + 10;
    window.newslet_frame.document.body.style.width = "732px";
    document.getElementById("newslet_frame").style.height= new_height + "px";
}