function image(formname)
{
    with (document.forms[formname].msg)
    {
        focus();
        if (caretPos) caretPos.text = '[img]' + caretPos.text;
        else value += '[img]';
        focus();
    }
}

function storeCaret(text)
{
    if (text.createTextRange) text.caretPos = document.selection.createRange().duplicate();
} 
function CheckRegForm()
{
    var errstr='';
    with (document.forms['regform'])
    {
        if ((name.value=='') || (pwd1.value=='') || (pwd2.value=='') || (email.value=='') || ((country.value=='') && (city.value=='')))    {errstr='Внесены не все необходимые данные.\n';}
        if (pwd1.value!=pwd2.value) {errstr+='Пароли не совпадают.'}
        if (agey.value.length<4)
            {errstr+='Год рождения должен быть четырехзначным.'}
            else
            {
                var c=0;
                for (var i=0;i<agey.value.length;i++)
                {
                c = agey.value.substring(i, i+1);
                if ((c<'0') || (c>'9')) {errstr='Введен неверный год рождения.';}
                }
            }

    }
    if (errstr=='') {regform.submit();} else {alert(errstr);}
}

function r(eid) {return confirm("Уверены?");}
