function delete_direct(id, field)
{
        rowForm = document.getElementById(id);
        values = rowForm.elements[field].value.split("\n");
        all = values.length;

        v = '';

        for (i=0; i<all; i++)
        {
                v += values[i].replace(/(\s+\d+)$/g, "");
                if((i+1) != all)
                {
                        v += "\n";
                }
        }
        rowForm.elements[field].value = v;
}

function changeText(from, text)
{
        from  = document.getElementById( from );
        text  = document.getElementById( text );
        values = text.value.split("\n");
        tag_en = values[0].match("{");
        tag_ru = values[0].match("\\*");

        if (tag_en == null && tag_ru == null)
        {
               first_value = values[0];
        }
        else
        {
               if(tag_en==null)
               {
                       tag_open = tag_close = '*';
               }
               else
               {
                       tag_open = '{';
                       tag_close = '}';
               }
               first_value = values[0].replace(/({|\*).*?(}|\*)/g, tag_open+'один из вариантов'+tag_close);
        }
        from.replaceChild(document.createTextNode(first_value), from.firstChild);
}

function changeUrl2(from, text)
{
        from  = document.getElementById( from );
        text  = document.getElementById( text );
        text.value = text.value.replace(/http:\/\//g, '');
        from.href = 'http://' + text.value;
}

function nonEnterKeyPress(event) {
        if (event.keyCode == 13) {
                event.returnValue = false;
                event.cancelBubble = true;
                return false;
        } else {
                return true;
        }
}
