/////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2003 gobase.org
//
/////////////////////////////////////////////////////////////////////

var free_replayer = '/service/uncgi/bin/free-sgf';
var gam_replayer = '/service/uncgi/bin/replay-sgf';
var var_replayer = '/service/uncgi/bin/replay-sgf';
function replay_button(replayer, target, align, game, move)
{
var img;
var url;
var txt;
var base = game.replace(/.*\/([^\/]+)/, "$1");
img  = '<IMG';
img +=   ' ALT="' + base + '"';
img += ' TITLE="' + base + '"';
img += ' SRC="/.images/new/replay.gif"';
if (align) {
    img += ' ALIGN="' + align + '"';
    img += ' HSPACE="2" VSPACE="0"';
}
img += ' WIDTH="16" HEIGHT="16" BORDER="0">';
url = replayer + '?gam=' + game;
if (move) {
    url += '&off=' + move;
}
txt = '<A TARGET="' + target + '" HREF="' + url + '"';
txt += ' onclick="replay(\''+replayer+'\',\''+game+'\',\''+move+'\'); return false;"';
txt += '>';
txt += img;
txt += '</A>';
document.write(txt);
}
function replay_icon(align, game)
{
replay_button(var_replayer, 'gobase_gam', align, game, null);
}
function replay_var(align, game)
{
replay_button(var_replayer, 'gobase_var', align, game, null);
}
function free_gam(align, game, move)
{
replay_button(free_replayer, 'gobase_gam', align, game, move);
}
function replay_gam(align, game, move)
{
replay_button(gam_replayer, 'gobase_gam', align, game, move);
}
function replay(replayer, game, move)
{
var win;
var url;
var name;
var opt;
url = replayer + '?gam=' + game;
if (move) {
url += '&off=' + move;
}
name = 'replay';
opt = 'width=860,height=620';
opt += ',toolbar=0,status=0,location=0,menubar=0';
opt += ',resizable=1,scrollbars=1';
win = window.open(url, name, opt);
if (win.opener == null) win.opener = window;
win.focus();
}

