// JavaScript Document

RedirUrls["Bet-at-home"] = new Array();
RedirUrls["Bet-at-home"]["window_url"] = "http://www.bet-at-home.com/affiliate.aspx?aid=31349&lang=CS";
RedirUrls["Bet-at-home"]["window_name"] = "betathome";
betathome_ret = "";


function betathome_continue() {
  show_tip_screen("Prosím počkejte, probíhá přesměrování na Bet-at-home");
  RedirName = "Bet-at-home";
  new Ajax.Request(base_url+"xhr/get_ticket_matches", {method: "post", postBody: "param="+kancl, onSuccess: function(ret) {
			  if(ret.responseText == "empty") {
					alert("Ticket je prázdný");
					screen.fade();
			  } else {
			    betathome_ret = ret.responseText;
//			    betathome_clear_all();
			    tips_parse(betathome_ret, betathome_parse);
			  }        
  }});
  
}

/*function betathome_clear_all() {
  iframe = new Element("iframe", {"id":"betathome-tips-remove"});
  iframe.style.display = "none";
  iframe.src = "http://www.bet-at-home.com/default.aspx?clearSession=true&setLang=CS";
  document.body.appendChild(iframe);
  setTimeout("iframe.remove();tips_parse(betathome_ret, betathome_parse);});", 2000);
//    tips_parse(betathome_ret, betathome_parse);    
}*/

function betathome_parse() {
  if(!($("betathome-tip") == "undefined" || $("betathome-tip") === null)) {
      $("betathome-tip").remove();
  }
  iframe = new Element("iframe", {"id":"betathome-tip"});
  iframe.style.display = "none";
  iframe.src = base_url+"xhr/betathome_form";
  $("tips_action").appendChild(iframe);
  setTimeout("iframe.observe(\"load\", function() {urls = new Array(); tips_checker(betathome_parse);  });", 2000);
}