var CMN=function(){var cmn,tO=function(v,type){var t=typeof v;if(t==="object"){if(!v){t="null"}else{if(typeof v.length==="number"&&(v.propertyIsEnumerable&&!v.propertyIsEnumerable("length"))&&typeof v.splice==="function"){t="array"}}}return type?t===type:t},pI=function(n){return parseInt(n,10)},getParams=function(j,d){var o={},dl=d.length,prop;for(var i=0;i<dl;i++){prop=d[i][0];o[prop]=tO(j[prop],"undefined")?d[i][1]:j[prop]}o.toString=function(){var pr,p="";for(pr in this){if(this.hasOwnProperty(pr)&&this[pr]!=arguments.callee){p+=(pr+": "+(tO(this[pr],"function")?"function...":this[pr])+"\n")}}return p};return o},module=function(o,d,f){return function(j){var lang="cs",roots=window.document.getElementsByTagName("html"),lang_attr=roots[0].getAttribute("lang"),par=getParams((j||{}),d),M=function(){},m;M.prototype=o;M.prototype.lang=lang_attr!==""?lang_attr:lang;M.prototype.getParams=function(){return par};M.prototype.getParam=function(p){return par[p]};M.prototype.setParam=function(p,v){for(var prop in par){if(prop==p){par[prop]=v;return true}}return false};M.prototype.toString=function(){return"CMN "+(this.name?this.name:"nameless module")+"\n\nParameters:\n"+this.getParams()};m=new M();if(tO(f,"function")){f.apply(m)}return m}},rm=[],ge=function(s){var el=tO(s,"string")?window.document.getElementById(s)?window.document.getElementById(s):null:s,rml=rm.length,c=el?tO(el.cmn,"undefined")?{}:el.cmn:{},i;if(!el){return el}if(c!==CMN){for(i=0;i<rml;i++){el[rm[i][0]]=rm[i][1]}el.fE=el.firstEl=cmn.firstEl;el.lE=el.lastEl=cmn.lastEl;el.nE=el.nextEl=cmn.nextEl;el.pE=el.prevEl=cmn.prevEl;el.hC=el.hasClass=cmn.hasClass;el.aC=el.addClass=cmn.addClass;el.rC=el.removeClass=cmn.removeClass;el.aL=el.addListener=function(evtype,fc,capt){return cmn.addListener(this,evtype,fc,capt)};el.rL=el.removeListener=function(evtype,fc,capt){return cmn.removeListener(this,evtype,fc,capt)};el.cE=el.createEl=function(j){return ge(this.appendChild(cmn.createEl(j)))};el.getElementsByTagNames=cmn.getElementsByTagNames;el.getElementsByClassName=function(cl,tg){return cmn.getElementsByClassName(this,cl,tg)};el.cmn=cmn}return el},gc=function(a){if(!a){return a}var rml=rm.length,i,c=tO(a.cmn,"undefined")?{}:a.cmn,l=a.length;if(c!==CMN){for(i=0;i<rml;i++){a[rm[i][0]]=rm[i][1]}a.aC=a.addClass=function(){var ag=[].splice.call(arguments,null),i;for(i=0;i<l;i++){cmn.addClass(a[i],ag)}return a};a.rC=a.removeClass=function(){var ag=[].splice.call(arguments,null),i;for(i=0;i<l;i++){cmn.removeClass(a[i],ag)}return a};a.aL=a.addListener=function(evtype,fc,capt){var i;for(i=0;i<l;i++){cmn.addListener(a[i],evtype,fc,capt)}return a};a.rL=a.removeListener=function(evtype,fc,capt){var i;for(i=0;i<l;i++){cmn.removeListener(a[i],evtype,fc,capt)}return a};a.cmn=cmn}return a},regElMethod=function(fn,f){var sf=function(x){if(tO(x,"array")){var a=tO(x.cmn,"undefined")?{}:x.cmn,i,l;if(a!==CMN){x=gc(x)}l=x.length;for(i=0;i<l;i++){f(x[i])}}else{x=ge(x);f(x)}return x};cmn[fn]=function(){var o=null,l=arguments.length,i,ao=[],c,e;if(l>1){for(i=0;i<l;i++){e=arguments[i];if(tO(e,"array")){ao=ao.concat(sf(e))}else{ao.push(sf(e))}}c=tO(ao.cmn,"undefined")?{}:ao.cmn;o=c===CMN?ao:gc(ao)}else if(l===1){o=sf(arguments[0])}return o};rm.push([fn,function(){return sf(this)}])},dombuilt=false,onbuilt=[],built=function(){if(dombuilt){return}var i,l=onbuilt.length;for(i=0;i<l;i++){onbuilt[i]()}dombuilt=true},json_parse,lsts=[];if(window.JSON){json_parse=window.JSON.parse}else{json_parse=function(){var at,ch,escapee={'"':'"','\\':'\\','/':'/',b:'\b',f:'\f',n:'\n',r:'\r',t:'\t'},text,err=function(m){throw{name:"SyntaxError",message:m,at:at,text:text}},nxt=function(c){if(c&&c!==ch){err("Expected '"+c+"' instead of '"+ch+"'")}ch=text.charAt(at);at+=1;return ch},number=function(){var number,string="";if(ch==="-"){string="-";nxt("-")}while(ch>="0"&&ch<="9"){string+=ch;nxt()}if(ch==="."){string+=".";while(nxt()&&ch>="0"&&ch<="9"){string+=ch}}if(ch==="e"||ch==="E"){string+=ch;nxt();if(ch==="-"||ch==="+"){string+=ch;nxt()}while(ch>="0"&&ch<="9"){string+=ch;nxt()}}number=+string;if(isNaN(number)){err("Bad number")}else{return number}},string=function(){var hex,i,string="",uffff;if(ch==='"'){while(nxt()){if(ch==='"'){nxt();return string}else if(ch==="\\"){nxt();if(ch==="u"){uffff=0;for(i=0;i<4;i+=1){hex=parseInt(nxt(),16);if(!isFinite(hex)){break}uffff=uffff*16+hex}string+=String.fromCharCode(uffff)}else if(tO(escapee[ch],"string")){string+=escapee[ch]}else{break}}else{string+=ch}}}err("Bad string")},wht=function(){while(ch&&ch<=" "){nxt()}},word=function(){switch(ch){case"t":nxt("t");nxt("r");nxt("u");nxt("e");return true;case"f":nxt("f");nxt("a");nxt("l");nxt("s");nxt("e");return false;case"n":nxt("n");nxt("u");nxt("l");nxt("l");return null}err("Unexpected '"+ch+"'")},value,array=function(){var array=[];if(ch==="["){nxt("[");wht();if(ch==="]"){nxt("]");return array}while(ch){array.push(value());wht();if(ch==="]"){nxt("]");return array}nxt(",");wht()}}err("Bad array")},object=function(){var key,object={};if(ch==="{"){nxt("{");wht();if(ch==="}"){nxt("}");return object}while(ch){key=string();wht();nxt(":");if(Object.hasOwnProperty.call(object,key)){err('Duplicate key "'+key+'"')}object[key]=value();wht();if(ch==="}"){nxt("}");return object}nxt(",");wht()}}err("Bad object")};value=function(){wht();switch(ch){case"{":return object();case"[":return array();case'"':return string();case"-":return number();default:return ch>="0"&&ch<="9"?number():word()}};return function(source,reviver){var result;text=source;at=0;ch=" ";result=value();wht();if(ch){err("Syntax error")}return tO(reviver,"function")?function walk(holder,key){var k,v,value=holder[key];if(value&&tO(value,"object")){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}({"":result},""):result}}()}cmn={tO:tO,isMail:function(s){s=s||((this!==CMN)?this:false)||"";return(/^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/).test(s)},trim:function(s){s=s||((this!==CMN)?this:false)||"";return s.replace(/^\s+|\s+$/g,"")},number_format:function(n,e,d,t){n=n||((this!==CMN)?this:false)||0;t=t||",";d=d||".";var c=isNaN(e)?2:e,sg=n<0?"-":"",i,j;n=Math.abs(+n||0).toFixed(c);i=pI(n)+"";j=i.length>3?i.length%3:0;return sg+(j?i.substr(0,j)+t:"")+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c?d+Math.abs(n-i).toFixed(c).slice(2):"")},extendTypes:function(){String.prototype.trim=this.trim;String.prototype.isMail=this.isMail;Number.prototype.number_format=this.number_format},createEl:function(j){var par=getParams(j,[["tag","div"],["id",""],["className",""],["text",""],["style",null],["attrs",null],["doc",window.document]]);var e=par.doc.createElement(par.tag);if(par.id!==""){e.id=par.id}if(par.className!==""){e.className=par.className}if(par.text!==""){e.appendChild(par.doc.createTextNode(par.text))}if(par.style){for(var styleProp in par.style){if(par.style.hasOwnProperty(styleProp)&&!tO(par.style[styleProp],"function")){e.style[styleProp]=par.style[styleProp]}}}if(par.attrs){for(var attrName in par.attrs){if(par.attrs.hasOwnProperty(attrName)&&!tO(par.attrs[attrName],"function")){e.setAttribute(attrName,par.attrs[attrName])}}}return ge(e)},browser:{isIE:!!(window.attachEvent&&!window.opera),isOpera:!!window.opera,isGecko:!!window.document.getAnonymousElementByAttribute,isWebKit:navigator.userAgent.indexOf("KHTML")>-1,toString:function(){var s="";for(var p in navigator){if(tO(navigator[p],"string")||tO(navigator[p],"number")){s+=(p+": "+navigator[p]+"\n")}}return s}},getViewportWidth:function(){if(window.innerWidth){return pI(window.innerWidth)}else{if(window.document.documentElement&&window.document.documentElement.clientWidth){return pI(document.documentElement.clientWidth)}else{if(window.document.body&&window.document.body.clientWidth){return pI(window.document.body.clientWidth)}}}},getViewportHeight:function(){if(window.innerHeight){return pI(window.innerHeight)}else{if(window.document.documentElement&&window.document.documentElement.clientHeight){return pI(window.document.documentElement.clientHeight)}else{if(window.document.body&&window.document.body.clientHeight){return pI(window.document.body.clientHeight)}}}},getCollection:function(){var o=null,l=arguments.length,i,ao=[],c,e;for(i=0;i<l;i++){e=arguments[i];if(tO(e,"array")){ao=ao.concat(e)}else{ao.push(e)}}c=tO(ao.cmn,"undefined")?{}:ao.cmn;o=c===CMN?ao:gc(ao);return o},addClass:function(){var a0=arguments[0],c=this===CMN,el=c?tO(a0,"string")?window.document.getElementById(a0):a0:this,st=c?1:0,al=arguments.length,i,e,j,jl,n,ac=function(el,cl){var re=new RegExp("\\b"+cl+"\\b");if(!re.test(el.className)){el.className=(el.className?el.className:"")+" "+cl}};for(i=st;i<al;i++){e=arguments[i];if(tO(e,"array")){jl=e.length;for(j=0;j<jl;j++){n=e[j];if(tO(n,"array")){CMN.addClass(el,n)}else{ac(el,n)}}}else{ac(el,e)}}return ge(el)},removeClass:function(){var a0=arguments[0],c=this===CMN,el=c?tO(a0,"string")?window.document.getElementById(a0):a0:this,st=c?1:0,al=arguments.length,i,e,j,jl,n,rc=function(el,cl){var re=new RegExp("\\s*"+cl+"\\s*","g");el.className=el.className.replace(re,"")};for(i=st;i<al;i++){e=arguments[i];if(tO(e,"array")){jl=e.length;for(j=0;j<jl;j++){n=e[j];if(tO(n,"array")){CMN.removeClass(el,n)}else{rc(el,n)}}}else{rc(el,e)}}return ge(el)},hasClass:function(){var a0=arguments[0],c=this===CMN,el=c?tO(a0,"string")?window.document.getElementById(a0):a0:this,s=[],st=c?1:0,al=arguments.length,re,e,i;for(i=st;i<al;i++){e=arguments[i];if(tO(e,"array")){s=s.concat(e)}else if(tO(e,"string")){s.push(e)}}re=new RegExp("\\b("+s.join("|")+")\\b");return re.test(el.className)},getElementsByTagNames:function(){var a0=arguments[0],c=this===CMN,el=c?tO(a0,"string")?window.document.getElementById(a0):a0:this,st=c?1:0,o=[],al=arguments.length,re,e,i,j,jl,con=function(a,ae){var i,l=a.length,e=ae.length+l;for(i=l;i<e;i++){a[i]=ae[i-l]}return a};for(i=st;i<al;i++){e=arguments[i];if(tO(e,"array")){jl=e.length;for(j=0;j<jl;j++){o=con(o,el.getElementsByTagName(e[j]))}}else if(tO(e,"string")){o=con(o,el.getElementsByTagName(e))}}return gc(o)},getElementsByClassName:function(el,cl,tg){var a,al,o=[],re,i;tg=tg||"*";el=tO(el,"string")?window.document.getElementById(el):el;a=CMN.getElementsByTagNames(el,tg);cl=tO(cl,"array")?cl.join("|"):tO(cl,"string")?cl:"";re=new RegExp("\\b("+cl+")\\b");al=a.length;for(i=0;i<al;i++){if(re.test(a[i].className)){o.push(a[i])}}return gc(o)},firstEl:function(el){el=el||this;if(tO(el,"string")){el=window.document.getElementById(el)}if(el.firstChild){el=el.firstChild;if(el.nodeType===1){return ge(el)}return CMN.nextEl(el)}return null},lastEl:function(el){el=el||this;if(tO(el,"string")){el=window.document.getElementById(el)}if(el.lastChild){el=el.lastChild;if(el.nodeType===1){return ge(el)}return CMN.nextEl(el)}return null},nextEl:function(el){el=el||this;if(tO(el,"string")){el=window.document.getElementById(el)}while(el.nextSibling){el=el.nextSibling;if(el.nodeType===1){return ge(el)}}return null},prevEl:function(el){el=el||this;if(tO(el,"string")){el=window.document.getElementById(el)}while(el.previousSibling){el=el.previousSibling;if(el.nodeType==1){return ge(el)}}return null},getPosX:function(el){el=tO(el,"string")?window.document.getElementById(el):el;var curleft=0;if(el.offsetParent){while(el.offsetParent){curleft+=el.offsetLeft;el=el.offsetParent}}else if(el.x){curleft+=el.x}return pI(curleft)},getPosY:function(el){el=tO(el,"string")?window.document.getElementById(el):el;var curtop=0;if(el.offsetParent){while(el.offsetParent){curtop+=el.offsetTop;el=el.offsetParent}}else if(el.y){curtop+=el.y}return pI(curtop)},getStyle:function(el,prop){el=tO(el,"string")?window.document.getElementById(el):el;var cs;if(window.document.defaultView&&window.document.defaultView.getComputedStyle){cs=el.ownerDocument.defaultView.getComputedStyle(el,"");if(!cs){return cs}return cs[prop]}return el.currentStyle[prop]},getElementHeight:function(el){el=tO(el,"string")?window.document.getElementById(el):el;return pI(this.browser.isIE?el.offsetHeight:this.getStyle(el,"height"))},getElementWidth:function(el){el=tO(el,"string")?window.document.getElementById(el):el;return pI(this.browser.isIE?el.offsetWidth:this.getStyle(el,"width"))},addListener:function(el,evtype,fc,capt){var src,r,f;el=tO(el,"string")?window.document.getElementById(el):el;if(el===window&&evtype==="domready"){if(dombuilt){fc();return true}onbuilt.push(fc);if(CMN.browser.isIE&&document.readyState){if(!window.document.getElementById("ie_ready")){src=window.location.protocol==="https:"?"://0":((" java").substring(1)+"script:void(0)");window.document.write('<scr'+'ipt id="ie_ready" defer src="'+src+'"><\/script>');window.document.getElementById("ie_ready").onreadystatechange=function(){if(this.readyState==="complete"){built()}}}}else{if(CMN.browser.isGecko){window.document.addEventListener("DOMContentLoaded",built,false)}else{window.addEventListener("load",built,false)}}return true}else{if(el.addEventListener){el.addEventListener(evtype,fc,capt)}else if(el.attachEvent){f=function(){fc.apply(el,arguments)};r=el.attachEvent("on"+evtype,f,capt);if(r){lsts.push([fc,f])}}return ge(el)}},removeListener:function(el,evtype,fc,capt){var i,l=onbuilt.length,o=false,ll=lsts.length;el=tO(el,"string")?window.document.getElementById(el):el;if(el===window&&evtype==="domready"){for(i=0;i<l;i++){if(onbuilt[i]===fc){onbuilt.splice(i,1);o=true}}return o}else{if(el.removeEventListener){el.removeEventListener(evtype,fc,capt)}else if(el.detachEvent){for(i=0;i<ll;i++){if(lsts[i][0]===fc){el.detachEvent("on"+evtype,lsts[i][1],capt)}}}return ge(el)}},getEvent:function(e){e=e||window.event;if(tO(e.target,"undefined")){e.target=e.srcElement}if(tO(e.layerX,"undefined")){e.layerX=e.layerX=e.offsetX}if(tO(e.layerY,"undefined")){e.layerY=e.layerY=e.offsetY}if(tO(e.which,"undefined")){e.which=e.which=e.keyCode}if(tO(e.preventDefault,"undefined")){e.preventDefault=function(){e.returnValue=false}}return e},createModule:function(n,d,f){cmn[n]=module({name:n},d,f)},xhr:function(j){var getRequest=function(){var req=null,MSXMLProgID=["Microsoft.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"];try{req=new XMLHttpRequest()}catch(xX){for(var i=0;i<MSXMLProgID.length;i++){try{req=new window.ActiveXObject(MSXMLProgID[i]);break}catch(xA){}}}finally{return req}},req=getRequest();if(!req){throw{name:"CMN.XHR",message:"Fatal: Cannot initialize XHR object :("}}var o=module({name:"xhr",response:{xml:null,text:"",json:null,status:0,json_error:null},onresponse:function(){}},[["url",""],["method","GET"],["params",""],["async",true],["timestamp",false]])(j),setResult=function(){o.response.status=req.status;if(req.status===200){o.response.xml=req.responseXML;o.response.text=req.responseText;try{o.response.json=json_parse(req.responseText)}catch(xJ){o.response.json_error=xJ}}};if(o.getParam("async")){req.onreadystatechange=function(){if(req.readyState==4){setResult();o.onresponse()}}}o.send=function(){var par=this.getParams();if(par.timestamp){par.params+=("&cmn_xhr_timestamp="+new Date().getTime())}if(par.method.toUpperCase()==="POST"){req.open("POST",par.url,par.async);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(req.overrideMimeType){req.setRequestHeader("Connection","close")}req.send(par.params)}else{req.open("GET",par.url+"?"+par.params,par.async);req.send(null)}if(!par.async){setResult()}};return o},ani:function(j){var timer,ts,k,d=[["start",0],["end",0],["method",function(){}],["timestep",100],["duration",1000],["course","linear"]],o={name:"ani",x:0,y:0},onstart=[],onend=[],m=module(o,d)(j),pas=function(){var end=m.getParam("end");m.x=new Date().getTime()-ts.getTime();switch(m.getParam("course")){case"square":m.y=Math.round(Math.pow(m.x,2)*k);break;case"linear":m.y=Math.round(m.x*k);break}m.y+=m.getParam("start");if(m.y>=end||m.x>m.getParam("duration")){m.y=end;m.stop();m.getParam("method").apply(m);for(var i=0;i<onend.length;i++){if(tO(onend[i],"function")){onend[i].apply(m)}}}else{m.getParam("method").apply(m)}};m.onstart=function(f,a){if(tO(a,"undefined")||a){onstart.push(f)}else{for(var i=0;i<onstart.length;i++){if(onstart[i].toString()==f.toString()){onstart.splice(i,1)}}}};m.onend=function(f,a){if(tO(a,"undefined")||a){onend.push(f)}else{for(var i=0;i<onend.length;i++){if(onend[i].toString()==f.toString()){onend.splice(i,1)}}}};m.run=function(){this.y=this.getParam("start");var sl=onstart.length,he=this.getParam("end")-this.getParam("start");switch(this.getParam("course")){case"square":k=he/this.getParam("duration")/1000;break;case"linear":k=he/this.getParam("duration");break}for(var i=0;i<sl;i++){if(tO(onstart[i],"function")){onstart[i].apply(this)}}ts=new Date();timer=window.setInterval(pas,this.getParam("timestep"))};m.stop=function(){window.clearInterval(timer)};return m},JSON:{parse:json_parse}};cmn.gE=cmn.getEl=ge;cmn.gC=cmn.getCollection;cmn.cE=cmn.createEl;cmn.fE=cmn.firstEl;cmn.lE=cmn.lastEl;cmn.nE=cmn.nextEl;cmn.pE=cmn.prevEl;cmn.gX=cmn.getPosX;cmn.gY=cmn.getPosY;cmn.gH=cmn.getElementHeight;cmn.gW=cmn.getElementWidth;cmn.aC=cmn.addClass;cmn.rC=cmn.removeClass;cmn.hC=cmn.hasClass;cmn.aL=cmn.addListener;cmn.rL=cmn.removeListener;regElMethod("setDN",function(el){el.style.display="none"});regElMethod("setDB",function(el){el.style.display=el.tagName.toLowerCase()==="tr"?"table-row":"block"});regElMethod("setDI",function(el){el.style.display="inline"});regElMethod("setVV",function(el){el.style.visibility="visible"});regElMethod("setVH",function(el){el.style.visibility="hidden"});regElMethod("swapDisplay",function(el){el.style.display=el.style.display==="none"?"block":"none"});regElMethod("swapVisibility",function(el){el.style.visibility=el.style.visibility==="hidden"?"visible":"hidden"});return cmn}();

