/***********************************************************************************************************
 * su.bot.checkers.javascript.VisualProperties
 * Location: http://www.bot.su/library/su/bot/checkers/javascript/VisualProperties.js
 * Index Version Location: http://www.bot.su/library/su/bot/checkers/javascript/visualproperties/index.html
 * © Bot.Su (http://www.bot.su/)
***********************************************************************************************************/

if (typeof su == "undefined") {su = {};};
if (typeof su.bot == "undefined") {su.bot = {};};
if (typeof su.bot.checkers == "undefined") {su.bot.checkers = {};};
if (typeof su.bot.checkers.javascript == "undefined") {su.bot.checkers.javascript = {};};

if (typeof su.bot.checkers.javascript.VisualProperties == "undefined") {
 su.bot.checkers.javascript.VisualProperties = function() {}; 
 su.bot.checkers.javascript.VisualProperties.prototype = new com.oclib.javascript.lang.Root();

 su.bot.checkers.javascript.VisualProperties.prototype.className = "VisualProperties"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classNamespace = "su.bot.checkers.javascript.VisualProperties"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classCreated = "20070403"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classCreator = "http://www.bot.su/"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classLocation = "http://www.bot.su/library/su/bot/checkers/javascript/VisualProperties.js"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classIndexLocation = "http://www.bot.su/library/su/bot/checkers/javascript/visualproperties/index.html"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classVersion = "20070528"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classVersionLocation = "http://www.bot.su/library/su/bot/checkers/javascript/visualproperties/builds/20070528/VisualProperties.js"; 
 su.bot.checkers.javascript.VisualProperties.prototype.classVersionIndexLocation = "http://www.bot.su/library/su/bot/checkers/javascript/visualproperties/index.html"; 
 
 su.bot.checkers.javascript.VisualProperties.prototype.environment;
  su.bot.checkers.javascript.VisualProperties.prototype.getEnvironment = function () {return this.environment;};
  su.bot.checkers.javascript.VisualProperties.prototype.setEnvironment = function (environment) {this.environment = environment;}; 
  
 su.bot.checkers.javascript.VisualProperties.prototype.autoplayCheckbox = function(e) {
  if(this.mustTrace()) {this.getLog().println("su.bot.checkers.javascript.VisualProperties.autoplayCheckbox is runing...");};
  var el = document.getElementById("autoplayCheckbox");  
  this.getEnvironment().getProperties().setAutoplay(el.checked);
  this.getEnvironment().getVisualGamePanel().showAutoplay(el.checked);
  this.getEnvironment().getReferee().setMaxScore(0);
  this.getEnvironment().getReferee().setMinScore(0);
 };
  
 su.bot.checkers.javascript.VisualProperties.prototype.init = function() {
  if(this.mustTrace()) {this.getLog().println("su.bot.checkers.javascript.VisualProperties.init is runing...");};
  var the = this;
  this.getEnvironment().getEvents().addEventListener("autoplayCheckbox", "change", function(e) {the.autoplayCheckbox(e);}, false);
  this.getEnvironment().getEvents().addEventListener("maxGamerSelect", "change", function(e) {the.maxGamerSelect(e);}, false);
  this.getEnvironment().getEvents().addEventListener("minGamerSelect", "change", function(e) {the.minGamerSelect(e);}, false);
 };
  
 su.bot.checkers.javascript.VisualProperties.prototype.maxGamerSelect = function(e) {
  if(this.mustTrace()) {this.getLog().println("su.bot.checkers.javascript.VisualProperties.maxGamerSelect is runing...");};
  var el = document.getElementById("maxGamerSelect");  
  var gamerName = el.options[el.selectedIndex].value;
  var classLoader = this.getEnvironment().getClassLoader();
  var gamersLocator = this.getEnvironment().getProperties().getGamersLocator();
  classLoader.require(gamersLocator[gamerName]["namespace"], gamersLocator[gamerName]["location"]);
  var es = "var maxGamer = new "+gamersLocator[gamerName]["namespace"]+"()";
  if (window.execScript) {
   window.execScript(es, 'javascript');
  } else {
   window.eval(es);
  };
  maxGamer.setDebugging(debugging); maxGamer.setTracing(tracing); maxGamer.setLog(checkersLog);
  maxGamer.init();
  this.getEnvironment().setMaxGamer(maxGamer); 
 };
  
 su.bot.checkers.javascript.VisualProperties.prototype.minGamerSelect = function(e) {
  if(this.mustTrace()) {this.getLog().println("su.bot.checkers.javascript.VisualProperties.minGamerSelect is runing...");};
  var el = document.getElementById("minGamerSelect");  
  var gamerName = el.options[el.selectedIndex].value;
  var classLoader = this.getEnvironment().getClassLoader();
  var gamersLocator = this.getEnvironment().getProperties().getGamersLocator();
  classLoader.require(gamersLocator[gamerName]["namespace"], gamersLocator[gamerName]["location"]);
  var es = "var minGamer = new "+gamersLocator[gamerName]["namespace"]+"()";
  if (window.execScript) {
   window.execScript(es, 'javascript');
  } else {
   window.eval(es);
  };
  minGamer.setDebugging(debugging); minGamer.setTracing(tracing); minGamer.setLog(checkersLog);
  minGamer.init();
  this.getEnvironment().setMinGamer(minGamer); 
  if(this.mustDebug()) {this.getLog().println("su.bot.checkers.javascript.VisualProperties.maxGamerSelect this.getEnvironment().getMinGamer().getClassName()="+this.getEnvironment().getMinGamer().getClassName());};
  if(this.mustDebug()) {this.getLog().println("su.bot.checkers.javascript.VisualProperties.maxGamerSelect this.getEnvironment().getMinGamer().getName()="+this.getEnvironment().getMinGamer().getName());};
 };
};
