// FCMS-Generated

/*-------Global-------*/
var RE_START = /^([\ \t\n]+)/;
var RE_END   = /^([\ \t\n]+)/;
var HEXA = Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');

function trim(s)	{return String(s).replace(RE_START,"").replace(RE_END,"");}
function ch(c)		{return String.fromCharCode(c);}

function generalWindow(windowName, url, prp)
 {
  try
   {
    if ((typeof navigator[windowName] != "undefined") && (navigator[windowName] != null))
     {
      if (navigator[windowName].closed) navigator[windowName] = window.open(url,"",prp);
      else navigator[windowName].location.href = url;
     }
    else navigator[windowName] = window.open(url,"",prp);
   }
  catch (err)
   {
    if ((typeof navigator[windowName] == "undefined") || (navigator[windowName]==null)) navigator[windowName] = window.open(url,"",prp);
    else navigator[windowName].location.href = url;
   }
  navigator[windowName].focus();
 }

function DV(key,def)
 {
  return ((typeof key != "undefined") && (key != null) && (typeof DICTIONARY != "undefined") && (DICTIONARY != null) && (typeof DICTIONARY[key] != "undefined")) ? DICTIONARY[key] : ((typeof def != "undefined" && def!=null) ? def : key);
 }

function AlertMessage(key,ret)
 {
  alert(DV(key,key));
  return ret;
 }
 
function RefreshOpener()
 {
  var op = window.opener;
  window.opener.location.href = window.opener.location.href;
 }

function showMarathon()
 {
  generalWindow("PopupWindow","/popup/marathon.html","width=842,height=600,scrollbars=yes,resizable=yes");
 } 

function ShowExtra()
 {
  generalWindow("PopupWindow","/"+Url("TextContent")+"/extras","width=600,height=460,scrollbars=yes,resizable=yes"); 
 }
 
function ShowExtras()
 {
  window.location.href = "/"+Url("Extras2");    
  //generalWindow("PopupWindow","/"+Url("Extras"),"width=600,height=460,scrollbars=yes,resizable=yes"); 
 } 
 
function ShowHighlight(type,id)
 {
  generalWindow("HighlightWindow","/"+Url(type)+"/"+id,"width=600,height=460,scrollbars=yes,resizable=yes");
 }

function ShowProgramInfo(id,type)
 {
  generalWindow("ProgramInfoWindow","/"+Url(type)+"/"+id,"width=600,height=460,scrollbars=yes,resizable=yes");
 } 
/*
function ShowProgram(id,clickable,channel)
 {
  if (clickable)
   generalWindow("ProgramWindow","/"+Url("Episode")+"/"+id+"/"+channel,"width=600,height=460,scrollbars=yes,resizable=yes");
 }
*/

function ShowProgram(id,clickable,channel)
 {
  if (clickable)
   window.location.href = "/"+Url("EpisodeRedirect")+"/"+id+"/"+channel;
 } 

function PreviewWindow(type,categoryid,fotoid)
 {
  generalWindow("PreviewWindow","/"+Url("Preview")+"/"+type+"/"+categoryid+"/"+fotoid,"width=500,height=475,scrollbars=no,resizable=no");
 } 

function ShowFooter(type)
 {
  if ((String(type).substr(0,4))=="axn-") type=String(type).substr(4);
  generalWindow("PopupWindow","/"+Url("TextContent")+"/"+type,"width=600,height=460,scrollbars=yes,resizable=yes");
 }
 
function Url(url)
 {
  return (_LANG_==0?"English/":"")+url;
 }

function flashAlert(txt)
{
 var text = String(txt).substr(0,txt.length-1);
 var text = eval("String.fromCharCode("+text+")");
 alert(text);
}

function setCookie(name,value,expireday,path,domain)
 {
  var ExpireDate = new Date();
  ExpireDate.setTime(ExpireDate.getTime()+ 1000*3600*24*expireday);
  document.cookie = name + "=" + escape(value)+
		    ((expireday==null) ? "" :";expires="+ExpireDate.toGMTString())+
		    ((path==null) ? "" : ";path="+path)+
		    ((domain==null) ? "" :";domain="+domain)
 }