function isNull(a){return (typeof(a)=="object" && !a);}
function isUndefined(a){return typeof(a)=="undefined";} 
function isFunction(a){return typeof(a)=="function";}
function isString(a){return typeof(a)=="string";}
function isArray(a){return a && !(a.propertyIsEnumerable("length")) && typeof a==="object" && typeof a.length==="number";}

function listProperties(obj){var lst="";for(var prop in obj)if(typeof obj[prop]!="function")lst+=prop+": "+obj[prop]+"\n";return lst;}
function listMethods(obj,full){var lst="";for(var prop in obj)if(typeof obj[prop]=="function")lst+=prop+": "+obj[prop]+"\n";if(full)return lst;var lst2="";var fceRE=browser.isIE?/(.*): function(\([^\{]+)\{/g:/(.*):\s+\ *function\s*(.*)\{/g;while(result=fceRE.exec(lst)){lst2+=result[1]+result[2]+"\n";}return lst2;}

function trim(inpstr){return inpstr.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");}
String.prototype.trim=function(){return trim(this);} 
function isMail(inpstr){return /^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/.test(inpstr);}
String.prototype.isMail=function(){return isMail(this);} 
function number_format(number,decimals,point,separator){if(!isNaN(number)){point=point?point:".";number=number.toString().split(".");if(separator){var tmp_number=[];for(var i=number[0].length,j=0;i>0;i-=3){var pos=i>0?i-3:i;tmp_number[j++]=number[0].substring(i,pos);}number[0]=tmp_number.reverse().join(separator);}if(decimals)if(number[1])number[1]=Math.round(parseFloat(number[1].substr(0,decimals)+"."+number[1].substr(decimals,number[1].length),10)); else number[1]="00";return(number.join(point));}else return null;} 
Number.prototype.number_format=function(decimals,point,separator){return number_format(this,decimals,point,separator);};

var browser={isIE:!!(window.attachEvent && !window.opera),isOpera:!!window.opera,isMozilla:(navigator.product=="Gecko" && navigator.userAgent.indexOf("KHTML")==-1),getIEversion:function(){if(!browser.isIE)return 0;else{var ver=navigator.appVersion;ver=ver.substring(ver.indexOf("MSIE")+4);return ver.substring(0,ver.indexOf(";"));}},toString:function(){return listProperties(navigator);}};
document.lang=document.getElementsByTagName("html")[0].lang?document.getElementsByTagName("html")[0].lang:"cs";

function getEl(elid){return document.getElementById(elid);}
function gE(el){if(typeof(el)=="string")el=document.getElementById(el);if(!el)return null;el.getElementsByClassName=function(clsName,tagName){return getElementsByClassName(this,clsName,tagName);};el.getElementsByTagNames=function(){var args=[this];var al=arguments.length;for(var i=0;i<al;i++)args.push(arguments[i]);return getElementsByTagNames.apply(null,args);};el.setDN=function(){if(arguments.length==0)setDN(this);else setDN.apply(null,arguments);};el.setDB=function(){if(arguments.length==0)setDB(this);else setDB.apply(null,arguments);};el.setDI=function(){if(arguments.length==0)setDI(this);else setDI.apply(null,arguments);};el.setTrDB=function(){if(arguments.length==0)setTrDB(this);else setTrDB.apply(null,arguments);};  el.setVV=function(){if(arguments.length==0)setVV(this);else setVV.apply(null,arguments);};el.setVH=function(){if(arguments.length==0)setVH(this);else setVH.apply(null,arguments);};el.swapDisplay=function(){if(arguments.length==0)swapDisplay(this);else swapDisplay.apply(null,arguments);};el.swapVisibility=function(){if(arguments.length==0)swapVisibility(this);else swapVisibility.apply(null,arguments);};el.clipEl=function(l,t,r,b){clipEl(this,l,t,r,b);};el.nextEl=function(){return nextEl(this);};el.prevEl=function(){return prevEl(this);};el.lastEl=function(){return lastEl(this);};el.firstEl=function(){return firstEl(this);};el.registerEvent=function(evtype,fc,capt){registerEvent(this,evtype,fc,capt);};el.unregisterEvent=function(evtype,fc,capt){unregisterEvent(this,evtype,fc,capt);};el.perform=function(fc){fc(this)};return el;}
function getElementsByClassName(parEl,clsName,tagName){if(typeof(parEl)=="string")parEl=document.getElementById(parEl);if(isUndefined(tagName))tagName="*";var out=[];var els=parEl.getElementsByTagName(tagName);if(isArray(clsName))clsName=clsName.join("|");for(var i=0;i<els.length;i++){if(eval("/\\b"+clsName+"\\b/").test(els[i].className))out.push(els[i]);}out.setDN=function(){if(arguments.length==0)setDN(this);else setDN.apply(null,arguments);};out.setDB=function(){if(arguments.length==0)setDB(this);else setDB.apply(null,arguments);};out.setDI=function(){if(arguments.length==0)setDI(this);else setDI.apply(null,arguments);};out.setTrDB=function(){if(arguments.length==0)setTrDB(this);else setTrDB.apply(null,arguments);};out.setVV=function(){if(arguments.length==0)setVV(this);else setVV.apply(null,arguments);};out.setVH=function(){if(arguments.length==0)setVH(this);else setVH.apply(null,arguments);};out.swapDisplay=function(){if(arguments.length==0)swapDisplay(this);else swapDisplay.apply(null,arguments);};out.swapVisibility=function(){if(arguments.length==0)swapVisibility(this);else swapVisibility.apply(null,arguments);};out.clipEl=function(l,t,r,b){clipEl(this,l,t,r,b);};out.registerEvent=function(evtype,fc,capt){registerEvent(this,evtype,fc,capt);};out.unregisterEvent=function(evtype,fc,capt){unregisterEvent(this,evtype,fc,capt);};out.perform=function(fc){var tl=this.length;for(var i=0;i<tl;i++)fc(this[i]);};return out;}
function getElementsByTagNames(el){var out=[];if(isString(el))el=document.getElementById(el);var al=arguments.length;for(var i=1;i<al;i++){var tmpa=el.getElementsByTagName(arguments[i]);var tmpal=tmpa.length;for(var j=0;j<tmpal;j++)out.push(tmpa[j]);}out.setDN=function(){if(arguments.length==0)setDN(this);else setDN.apply(null,arguments);};out.setDB=function(){if(arguments.length==0)setDB(this);else setDB.apply(null,arguments);};out.setDI=function(){if(arguments.length==0)setDI(this);else setDI.apply(null,arguments);};out.setTrDB=function(){if(arguments.length==0)setTrDB(this);else setTrDB.apply(null,arguments);};out.setVV=function(){if(arguments.length==0)setVV(this);else setVV.apply(null,arguments);};out.setVH=function(){if(arguments.length==0)setVH(this);else setVH.apply(null,arguments);};out.swapDisplay=function(){if(arguments.length==0)swapDisplay(this);else swapDisplay.apply(null,arguments);};out.swapVisibility=function(){if(arguments.length==0)swapVisibility(this);else swapVisibility.apply(null,arguments);};out.clipEl=function(l,t,r,b){clipEl(this,l,t,r,b);};out.registerEvent=function(evtype,fc,capt){registerEvent(this,evtype,fc,capt);};out.unregisterEvent=function(evtype,fc,capt){unregisterEvent(this,evtype,fc,capt);};out.perform=function(fc){var tl=this.length;for(var i=0;i<tl;i++)fc(this[i]);};return out;}
function firstEl(el){if(el=el.firstChild){if(el.nodeType==1)return gE(el); else return nextEl(el);}else return null;}
function lastEl(el){if(el=el.lastChild){if(el.nodeType==1)return gE(el); else return prevEl(el);}else return null;}
function nextEl(el){while(el=el.nextSibling)if(el.nodeType==1)return gE(el);return null;}
function prevEl(el){while(el=el.previousSibling)if(el.nodeType==1)return gE(el);return null;}




function registerEvent(el,evtype,fc,capt){
if(el==window && evtype=="domready"){if(isUndefined(window._onbuilt))window._onbuilt=[];if(window._dombuilt){fc();return;}
window._onbuilt.push(fc);
if(!isFunction(window._built))window._built=function(){if(window._dombuilt)return;
for(var i=0;i<window._onbuilt.length;i++)window._onbuilt[i]();window._dombuilt=true;};
if(browser.isIE && document.readyState){if(!getEl("ie_ready")){var src=(window.location.protocol=="https:")?"://0":"javascript:void(0)";document.write('<scr'+'ipt id="ie_ready" defer src="'+src+'"><\/script>');getEl("ie_ready").onreadystatechange=function(){if(this.readyState=="complete")window._built();};}}else{
if(browser.isMozilla)document.addEventListener("DOMContentLoaded",window._built,0); else window.addEventListener("load",window._built,0);}
return true;}
function _registerEvent(el,evtype,fc,capt){if(el.addEventListener){el.addEventListener(evtype,fc,capt);return el;}else if(el.attachEvent){var f=el.attachEvent("on"+evtype,function(){fc.apply(el,arguments)});return el;}return false;}if(isString(el))_registerEvent(getEl(el),evtype,fc,capt);else if(ell=el.length){for(var i=0;i<ell;i++)_registerEvent(el[i],evtype,fc,capt);}else _registerEvent(el,evtype,fc,capt);}


function unregisterEvent(el,evtype,fc,capt){if(el==window && evtype=="domready"){for(var i=0;i<window._onbuilt.length;i++){if(window._onbuilt[i]===fc)window_onbuilt.splice(i,1);}return true;}function _unregisterEvent(el,evtype,fc,capt){if(el.removeEventListener){el.removeEventListener(evtype,fc,capt);return true;}else if(el.detachEvent){var f=el.detachEvent("on"+evtype,function(){fc.apply(el,arguments)});return f;}return false;}if(isString(el))_unregisterEvent(getEl(el),evtype,fc,capt);else if(ell=el.length){for(var i=0;i<ell;i++)_unregisterEvent(el[i],evtype,fc,capt);}else _unregisterEvent(el,evtype,fc,capt);}





function getEvent(e){if(isUndefined(e))e=window.event;if(isUndefined(e.target))e.target=e.srcElement;if(isUndefined(e.layerX))e.layerX=e.offsetX;if(isUndefined(e.layerY))e.layerY=e.offsetY;if(isUndefined(e.which) && e.keyCode)e.which=e.keyCode;if(!e.preventDefault)e.preventDefault=function(){e.returnValue=false;};return e;}

function getViewportHeight(){
  
  if(window.innerHeight)return parseInt(window.innerHeight);
  else if(document.documentElement && document.documentElement.clientHeight)return parseInt(document.documentElement.clientHeight);
  else if(document.body && document.body.clientHeight)return parseInt(document.body.clientHeight);

    
  }


function getViewportWidth(){if(window.innerWidth)return parseInt(window.innerWidth);else if(document.documentElement && document.documentElement.clientWidth)return parseInt(document.documentElement.clientWidth);else if(document.body && document.body.clientWidth)return parseInt(document.body.clientWidth);}
function getElementHeight(el){if(typeof(el)=="string")el=document.getElementById(el);if(browser.isIE)return parseInt(el.offsetHeight);else return parseInt(document.defaultView.getComputedStyle(el,"").getPropertyValue("height"));}
function getElementWidth(el){if(typeof(el)=="string")el=document.getElementById(el);if(browser.isIE)return parseInt(el.offsetWidth);else return parseInt(document.defaultView.getComputedStyle(el,"").getPropertyValue("width"));}
function findPosX(el){if(typeof(el)=="string")el=document.getElementById(el);var curleft=0;if(el.offsetParent){while(el.offsetParent){curleft+=el.offsetLeft;el=el.offsetParent;}}else if(el.x)curleft+=el.x;return parseInt(curleft);}
function findPosY(el){if(typeof(el)=="string")el=document.getElementById(el);var curtop=0;if(el.offsetParent){while(el.offsetParent){curtop+=el.offsetTop;el=el.offsetParent;}}else if(el.y)curtop+=el.y;return parseInt(curtop);}

function setDN(){function _setDN(el){if(el.style)el.style.display="none";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_setDN(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_setDN(el[j]);}else _setDN(el);}}
function setDB(){function _setDB(el){if(el.style)el.style.display="block";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_setDB(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_setDB(el[j]);}else _setDB(el);}}
function setDI(){function _setDI(el){if(el.style)el.style.display="inline";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_setDI(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_setDI(el[j]);}else _setDI(el);}}
function setVH(){function _setVH(el){if(el.style)el.style.visibility="hidden";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_setVH(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_setVH(el[j]);}else _setVH(el);}}
function setVV(){function _setVV(el){if(el.style)el.style.visibility="visible";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_setVV(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_setVV(el[j]);}else _setVV(el);}}
function setTrDB(){function _setTrDB(el){if(el.style)el.style.display=browser.isIE?"block":"table-row";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_setTrDB(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_setTrDB(el[j]);}else _setTrDB(el);}}
function swapDisplay(){function _swapDisplay(el){if(el.style)el.style.display=el.style.display=="none"?"block":"none";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_swapDisplay(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_swapDisplay(el[j]);}else _swapDisplay(el);}}
function swapVisibility(){function _swapVisibility(el){if(el.style)el.style.visibility=el.style.visibility=="hidden"?"visible":"hidden";}var al=arguments.length;for(var i=0;i<al;i++){var el=arguments[i];if(typeof(el)=="string")_swapVisibility(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_swapVisibility(el[j]);}else _swapVisibility(el);}}
function clipEl(el,l,t,r,b){function _clipEl(el,l,t,r,b){if(el.style) el.style.clip="rect("+t+"px,"+(getElementWidth(el)-r)+"px,"+(getElementHeight(el)-b)+"px,"+l+"px)";}if(typeof(el)=="string")_clipEl(getEl(el));else if(ell=el.length){for(var j=0;j<ell;j++)_clipEl(el[j],l,t,r,b);}else _clipEl(el,l,t,r,b);}


function AJAX(){var req=false;if(window.XMLHttpRequest){req=new XMLHttpRequest();if(req.overrideMimeType)req.overrideMimeType("text/xml");}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}if(!req){throw("Fatal AJAX error");} this.setFinalMethod=function(fce){req.onreadystatechange=function(){if(req.readyState==4)fce(req.status);};};this.request=function(method,url,params,async){if(method.toUpperCase()=="POST"){req.open("POST",url);if(!isUndefined(params))req.send(params);}else req.open(method.toUpperCase(),url+(isUndefined(params)?"":"?"+params),(async || true));req.send(null);};this.getResponseText=function(){return req.responseText;};this.getResponseObject=function(){return req.responseXML;}};

function Slider(name,start,finalv,step,division,method1,method2){this.name=name;this.actual=start;this.start=start;this.finalv=finalv;this.ffinalv=finalv;this.step=step;this.division=division;this.running=isUndefined(method1)?function(){}:method1;this.last=isUndefined(method2)?function(){}:method2;}
Slider.prototype.run=function(){if(this.actual<this.finalv){this.actual+=Math.ceil((this.finalv-this.actual)/this.division);}else{this.actual+=Math.floor((this.finalv-this.actual)/this.division);}if(this.actual!=this.finalv){this.running(this.actual);this.timer=setTimeout(this.name+".run()",this.step);}else{this.last(this.finalv);clearTimeout(this.timer);}}
Slider.prototype.stop=function(){clearTimeout(this.timer);}
Slider.prototype.reverse=function(){if(this.finalv!=this.start)this.finalv=this.start;else this.finalv=this.ffinalv;}

function Cookie(name,expires){this.name=name;this.expires=expires;}
Cookie.prototype.getValue=function(name,default_value){var strCookie=document.cookie.split("; ");for(var i=0;i<strCookie.length;i++){var strPar=strCookie[i].split("=");if(this.name+"_"+name==strPar[0])return unescape(strPar[1]);};return default_value;}
Cookie.prototype.setValue=function(name,value,uexpires){var date=new Date();date.setTime(date.getTime()+((uexpires?uexpires:this.expires)*24*60*60*1000));var expires="; expires="+date.toGMTString();document.cookie=this.name+"_"+name+"="+value+expires+"; path=/";return value;}
Cookie.prototype.destroy=function(name){if(name){this.setValue(name,"",-1);}else{var strCookie=document.cookie.split("; ");for(var i=0;i<strCookie.length;i++){var strPar=strCookie[i].split("=");if(strPar[0].substring(0,this.name.length+1)==this.name+"_")this.setValue(strPar[0].substring(this.name.length+1),"",-1);}}}


function FormValidator(el,mode,errClass){


  var mailRE=/^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/;
  var iso_dateRE=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
  var czech_dateRE=/^([0-9]{1,2}\ *\.){2}\ *[0-9]{4}$/;
  var phoneRE=/^(\ *[0-9]\ *){9}$/;
  var intRE=/^[0-9]+$/;


  this.mode=isUndefined(mode)?1:mode;
  if(this.mode==1)this.errClass=isUndefined(errClass)?"error":errClass;

// var errClass=errClass || "error";

  if(typeof(el)=="string")el=gE(el);
  this.inps=[];

  if(isFunction(el.onsubmit))el.originalOnsubmit=el.onsubmit;

  this.labels=[];
  var labelEls=el.getElementsByTagName("label");
  for(var i=0;i<labelEls.length;i++){
    if(!isUndefined(labelEls[i].htmlFor) && labelEls[i].htmlFor!="")this.labels[labelEls[i].htmlFor]=labelEls[i].firstChild.data;
  }

 // el.checkform=this;

  var self=this;

  el.onsubmit=function(){
    var emptys=[];
    var invalids=[];
    var usermessages=[];

    var imess="Následující položky mají chybný formát:";
    var emess="Následující položky nebyly vyplněny:";

    if(document.lang=="en"){
      var imess="The following items have invalid format:";
      var emess="The following items are required:";
    }

    var imess_0='Položka "%" má chybný formát';
    var emess_0='Položka "%" není vyplněna';
    if(document.lang=="en"){
      var imess_0='The item "%" has incorrect format';
      var emess_0='The item "%" is required';
    }

    var inps=self.inps;

    var modeEnabled=function(mode,modearray){
      for(var i=0;i<modearray.length;i++){
        if(modearray[i]==mode)return true;
      }
      return false;
    }

    var alrt="";



    for(var i=0;i<inps.length;i++){

      if(isUndefined(inps[i][4]) || eval(inps[i][4])){

        if(typeof(inps[i][0])=="string")inps[i][0]=getEl(inps[i][0]);
        var el=inps[i][0];
        var mode=inps[i][1].toLowerCase().replace(/\ /gi,"");


        var modesdef=["require","validate","radios","checkboxes","user"];


        var modes=mode.split("&");

        for(var j=0;j<modesdef.length;j++)eval("var mode_"+modesdef[j]+"="+(modeEnabled(modesdef[j],modes)?"true":"false"));

        var type=inps[i][2];
        if(typeof type=="string" && type.trim()!="")var typeRE=eval(type+"RE");else var typeRE=type;

        var label="";
        if(!isUndefined(inps[i][3]) && !isNull(inps[i][3]))label=inps[i][3]; else if(!isUndefined(self.labels[el.id]))label=self.labels[el.id];

        label=label.replace(/\:$/,"");

        if(mode_require){
          if(el.value.trim()==""){
            emptys[emptys.length]=label;

            if(self.mode==0){
              alert(emess_0.replace(/%/,label));
              el.focus();
              return false;
            }
            el.className+=" "+self.errClass;
            el.onchange=new Function('if(isFunction(this.originalOnchange))this.originalOnchange(); if(this.value.trim()!="")this.className=this.className.replace(/\\b'+self.errClass+'\\b/,""); else if(!/\\b'+self.errClass+'\\b/.test(this.className))this.className+=" '+self.errClass+'";');
          }
        }


        if(mode_validate){
          if(el.value.trim()!="" && !typeRE.test(el.value)){
            invalids[invalids.length]=label;
             if(self.mode==0){
              alert(imess_0.replace(/%/,label));
              el.focus();
              return false;
            }
            el.className+=" "+self.errClass;
            el.onchange=new Function('if(isFunction(this.originalOnchange))this.originalOnchange(); if(this.value.trim()!="" && '+typeRE+'.test(this.value))this.className=this.className.replace(/\\b'+self.errClass+'\\b/,""); else if(this.value.trim()!="" && !'+typeRE+'.test(this.value) && !/\\b'+self.errClass+'\\b/.test(this.className))this.className+=" '+self.errClass+'";');
          }
        }


        if(mode_radios){
          var ins=el.parentNode.getElementsByTagName("input");
          var miss=true;
          for(var j=0;j<ins.length;j++)if(ins[j].checked)miss=false;
          if(miss){
            emptys[emptys.length]=label;
            el.parentNode.className+=" "+self.errClass;
            var fc=new Function('if(isFunction(this.originalOnclick))this.originalOnclick(); this.parentNode.className=this.parentNode.className.replace(/\\b'+self.errClass+'\\b/gi,"");');
            for(var j=0;j<ins.length;j++)ins[j].onclick=fc;
          }
        }


        if(mode_checkboxes){
          var ins=el.parentNode.getElementsByTagName("input");
          var miss=true;
          for(var j=0;j<ins.length;j++)if(ins[j].checked)miss=false;
          if(miss){
            emptys[emptys.length]=label;
            el.parentNode.className+=" "+self.errClass;
            var fc=new Function('if(isFunction(this.originalOnclick))this.originalOnclick(); var inps=this.parentNode.getElementsByTagName("input");  var miss=true;for(var i=0;i<inps.length;i++)if(inps[i].checked)miss=false;   if(!miss) this.parentNode.className=this.parentNode.className.replace(/\\b'+self.errClass+'\\b/,""); else this.parentNode.className+=" '+self.errClass+'"');
            for(var j=0;j<ins.length;j++)ins[j].onclick=fc;
          }
        }




     		 if(mode_user){
       			if(eval(inps[i][5])){
         			usermessages.push(inps[i][6]);
        				if(el.type.toLowerCase()=="text" || el.type.toLowerCase()=="password" || el.tagName.toLowerCase()=="textarea")el.className+=" "+self.errClass;
          		el.onchange=new Function('if(isFunction(this.originalOnchange))this.originalOnchange(); if('+inps[i][5]+'){if(!/\\b'+this.className+'\\b/.test(this.className))this.className=this.className+" '+self.errClass+'";}else this.className=this.className.replace(/\\b'+self.errClass+'\\b/,"");');
        		}
        }


      }
    }



    if(emptys.length>0 || invalids.length>0 || usermessages.length>0){
      if(emptys.length>0){
        alrt+=emess+"\n\n";
        for(var i=0;i<emptys.length;i++)alrt+=emptys[i]+"\n";
      }

      if(invalids.length>0){
        if(emptys.length>0)alrt+="\n\n";
         alrt+=imess+"\n\n";
        for(var i=0;i<invalids.length;i++)alrt+=invalids[i]+"\n";
      }

      if(usermessages.length>0){
        if(emptys.length>0||invalids.length>0)alrt+="\n";
        for(var i=0;i<usermessages.length;i++)alrt+=usermessages[i]+"\n";
      }

      alert(alrt);
      return false;
    }

    if(!isUndefined(this.originalOnsubmit))return this.originalOnsubmit();

  }

}



FormValidator.prototype.registerInput=function(){
  if(el=gE(arguments[0])){
    if(isFunction(el.onchange))el.originalOnchange=el.onchange;
    if(isFunction(el.onclick))el.originalOnclick=el.onclick;
    this.inps[this.inps.length]=arguments;
    
   if(arguments[1]!="user" && arguments[1]!="validate"){ var asterisk=document.createElement("span");
    asterisk.className="asterisk";
    asterisk.appendChild(document.createTextNode("*"));
    el.parentNode.getElementsByTagName('label')[0].appendChild(asterisk);
    }
  }else alert('"'+arguments[0]+'" not found');
}



function picWin(){var url=(typeof(arguments[0])=="string")?arguments[0]:"URL_MISSING";var width=arguments[1] || 100;var height=arguments[2] || 100;var title=arguments[3] || "";var winParams=arguments[4] || "";var closeTitle=(document.lang=="cs")?"Kliknutím zavřete okno":"Click to close the window";var encoding="iso-8859-2";if(typeof(arguments[0])=="object"){var assign=function(data){var vars=["url","width","height","title","winParams","closeTitle","encoding"];var vl=vars.length;for(var i=0;i<vl;i++)if(!isUndefined(data[vars[i]]))eval(vars[i]+"=data."+vars[i]);};assign(arguments[0]);}var win=window.open("about:blank","","width="+width+",height="+height+((winParams=="")?"":(","+winParams)));if(typeof(win)!="object")return true;var html='<html><head><title>'+title+'</title><meta http-equiv="content-type" content="text/html; charset='+encoding+'"></head><body style="margin:0"><img src="'+url+'" style="cursor:pointer;display:block;" width="'+width+'" height="'+height+'" alt="'+title+'" title="'+closeTitle+'"></body></html>';win.document.open();win.document.write(html);win.document.onclick=function(){win.close();};win.document.close();win.focus();return false;}

