

function getIframeCode() {
  the_game = document.getElementById('the_game').value;
  the_width = document.getElementById('chat_window_width').value;
  if(the_game != '' && the_width != '' && the_width >= 400) {
    tbr = '';
    tbr += '<!-- Begin TcgChat.com ' + the_game + ' Chat Widget -->' + "\n";
    tbr += '<div class="tcg__widget" style="width:' + the_width + 'px;">' + "\n";
    tbr += '<SCRIPT TYPE="text/javascript" SRC="http://www.tcgchat.com/widget.js"></SCRIPT>' + "\n";
    tbr += '<link rel="stylesheet" type="text/css" href="http://www.tcgchat.com/widget.css" />' + "\n";
    tbr += '<div><iframe src="http://www.tcgchat.com/' + the_game.replace(' ', '-') + '-chat.html" style="width:100%; height:390px;" alt="' + the_game + ' Chat Room"></iframe></div>' + "\n";
    tbr += '<div class="tcg__footer">&copy;2008 <a href="http://www.tcgchat.com/' + the_game.replace(' ', '-') + '-Chat.html">' + the_game + '</a> Chat provided by TcgChat.com</div>' + "\n";
    tbr += '</div>' + "\n";
    tbr += '<!-- End TcgChat.com Widget -->' + "\n";
    document.getElementById('the_iframe_code').value = tbr;
  }
}

function checkChatWindowWidth(the_width) {
  if(the_width < 400) {
    alert('The chat program cannot have a width of less than 400.');
    document.getElementById('chat_window_width').value = 400;
  }
}