function changeLanguage(url)
 {
  var _url   =  String(url).replace("/English","");
  var prefix = _LANG_==0 ? "" : "/English";
  _url       = prefix+_url; 
  if (_url=="") _url = "/";
  window.location.href =_url;
 }    
 
function hasAnswer(form)
 {
  var radio = form["answer"];
  for (var i=0; i<radio.length; i++)
   if (radio[i].checked) return true;
  
  return false;
 }  

function checkGameForm(form)
 {
  var ret = false;
  if (form == null || (typeof form == "undefined") ) form = document.GameForm;
  if (hasAnswer(form)==false) AlertMessage("NoAnswer");
  else if (!/^[a-z0-9._-]+@([a-z0-9-]{2,})([.][a-z0-9-]{2,})*[.][a-z]{2,6}$/.exec(form.email.value)) AlertMessage("GameBadEmail");
  else if (trim(form.name.value)=="") AlertMessage("GameBadEmail");
  else ret = true;
  return ret;
 } 

function popup(type)
 {
  generalWindow("PopUpWindow","http://www.axn.cz/lost3game/"+type+".html","width=600,height=600,scrollbars=yes,resizable=yes"); 
 } 
/*-------Nyito-------*/
function CheckXmlError2(xml)
 {
  var statusnode = FindNode(xml,["response","header","status"]);
  if (statusnode==null) return 1;
  var status = GetNodeValue(statusnode);
  if (status=="0") return 0;
  var msgnode = FindNode(xml,["response","header","message"]);
  if (msgnode==null) return 1;
  AlertMessage(GetNodeValue(msgnode));
  return 2;
 }

function NLXml(url,handler,method,data,mime)
 {
  function OnLoad(e)
   {
    var xml = GetEventXml(e);
    if (xml==null) AlertMessage("SubscribeFailed1");
    var result = CheckXmlError2(xml);
    if (result==0) handler(xml);
    else if (result==1) AlertMessage("SubscribeFailed2");
   }
  function OnError()	{AlertMessage("SubscribeFailed3");}
  XMLLoad(url,{"OnLoad":OnLoad,"OnError":OnError},method,data,mime);
 }

function CheckHirlevelForm(form)
 {
  if (form == null || (typeof form == "undefined") ) form = document.HirlevelForm;
  if (form.name.value=="") AlertMessage("HirlevelNoName");
  else if (!/^[a-z0-9._-]+@([a-z0-9-]{2,})([.][a-z0-9-]{2,})*[.][a-z]{2,3}$/.exec(form.email.value)) AlertMessage("HirlevelBadEmail");
  else
   {
    function Handler(xml)
     { 
      var node = FindNode(xml,["response","content"]);
      if (node!=null)
       {
        var content = GetNodeValue(node,null);
	if (content!=null)
	 {
	  AlertMessage(content);    	 
	  //document.getElementById("NewsletterBox").innerHTML = content;
	 }
       }
     }
    var xml = "<subscribe><name><![CDATA["+form.name.value+"]]></name><email><![CDATA["+form.email.value+"]]></email></subscribe>";
    NLXml("/"+Url("Subscribe"),Handler,"POST",xml);
   }
  //return false;
 }

/*-------Flash-------*/
function embedFlash(url,name,width,height,quality,bgColor,menu,allowSA){
	url += "?";
	if(arguments.length > 8){
		var params = ""
		for(var i=8; i<arguments.length; i++){
			url+=arguments[i][0]+'='+arguments[i][1]+"&"
			params += '<param name="'+arguments[i][0]+'" value="'+arguments[i][1]+'">\n'
		}
	}

	var embedCode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" align="middle" id="'+name+'">\n'
	embedCode += 		params != null ? params : ""
	embedCode +=		'<param name="allowScriptAccess" value="'+allowSA+'" />\n'
	embedCode +=		'<param name="movie" value="'+url+'MMredirectURL='+window.top.location+'&MMplayerType=ActiveX&MMdoctitle='+document.title+'" />\n'
	embedCode +=		'<param name="bgcolor" value="'+bgColor+'" />\n'
	embedCode +=		'<param name="quality" value="'+quality+'" />\n'
	embedCode +=		'<param name="menu" value="'+menu+'">\n'
	embedCode +=		'<embed src="'+url+'MMredirectURL='+window.top.location+'&MMplayerType=PlugIn" width="'+width+'" height="'+height+'" name="'+name+'" align="middle" quality="'+quality+'" bgcolor="'+bgColor+'"  menu="'+menu+'" allowScriptAccess="'+allowSA+'" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n'
	embedCode += 	'</object>'

	return embedCode
}
function goSearch(txt){
	
	var text = String(txt).substr(0,txt.length-1);
	//alert(eval("String.fromCharCode("+text+")"));
	var request = eval("String.fromCharCode("+text+")");
	var form = document.SearchForm;
	if (form!=null)
	 {
	  if (String(request).length<3) AlertMessage("ShortRequest" ); 
	  else
	   {
	    form.Request.value = request;
	    form.Offset.value = 0;
	    form.Limit.value = 3;    
	    form.submit();
	   }    
	 }
	else AlertMessage("SearchUnderConstruction");
	//AlertMessage("SearchUnderConstruction");
}

