// Base dialog class.
function Dialog() {
    this.outer = $("<div/>").addClass("dlg_outer");
    this.inner = $("<div/>").addClass("dlg_inner");
    this.outer.append(this.inner);
    $("body").append(this.outer);

    this.html = function(text) {
        this.inner.html(text);
    }
    this.find = function(s) {
        return this.inner.find(s);
    }
    this.show = function() {
        this.outer.show();
    }
    this.show_centered = function(speed) {
        this.show(speed);
        this.outer.css("left", ($(window).width() - this.inner.width()) / 2);
        this.outer.css("top", ($(window).height() - this.inner.height()) / 2 +
                              $(window).scrollTop());
    }
    this.show_near_mouse = function(e, speed) {
        this.outer.css("left", e.pageX+15);
        this.outer.css("top", e.pageY+15);
        this.show(speed);
    }
    this.destroy = function() {
        this.outer.remove();
    }
}

function login_dialog() {
    $("#login_button").click(login_win);
}

function login_win() {
    var dialog = new Dialog;
    dialog.html(
        '<form><table>'+
        '<tr><td>Имя:</td><td>'+
        '<input class="login_name blueinput"></td></tr>'+
        '<tr><td>Пароль:</td><td>'+
        '<input type="password" class="login_pass blueinput">'+
        '</td></tr><tr><td colspan="2" class="dlg_ok_cancel">'+
        '<input type="submit" class="styledbutton" value="[&lt; Войти &gt;]">'+
        '<input type="button" class="dlg_cancel styledbutton" '+
        'value="[&lt; Отмена &gt;]">'+
        '</td></tr></table></form>');
    dialog.find("form").submit(function() {
        var l = dialog.find(".login_name").val();
        var p = dialog.find(".login_pass").val();
        api_call(
            "passlogin", {user: l, password: p}, false,
            // onsuccess
            function() {
                window.location = "/login?key="+d.desc;
            });
        return false;
    });
    dialog.find(".dlg_cancel").click(function() {
        dialog.destroy();
    });
    dialog.show_centered();
    return false;
}

function confirm_dialog(desc, f, e) {
    var dialog = new Dialog;
    dialog.html(
        '<form class="dlg_centered">'+
        '<span>Вы уверены, что хотите '+desc+'?</span><br /><br />'+
        '<input type="button" class="dlg_yes styledbutton" value="[&lt; Да &gt;]">'+
        '<input type="button" class="dlg_no styledbutton" value="[&lt; Нет &gt;]">'+
        '</form>');
    dialog.find(".dlg_yes").click(function() {
        dialog.destroy();
        f();
    });
    dialog.find(".dlg_no").click(function() {
        dialog.destroy();
    });
    dialog.show_near_mouse(e);
}

function info_dialog(desc) {
    var dialog = new Dialog;
    dialog.html(
        '<form class="dlg_centered">'+
        '<span>'+desc+'</span><br /><br />'+
        '<input type="button" class="dlg_ok styledbutton" value="[&lt; OK &gt;]">'+
        '</form>');
    var ok_b = dialog.find(".dlg_ok");
    ok_b.click(function() {
        dialog.destroy();
        focused.focus();
    });
    var focused = $("*:focus");
    dialog.show_centered();
    ok_b.focus();
}

@@ -1176,16 +1176,18 @@
 ueinput%22
+ /
 %3E%3C/td%3E%3C/
@@ -1288,16 +1288,18 @@
 ueinput%22
+ /
 %3E'+%0A    
@@ -1401,32 +1401,44 @@
 =%22styledbutton%22 
+'+%0A        '
 value=%22%5B&lt; %D0%92%D0%BE%D0%B9
@@ -1442,24 +1442,26 @@
 %D0%92%D0%BE%D0%B9%D1%82%D0%B8 &gt;%5D%22
+ /
 %3E'+%0A        
@@ -1544,32 +1544,34 @@
 t; %D0%9E%D1%82%D0%BC%D0%B5%D0%BD%D0%B0 &gt;%5D%22
+ /
 %3E'+%0A        '%3C/t
@@ -2342,32 +2342,44 @@
 s styledbutton%22 
+'+%0A        '
 value=%22%5B&lt; %D0%94%D0%B0 
@@ -2380,24 +2380,26 @@
 t; %D0%94%D0%B0 &gt;%5D%22
+ /
 %3E'+%0A        
@@ -2440,32 +2440,44 @@
 o styledbutton%22 
+'+%0A        '
 value=%22%5B&lt; %D0%9D%D0%B5%D1%82
@@ -2479,24 +2479,26 @@
 ; %D0%9D%D0%B5%D1%82 &gt;%5D%22
+ /
 %3E'+%0A        
@@ -2934,16 +2934,28 @@
 button%22 
+'+%0A        '
 value=%22%5B
@@ -2968,16 +2968,18 @@
 K &gt;%5D%22
+ /
 %3E'+%0A    

Fix input html tag