var b = 2;
var i = 2;
var u = 2;
var q = 2;
var c = 2;
var url = 2;
var img = 2;

function tag(v, tagadd, newbut, tagclose, oldbut, name, elm) {
    if (eval(v)%2 == 0) {
        eval("window.document.getElementById(name).value = newbut;");
        var post = window.document.getElementById(elm).value;
        window.document.getElementById(elm).value = post + tagadd;
        window.document.getElementById(elm).focus();
    } else {
        eval("window.document.getElementById(name).value = oldbut;");
        var post = window.document.editform.post.value;
        window.document.getElementById(elm).value = post + tagclose;
        window.document.getElementById(elm).focus();
    }
    eval(v+"++;");
}