function SetOffset(offset,limit)
 {
   url = Url("/Search")+"/"+_TMPID_+"/"+offset;
   window.location.href=url;
 }      
 
function checkSearch()
{
 return true;
}

/*-------SWFObject-------*/
/**
 * SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=key+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);
axo.AllowScriptAccess="always";}
catch(e){
if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}
if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){
var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){
_2d[i].style.display="none";
for(var x in _2d[i]){if(typeof _2d[i][x]=="function"){_2d[i][x]=null;}}}};
if(typeof window.onunload=="function"){
var oldunload=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();
oldunload();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}
if(Array.prototype.push==null){
Array.prototype.push=function(_30){
this[this.length]=_30;
return this.length;};}

var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for legacy support
var SWFObject=deconcept.SWFObject;


/*-------Dom-------*/
var Agent = navigator.userAgent.toLowerCase();
var IsIE  = ((Agent.indexOf("msie")!=-1) && (Agent.indexOf("mac")==-1) && (Agent.indexOf("opera")==-1) && (navigator.appVersion.match(/MSIE (.\..)/)[1] > 5.5));

function GetNodeValue(node,def)
 {
  if ((typeof node == "undefined") || (node==null) || (typeof node.firstChild == "undefined") || (node.firstChild==null)) return def;
  switch (node.firstChild.nodeType)
   {
    case 3	:
    case 4	: var value = node.firstChild.nodeValue; 
		  return ((typeof value == "undefined") || (value==null)) ? def : value;
		  break;
   }
  return def;  
 } 

function GetNodeAttribute(n,name,def)
 {
  var ret = n.getAttribute(name);
  return ((typeof ret=="undefined") || (ret==null)) ? def : ret;
 }

function GetFirstElementNode(parent,def)
 {
  if ((typeof parent == "undefined") || (parent==null)) return def;
  for (var child=parent.firstChild; child!=null; child=child.nextSibling)
   if (child.nodeType==child.ELEMENT_NODE) return child;
  return def;
 }

function CreateElement(tagname,parent,props,attrs,styles,events)
 {
  var return_value = document.createElement(tagname);
  if (parent!=null) parent.appendChild(return_value);
  SetNodeProperties(return_value,props,attrs,styles,events);
  return return_value;
 }

function CreateElementBefore(tagname,parent,refnode,props,attrs,styles,events)
 {
  if (refnode==null) return CreateElement(tagname,parent,props,attrs,styles,events);
  var return_value = document.createElement(tagname);
  if (parent!=null) parent.insertBefore(return_value,refnode);
  SetNodeProperties(return_value,props,attrs,styles,events);
  return return_value;
 }
 
function SetNodeProperties(node,props,attrs,styles,events)
 {
  if ((typeof props != "undefined") && (props!=null))
   for (var i in props) node[i] = props[i];
  if ((typeof attrs != "undefined") && (attrs!=null))
   for (var i in attrs) node.setAttribute(i,attrs[i]);
  if ((typeof styles != "undefined") && (styles!=null))
   for (var i in styles) node.style[i] = styles[i];
  if ((typeof events != "undefined") && (events!=null))
   for (var i in events) node.addEventListener(i,events[i],false);
 }

