// Now in the CMS
var handToolDiv;
var footerDiv;
var qHand = '';
var flashPlayer;
var ie6 = (window.XMLHttpRequest) ? 0 : 1;
function submitHandButton(handNum)
{
var bPassed = (typeof(handNum) == "undefined") ? false : true;
document.getElementById("replayHelp").style.display = "none";
document.getElementById("replayFlashArea").style.display = "block";
if(bPassed)
{
document.getElementById("handNum").value = handNum;
}
if(document.getElementById('handNum').value)
{
qHand = "loadXML(document.getElementById('handNum').value)";
loadXML(document.getElementById("handNum").value);
}
}
function loadXML(hand_id) {
if(typeof(hand_id) == "undefined") return;
document.getElementById("handNum").value = hand_id;
document.getElementById("pass_hand").value = hand_id;
document.getElementById("pass_hand1").value = hand_id;
document.getElementById("pass_hand2").value = hand_id;
document.title = "Hand Replay - Hand Number: "+hand_id;
if(ie6) flashPlayer.sendHandNumber(hand_id);
else if(typeof(flashPlayer) != "undefined" && !ie6) flashPlayer.sendHandNumber(hand_id);
}
// This function is called from Flash to let the browser know thats its ready
function init() {
//foHandHistory();
flashPlayer = document.getElementById("handhistory");
//hand = deconcept.util.getRequestParameter("hand");
handVar = getURLVar("hand");
if(qHand != '')
{
eval(qHand);
qHand = '';
}
else if(handVar){
loadXML(handVar);
}
}
function forceRefresh() {
handToolDiv.contentEditable = false;
footerDiv.style.bottom= '';
footerDiv.style.bottom= '0px';
}
function foHandHistory() {
var fo = new SWFObject("/flash/tg-handhistory-v2.swf", "handhistory", "703", "475", "9", "#000000", true);
fo.write("replayFlashArea");
handToolDiv = document.getElementById("handTools");
footerDiv = document.getElementById('footerWrap');
if(handToolDiv) handToolDiv.contentEditable = true;
if(handToolDiv) handToolDiv.onresize= forceRefresh;
document.getElementById("replayFlashArea").style.display = "none";
}
function urldecode() {
}
// This function is called from the flash file, once it has received a valid hand to play
function loadHandInfo() {
f_runAjax("handTools","/ajax/hand-replay.php","handNum");
document.getElementById('footerWrap').style.bottom = '';
document.getElementById('footerWrap').style.bottom = '0px';
}
function getURLVar(urlVarName) {
var urlHalves = String(document.location).split('?');
var urlVarValue = '';
if(urlHalves[1]){
var urlVars = urlHalves[1].split('&');
for(i=0; i<=(urlVars.length); i++){
if(urlVars[i]){
var urlVarPair = urlVars[i].split('=');
if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
urlVarValue = urlVarPair[1];
}
}
}
}
return urlVarValue;
}
function rate_it() {
var rateBtn = document.getElementById('rateBtn');
if (document.getElementById('rate_me').style.display == 'none') {
document.getElementById('rate_me').style.display='block';
document.getElementById('rateBtn').className = 'showRating';
//document.anchors['rateBtn'].className = 'showRating';// = 52;
} else {
document.getElementById('rate_me').style.display='none';
//document.anchors['rateBtn'].className = 'rate';
document.getElementById('rateBtn').className = 'rate';
//document.getElementById('rateBtn').style.width = 172;
}
}
function update_rating(the_value) {
document.getElementById('hand_rating').value = the_value;
//alert('r=' +document.getElementById('hand_rating').value + " " + document.getElementById('handNum').value );
f_runAjax('rate_me', '/ajax/rate-hand.php', 'hand_rating|handNum');
}
function verify_input(prefix) {
var outcome = true;
if (prefix != 'c') {
if (document.getElementById(prefix + '_title').value == "" || document.getElementById(prefix + '_description').value == "") {
outcome = false;
document.getElementById(prefix + '_err').innerHTML = "Please enter a title and a description.";
}
pass_title = prefix + '_title|';
} else {
//alert(prefix + '_description');
if (document.getElementById(prefix + '_description').value == "") {
outcome = false;
document.getElementById(prefix + '_err').innerHTML = "Please enter your comment.";
}
pass_title = '';
}
if (prefix == "s") {
addon = "|favs"
} else {
addon = "";
}
if (outcome == true) {
//alert(prefix + '_f|' + pass_title + '_description|pass_hand2' + addon);
f_runAjax('handTools', '/ajax/hand-post.php', prefix + '_f|' + pass_title + prefix + '_description|pass_hand' + addon);
if (prefix == 's' || prefix == 'sv') {
document.getElementById(prefix + '_title').value = "";
}
document.getElementById(prefix + '_description').value = "";
tb_remove();
}
}
function verify_comment(theForm) {
var outcome = true;
if (theForm.description.value == "") {
outcome = false;
document.getElementById(theForm.name + '_err').innerHTML = "Please enter your comment.";
}
theForm.action = "hand-replay.html?hand=" + theForm.pass_hand2.value;
return outcome;
}
function toggle_comments() {
if (document.getElementById('replayComments').style.display == 'none') {
document.getElementById('replayComments').style.display = 'block';
document.getElementById('comments_link').innerHTML = 'Hide User Comments';
} else {
document.getElementById('replayComments').style.display = 'none';
document.getElementById('comments_link').innerHTML = 'View User Comments';
}
}