function highlight_text(formitem)
{
	formitem.focus();
	formitem.select();
}

function popup(page, width, height, winname)
{
    sWidth  = screen.width;
    sHeight = screen.height;

    xPos  = (sWidth  - width)  / 2;
    yPos  = (sHeight - height) / 2;
    yPos  = 30;

    prob  = "left="+xPos+",";
    prob += "top="+yPos+",";
    prob += "screenX="+xPos+",";
    prob += "screenY="+yPos+",";
    prob += "width="+width+",";
    prob += "height="+height+",";
    prob += "menubar=0,";
    prob += "toolbar=0,";
    prob += "statusbar=0,";
    prob += "scrollbars=1,";
    prob += "resizable=0,";
    prob += "locationbar=0,";
    prob += "directories=0";

    win = window.open(page, winname, prob);
    win.focus();
    
    return false;
}

function set_selected_color(colorvalue, formitem)
{
    if(document.getElementById("modform").elements[formitem])
    {
        formelm = document.getElementById("modform").elements[formitem];

        formelm.value = colorvalue; document.getElementById("modform").submit();
    }

    return(true);
}

function show_sub(id, clsname)
{
    var elm = document.getElementById("navlink"+id);
    var itm = document.getElementById("subnavi"+id);
    var pos = getPos(elm);
    
    elm.className = clsname; //"mainnavilinkb";
    
    if(pos)
    {
        pos[0] += 150;
        //pos[1] -=   1;
        itm.style.left    = pos[0]+"px";
        itm.style.top     = pos[1]+"px";
        itm.style.display = "block";
    }
}

function hide_sub(id, clsname)
{
    var itm = document.getElementById("subnavi"+id);
    var elm = document.getElementById("navlink"+id);
    
    itm.style.display = "none";
    elm.className     = clsname;
}

function getPos(el)
{
    var lx=0,ly=0;
    
    if(el)
    {
        while(el!=null)
        {
            lx+=el.offsetLeft;
            ly+=el.offsetTop;
            el=el.offsetParent;
        }
        
        return new Array(lx, ly);
    }
    return false;
}

