/////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2004 http://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="Replay ' + base + '"';
img += ' TITLE="Replay ' + base + '"';
img += ' SRC="/img/new/replay.gif"';
switch (align) {
case 'left':
style = 'float:left;margin:0px;margin-right:4px;';
break;
case 'right':
style = 'float:right;margin:0px;margin-left:4px;';
break;
default:
style = 'margin:0px;';
break;
}
img += ' STYLE="' + style + '"';
img += ' WIDTH="16" HEIGHT="16" BORDER="0">';
url = replayer + '?gam=' + game;
if (move) {
url += '&off=' + move;
}
txt = '<A';
txt += ' TARGET="' + target + '"';
txt += ' 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();
win.moveTo((screen.width - 860)/2, (screen.height - 620)/2);
}