function FindNode(node,list)
 {
  var itemix = 0;
  var actualparent = node;
  var child = node.firstChild;
  while (child!=null)
   {
    if ((child.nodeType==1) && (child.tagName.toLowerCase()==list[itemix]))
     { 
      if ((++itemix)==list.length) return child;
      actualparent = child;
      child = actualparent.firstChild;
     }
    else child = child.nextSibling;
   }
  return null;
 }

function GetEventXml(e)
 {
  if (IsIE)
   {
    var txt = e.responseText;
    var parser 	= null
    var xml	= null;
    var versions	= new Array("4.0","3.0","2.6","2.0","1.0");
    for (var i=0; i<versions.length; i++)
     {
      try
       {
        var parser = new ActiveXObject("Msxml2.DOMDocument."+versions[i]);
        if (parser.loadXML(txt)) return parser.documentElement.parentNode;
       }
      catch (err) {}
     }
    return null;   
   }
  else
   {
//    alert(e.target.responseText);
    if ((typeof e.target != "undefined") && (e.target != null) && (typeof e.target.responseXML != "undfined") && (e.target.responseXML != null))
     return e.target.responseXML;
    else return null;
   }
 }


function XMLLoad(url,info,method,data,mime)
 {
  var http	= null;
  method 	= method || "GET";
  data   	= data   || null;
  mime		= mime   || "text/xml";
  if (IsIE)
   {
    http = new ActiveXObject("Msxml2.XMLHTTP");
	   
    function E_state()
     {
      if (http.readyState==4 && (typeof info.OnLoad != "undefined") && (info.OnLoad!=null))
       info.OnLoad(http);
      if ((typeof info.OnReadystatechange != "undefined") && (info.OnReadystatechange != null))
       info.OnReadystatechange(http);
     }
    http.open(method,url,true);
    http.onreadystatechange = E_state;
    http.setRequestHeader("Content-Type", mime);
    http.send(data);
   }
  else
   {
    http = new XMLHttpRequest();

    http.open(method,url,false);
    http.overrideMimeType(mime);
    if (typeof info.OnError != "undefined") http.onerror = info.OnError;
    if (typeof info.OnProgress != "undefined") http.onprogress = info.OnProgress;
    if (typeof info.OnLoad != "undefined") http.onload = info.OnLoad;
    if (typeof info.OnReadystatechange != "undefined") http.onreadystatechange	= info.OnReadystatechange;
    http.send(data);
   } 
 }

function IsNodeTagName(node,name)
 {
  return ((node.nodeType==node.ELEMENT_NODE) && (node.tagName.toLowerCase()==name));
 }

function CheckXmlError(xml)
 {
  var statusnode = FindNode(xml,["response","header","status"]);
  if (statusnode==null)
   {
    //AlertMessage("NoStatusNode");
    return false;
   }
  var status = GetNodeValue(statusnode);
  if (status=="0") return true;
  var msgnode = FindNode(xml,["response","header","message"]);
  if (msgnode==null)
   {
    //AlertMessage("NoMessageNode");
    return false;
   }
  AlertMessage(GetNodeValue(msgnode));
  return false;
 }

function DestroyChildren(node)
 {
  if (typeof node != "undefined")
   {
    for (var child=node.firstChild; child!=null; )
     {
      var succ = child.nextSibling;
      node.removeChild(child);
      child = succ;
     }
   }
 }
 
function SetEvent(o,fn,f,b)
 {
  if (IsIE) o["on"+fn] = f;
  else o.addEventListener(fn,f,b);
 }

function GetStringXml(s)
 {
  var ret = (new DOMParser()).parseFromString(s,"text/xml");
  if ((ret==null) || (typeof ret == "undefined")) return null;
  else return ret;
 }

function CommonLoadXml(url,handler,method,data,mime)
 {
  function OnLoad(e)
   {
    var xml = GetEventXml(e);
    if (xml==null) AlertMessage("LoadXmlNoXml");
    if (CheckXmlError(xml)) handler(xml);
   }
  function OnError()	{AlertMessage("LoadXmlFailed");}
  XMLLoad(url,{"OnLoad":OnLoad,"OnError":OnError},method,data,mime);
 }
