function ShowAward(army, award)
{
    this.Class = Math.round(Math.random() * 10000000000000000);     
    $("#osx-modal-data").empty();
    $("#osx-modal-data").load(_ROOT + '/award/index/' + army + '/' + award + '/?' + this.Class);    
    $(".osx").click();
}
function SetWarId(id)
{
    $.cookie('show_war', parseInt(id), {path: _ROOT});
    location.reload();
}

function SortTable(prefix, field)
{
    var _field = prefix + '_field';
    var _direction = prefix + '_direction';

    var _f = $.cookie(_field);
    var _d = $.cookie(_direction);
    
    if(_f == field) {
        if(_d == 'DESC') {
            $.cookie(_direction, 'ASC', {path: _ROOT});
        } else {
            $.cookie(_direction, 'DESC', {path: _ROOT});
        }
    } else {
        $.cookie(_field, field, {path: _ROOT});
        $.cookie(_direction, 'DESC', {path: _ROOT});
    }
    
    location.reload();
}

function SetLanguage(_lang)
{
    $.cookie('language', _lang, {path: _ROOT});
    location.reload();
}

function submitSearch()
{
    var _s = $("#searchKey").val();
    if(_s.length <= 1) {
        alert("Invalid search key");
        return false;
    }
}

var style = "";

function chstyle(_obj)
{
    style = $(_obj).attr('class');
    $(_obj).attr('class', 'over');
}

function restorestyle(_obj)
{
    $(_obj).attr('class', style);
}

function Hide(obj)
{
    $(obj).animate({height: "hide"}, 300);
    $("#hide-map").hide();
    $("#show-map").show();
    $.cookie('map', 'hide', {expires: 30, path: _ROOT});          
}

function Show(obj)
{
    $(obj).animate({height: "show"}, 300);
    $("#show-map").hide();
    $("#hide-map").show();
    $.cookie('map', 'show', {expires: 30, path: _ROOT});         
}

function delayer(URL)
{
    window.location = URL;
}


function Redirect(timeOut)
{
    setTimeout('delayer()', timeOut);
    return false;
} 
