function setregistercode(myform)
{
    request_string = "/js/security.php";
    $.get(request_string, function(data){
        document.getElementById(myform).submit();
    });
}
//--------------------------------------------------------------------------------
function showhide(tag)
{
    if ( document.getElementById(tag).style.display == 'none' )
    {
        document.getElementById(tag).style.display = 'block';
        document.getElementById(tag).style.visibility = 'visible';
    }
    else
    {
        document.getElementById(tag).style.display = 'none';
        document.getElementById(tag).style.visibility = 'hidden';
    }
}
//--------------------------------------------------------------------------------
function editpost(tag, id)
{
    if ( id > 0 )
    {
        document.getElementById('postcontent').innerHTML = '<br /><img src="/template/img/ajax-loader.gif" border="0">';
        var request_string = "/menu/loadpost.php?id=" + id;
        $.get(request_string, function(data){
            document.getElementById('postcontent').innerHTML = data;
        });
        showhide(tag);
    }
}
//--------------------------------------------------------------------------------
function deletepost(id)
{
    if ( id > 0 )
    {
        var request_string = "/menu/deletepost.php?id=" + id;
        $.get(request_string, function(data){
            document.getElementById('post'+id).innerHTML = '';
        });
    }
}
//--------------------------------------------------------------------------------
function deletepost_full(id, parent1, parent2, parent3)
{
    if ( id > 0 )
    {
        var request_string = "/menu/deletepost.php?id=" + id;
        $.get(request_string, function(data){
            document.location.href = '/menu/'+parent1+'/'+parent2+'/'+parent3+'/';
        });
    }
}
//--------------------------------------------------------------------------------
function showmove(id)
{
    if ( id > 0 )
    {
        showhide('movepost');
        document.getElementById('postid').value = id;
        document.getElementById('moveoptions').innerHTML = '<img src="/template/img/ajax-loader.gif" border="0">';
        var request_string = "/menu/getmenus.php";
        $.get(request_string, function(data){
            document.getElementById('moveoptions').innerHTML = data;
        });
    }
}
//--------------------------------------------------------------------------------
function massshowmove()
{
    showhide('groupop')
    document.getElementById('options').innerHTML = '<img src="/template/img/ajax-loader.gif" border="0">';
    var request_string = "/menu/getmenus.php";
    $.get(request_string, function(data){
        document.getElementById('options').innerHTML = data;
    });
}
//--------------------------------------------------------------------------------
function mass_op()
{
    if ( document.massopform.elements[0].title == '1' )
    {
        for ( i=0; i < document.massopform.elements.length; i++ )
        {
            document.massopform.elements[i].checked = 0;
            document.massopform.elements[i].title = "0";
            document.massopform.select.value = "Выбрать все";
        }
    }
    else
    {
        for ( i=0; i < document.massopform.elements.length; i++ )
        {
            document.massopform.elements[i].checked = 1;
            document.massopform.elements[i].title = "1";
            document.massopform.select.value = "Сбросить выбор";
        }
    }
}
//--------------------------------------------------------------------------------
function deletetag (id, postid)
{
    if ( id > 0 && postid > 0 )
    {
        var request_string = "/post/deletetag.php?tagid="+id+'&postid='+postid;
        $.get(request_string, function(data){
            document.location.href = document.URL;
        });
    }
}
//--------------------------------------------------------------------------------
function votepost(vote, postid)
{
    if (vote > 0 && vote < 4 && postid > 0)
    {
        var request_string = "/post/vote.php?vote="+vote+'&postid='+postid;
        $.get(request_string, function(data){
            document.location.href = document.URL;
        });
    }
}
//--------------------------------------------------------------------------------
function taghelp()
{
    tag = document.getElementById('sitetag').value;
    if ( tag.length > 1 )
    {
    request_string = "/post/tags.php?tag="+encodeURI(tag);
    $.get(request_string, function(data){
        document.getElementById('dbtags').innerHTML = data;
    });
    }
    else
    {
        document.getElementById('dbtags').innerHTML = '';
    }
}
//--------------------------------------------------------------------------------
function gotosite(id)
{
    request_string = "/catalog/incsite.php?id="+id;
    $.get(request_string, function(data){
    });
}
//--------------------------------------------------------------------------------
function deletecomment(id)
{
    if ( id > 0 )
    {
        request_string = "/post/deletecomment.php?id="+id;
        $.get(request_string, function(data){
            document.location.href = "/post/"+id+"/#comments";
        });
    }
}
