Date.prototype.toCalendarDate=function(a){a=arguments.length?a:"";return""+this.getFullYear()+a+(this.getMonth()+1<10?"0":"")+(this.getMonth()+1)+a+(this.getDate()<10?"0":"")+this.getDate()};Date.prototype.toHolidayDate=function(){return""+(this.getDate()<10?"0":"")+this.getDate()+"."+(this.getMonth()+1<10?"0":"")+(this.getMonth()+1)};Date.prototype.toHolidayDateFull=function(){return""+(this.getDate()<10?"0":"")+this.getDate()+"."+(this.getMonth()+1<10?"0":"")+(this.getMonth()+1)+"."+this.getFullYear()};Date.getCurrent=function(){var a=new Date();a=a.getHours()<4?new Date(a-24*60*60*1000):a;return new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0)};Date.fromString=function(e){if(/^\d{8}$/.test(e)){var b=e.substr(0,4),c=e.substr(4,2)-1,a=e.substr(6,2),d=Date.getCurrent();d.setFullYear(b,c,a);d.setHours(0,0,0,0);return(d.getFullYear()==b&&d.getMonth()==c&&d.getDate()==a)?d:Date.getCurrent()}else{return Date.getCurrent()}};HOLIDAYS.RU={"01.01.2011":1,"02.01.2011":1,"03.01.2011":1,"04.01.2011":1,"05.01.2011":1,"06.01.2011":1,"07.01.2011":1,"08.01.2011":1,"09.01.2011":1,"10.01.2011":1,"23.02.2011":1,"05.03.2011":0,"07.03.2011":1,"08.03.2011":1,"01.05.2011":1,"02.05.2011":1,"09.05.2011":1,"12.06.2011":1,"13.06.2011":1,"04.11.2011":1,"02.01.2012":1,"03.01.2012":1,"04.01.2012":1,"05.01.2012":1,"06.01.2012":1,"09.01.2012":1,"23.02.2012":1,"08.03.2012":1,"09.03.2012":1,"11.03.2012":0,"28.04.2012":0,"30.04.2012":1,"01.05.2012":1,"09.05.2012":1,"09.06.2012":0,"11.06.2012":1,"05.11.2012":1,"29.12.2012":0,"31.12.2012":1};HOLIDAYS.BY={"07.01.2011":1,"08.03.2011":1,"09.05.2011":1,"07.11.2011":1,"08.03.2012":1,"24.04.2012":1,"01.05.2012":1,"09.05.2012":1,"03.07.2012":1,"07.11.2012":1,"25.12.2012":1};HOLIDAYS.UA={"03.01.2011":1,"07.01.2011":1,"08.03.2011":1,"25.04.2011":1,"02.05.2011":1,"03.05.2011":1,"09.05.2011":1,"13.06.2011":1,"28.06.2011":1,"24.08.2011":1,"02.01.2012":1,"09.01.2012":1,"08.03.2012":1,"16.04.2012":1,"01.05.2012":1,"02.05.2012":1,"09.05.2012":1,"04.06.2012":1,"28.06.2012":1,"24.08.2012":1};HOLIDAYS.AZ={"08.03.2011":1,"21.03.2011":1,"22.03.2011":1,"23.03.2011":1,"24.03.2011":1,"25.03.2011":1,"09.05.2011":1,"15.06.2011":1,"01.08.2011":1,"02.08.2011":1,"18.10.2011":1,"07.11.2011":1,"08.11.2011":1,"17.11.2011":1,"02.01.2012":1,"03.01.2012":1,"04.01.2012":1,"05.01.2012":1,"05.03.2012":1,"06.03.2012":1,"07.03.2012":1,"08.03.2012":1,"09.03.2012":1,"09.05.2012":1,"28.05.2012":1,"15.06.2012":1,"26.06.2012":1,"20.08.2012":1,"18.10.2012":1,"25.10.2012":1,"26.10.2012":1,"09.11.2012":1,"31.12.2012":1};HOLIDAYS.KZ={"03.01.2011":1,"04.01.2011":1,"07.01.2011":1,"08.03.2011":1,"21.03.2011":1,"02.05.2011":1,"09.05.2011":1,"06.07.2011":1,"30.08.2011":1,"07.11.2011":1,"16.12.2011":1,"02.01.2012":1,"03.01.2012":1,"09.01.2012":1,"08.03.2012":1,"21.03.2012":1,"22.03.2012":1,"23.03.2012":1,"01.05.2012":1,"09.05.2012":1,"06.07.2012":1,"30.08.2012":1,"25.10.2012":1,"17.12.2012":1,"18.12.2012":1};HOLIDAYS.KG={"03.01.2011":1,"07.01.2011":1,"23.02.2011":1,"08.03.2011":1,"21.03.2011":1,"24.03.2011":1,"02.05.2011":1,"05.05.2011":1,"09.05.2011":1,"31.08.2011":1,"07.11.2011":1,"02.01.2012":1,"09.01.2012":1,"23.02.2012":1,"08.03.2012":1,"21.03.2012":1,"26.03.2012":1,"01.05.2012":1,"07.05.2012":1,"09.05.2012":1,"31.08.2012":1,"25.10.2012":1,"07.11.2012":1};HOLIDAYS.UZ={"08.03.2011":1,"21.03.2011":1,"09.05.2011":1,"31.08.2011":1,"01.09.2011":1,"07.11.2011":1,"08.12.2011":1,"08.03.2012":1,"21.03.2012":1,"09.05.2012":1,"01.10.2012":1,"25.10.2012":1};pElement=function(){};pElement.prototype=new ample.classes.Element;pElement.prototype.namespaceURI="http://www.programma.tv/ns";pElement.prototype.$isAccessible=function(){return this.getAttribute("disabled")!="true"};ample.extend(pElement);(function(){var a=function(){this._onblur=a.onblur};a.prototype=new pElement;a.prototype.tabIndex=0;a.prototype.selectedDate=null;a.prototype.activeDate=null;a.prototype.isScrolling=false;a.prototype.displayAtOnce=7;a.prototype._old_width=-1;a.prototype.isScrolling=false;a.prototype.setDateSelected=function(b,g){b=b===null?null:new Date(b);var f=this.getItemByDate(b),h=null,d=Number(this.selectedDate)!=Number(b);for(var e=0;e<this.childNodes.length;e++){if(this.childNodes[e].getSelected()){h=this.childNodes[e];break}}this.selectedDate=b;if(f!=h||f==h&&f!==null&&Number(f.getDate())!=Number(h.getDate())){if(h!==null){h.setSelected(false)}if(f!==null){f.setSelected(true)}if(d){var c=ample.createEvent("CustomEvent");c.initCustomEvent("change",true,true,null,null);this.dispatchEvent(c);if(g){c=ample.createEvent("CustomEvent");c.initCustomEvent("interaction",true,true,null,null);this.dispatchEvent(c)}}}};a.prototype.getDateSelected=function(){return this.selectedDate};a.prototype.getDateLeft=function(){for(var b=0;b<this.childNodes.length;b++){if(this.childNodes[b]._moveableLeft){return this.childNodes[b].getDate()}}return null};a.prototype.getDateRight=function(){for(var b=0;b<this.childNodes.length;b++){if(this.childNodes[b]._moveableRight){return this.childNodes[b].getDate()}}return null};a.prototype.getItemByDate=function(b){for(var c=0;c<this.childNodes.length;c++){if(Number(this.childNodes[c].getDate())==Number(b)){return this.childNodes[c]}}return null};a.prototype.fillFromDate=function(b){b=new Date(b);var c=b-((b.getDay()==0?7:b.getDay())-1)*24*60*60*1000;c=c-Math.floor(this.childNodes.length/7/2)*7*24*60*60*1000;this.fillFromExactDate(c)};a.prototype.fillFromExactDate=function(b){var d=Number(new Date(b));if(Number(this.childNodes[0].getDate())!=d){for(var c=0;c<this.childNodes.length;c++){this.childNodes[c].setDate(new Date(d+c*24*60*60*1000))}}};a.prototype.setDateActive=function(b){b=b===null?null:new Date(b);var f=this.getItemByDate(b),c=null,d=false;for(var e=0;e<this.childNodes.length;e++){if(this.childNodes[e]._active){c=this.childNodes[e];break}}this.activeDate=b;if(f!=c||f==c&&f!==null&&Number(f.getDate())!=Number(c.getDate())){if(c!==null){c.setActive(false)}if(f!==null){f.setActive(true)}}};a.prototype.getDateActive=function(){return this.activeDate};a.prototype.cleanHandlers=function(){for(var b=0;b<this.childNodes.length;b++){this.childNodes[b]._moveableLeft=false;this.childNodes[b]._moveableRight=false}};a.prototype.setHandlers=function(b){b=arguments.length?b:this.selectedDate?this.getItemByDate(this.selectedDate):this.childNodes[(this.childNodes.length-1)/2+1];if(this.displayAtOnce==1){b.nextSibling._moveableRight=true;b.previousSibling._moveableLeft=true}else{if(this.displayAtOnce==3){b.nextSibling.nextSibling._moveableRight=true;b.previousSibling.previousSibling._moveableLeft=true}else{if(this.displayAtOnce==7){this.childNodes[Math.round(this.childNodes.length/7/2)*7]._moveableRight=true;this.childNodes[Math.floor(this.childNodes.length/7/2)*7-1]._moveableLeft=true}}}};a.prototype.getSelectedItemIndex=function(){return this.getItemIndex(this.selectedDate?this.getItemByDate(this.selectedDate):this.childNodes[(this.childNodes.length-1)/2+1])};a.prototype.getItemIndex=function(c){var d=this.selectedDate?this.getItemByDate(this.getDateSelected()):this.childNodes[(this.childNodes.length-1)/2+1];for(var b=0;b<this.childNodes.length;b++){if(this.childNodes[b]===c){return b}}return null};a.prototype.$getTagOpen=function(){var b=this.attributes["class"];return'<div class="p-week'+(b?" "+b:"")+'"><div class="p-week--table"><table class="p-week--table-real" border="0" cellpadding="0" cellspacing="0"><tr class="p-week--gateway">'};a.prototype.$getTagClose=function(){return"</tr></table></div></div>"};a.onfocus=function(b){this.setDateActive(this.getDateActive()?this.getDateActive():this.getDateSelected())};a.onblur=function(d){var f=arguments.callee,g=this;if(this.isScrolling){this.addEventListener("scrollend",function(){f.call(g);g.removeEventListener("scrollend",arguments.callee,false)},false);return}var b=this.getItemIndex(this.getItemByDate(this.getDateActive())),j=new Date(this.getDateActive()),e,c,i,h;if(this.getDateSelected()>=this.getDateRight()){this.fillFromDate(this.getDateSelected());this.setDateSelected(this.getDateSelected());this.setDateActive(this.getDateSelected());if(this.displayAtOnce==1){b=this.getItemIndex(this.getItemByDate(this.getDateRight()));j=new Date(this.getDateRight());c=this.getItemByDate(this.getDateActive());e=this.getItemIndex(c)+1;if(Number(j)>=Number(this.getDateActive())){i=b-e+3;this.$getContainer("table").style.left=(parseInt(this.$getContainer("table").style.left,10)+parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*i)+"%";b-=i}this.cleanHandlers();h=Math.floor(parseInt(this.$getContainer("table").style.left,10)-parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*(Math.abs(b-e)))+"%";this.finalLeft=h;this.isScrolling=true;ample.query(this).animate({left:h},150*Math.abs(b-e),"ease-in",function(){a.completeBlurAnimation(g,h,c)},"table")}else{if(this.displayAtOnce==3){b=this.getItemIndex(this.getItemByDate(this.getDateRight()));j=new Date(this.getDateRight());c=this.getItemByDate(this.getDateActive());e=this.getItemIndex(c)+2;if(Number(j)>=Number(this.getDateActive())){i=b-e+6;this.$getContainer("table").style.left=(parseInt(this.$getContainer("table").style.left,10)+parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*i)+"%";b-=i}this.cleanHandlers();h=Math.floor(parseInt(this.$getContainer("table").style.left,10)-parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*(Math.abs(b-e)))+"%";this.finalLeft=h;this.isScrolling=true;ample.query(this).animate({left:h},150*Math.abs(b-e),"ease-in",function(){a.completeBlurAnimation(g,h,c)},"table")}else{if(this.displayAtOnce==7){this.cleanHandlers();h=parseInt(this.$getContainer("table").style.left,10)+"%";this.$getContainer("table").style.left=Math.floor(parseInt(this.$getContainer("table").style.left,10)+parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*7)+"%";this.finalLeft=h;this.isScrolling=true;ample.query(this).animate({left:h},600,"ease-in",function(){a.completeBlurAnimation(g,h,c)},"table")}}}}else{if(this.getDateSelected()<=this.getDateLeft()){this.fillFromDate(this.getDateSelected());this.setDateSelected(this.getDateSelected());this.setDateActive(this.getDateSelected());if(this.displayAtOnce==1){b=this.getItemIndex(this.getItemByDate(this.getDateLeft()));j=new Date(this.getDateLeft());c=this.getItemByDate(this.getDateActive());e=this.getItemIndex(c)-1;if(Number(j)<=Number(this.getDateActive())){i=b-e-3;this.$getContainer("table").style.left=(parseInt(this.$getContainer("table").style.left,10)+parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*i)+"%";b-=i}this.cleanHandlers();h=Math.floor(parseInt(this.$getContainer("table").style.left,10)+parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*Math.abs(b-e))+"%";this.finalLeft=h;this.isScrolling=true;ample.query(this).animate({left:h},150*Math.abs(b-e),"ease-in",function(){a.completeBlurAnimation(g,h,c)},"table")}else{if(this.displayAtOnce==3){b=this.getItemIndex(this.getItemByDate(this.getDateLeft()));j=new Date(this.getDateLeft());c=this.getItemByDate(this.getDateActive());e=this.getItemIndex(c)-2;if(Number(j)<=Number(this.getDateActive())){i=b-e-6;this.$getContainer("table").style.left=(parseInt(this.$getContainer("table").style.left,10)+parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*i)+"%";b-=i}this.cleanHandlers();h=Math.floor(parseInt(this.$getContainer("table").style.left,10)+parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*Math.abs(b-e))+"%";this.finalLeft=h;this.isScrolling=true;ample.query(this).animate({left:h},150*Math.abs(b-e),"ease-in",function(){a.completeBlurAnimation(g,h,c)},"table")}else{if(this.displayAtOnce==7){this.cleanHandlers();h=parseInt(this.$getContainer("table").style.left,10)+"%";this.$getContainer("table").style.left=Math.floor(parseInt(this.$getContainer("table").style.left,10)-parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*7)+"%";this.finalLeft=h;this.isScrolling=true;ample.query(this).animate({left:h},600,"ease-in",function(){a.completeBlurAnimation(g,h,c)},"table")}}}}}};a.completeBlurAnimation=function(e,b,d){e.$getContainer("table").style.left=b;e.setHandlers(d);e.finalLeft=null;e.isScrolling=false;if(e.getDateActive()<=e.getDateLeft()){e.setDateActive(Number(e.getDateLeft())+24*60*60*1000)}if(e.getDateActive()>=e.getDateRight()){e.setDateActive(Number(e.getDateRight())-24*60*60*1000)}e.fillFromDate(e.getDateSelected());e.setDateSelected(e.getDateSelected());var c=ample.createEvent("CustomEvent");c.initCustomEvent("scrollend",true,true,null,null);e.dispatchEvent(c)};a.onkeydown=function(d){var c,b;switch(d.keyIdentifier){case"Enter":case"U+0020":d.preventDefault();this.setDateSelected(this.getDateActive(),true);break;case"Home":break;case"End":break;case"Up":case"Left":d.preventDefault();b=this.getItemByDate(this.getDateActive());c=b.previousSibling?b.previousSibling:b;this.setDateActive(c.getDate());if(c._moveableLeft){this.moveLeft()}break;case"Down":case"Right":d.preventDefault();b=this.getItemByDate(this.getDateActive());c=b.nextSibling?b.nextSibling:b;this.setDateActive(c.getDate());if(c._moveableRight){this.moveRight()}break;case"PageUp":d.preventDefault();if(!this.isScrolling){this.setDateActive(this.getDateRight());this.moveRight()}break;case"PageDown":d.preventDefault();if(!this.isScrolling){this.setDateActive(this.getDateLeft());this.moveLeft()}break}};a.prototype.moveLeft=function(){var d=parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*this.displayAtOnce,c=parseInt(this.$getContainer("table").style.left,10),b=this,e=this.displayAtOnce==1?150:this.displayAtOnce==3?200:600;b.cleanHandlers();this.isScrolling=true;ample.query(this).animate({left:Math.floor(c+d)+"%"},e,"ease-in",function(){var i=b.getDateSelected(),h=b.getDateActive(),g=b.getItemIndex(b.getItemByDate(b.getDateActive()));if(b.displayAtOnce==1){if(g<11){b.fillFromDate(h);b.setDateSelected(i);b.setDateActive(h)}b.$getContainer("table").style.left="-"+Math.floor(1750/35*(b.getItemIndex(b.getItemByDate(h))-1+0.5))+"%";b.setHandlers(b.getItemByDate(h))}else{if(b.displayAtOnce==3){if(g<11){b.fillFromDate(h);b.setDateSelected(i);b.setDateActive(h)}b.$getContainer("table").style.left="-"+Math.floor(900/35*(b.getItemIndex(b.getItemByDate(h))-3+0.55))+"%";b.setHandlers(b.getItemByDate(h-24*60*60*1000))}else{if(b.displayAtOnce==7){b.fillFromDate(h);b.$getContainer("table").style.left=c+"%";b.setDateSelected(i);b.setDateActive(h);b.setHandlers()}}}b.isScrolling=false;var f=ample.createEvent("CustomEvent");f.initCustomEvent("scrollend",true,true,null,null);b.dispatchEvent(f)},"table")};a.prototype.moveRight=function(){var d=parseInt(this.$getContainer("table").style.width,10)/this.childNodes.length*this.displayAtOnce,c=parseInt(this.$getContainer("table").style.left,10),b=this,e=this.displayAtOnce==1?150:this.displayAtOnce==3?200:600;b.cleanHandlers();this.isScrolling=true;ample.query(this).animate({left:Math.floor(c-d)+"%"},e,"ease-in",function(){var i=b.getDateSelected(),h=b.getDateActive(),g=b.getItemIndex(b.getItemByDate(b.activeDate));if(b.displayAtOnce==1){if(g>24){b.fillFromDate(h);b.setDateSelected(i);b.setDateActive(h)}b.$getContainer("table").style.left="-"+Math.floor(1750/35*(b.getItemIndex(b.getItemByDate(h))-1+0.5))+"%";b.setHandlers(b.getItemByDate(h))}else{if(b.displayAtOnce==3){if(g>24){b.fillFromDate(h);b.setDateSelected(i);b.setDateActive(h)}b.$getContainer("table").style.left="-"+Math.floor(900/35*(b.getItemIndex(b.getItemByDate(h))-1+0.55))+"%";b.setHandlers(b.getItemByDate(Number(h)+24*60*60*1000))}else{if(b.displayAtOnce==7){b.fillFromDate(h);b.$getContainer("table").style.left=c+"%";b.setDateSelected(i);b.setDateActive(h);b.setHandlers()}}}b.isScrolling=false;var f=ample.createEvent("CustomEvent");f.initCustomEvent("scrollend",true,true,null,null);b.dispatchEvent(f)},"table")};a.onresize=function(b){var d=this.getSelectedItemIndex(),c=false;if(d==null){this.fillFromDate(this.getDateSelected());this.setDateSelected(this.getDateSelected());this.setDateActive(this.getDateActive());d=this.getSelectedItemIndex();c=true}if(((this._old_width>=400||this._old_width==-1||c)&&this.$getContainer().offsetWidth<400&&this.$getContainer().offsetWidth>=200)||(this._old_width<200&&this.$getContainer().offsetWidth>=200&&this.$getContainer().offsetWidth<400)||((this._old_width==-1||c)&&this.$getContainer().offsetWidth<200)){this.displayAtOnce=1;d=d-1;this.cleanHandlers();this.$getContainer("table").style.width="1750%";this.$getContainer("table").style.left="-"+((1750/35*(d+0.5)))+"%";this.setHandlers();this.setAttribute("viewFormat","long")}else{if(((this._old_width>=800||this._old_width==-1||c)&&this.$getContainer().offsetWidth<800&&this.$getContainer().offsetWidth>=400)||(this._old_width<400&&this.$getContainer().offsetWidth>=400&&this.$getContainer().offsetWidth<800)){this.displayAtOnce=3;d=d-2;this.cleanHandlers();this.$getContainer("table").style.width="900%";this.$getContainer("table").style.left="-"+((900/35*(d+0.55)))+"%";this.setHandlers();this.setAttribute("viewFormat","long")}else{if(this._old_width<800&&this.$getContainer().offsetWidth>=800){this.displayAtOnce=7;this.cleanHandlers();this.$getContainer("table").style.width="450%";this.$getContainer("table").style.left="-175%";this.setAttribute("viewFormat","long");this.setHandlers()}}}if((this._old_width>=200||this._old_width==-1||c)&&this.$getContainer().offsetWidth<200){this.setAttribute("viewFormat","short")}this._old_width=this.$getContainer().offsetWidth};a.ondomnodeinserted=function(d){for(var b=0;b<this.childNodes.length;b++){this.childNodes[b].$getContainer().style.width=100/this.childNodes.length+"%"}var c=this;ample.addEventListener("resize",function(e){a.onresize.apply(c,arguments)},false)};a.onmousedown=function(b){if(b.target!=this){this.setDateActive(b.target.getDate())}};a.onclick=function(b){if(b.target!=this&&Number(b.target.getDate())==Number(this.getDateActive())){if(b.target._moveableLeft){this.moveLeft()}else{if(b.target._moveableRight){this.moveRight()}else{this.setDateSelected(b.target.getDate(),true)}}}};a.onmousewheel=function(b){b.preventDefault();if(!this.isScrolling){this.focus();if(b.wheelDelta<0){this.setDateActive(this.getDateRight());this.moveRight()}else{this.setDateActive(this.getDateLeft());this.moveLeft()}}};a.onattributechanged=function(c){if(c.target==c.currentTarget&&c.attrName=="viewFormat"&&c.prevValue!=c.newValue){for(var b=0;b<this.childNodes.length;b++){this.childNodes[b].setAttribute(c.attrName,c.newValue);this.childNodes[b].setDate(this.childNodes[b].getDate())}}};a.handlers={keydown:a.onkeydown,mousedown:a.onmousedown,click:a.onclick,focus:a.onfocus,blur:a.onblur,DOMNodeInsertedIntoDocument:a.ondomnodeinserted,mousewheel:a.onmousewheel,DOMAttrModified:a.onattributechanged};a.prototype.localName="week";ample.extend(a)})();(function(){var a=function(){};a.prototype=new pElement;a.prototype._date=null;a.prototype._moveableLeft=false;a.prototype._moveableRight=false;a.prototype._selected=false;a.prototype._active=false;a.prototype.setSelected=function(b){this.$setPseudoClass("selected",b);this._selected=b};a.prototype.getSelected=function(){return this._selected};a.prototype.setActive=function(b){this.$setPseudoClass("active",b);return this._active=b};a.prototype.getActive=function(){return this._active};a.prototype.getDate=function(){return this._date};a.prototype.setDate=function(b){this._date=b;var c=(b.getDate()>9?"":"0")+b.getDate()+"."+(b.getMonth()+1>9?"":"0")+(b.getMonth()+1);if(this.attributes.viewFormat=="short"){this.$getContainer("w").innerHTML=strings.DAYS_SHORT[b.getDay()];this.$getContainer("d").innerHTML=c}else{this.$getContainer("w").innerHTML=strings.DAYS[b.getDay()];this.$getContainer("d").innerHTML=b.getDate()+" "+strings.MONTHS[b.getMonth()]}if(isHoliday(b)){this.toHoliday()}else{this.toNormal()}this.setAttribute("date",this._date)};a.prototype.toHoliday=function(){var b=this.$getContainer("l")||this.$getContainer("l-h");if(b.className!="p-wday--l-h"){b.className="p-wday--l-h"}};a.prototype.toNormal=function(){var b=this.$getContainer("l")||this.$getContainer("l-h");if(b.className!="p-wday--l"){b.className="p-wday--l"}};a.prototype.setFavorite=function(b){var d=this.$getContainer("r")||this.$getContainer("r-f");if(b&&d.className!="p-wday--r-f"){d.className="p-wday--r-f"}else{if(!b&&d.className!="p-wday--r"){d.className="p-wday--r"}}};a.prototype.$getTagOpen=function(){var e=this.getAttribute("class"),b=this.getAttribute("date"),d=this.getAttribute("wday");return'<td class="p-wday" unselectable="on" onmousedown="return false"><div class="p-wday--l"><div class="p-wday--r"><div class="p-wday--f"><span class="p-wday--w">'+d+'</span><br/><span class="p-wday--d">'+b+"</span>"};a.prototype.$getTagClose=function(){return"</div></div></div></td>"};a.prototype.localName="wday";ample.extend(a)})();(function(){var a=function(){this.animateToSelection=a.onblur};a.prototype=new pElement;a.prototype.tabIndex=0;a.prototype.selectedItem=null;a.prototype.activeItem=null;a.prototype.deleteInProgress=false;a.prototype._drawTimeout=null;a.prototype._drawInterval=null;a.prototype._lastScrollTop=null;a.prototype.setActiveChannel=function(b){if(this.activeItem==b){return}if(this.activeItem){this.activeItem.setActive(false);this.activeItem=null}if(b){b.setActive();this.activeItem=b}};a.prototype.setSelectedChannel=function(d,c){if(this.selectedItem==d){return}if(this.selectedItem){this.selectedItem.setSelected(false);this.selectedItem=null}if(d){d.setSelected();this.selectedItem=d;this.scrollToChannel(this.selectedItem)}var b=ample.createEvent("CustomEvent");b.initCustomEvent("change",true,true,null,null);this.dispatchEvent(b);if(c){b=ample.createEvent("CustomEvent");b.initCustomEvent("interaction",true,true,null,null);this.dispatchEvent(b)}};a.prototype.getSelectedChannel=function(){return this.selectedItem};a.prototype.resize=function(b){if(parseInt(this.$getContainer().style.height)+b>0){this.$getContainer().style.height=(parseInt(this.$getContainer().style.height)+b)+"px"}};a.prototype.scrollByPages=function(c){if(this.childNodes.length){var b=this.ownerDocument.$getContainerPosition(this.$getContainer("items"));this.scrollBy(b.height*c)}};a.prototype.scrollByLines=function(e){if(this.childNodes.length){var d=this.childNodes[0].getBoundingClientRect(),c=d.bottom-d.top,b=this;this.scrollBy(c*e)}};a.prototype.startDrawIcons=function(){var b=this;window.clearTimeout(this._drawTimeout);this._drawTimeout=window.setTimeout(function(){b.drawIcons()},200)};a.prototype.drawIcons=function(){for(var c=0;c<this.childNodes.length;c++){if(this.childNodes[c].localName=="channel"){var b="s-"+this.childNodes[c].getAttribute("id"),e=this.childNodes[c].$getContainer("bt").className,d=false;if(e.indexOf(" "+b)==-1){if(this.isChannelVisible(this.childNodes[c])){this.childNodes[c].$getContainer("bt").className=e+" "+b;d=true}else{if(d){break}}}}}};a.prototype.isNeedScrollToChannel=function(f){var c=f.parentNode.parentNode.parentNode,g=f.getBoundingClientRect().top-c.getBoundingClientRect().top-3,d=f.getBoundingClientRect().bottom-f.getBoundingClientRect().top+7,e=c.getBoundingClientRect().bottom-c.getBoundingClientRect().top,b=this;if(g<0){return f.parentNode.parentNode.$getContainer().scrollTop+g}else{if(g+d>e){return f.parentNode.parentNode.$getContainer().scrollTop+(g+d)-e}}return false};a.prototype.scrollToChannel=function(d){var c=this.isNeedScrollToChannel(d),b=this;if(c!==false){d.parentNode.parentNode.$getContainer().scrollTop=c}};a.prototype.isChannelVisible=function(e){var b=e.parentNode.parentNode.parentNode,f=e.getBoundingClientRect().top-b.getBoundingClientRect().top-3,c=e.getBoundingClientRect().bottom-e.getBoundingClientRect().top+7,d=b.getBoundingClientRect().bottom-b.getBoundingClientRect().top;if(f+c<0||f>d){return false}else{return e.style.display!="none"}};a.prototype.isChannelVisibleInViewPort=function(e){var b=e.parentNode.parentNode.parentNode,f=e.getBoundingClientRect().top-b.getBoundingClientRect().top-3,c=e.getBoundingClientRect().bottom-e.getBoundingClientRect().top+7,d=b.getBoundingClientRect().bottom-b.getBoundingClientRect().top;if(f<0||f+c>d){return false}else{return e.style.display!="none"}};a.prototype.scrollBy=function(b){this.parentNode.$getContainer().scrollTop+=Math.floor(b)};a.prototype.selectChannel=function(c){if(this.selectedItem!=c){if(this.selectedItem){this.selectedItem.setAttribute("selected","false")}c.setAttribute("selected","true");this.attributes.value=c.attributes.value;this.selectedItem=c;var b=this.ownerDocument.createEvent("Events");b.initEvent("change",false,false);this.dispatchEvent(b)}};a.prototype.$getTagOpen=function(){var b=this.getAttribute("class");return'<div class="p-channels'+(b?" "+b:"")+'">'};a.prototype.$getTagClose=function(){return"</div>"};a.onblur=function(c){var d=this.isNeedScrollToChannel(this.selectedItem),b=this;if(d!==false){ample.query(this.parentNode).animate({scrollTop:d},200,"ease-in",function(){b.setActiveChannel(b.selectedItem)})}};a.onfocus=function(b){this.setActiveChannel(this.activeItem?this.activeItem:this.selectedItem)};a.onkeydown=function(d){switch(d.keyIdentifier){case"Enter":case"U+0020":d.preventDefault();this.setSelectedChannel(this.activeItem,true);break;case"Home":d.preventDefault();this.setActiveChannel(this.childNodes[0]);break;case"End":d.preventDefault();this.setActiveChannel(this.childNodes[this.childNodes.length-1]);break;case"Up":d.preventDefault();if(d.ctrlKey){if(this.getAttribute("editable")=="true"&&this.activeItem.previousSibling){var g=this.activeItem==this.selectedItem,f=this.activeItem.previousSibling,c=this.insertBefore(this.activeItem,f);if(g){c.setSelected()}c.setActive()}}else{if(this.activeItem.previousSibling){this.setActiveChannel(this.activeItem.previousSibling)}}break;case"Down":d.preventDefault();if(d.ctrlKey){if(this.getAttribute("editable")=="true"&&this.activeItem.nextSibling){var g=this.activeItem==this.selectedItem,e=this.activeItem.nextSibling,b=e.nextSibling,c=b?this.insertBefore(this.activeItem,b):this.appendChild(this.activeItem);if(g){c.setSelected()}c.setActive()}}else{if(this.activeItem.nextSibling){this.setActiveChannel(this.activeItem.nextSibling)}}break;case"Backspace":if(!d.ctrlKey&&!d.shiftKey){d.preventDefault();if(this.getAttribute("editable")=="true"&&this.activeItem&&!this.deleteInProgress){this.deleteInProgress=true;this.activeItem.style.overflowY="hidden";this.activeItem.style.height=this.activeItem.$getContainer().offsetHeight+"px";ample.query(this.activeItem).animate({height:0},200,"ease-in",a.ondeleteEnd)}}break}};a.ondeleteEnd=function(c){this.style.overflowY="";this.style.height="auto";var b=this.nextSibling?this.nextSibling:this.previousSibling,d=this==this.parentNode.selectedItem;this.parentNode.appendChild(this);if(d){this.parentNode.setSelectedChannel(b,true)}this.parentNode.setActiveChannel(b);this.parentNode.deleteInProgress=false;this.parentNode.startDrawIcons()};a.prototype.renumberChildNodes=function(){};a.ondomnodeinserted=function(){var b=this;this.renumberChildNodes();this._drawInterval=window.setInterval(function(){if(b._lastScrollTop==null||b._lastScrollTop!=b.parentNode.$getContainer().scrollTop){b._lastScrollTop=b.parentNode.$getContainer().scrollTop;var c=ample.createEvent("CustomEvent");c.initCustomEvent("scrolled",true,true,b._lastScrollTop,null);b.dispatchEvent(c)}},50)};a.onscrolled=function(){this.startDrawIcons()};a.ondomnoderemoved=function(){window.clearInterval(this._drawInterval)};a.handlers={keydown:a.onkeydown,blur:a.onblur,focus:a.onfocus,scrolled:a.onscrolled,DOMNodeInsertedIntoDocument:a.ondomnodeinserted,DOMNodeRemovedFromDocument:a.ondomnoderemoved};a.prototype.localName="channels";ample.extend(a)})();(function(){var a=function(){};a.prototype=new pElement;a.prototype._active=false;a.prototype.$hoverable=true;a.prototype._dragged=false;a.prototype.setActive=function(c){this._active=c===false?false:true;this.$setPseudoClass("active",this._active);if(this._active){var b=ample.createEvent("CustomEvent");b.initCustomEvent("activate",true,true,null,null);this.dispatchEvent(b)}};a.prototype.setSelected=function(b){this.$setPseudoClass("selected",b===false?false:true)};a.prototype.$getTagOpen=function(){var b=this.getAttribute("class");return'<div class="p-channel'+(b?" "+b:"")+'" unselectable="on" onmousedown="return false">&nbsp;<div class="p-channel--bt" title="'+this.attributes.title.replace(/\"/g,"&quot;")+'" unselectable="on" onmousedown="return false"><div class="p-channel--img" unselectable="on" onmousedown="return false"></div><span class="p-channel--text" unselectable="on" onmousedown="return false">'+this.attributes.name+"</span></div></div>"};a.prototype.$getTagClose=function(){return""};a.onclick=function(b){this.parentNode.setSelectedChannel(this,true)};a.onmousedown=function(b){this.parentNode.setActiveChannel(this)};a.onactivate=function(b){this.parentNode.scrollToChannel(this)};a.handlers={click:a.onclick,mousedown:a.onmousedown,activate:a.onactivate};a.prototype.localName="channel";ample.extend(a)})();var pElement_program=function(){};pElement_program.prototype=new pElement;pElement_program.prototype.$getTagOpen=function(){var a=this.getAttribute("class");return'<div class="p-program'+(a?" "+a:"")+'">'};pElement_program.prototype.$getTagClose=function(){return"</div>"};pElement_program.prototype.localName="program";ample.extend(pElement_program);var pElement_day=function(){};pElement_day.prototype=new pElement;pElement_day.prototype.tabIndex=0;pElement_day.prototype.activeItem=null;pElement_day.prototype.selectedItem=null;pElement_day.prototype.$getTagOpen=function(){var a=this.getAttribute("class");return'<div class="p-day'+(a?" "+a:"")+'">'};pElement_day.prototype.$getTagClose=function(){return"</div>"};pElement_day.prototype.setActiveItem=function(a){if(this.activeItem){this.activeItem.setActive(false)}if(a){this.activeItem=a;this.activeItem.setActive()}if(this.activeItem){this.scrollToItem(this.activeItem,0,true)}};pElement_day.prototype.setSelectedItem=function(a){if(this.selectedItem){this.selectedItem.setSelected(false)}if(a){this.selectedItem=a;this.selectedItem.setSelected()}};pElement_day.prototype.scrollToItem=function(l,k,p){var a=ample.getElementById("programma_container_load").$getContainer(),h=ample.getElementById("programma_container_load").getBoundingClientRect(),b=ample.getElementById("weekdays").getBoundingClientRect(),e=h.bottom-h.top-20,c=l.getBoundingClientRect().top-b.bottom-(l.$getContainer().getBoundingClientRect?10:0),g=l.getBoundingClientRect().bottom-l.getBoundingClientRect().top+4,f,d=false;var r=a.scrollTop;if(arguments.length<2){k=0}if(arguments.length<3){p=false}if(c<0){a.scrollTop+=c;d=true}else{if(c+g>e){if(p){a.scrollTop+=(c+g)-e}else{a.scrollTop+=c}d=true}}c=l.getBoundingClientRect().top-b.bottom-(l.$getContainer().getBoundingClientRect?10:0);g=l.getBoundingClientRect().bottom-l.getBoundingClientRect().top+4;var j=e-c-g;if(c>j){var o=l.nextSibling,n;for(f=0;o&&o.getAttribute("hidden")==0&&f<k;f++){c=o.getBoundingClientRect().top-b.bottom-(o.$getContainer().getBoundingClientRect?10:0);g=o.getBoundingClientRect().bottom-o.getBoundingClientRect().top+4,n=a.scrollTop;a.scrollTop+=(c+g)-e;if(l.getBoundingClientRect().top-b.bottom-(l.$getContainer().getBoundingClientRect?10:0)<0){a.scrollTop=n;break}o=o.nextSibling}}else{if(p){var m=l.previousSibling,o=l.nextSibling;for(f=0;m&&o&&o.getAttribute("hidden")==0&&f<k;f++){c=m.getBoundingClientRect().top-b.bottom-(m.$getContainer().getBoundingClientRect?10:0);n=a.scrollTop;a.scrollTop+=c;if(l.getBoundingClientRect().top-b.bottom-(l.$getContainer().getBoundingClientRect?10:0)>e){a.scrollTop=n;break}m=m.previousSibling}}}var q=a.scrollTop;a.scrollTop=r;if(q!=r){ample.query("#programma_container_load").animate({scrollTop:q},150,"linear")}return d};pElement_day.onfocus=function(a){if(!this.activeItem){if(this.selectedItem){this.setActiveItem(this.selectedItem)}else{if(this.firstChild){this.setActiveItem(this.firstChild)}}}};pElement_day.onkeydown=function(b){if(b.target!=b.currentTarget){return}var a;if(b.ctrlKey||b.altKey||b.shiftKey){return}switch(b.keyIdentifier){case"Home":for(a=0;a<this.childNodes.length;a++){if(this.childNodes[a].getAttribute("hidden")=="0"){this.setActiveItem(this.childNodes[a]);break}}b.preventDefault();break;case"End":for(a=this.childNodes.length-1;a>=0;a--){if(this.childNodes[a].getAttribute("hidden")=="0"){this.setActiveItem(this.childNodes[a]);break}}b.preventDefault();break;case"Up":case"Left":if(this.activeItem&&this.activeItem.previousSibling&&this.activeItem.previousSibling.getAttribute("hidden")=="0"){this.setActiveItem(this.activeItem.previousSibling)}b.preventDefault();break;case"Down":case"Right":if(this.activeItem&&this.activeItem.nextSibling&&this.activeItem.nextSibling.getAttribute("hidden")=="0"){this.setActiveItem(this.activeItem.nextSibling)}b.preventDefault();break}};pElement_day.handlers={focus:pElement_day.onfocus,keydown:pElement_day.onkeydown};pElement_day.prototype.localName="day";ample.extend(pElement_day);var pElement_item=function(){};pElement_item.prototype=new pElement;pElement_item.prototype.$hoverable=true;pElement_item.prototype.removed=false;pElement_item.prototype.modified=false;String.prototype.replaceEntities=function(){return this.replace(/&quot;/ig,'"').replace(/&laquo;/gi,"<").replace(/&raquo;/gi,">").replace(/&amp;/gi,"&")};pElement_item.strings={VK:"Share on vkontakte.ru",FB:"Share on facebook.com",TW:"Share on twitter.com",OD:"Share on odnoklassniki.ru",LNK:"Link to this item"};pElement_item.prototype.setAttributes=function(a){for(var b=0;b<a.length;b++){this.setAttribute(a[b][0],a[b][1])}};pElement_item.prototype.syncVisual=function(){this.$getContainer("time").innerHTML=this.formatDateToVisual();this.$getContainer("title-view").innerHTML=this.getAttribute("title").replace(/(\r?\n)/g,"<br />$1");this.$getContainer("description").style.display=this.getAttribute("description").replace(/(\r?\n)/g,"<br />$1")!=""?"block":"none";this.$getContainer("description-view").innerHTML=this.getAttribute("description").replace(/(\r?\n)/g,"<br />$1");if(this.getAttribute("timeStart")!=this.getAttribute("_timeStart")||this.getAttribute("title")!=this.getAttribute("_title")||this.getAttribute("description")!=this.getAttribute("_description")||/i_\d+/g.test(this.getAttribute("id"))){this.setModified(true)}else{this.setModified(false)}};pElement_item.prototype.setModified=function(a){this.modified=a;this.setAttribute("class",this.getAttribute("class").replace(/\s+modified/gi,"")+(a?" modified":""))};pElement_item.prototype.getModified=function(){return this.modified};pElement_item.prototype.setRemoved=function(a){this.removed=a;this.setAttribute("class",this.getAttribute("class").replace(/\s+removed/gi,"")+(a?" removed":""))};pElement_item.prototype.getRemoved=function(){return this.removed};pElement_item.prototype.setActive=function(a){this.$setPseudoClass("active",a===false?false:true)};pElement_item.prototype.setVisible=function(a){this.$getContainer().style.display=a?"block":"none"};pElement_item.prototype.setSelected=function(a){this.$setPseudoClass("selected",a===false?false:true)};pElement_item.onfocus=function(a){};pElement_item.onkeydown=function(a){};pElement_item.prototype.formatDateToVisual=function(){var a=new Date(this.getAttribute("timeStart"));return(a.getHours()>9?a.getHours():"0"+a.getHours())+":"+(a.getMinutes()>9?a.getMinutes():"0"+a.getMinutes())};pElement_item.prototype.addHours=function(b){var a=new Date(new Date(this.getAttribute("timeStart"))*1+b*60*60*1000);this.setAttribute("timeStart",String(a));this.$getContainer("time").innerHTML=this.formatDateToVisual()};pElement_item.prototype.$getTagOpen=function(){var d=this.getAttribute("class"),e=this.getAttribute("title"),b=this.getAttribute("href"),a=Number(this.getAttribute("hidden")),c=new Date(this.getAttribute("timeStart")),f=(c.getHours()>9?c.getHours():"0"+c.getHours())+":"+(c.getMinutes()>9?c.getMinutes():"0"+c.getMinutes());return'<div class="p-item'+(d?" "+d:"")+'"'+(a?' style="display: none;"':"")+'><div class="p-item--spacer"><div class="p-item--removed"><div class="p-item--removed-left"></div><div class="p-item--removed-right"></div></div></div><div class="p-item--left"><div class="p-item--time">'+f+'</div><div class="p-item--title"><a class="p-item--lnk" href="'+b+'" title="'+pElement_item.strings.LNK+'"></a><div class="p-item--tw" title="'+pElement_item.strings.TW+'"></div><div class="p-item--fb" title="'+pElement_item.strings.FB+'"></div><div class="p-item--od" title="'+pElement_item.strings.OD+'"></div><div class="p-item--vk" title="'+pElement_item.strings.VK+'"></div><div class="p-item--fav"></div><div class="p-item--title-view">'+e+'</div></div><div class="p-item--description"'+(this.firstChild&&this.firstChild.length?"":' style="display: none;"')+'><div class="p-item--description-view">'};pElement_item.prototype.$getTagClose=function(){return"</div></div></div></div>"};pElement_item.prototype.favorite=function(c){var a=this.$getContainer("bottom")||this.$getContainer("bottom-f");if(c&&a.className!=="p-item--bottom-f"){a.className="p-item--bottom-f"}else{if(!c&&a.className!=="p-item--bottom"){a.className="p-item--bottom"}}};pElement_item.onmousedown=function(a){this.parentNode.setActiveItem(this)};pElement_item.onclick=function(c){var b=this,a;if(c.$pseudoTarget==this.$getContainer("fav")){a=ample.createEvent("CustomEvent");a.initCustomEvent("favorite",true,true,null,null);a.favId=this.getAttribute("id");a.item=this;ample.dispatchEvent(a)}else{if(c.$pseudoTarget==this.$getContainer("vk")){a=ample.createEvent("CustomEvent");a.initCustomEvent("share",true,true,null,null);a.shareTo="vk";b.dispatchEvent(a)}else{if(c.$pseudoTarget==this.$getContainer("fb")){a=ample.createEvent("CustomEvent");a.initCustomEvent("share",true,true,null,null);a.shareTo="fb";b.dispatchEvent(a)}else{if(c.$pseudoTarget==this.$getContainer("od")){a=ample.createEvent("CustomEvent");a.initCustomEvent("share",true,true,null,null);a.shareTo="od";b.dispatchEvent(a)}else{if(c.$pseudoTarget==this.$getContainer("tw")){a=ample.createEvent("CustomEvent");a.initCustomEvent("share",true,true,null,null);a.shareTo="tw";b.dispatchEvent(a)}}}}}};pElement_item.ondomnodeinserted=function(a){if(!("_timeStart" in this.attributes)){this.attributes._timeStart=new Date(this.attributes.timeStart)+""}if(!("_title" in this.attributes)){this.attributes._title=this.attributes.title}if(!("_description" in this.attributes)){this.attributes._description=this.attributes.description}if(this.getModified()){this.syncVisual()}};pElement_item.handlers={mousedown:pElement_item.onmousedown,click:pElement_item.onclick,DOMNodeInsertedIntoDocument:pElement_item.ondomnodeinserted};pElement_item.prototype.localName="item";ample.extend(pElement_item);var SERVER_BASE=location.href.replace(/^(https?:\/\/[^\/]+).*$/gi,"$1");ample.domConfig.setParameter("ample-module-history-fix",true);ample.domConfig.setParameter("ample-enable-transitions",false);function updateClock(e){var g=new Date(),c=g.getMilliseconds(),f=ample.getElementById("clock");if(e===true){c=600}else{f._timeout=window.setTimeout(updateClock,c<500?500:1000-c)}if(!f){return}var b=f.childNodes[0].$getContainer(),d=f.childNodes[1].$getContainer(),h=f.childNodes[2].$getContainer(),i=f.childNodes[3].$getContainer(),a=updateClock._previousCall==null?true:Number(new Date)-updateClock._previousCall>1000;d.style.visibility=c<500?"hidden":"visible";if(e===true||g.getSeconds()==0||a){b.innerHTML=(g.getHours()>9?"":"0")+g.getHours();h.innerHTML=(g.getMinutes()>9?"":"0")+g.getMinutes();i.innerHTML=(document.body.className=="w400"||document.body.className=="w200")?"&nbsp;"+(g.getDate()>9?"":"0")+g.getDate()+"."+(g.getMonth()+1>9?"":"0")+(g.getMonth()+1)+"."+g.getFullYear()+",&nbsp;"+strings.DAYS_SHORT[g.getDay()]:"&nbsp;"+(g.getDate()>9?"":"0")+g.getDate()+"&nbsp;"+strings.MONTHS[g.getMonth()]+"&nbsp;"+g.getFullYear()+"&nbsp;"+strings.YEAR+",&nbsp;"+strings.DAYS[g.getDay()];highlightCurrentTVProgram(e||a)}updateClock._previousCall=new Date()}updateClock._previousCall=null;function onClockClick(c){c.preventDefault();var b=ample.getElementById("weekdays"),a=Date.getCurrent();if(b.isScrolling){b.setDateSelected(a)}else{b.setDateSelected(a,true);b.setDateActive(a);b._onblur();if(!google_track_once_clock){google_track_once_clock=true;google_track_event("clock","clicked")}}}function closeAd(b){if(closeAd.inProgress){return}closeAd.inProgress=true;var a=ample.getElementById("programma_container_load"),d=ample.getElementById("ad_container"),c=parseInt(a.style.height)+d.$getContainer().offsetHeight;if(b){ample.query("#ad").animate({opacity:0},700,"linear",function(){d.style.display="none";a.style.height=c+"px";closeAd.inProgress=false})}else{d.style.display="none";a.style.height=c+"px";closeAd.inProgress=false}}closeAd.inProgress=false;function onProgramChange(){var c=ample.getElementById("weekdays"),b=ample.getElementById("channels_container").firstChild;if(c&&b&&c.selectedDate&&b.selectedItem){var a=c.selectedDate,f="";f+=strings.TITLE;f+=" - "+b.selectedItem.getAttribute("name").replace(/\&amp;/gi,"&");f+=" - "+a.getDate()+" "+strings.MONTHS[a.getMonth()];document.title=f;onProgramChange.title=b.selectedItem.getAttribute("name").replace(/\&amp;/gi,"&")+", "+a.getDate()+" "+strings.MONTHS[a.getMonth()]+" - "+strings.NAME;var e=b.selectedItem.getAttribute("url_home");ample.query("#set-href").empty().append('<div id="href">'+strings.SITEURL.TEXT+'&nbsp;<a id="href-a" href="'+e+'" target="_blank" title="'+strings.SITEURL.HREF+e+'">'+e+"</a></div>");var d=(a.getDate()>9?"":"0")+a.getDate()+"."+(a.getMonth()+1>9?"":"0")+(a.getMonth()+1);if(isHoliday(a)){ample.getElementById("main").setAttribute("class","holiday")}else{ample.getElementById("main").setAttribute("class","")}var g=SERVER_BASE+"/"+VERSION+"/day/"+b.selectedItem.getAttribute("id")+"/"+c.selectedDate.toCalendarDate()+"/",h="/day/"+b.selectedItem.getAttribute("id")+"/"+c.selectedDate.toCalendarDate()+"/";if(user.editor||!(g in user.urls)||(g in user.urls&&(new Date-user.urls[g])/1000>TIME_TO_CACHE)){ample.query("#programma_container_load").empty().append('<img id="programma_container_trobbler" alt="'+strings.LOADING_ALT+'" />');ample.getElementById("programma_container_trobbler").setAttribute("src","/"+VERSION+"/i/loading.gif");ample.getElementById("programma_container_load").$getContainer().scrollTop=0}user.date=c.selectedDate.toCalendarDate();user.channel=b.selectedItem.getAttribute("id");ample.getElementById("programma_container_load")._url=g;if(onProgramChange.currentRequest){onProgramChange.currentRequestAborted=true;onProgramChange.currentRequest.abort()}if(window.sk){ample.cookie("s",b64_md5(window.sk[ample.cookie("sk")]+h).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,""));ample.cookie("k",window.sk[ample.cookie("sk")])}onProgramChange.currentRequest=ample.ajax({type:"GET",url:g+(user.editor?("?r="+Math.random()).replace(".",""):""),headers:{},timeout:TIMEOUT*1000,complete:function(o,x){if(x!="success"){if(!onProgramChange.currentRequestAborted){if(o.status==403||o.status==410){ample.query("#programma_container_load").empty().append('<div id="programma_container_error">'+strings.LOADING_ERROR.DENIED+"</div>")}else{ample.query("#programma_container_load").empty().append('<div id="programma_container_error">'+strings.LOADING_ERROR.TEXT+'<a href="/" onclick="onProgramChange();event.preventDefault();" title="'+strings.LOADING_ERROR.TITLE+'">'+strings.LOADING_ERROR.A+"</a></div>")}ample.getElementById("programma_container_load").$getContainer().scrollTop=0}onProgramChange.currentRequestAborted=false}else{var p=ample.importNode(o.responseXML.documentElement,true),m=(new Date(c.selectedDate)).setHours(0,0,0,0)+4*60*60*1000,l=(new Date(c.selectedDate)).setHours(0,0,0,0)+(24+4)*60*60*1000,u;var v=p.firstChild.firstChild;while(v){if(b.selectedItem.getAttribute("tz")!=""){u=new Date(v.getAttribute("timeStart"));v.setAttribute("timeStart",(new Date(u*1+b.selectedItem.getAttribute("tz")*60*60*1000)))}if(window.BAD_WINTER_TIME&&new Date(v.getAttribute("timeStart"))>new Date("Oct 30 02:00:00 UTC+0400 2011")){u=new Date(v.getAttribute("timeStart"));v.setAttribute("timeStart",(new Date(u*1+1*60*60*1000)))}u=new Date(v.getAttribute("timeStart"));v.setAttribute("hidden",Number(!(u>=m&&u<l)));if(v.firstChild){v.setAttribute("description",v.firstChild.nodeValue.replace(/(^(\r?\n)*|(\r?\n)*$)/g,""));v.firstChild.nodeValue=v.firstChild.nodeValue.replace(/(^(\r?\n)*|(\r?\n)*$)/g,"").replace(/(\r?\n)/g,"<br />$1")}else{v.setAttribute("description","")}if(user.editor&&window.editor&&window.editor.getContainer()){v.addEventListener("click",switchEditItemOn,false)}else{v.addEventListener("share",onItemShare,false)}v=v.nextSibling}if(user.editor&&window.editor&&window.editor.getContainer()){var y=ample.getElementById("channels_container").firstChild.selectedItem.getAttribute("c_id");if(y in editor.logger.logByChannel){var s,k;var n=[];for(var q in editor.logger.logByChannel[y]){s=editor.logger.logByChannel[y][q][0];k=editor.logger.logByChannel[y][q][editor.logger.logByChannel[y][q].length-1];if(n.length==0){n.push({firstAction:s,lastAction:k})}else{for(var r=0;r<n.length;r++){if(k.ts*1>=n[r]["lastAction"].ts*1){if(r+1==n.length||k.ts*1<=n[r+1]["lastAction"].ts*1){n.splice(r+1,0,{firstAction:s,lastAction:k});break}}else{n.splice(0,0,{firstAction:s,lastAction:k});break}}}}var w=p.firstChild.firstChild,z=true;for(q=0;q<n.length;q++){s=n[q]["firstAction"];k=n[q]["lastAction"];v=w;while(v){if(v.getAttribute("hidden")==0){u=new Date(v.getAttribute("timeStart"));if(k.id==v.getAttribute("id")){if(k.action=="edit"){v.setModified(true);v.setAttributes([["_title",v.getAttribute("title")],["_timeStart",new Date(v.getAttribute("timeStart"))+""],["_description",v.getAttribute("description")],["title",k.title],["timeStart",k.ts+""],["timeOrigin",k.ts*1],["description",k.description]]);if(z){w=v;z=false}break}else{if(k.action=="remove"){v.setRemoved(true);v.setAttributes([["_title",v.getAttribute("title")],["_timeStart",new Date(v.getAttribute("timeStart"))+""],["_description",v.getAttribute("description")],["title",k.title],["timeStart",k.ts+""],["timeOrigin",k.ts*1],["description",k.description]]);if(z){w=v;z=false}break}}}else{if(/i_\d+/g.test(k.id)&&k.ts*1>=u*1&&(!v.nextSibling||v.nextSibling&&k.ts*1<=new Date(v.nextSibling.getAttribute("timeStart"))*1)){if(v.nextSibling){ample.query(v.nextSibling).before('<p:item                               title="'+k.title.toXML()+'"                               timeStart="'+k.ts+'"                               timeOrigin="'+k.ts*1+'"                               id="'+k.id+'">'+k.description.toXML()+"</p:item>")[0]}else{ample.query(v).after('<p:item                               title="'+k.title.toXML()+'"                               timeStart="'+k.ts+'"                               timeOrigin="'+k.ts*1+'"                               id="'+k.id+'">'+k.description.toXML()+"</p:item>")[0]}var t=v.nextSibling;t.setAttributes([["_title",""],["_timeStart",new Date(0)+""],["_description",""],["title",k.title],["timeStart",k.ts+""],["timeOrigin",k.ts*1],["description",k.description]]);t.setModified(true);if(k.action=="remove"){t.setRemoved(true)}t.addEventListener("click",switchEditItemOn,false);if(z){w=v;z=false}break}}}v=v.nextSibling}}}}ample.query("#programma_container_load").empty().append(p);ample.getElementById("programma_container_load").$getContainer().scrollTop=0;onProgramLoad()}onProgramChange.currentRequest=null}})}}onProgramChange.currentRequest=null;onProgramChange.currentRequestAborted=false;function handleDblClick(){if(ample.getElementById("href-container").getAttribute("class").indexOf(" hidden")==-1){ample.query("#weekdays").attr("class",ample.query("#weekdays").attr("class")+" hidden");ample.getElementById("links").setAttribute("class",ample.getElementById("links").getAttribute("class")+" hidden");ample.getElementById("href-container").setAttribute("class",ample.getElementById("href-container").getAttribute("class")+" hidden");ample.getElementById("programma_container_load").setAttribute("class",ample.getElementById("programma_container_load").getAttribute("class")+" hidden");ample.getElementById("programma_container_load").style.height=(parseInt(ample.getElementById("programma_container_load").style.height)+19)+"px"}else{ample.getElementById("weekdays").setAttribute("class",ample.getElementById("weekdays").getAttribute("class").replace(" hidden",""));ample.getElementById("links").setAttribute("class",ample.getElementById("links").getAttribute("class").replace(" hidden",""));ample.getElementById("href-container").setAttribute("class",ample.getElementById("href-container").getAttribute("class").replace(" hidden",""));ample.getElementById("programma_container_load").setAttribute("class",ample.getElementById("programma_container_load").getAttribute("class").replace(" hidden",""));ample.getElementById("programma_container_load").style.height=(parseInt(ample.getElementById("programma_container_load").style.height)-19)+"px"}}function onItemShare(f){var g=f.target.getAttribute("description").replaceEntities(),b=f.target.formatDateToVisual()+" "+f.target.getAttribute("title").replaceEntities()+" | "+onProgramChange.title.replaceEntities(),e=f.target.formatDateToVisual()+" "+f.target.getAttribute("title").replaceEntities(),a=f.target.getAttribute("href").replace("#",""),d=ample.getElementById("channels_container").firstChild.selectedItem.getAttribute("tz"),c=a+(d?d+"/":"");if(g.length>SHARE_DESCRIPTION_MAX_LENGTH){g=g.substr(0,SHARE_DESCRIPTION_MAX_LENGTH)+"..."}if(e.length>SHARE_TITLE_MAX_LENGTH){e=e.substr(0,SHARE_TITLE_MAX_LENGTH)+"..."}if(f.shareTo=="vk"){window.open("http://vk.com/share.php?url="+encodeURIComponent(c)+"&title="+encodeURIComponent(b)+"&description="+encodeURIComponent((g!=""?g:""))+"&image="+encodeURIComponent(SERVER_BASE+"/"+VERSION+"/i/apple-icon.png")+"&noparse=true","_blank","scrollbars=0, resizable=1, menubar=0, left=200, top=200, width=554, height=521, toolbar=0, status=0");google_track_social("vkontakte","share",a)}else{if(f.shareTo=="fb"){window.open("http://www.facebook.com/dialog/feed?display=popup&app_id=190871887631431&link="+encodeURIComponent(c)+"&caption="+encodeURIComponent(b)+"&message="+encodeURIComponent(e+(g!=""?"\n\n"+g:""))+"&image="+encodeURIComponent(SERVER_BASE+"/"+VERSION+"/i/apple-icon.png")+"&redirect_uri="+encodeURIComponent(SERVER_BASE+"/postclose/"),"_blank","scrollbars=0, resizable=1, menubar=0, left=200, top=200, width=554, height=421, toolbar=0, status=0");google_track_social("facebook","share",a)}else{if(f.shareTo=="od"){if(window.ODKL){ODKL.Share({tagName:"a",href:c});google_track_social("odnoklassniki","share",a)}}else{if(f.shareTo=="tw"){window.open("http://twitter.com/share?&url="+encodeURIComponent(c)+"&text="+encodeURIComponent(e),"_blank","scrollbars=0, resizable=1, menubar=0, left=200, top=200, width=554, height=270, toolbar=0, status=0");google_track_social("twitter","share",a)}}}}}function onProgramLoad(){user.urls[ample.getElementById("programma_container_load")._url]=new Date;if(!ample.querySelectorAll("p|item[hidden=0]").length){ample.query("#programma_container_load").empty().append('<div id="programma_container_nodata">'+strings.LOADING_NO_DATA+"</div>")}else{var a=ample.querySelector("p|day");if(a&&ample.getElementById("weekdays").selectedDate<Date.getCurrent()){a.setAttribute("class","past")}updateClock(true)}if(ample.getElementById("ad_container").style.display!="none"&&document.getElementById("ad-iframe")&&document.getElementById("ad-iframe").contentWindow){document.getElementById("ad-iframe").contentWindow.location.href=getAdHref()}var b=window.location.hash.substring(1).split("/")[2];if(b){findProgramByTime(b,false)}}function flashItem(a){if(a){flashItem.flashing=window.setInterval(function(){if(!a||flashItem.count>9){window.clearInterval(flashItem.flashing)}else{a.setAttribute("class",a.getAttribute("class").replace(/\s*flash/gi,"")+(Math.floor(flashItem.count/2)*2!=flashItem.count?" flash":""));flashItem.count++}},200)}}function clearFlashing(){window.clearInterval(flashItem.flashing);flashItem.count=0;var b=ample.querySelectorAll("p|item[hidden=0]");for(var a=0;a<b.length;a++){if(b[a].getAttribute("class").match(/\s*flash/gi)){b[a].setAttribute("class",b[a].getAttribute("class").replace(/\s*flash/gi,""));break}}}flashItem.flashing=null;flashItem.count=0;function onAmpleLoad(g){window.setTimeout(function(){window.clearInterval(window.logoInterval)},5000);window.setTimeout(function(){},100);ample.getElementById("channels-scroller").addEventListener("mousedown",channelsScrollerMousedown,false);ample.getElementById("channels-scroller").addEventListener("mouseenter",function(){ample.query("#channels-scroller").animate({opacity:"1"},400)},false);ample.getElementById("channels-scroller").addEventListener("mouseleave",function(){if(!scrollerMouseMove.isMoving){ample.query("#channels-scroller").animate({opacity:"0.3"},400)}},false);ample.getElementById("tune-tz").addEventListener("mouseenter",function(){ample.query("#channels-scroller").animate({opacity:"1"},400)},false);ample.getElementById("tune-tz").addEventListener("mouseleave",function(){if(!scrollerMouseMove.isMoving){ample.query("#channels-scroller").animate({opacity:"0.3"},400)}},false);ample.getElementById("t-stepdown").addEventListener("mousedown",ontzStepDown,false);ample.getElementById("t-stepdown").addEventListener("mouseup",function(){ontzStepDown.i=window.clearInterval(ontzStepDown.i)},false);ample.getElementById("t-stepup").addEventListener("mousedown",ontzStepUp,false);ample.getElementById("t-stepup").addEventListener("mouseup",function(){ontzStepUp.i=window.clearInterval(ontzStepUp.i)},false);ample.getElementById("edit-button").addEventListener("mousedown",editModeOn,false);ample.getElementById("search").addEventListener("keydown",function(i){window.clearTimeout(ample.query("#search-text")[0].blurTimer);i.stopPropagation();ample.query("#search-text")[0].focus()},false);ample.getElementById("search-text").addEventListener("blur",blurSearch,false);ample.getElementById("search-text").addEventListener("mousedown",function(i){i.stopPropagation(i)},false);ample.getElementById("search-text").addEventListener("keydown",searchKeyDown,false);ample.getElementById("search-text").addEventListener("keyup",searchKeyUp,false);ample.getElementById("ch_outer").addEventListener("mouseenter",onChannelsMouseEnter,false);ample.getElementById("ch_outer").addEventListener("mouseleave",onChannelsMouseLeave,false);ample.getElementById("channels_container").addEventListener("mousewheel",onChannelsMouseWheel,false);ample.getElementById("channels_container").addEventListener("dblclick",function(i){document.body.id=="auth-edit"?editModeOff():editModeOn(i)},false);ample.getElementById("tune-tz-tz").parentNode.addEventListener("mousedown",function(i){i.preventDefault()},false);ample.getElementById("clock").addEventListener("click",onClockClick,false);ample.getElementById("clock").addEventListener("mouseenter",onHelpMouseEnter,false);ample.getElementById("clock").addEventListener("mouseleave",onHelpMouseLeave,false);ample.getElementById("login-with-link").addEventListener("mousedown",showLogin,false);ample.getElementById("login-with-link").addEventListener("click",function(i){i.preventDefault()},false);pElement_item.strings.VK=strings.SHARE.VK;pElement_item.strings.FB=strings.SHARE.FB;pElement_item.strings.OD=strings.SHARE.OD;pElement_item.strings.TW=strings.SHARE.TW;pElement_item.strings.LNK=strings.SHARE.LNK;document.body.clientHeightOld=document.body.clientHeight;document.body.stoppedVertical=null;document.body.clientWidthOld=document.body.clientWidth;document.body.stoppedHorizontal=null;var f=ample.getElementById("links").parentNode.getBoundingClientRect().bottom-ample.getElementById("links").parentNode.getBoundingClientRect().top,h=ample.getElementById("main").getBoundingClientRect().bottom-ample.getElementById("main").getBoundingClientRect().top,d=ample.getElementById("weekdays");ample.getElementById("channels_container").style.height=(h-f-4-10)+"px";ample.getElementById("channels_container")._diff=document.body.clientHeight-parseInt(ample.getElementById("channels_container").style.height);ample.getElementById("ch_outer").style.height=(h-f-4-3)+"px";ample.getElementById("ch_outer")._diff=document.body.clientHeight-parseInt(ample.getElementById("ch_outer").style.height);ample.getElementById("weekdays")._diff=document.body.clientWidth-parseInt(ample.getElementById("weekdays").style.width);var a=ample.getElementById("ad_container").getBoundingClientRect().bottom-ample.getElementById("ad_container").getBoundingClientRect().top;ample.getElementById("programma_container_load").style.height=(h-f-4-3-20-a-(document.body.className!="w200"&&document.body.className!="w400"?4:0))+"px";var b=window.location.hash.substring(1).split("/")[1];b=b?Date.fromString(b):Date.getCurrent();for(var e=0;e<d.childNodes.length;e++){d.childNodes[e].addEventListener("DOMAttrModified",checkIfFavorite,false)}d.fillFromDate(b);d.setDateSelected(b);var c=ample.createEvent("UIEvent");c.initUIEvent("resize",true,true,null,null);ample.dispatchEvent(c);updateClock(true);window.setTimeout("window.setTimeout(updateClock, 500);",1000-(new Date()).getMilliseconds());ample.getElementById("write-us").setAttribute("href","mailto:support"+"aa@programma.tv".substring(2));ample.getElementById("channels_container").firstChild.setAttribute("editable",user.authenticated);ample.query("#status").hide();document.getElementById("loading").style.display="none";ample.getElementById("ample").style.visibility="visible";onChannelsLoad();window.setTimeout(loadKeyWords,500);window.setTimeout(loadFavoriteDays,300);if(/(iphone|ipod|android)/i.test(navigator.userAgent)){closeAd(false)}else{window.setTimeout(createAd,1000)}document.body.onscroll=function(){this.scrollTop=0}}function createAd(){var a=ample.getElementById("ad_container").style.display!="none";if(a){var b=document.createElement("iframe");b.src=getAdHref();b.width="100%";b.height="100%";b.frameBorder="0";b.border="0";b.id="ad-iframe";ample.getElementById("ad").$getContainer().appendChild(b)}}function getAdHref(){var c=ample.query("#ad_container").width()-39,b=0,a=user.adNetworks[getAdHref.counter];if(c>=728+728+234){b=4}else{if(c>=728+728){b=3}else{if(c>=728+468){b=2}else{if(c>=728+234){b=1}else{if(c>=728){b=0}}}}}if(a.type=="static"){user.adNetworks.splice(getAdHref.counter,1)}else{getAdHref.counter++}if(getAdHref.counter==user.adNetworks.length){getAdHref.counter=0}return"/?ad="+b+"&type="+a.name}getAdHref.counter=0;function onAmpleResize(c){var e=10,d=10,a=document.body.clientWidth,i=document.body.clientHeight;if(document.body.clientHeightOld&&document.body.clientWidthOld){var j=i-document.body.clientHeightOld,l=a-document.body.clientWidthOld,h=ample.getElementById("channels_container"),k=ample.getElementById("weekdays"),f=ample.getElementById("ch_outer"),b=ample.getElementById("programma_container_load"),g=ample.getElementById("ad_container");if(j!=0){if(i>d){if(document.body.stoppedVertical!=null){j=(i-document.body.stoppedVertical);document.body.stoppedVertical=null}if(parseInt(h.style.height)+j>0){h.style.height=(parseInt(h.style.height)+j)+"px";ample.getElementById("channels_container").firstChild.startDrawIcons()}if(parseInt(f.style.height)+j>0){f.style.height=(parseInt(f.style.height)+j)+"px"}if(parseInt(b.style.height)+j>0){b.style.height=(parseInt(b.style.height)+j)+"px"}}else{if(document.body.stoppedVertical==null){document.body.stoppedVertical=document.body.clientHeightOld}}window.setTimeout(repositionChannelsScollbar,100)}if(l!=0){}document.body.clientHeightOld=i;document.body.clientWidthOld=a}}function saveSettings(){if(!user.authenticated){return}var a=ample.querySelectorAll("p|channel"),d="",c="";if(!a.length){return}for(var b=0;b<a.length;b++){d+=a[b].getAttribute("id")+":"+encodeURIComponent("tz:"+((a[b].getAttribute("tz")==""||a[b].getAttribute("tz")==0)?"":a[b].getAttribute("tz")))+(b!=a.length-1?",":"")}c+="channels="+encodeURIComponent(d);if(user.rawSettings!=c){user.rawSettings=c;window.clearTimeout(saveSettings._timeout);saveSettings._timeout=window.setTimeout(saveSettingsRequest,2500)}}function saveSettingsRequest(){saveSettingsRequest.oRequest.abort();window.clearTimeout(saveSettingsRequest.t);saveSettingsRequest.oRequest.open("POST",SERVER_BASE+"/"+VERSION+"/settings/",true);saveSettingsRequest.oRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");saveSettingsRequest.oRequest.onreadystatechange=function(){if(saveSettingsRequest.oRequest.readyState==4){if(saveSettingsRequest.oRequest.responseText==1){ample.query("#status").text(strings.SETTINGS.SAVED);saveSettingsRequest.t=window.setTimeout(function(){ample.query("#status").hide(500)},1000)}else{ample.query("#status").empty().append("<span>"+strings.SETTINGS.ERROR+' - <a onclick="saveSettingsRequest(); event.preventDefault();" title="'+strings.SETTINGS.RETRY_TITLE+'">'+strings.SETTINGS.RETRY+"</a></span>")}}};ample.query("#status").text(strings.SETTINGS.SAVING);ample.query("#status").show();saveSettingsRequest.oRequest.send(user.rawSettings)}saveSettingsRequest.oRequest=new XMLHttpRequest;saveSettingsRequest.t=null;function onAmpleUnload(a){window.clearTimeout(ample.getElementById("clock")._timeout);if(window.scrollbars){window.scrollbars.visible=true}}function onChannelsMouseWheel(b){var a=ample.getElementById("channels_container").firstChild;if(a.nodeName=="p:channels"){if(ample.activeElement!==a&&ample.activeElement!==ample.getElementById("search-text")){a.focus()}}}function setTzSettingsPosition(){if(document.body.id=="auth-edit"){var a=ample.query(ample.querySelector("#channels_container").firstChild.selectedItem).position().top,b=ample.query("#tune-tz").height();if(a<ample.query(ample.getElementById("weekdays").parentNode).height()){ample.querySelector("#tune-tz").$getContainer().style.top="-500px"}else{if((a+b+4>document.body.clientHeight)){ample.querySelector("#tune-tz").$getContainer().style.top="-500px"}else{if(!!document.namespaces&&navigator.userAgent.match(/MSIE ([\d.]+)/)[1]<8){a=a-2}ample.querySelector("#tune-tz").$getContainer().style.top=a+"px"}}}}setTzSettingsPosition.t=null;function onChannelsLoad(){var d=ample.getElementById("channels_container"),b=d.firstChild,e=b.firstChild,a=window.location.hash.substring(1).split("/")[0];b.addEventListener("interaction",onUserInteraction,false);b.addEventListener("change",onProgramChangeInEditMode,false);b.addEventListener("scrolled",repositionChannelsScollbar,false);if(!a){a=user.channel}if(a){for(var c=0;c<b.childNodes.length;c++){if(b.childNodes[c].getAttribute("id")==a){e=b.childNodes[c];break}}}b.setSelectedChannel(e);d.$getContainer().scrollTop+=2000;b.scrollToChannel(e);repositionChannelsScollbar();saveSettings._interval=window.setInterval(saveSettings,500);d.style.visibility="visible";ample.addEventListener("favorite",saveFavorite,false);ample.addEventListener("hashchange",onHashChange,false);onProgramChange()}function saveFavorite(a){ample.ajax({url:SERVER_BASE+"/settings/",type:"POST",dataType:"text",timeout:TIMEOUT*2.5*1000,data:"favSet="+encodeURIComponent(a.favId)+"&favDate="+encodeURIComponent(ample.getElementById("weekdays").selectedDate.toCalendarDate()),complete:function(c,b){if(b!="success"){alert("error and timeout handling")}else{if(c.responseText=="1"){a.item.favorite(true)}else{alert("error handling")}}}})}function repositionChannelsScollbar(){var f=ample.getElementById("ch_outer").$getContainer(),d=ample.getElementById("channels_container").$getContainer(),k=f.offsetHeight,i=f.offsetTop,g=d.scrollHeight,c=d.scrollTop,e=39-(k*k/g),j=Math.min(k,Math.max(k*k/g,39));e=e>0?e:0;ample.getElementById("channels-scroller").style.top=Math.min((i+c*(k-e)/g),i+k-j)+"px";ample.getElementById("channels-scroller").style.height=j+"px"}function onUserInteraction(){var b=ample.getElementById("weekdays"),a=ample.getElementById("channels_container").firstChild;if(b&&a&&b.selectedDate&&a.selectedItem){var c=a.selectedItem.getAttribute("id")+"/"+(b.selectedDate.toCalendarDate()==(Date.getCurrent()).toCalendarDate()?"":b.selectedDate.toCalendarDate()+"/");ample.bookmark(c);onHashChange({newURL:SERVER_BASE+"/#"+c});google_track("/"+a.selectedItem.getAttribute("id")+"/"+b.selectedDate.toCalendarDate()+"/")}}function handleSwipe(d){var c=ample.getElementById("weekdays"),b=ample.getElementById("channels_container").firstChild;if(c&&b&&c.selectedDate&&b.selectedItem){var a=new Date(Number(c.selectedDate)+1000*60*60*24*(d=="left"?1:-1)),e=b.selectedItem.getAttribute("id")+"/"+(a.toCalendarDate()==(new Date).toCalendarDate()?"":a.toCalendarDate()+"/");ample.bookmark(e);onHashChange({newURL:SERVER_BASE+"/#"+e});google_track("/"+b.selectedItem.getAttribute("id")+"/"+a.toCalendarDate()+"/")}}function handlePinch(a,c){if(handlePinch.lastDistance==null){handlePinch.lastDistance=a.detail}if(Math.abs(handlePinch.lastDistance-a.detail)>=10){var b=ample.getElementById("programma_container_load").getAttribute("class");if(c=="in"){if(b=="s1"){ample.getElementById("programma_container_load").setAttribute("class","s2")}else{if(b=="s2"){ample.getElementById("programma_container_load").setAttribute("class","s3")}else{if(b=="s3"){ample.getElementById("programma_container_load").setAttribute("class","s4")}else{if(b=="s4"){ample.getElementById("programma_container_load").setAttribute("class","s5")}}}}}else{if(b=="s5"){ample.getElementById("programma_container_load").setAttribute("class","s4")}else{if(b=="s4"){ample.getElementById("programma_container_load").setAttribute("class","s3")}else{if(b=="s3"){ample.getElementById("programma_container_load").setAttribute("class","s2")}else{if(b=="s2"){ample.getElementById("programma_container_load").setAttribute("class","s1")}}}}}handlePinch.lastDistance=a.detail}}handlePinch.lastDistance=null;function onHashChange(a){var c=a.newURL.replace(/(^.+)#([^#]*)$/g,"$2"),g=c.split("/")[0],m=c.split("/")[1],n=c.split("/")[2],j=new Date(n*1000),b=(m?Date.fromString(m):Date.getCurrent()),e=ample.getElementById("channels_container").firstChild,h=null;for(var f=0;f<e.childNodes.length;f++){if(e.childNodes[f].getAttribute("id")==g){h=e.childNodes[f];break}}if(n&&h){if(h.getAttribute("tz")!=""){j=new Date(j*1+h.getAttribute("tz")*60*60*1000)}if(j.getHours()<4){j=new Date(j*1-24*60*60*1000)}if(j.toCalendarDate()!=m){var d=g+"/"+j.toCalendarDate()+"/"+n;ample.bookmark(d);onHashChange({newURL:SERVER_BASE+"/#"+d});return}}if(!h){h=e.firstChild}var l=user.channel==g&&user.date==m;if(user.channel!=g){e.setSelectedChannel(h)}if(user.date!=m){var k=ample.getElementById("weekdays");if(k.isScrolling){k.setDateSelected(b)}else{k.setDateSelected(b);k.setDateActive(b);k._onblur()}}if(n&&l){findProgramByTime(n,true)}if(!l){onProgramChange()}}function findProgramByTime(d,a){var c=ample.querySelectorAll("p|item");for(var b=0;b<c.length;b++){if(c[b].getAttribute("timeOrigin")==d&&c[b].getAttribute("hidden")==0){c[b].parentNode.scrollToItem(c[b],a?0:2);clearFlashing();flashItem(c[b]);break}}}function onResizeStyleChange(){var b=ample.getElementById("programma_container_load"),a=document.body.className;if(document.body.clientWidth<=313){if(a!="w200"){document.body.className="w200";if(a!="w200"&&a!="w400"){b.style.height=(parseInt(b.style.height)+4)+"px";updateGooglePlusOne()}updateClock(true);editModeOff()}}else{if(document.body.clientWidth>313&&document.body.clientWidth<=513){if(a!="w400"){document.body.className="w400";if(a!="w200"&&a!="w400"){b.style.height=(parseInt(b.style.height)+4)+"px";updateGooglePlusOne()}editModeOff();updateClock(true);if(ample.getElementById("channels_container").firstChild.getSelectedChannel()){ample.getElementById("channels_container").$getContainer().scrollTop+=2000;ample.getElementById("channels_container").firstChild.scrollToChannel(ample.getElementById("channels_container").firstChild.getSelectedChannel())}}}else{if(document.body.clientWidth>513&&document.body.clientWidth<=913){if(a!="w800"){document.body.className="w800";if(a=="w200"||a=="w400"){b.style.height=(parseInt(b.style.height)-4)+"px";updateGooglePlusOne()}updateClock(true);if(ample.getElementById("channels_container").firstChild.getSelectedChannel()){ample.getElementById("channels_container").$getContainer().scrollTop+=2000;ample.getElementById("channels_container").firstChild.scrollToChannel(ample.getElementById("channels_container").firstChild.getSelectedChannel())}}}else{if(document.body.clientWidth>913&&document.body.clientWidth<=1013){if(a!="w900"){document.body.className="w900";if(a=="w200"||a=="w400"){b.style.height=(parseInt(b.style.height)-4)+"px";updateGooglePlusOne()}updateClock(true)}}else{if(a!=""){document.body.className="";if(a=="w200"||a=="w400"){b.style.height=(parseInt(b.style.height)-4)+"px";updateGooglePlusOne()}updateClock(true)}}}}}}ample.addEventListener("load",onAmpleLoad,false);ample.addEventListener("unload",onAmpleUnload,false);ample.addEventListener("resize",onAmpleResize,false);ample.addEventListener("resize",onResizeStyleChange,false);function channelsIntervalBottom(b,f){var d=ample.getElementById("channels_container"),g=d.$getContainer().scrollTop,e=g+f;if(e>b){e=b}d.$getContainer().scrollTop=e;if(g==d.$getContainer().scrollTop){window.clearInterval(window._channels_interval);var a=200,c=500;b=ample.getElementById("channels_container").$getContainer().scrollTop-a;window._channels_interval=window.setInterval(function(){channelsIntervalTop(b,-a/(c/20))},20)}}function highlightCurrentTVProgram(f){var a=Number(new Date),e=ample.querySelectorAll("p|item[hidden=0]"),c=ample.querySelector("p|day"),g=false,d,b,h;for(h=0;h<e.length;h++){d=Number(new Date(e[h].getAttribute("timeStart")));b=e[h].nextSibling?Number(new Date(e[h].nextSibling.getAttribute("timeStart"))):Number(new Date(d+4*60*60*1000));if(d<=a&&a<b){e[h].setAttribute("class",e[h].getAttribute("class").replace(/\s+past/i,""));e[h].parentNode.setSelectedItem(e[h]);if(f){e[h].parentNode.scrollToItem(e[h],2)}g=true}else{if(a>d){e[h].setAttribute("class",e[h].getAttribute("class").replace(/\s+past/i,"")+" past")}else{e[h].setAttribute("class",e[h].getAttribute("class").replace(/\s+past/i,""))}}}if(c&&!g){c.setSelectedItem(null)}}function channelsIntervalTop(a,d){var b=ample.getElementById("channels_container"),e=b.$getContainer().scrollTop,c=e+d;if(c<a){c=a}b.$getContainer().scrollTop=c;if(e==b.$getContainer().scrollTop){window.clearInterval(window._channels_interval)}}if(window.scrollbars){window.scrollbars.visible=false}function onHelpMouseEnter(){ample.query("#links-current").animate({opacity:0,color:"#fff"},400,"ease-out")}function onHelpMouseLeave(){ample.query("#links-current").animate({opacity:1,color:"#333"},400,"ease-out")}function onChannelsMouseEnter(a){ample.query("#channels-scroller").animate({opacity:"1"},400)}function onChannelsMouseLeave(a){if(!scrollerMouseMove.isMoving){ample.query("#channels-scroller").animate({opacity:"0.3"},400)}}function showLogin(a){if(user.authenticated){return}var b=a.target;b.setAttribute("class",b.getAttribute("class")+" active");ample.getElementById("login-with").style.display="block";ample.getElementById("login-with-in").style.display="block";ample.addEventListener("mousedown",function(c){var d=ample.getElementById("login-with-in");if(!(c.target==d||(c.target.compareDocumentPosition(d)&ample.classes.Node.DOCUMENT_POSITION_CONTAINS))){this.removeEventListener("mousedown",arguments.callee,true);b.setAttribute("class",b.getAttribute("class").replace(" active",""));ample.getElementById("login-with").style.display="none";d.style.display="none"}c.stopPropagation()},true);a.stopPropagation()}function openIDLogin(_provider){if(_provider!="google"&&_provider!="yandex"||openIDLogin.inProgress){return}openIDLogin.inProgress=true;var oLogo=ample.getElementById(_provider+"-loading");oLogo.setAttribute("class","active");openIDLogin.logoAnimationInterval=window.setInterval(function(){var a=[oLogo.childNodes[0].childNodes[0],oLogo.childNodes[0].childNodes[1],oLogo.childNodes[0].childNodes[2],oLogo.childNodes[1].childNodes[2],oLogo.childNodes[2].childNodes[2],oLogo.childNodes[2].childNodes[1],oLogo.childNodes[2].childNodes[0],oLogo.childNodes[1].childNodes[0]],s;for(var i=0;i<a.length;i++){s=Number(a[i].getAttribute("class").replace("l",""));a[i].setAttribute("class","l"+(s-1==0?8:s-1))}},130);ample.ajax({url:SERVER_BASE+"/?auth="+_provider+"&channel="+user.channel+"&date="+user.date,type:"GET",dataType:"text",timeout:TIMEOUT*2.5*1000,complete:function(oRequest,sStatus){openIDLogin.inProgress=false;if(sStatus!="success"){oLogo.setAttribute("class","");window.clearInterval(openIDLogin.logoAnimationInterval);alert("error and timeout handling")}else{try{eval(String(oRequest.responseText).replace("while(1);",""))}catch(e){oLogo.setAttribute("class","");window.clearInterval(openIDLogin.logoAnimationInterval);alert("error occured while eval")}}}})}openIDLogin.inProgress=false;openIDLogin.timeout=null;function logout(a){ample.ajax({url:SERVER_BASE+"/?logout=1",type:"GET"});document.body.id="noauth";document.getElementById("ample").className="";user.authenticated=false;delete user.editor;delete user.admin;ample.getElementById("channels_container").firstChild.setAttribute("editable",false);a.preventDefault()}function loadKeyWords(){ample.ajax({url:SERVER_BASE+"/"+VERSION+"/channels/keywords/",type:"GET",dataType:"text",timeout:TIMEOUT*1000,complete:function(oRequest,sStatus){if(sStatus=="success"){var channels_keywords={},_channels=ample.getElementById("channels_container").firstChild;try{channels_keywords=eval(String(oRequest.responseText).replace("while(1);",""))}catch(e){channels_keywords={}}for(var i=0;i<_channels.childNodes.length;i++){_channels.childNodes[i].setAttribute("keywords",channels_keywords[_channels.childNodes[i].getAttribute("id")]||"");_channels.childNodes[i].keywordsArray=channels_keywords[_channels.childNodes[i].getAttribute("id")]?channels_keywords[_channels.childNodes[i].getAttribute("id")].split(/\s+/):[]}ample.query("#search-button")[0].addEventListener("click",showSearch,false)}else{window.setTimeout(loadKeyWords,30000)}}})}function showSearch(){var a;if(document.body.className=="w200"||document.body.className=="w400"){a="54px"}else{if(user.mobile){a="84px"}else{a="104px"}}ample.query("#search").animate({width:a,height:"27px"},200,"ease-in",function(){ample.getElementById("search-text").focus();var b=ample.query("#channels_container")[0].firstChild,e=ample.query("#channels_container")[0].parentNode,d=b.selectedItem,c=d.getBoundingClientRect().top-e.getBoundingClientRect().top-3;if(c<11){ample.query(b).stop();c=11}ample.query("#channels_container")[0].$getContainer().scrollTop+=(d.getBoundingClientRect().top-e.getBoundingClientRect().top-3)-c})}function blurSearch(){var a=ample.getElementById("channels_container").firstChild;a.$setPseudoClass("focus",false);this.blurTimer=window.setTimeout(function(){var b=ample.query("#channels_container")[0].firstChild,f=ample.query("#channels_container")[0].parentNode,e=b.selectedItem,d=e.getBoundingClientRect().top-f.getBoundingClientRect().top-3;if(!b.isChannelVisible(b.selectedItem)){d=10}for(var c=0;c<b.childNodes.length;c++){b.childNodes[c].style.display="block"}ample.query("#channels_container")[0].$getContainer().scrollTop+=(e.getBoundingClientRect().top-f.getBoundingClientRect().top-3)-d;ample.query("#search").animate({width:"0px",height:"0px"},200,"ease-in")},200);ample.getElementById("search-text").$getContainer("value").value="";ample.getElementById("search-text").blur()}function searchKeyDown(e){var a=ample.getElementById("channels_container").firstChild,f,d,b,c;if(e.ctrlKey||e.shiftKey){return}switch(e.keyIdentifier){case"Enter":e.preventDefault();a.setSelectedChannel(a.activeItem,true);break;case"Esc":e.preventDefault();window.setTimeout(blurSearch,1);break;case"Up":e.preventDefault();if(a.activeItem){b=a.activeItem.previousSibling,c=null;while(b){if(b.style.display!="none"){c=b;break}b=b.previousSibling}if(c){a.setActiveChannel(c);a.scrollToChannel(c)}}break;case"Down":e.preventDefault();if(a.activeItem){f=a.activeItem.nextSibling,d=null;while(f){if(f.style.display!="none"){d=f;break}f=f.nextSibling}if(d){a.setActiveChannel(d);a.scrollToChannel(d)}}break}}function searchKeyUp(f){var c=f.target.$getContainer("value").value.toLowerCase().replace(/(^\s*|\s*$)/gi,"");if(f.target.currentValue===undefined){f.target.currentValue=""}if(f.target.currentValue!==c){var h=ample.getElementById("channels_container").firstChild,m=null,l=c.match(/[\w\+\u0401\u0410-\u044F\u0451]+/g),b=false,n;l=l===null?[]:l;for(var g=0;g<h.childNodes.length;g++){b=c===""||h.childNodes[g].getAttribute("keywords")==="";if(!b){n=h.childNodes[g].keywordsArray;var a=0;for(var e=0;e<l.length;e++){for(var d=0;d<n.length;d++){if(n[d].indexOf(l[e])!==-1){a++;break}}}b=a===l.length}if(b){h.childNodes[g].style.display="block";if(m===null){m=h.childNodes[g]}}else{h.childNodes[g].style.display="none"}}if(m!==null){h.$setPseudoClass("focus",true);h.setActiveChannel(m);h.scrollToChannel(m);h.startDrawIcons()}else{h.setActiveChannel(null)}}f.target.currentValue=c;repositionChannelsScollbar()}function editModeOn(f){f.preventDefault();if(user.mobile){return}if(!user.authenticated||document.body.className=="w200"||document.body.className=="w400"){return}if(!ample.querySelector(".placeholder")){var d=ample.getElementById("channels_container").firstChild,b=d.childNodes;d.setAttributeNS("http://www.amplesdk.com/ns/aml","droppable","true");for(var e=0;e<b.length;e++){b[e].setAttributeNS("http://www.amplesdk.com/ns/aml","draggable","true");b[e].addEventListener("dragstart",onDragStartHandler,false);b[e].addEventListener("dragend",onDragEndHandler,false)}var c=ample.getElementById("ch_outer"),g=ample.getElementById("tune-tz"),a=ample.getElementById("channels-scroller");ample.addEventListener("mousedown",function(h){if(!(h.target==c||(h.target.compareDocumentPosition(c)&ample.classes.Node.DOCUMENT_POSITION_CONTAINS)||h.target==a||(h.target.compareDocumentPosition(a)&ample.classes.Node.DOCUMENT_POSITION_CONTAINS)||h.target==g||(h.target.compareDocumentPosition(g)&ample.classes.Node.DOCUMENT_POSITION_CONTAINS))){this.removeEventListener("mousedown",arguments.callee,true);editModeOff();if(h.target==ample.querySelector(".edit")){h.stopPropagation()}}},true);d.scrollToChannel(d.getSelectedChannel());d.focus();window.clearInterval(saveSettings._interval);setTzSettingsPosition();setTzSettingsPosition.i=window.setInterval(setTzSettingsPosition,5);ample.query("#tune-tz").show();document.body.id="auth-edit";onProgramChangeInEditMode()}}function onProgramChangeInEditMode(c){if(document.body.id=="auth-edit"){var b=ample.query(ample.getElementById("channels_container").firstChild.selectedItem).height(),a=ample.getElementById("channels_container").firstChild.selectedItem.$getContainer().clientHeight;ample.query("#tune-tz-ch")[0].$getContainer().innerHTML=ample.querySelector("#channels_container").firstChild.selectedItem.getAttribute("name");ample.query("#tune-tz").height(Math.max(b,a)-4);ample.query("#tune-tz-bottom").height(Math.max(b,a)-4);var d=ample.getElementById("channels_container").firstChild.selectedItem.getAttribute("tz");d=(d==""?0:d*1);ample.query("#tune-tz-tz").text((d<0?"":"+")+d)}}function onDragStartHandler(c){var b=c.target.getBoundingClientRect(),a=b.bottom-b.top-2;c.target.parentNode.setSelectedChannel(c.target);ample.query(c.target).after('<div class="placeholder" style="height: '+a+'px;"><div style="height: '+(a-2)+'px;"></div></div>');ample.query("#tune-tz").hide();onDragMouseMoveHandler.draggedElement=c.target;ample.addEventListener("mousemove",onDragMouseMoveHandler,false);ample.query("#ch_outer").before(c.target)}function onDragEndHandler(a){onDragMouseMoveHandler.s=window.clearInterval(onDragMouseMoveHandler.s);ample.getElementById("channels_container").firstChild.insertBefore(a.target,ample.querySelector(".placeholder"));ample.removeEventListener("mousemove",onDragMouseMoveHandler,false);this.parentNode.insertBefore(a.target,ample.querySelector(".placeholder"));ample.query(ample.querySelector(".placeholder")).remove();ample.getElementById("channels_container").firstChild.renumberChildNodes();onProgramChangeInEditMode();ample.query("#tune-tz").show()}function onDragMouseMoveHandler(b){var a=ample.getElementById("ch_outer"),d=ample.getElementById("channels_container"),c=a.getBoundingClientRect();if(b.clientY<c.top+(document.body.className=="w400"||document.body.className=="w200"?25:50)){if(!onDragMouseMoveHandler.s){onDragMouseMoveHandler.t=Number(new Date)}onDragMouseMoveHandler.s=onDragMouseMoveHandler.s||window.setInterval(function(){var e=Math.floor((new Date-onDragMouseMoveHandler.t)/100)/10;d.$getContainer().scrollTop-=e<1?20:e<2?200*e:2000*e;moveSpot(onDragMouseMoveHandler.draggedElement)},10)}else{if(b.clientY>c.bottom-(document.body.className=="w400"||document.body.className=="w200"?25:50)){if(!onDragMouseMoveHandler.s){onDragMouseMoveHandler.t=Number(new Date)}onDragMouseMoveHandler.s=onDragMouseMoveHandler.s||window.setInterval(function(){var e=Math.floor((new Date-onDragMouseMoveHandler.t)/100)/10;d.$getContainer().scrollTop+=e<1?20:e<2?200*e:2000*e;moveSpot(onDragMouseMoveHandler.draggedElement)},10)}else{if(onDragMouseMoveHandler.s){onDragMouseMoveHandler.s=window.clearInterval(onDragMouseMoveHandler.s)}}}moveSpot(onDragMouseMoveHandler.draggedElement)}onDragMouseMoveHandler.s=null;onDragMouseMoveHandler.draggedElement=null;function moveSpot(b){var e=ample.getElementById("channels_container").firstChild,d=e.querySelector(".placeholder"),c=b.getBoundingClientRect(),j=(c.bottom-c.top)/2,a;if(!d){return}for(var f=0,h=false,g=1;f<e.childNodes.length&&(a=e.childNodes[f]);f++){if(a==d){h=true;g=-1}else{if(a!=b){if(c.top-a.getBoundingClientRect().top<g*j){break}}}}if(d.nextSibling!=a&&a!=d){e.insertBefore(d,a||null)}}function editModeOff(){if(!user.authenticated){return}var b=ample.getElementById("channels_container").firstChild,a=b.childNodes;b.setAttributeNS("http://www.amplesdk.com/ns/aml","droppable","false");for(var c=0;c<a.length;c++){a[c].setAttributeNS("http://www.amplesdk.com/ns/aml","draggable","false");a[c].removeEventListener("dragstart",onDragStartHandler,false);a[c].removeEventListener("dragend",onDragEndHandler,false)}window.clearInterval(setTzSettingsPosition.i);ample.query("#tune-tz").hide();document.body.id="auth";saveSettings();saveSettings._interval=window.setInterval(saveSettings,500)}function tzStepUp(){var a=ample.query("#tune-tz-tz").text()*1+1,f=(new Date(ample.getElementById("weekdays").selectedDate)).setHours(0,0,0,0)+4*60*60*1000,b=(new Date(ample.getElementById("weekdays").selectedDate)).setHours(0,0,0,0)+(24+4)*60*60*1000;if(a<=23){ample.query("#tune-tz-tz").text((a<0?"":"+")+a);ample.getElementById("channels_container").firstChild.selectedItem.setAttribute("tz",a);var d=ample.querySelectorAll("p|item");for(var c=0;c<d.length;c++){d[c].addHours(+1);var e=new Date(d[c].getAttribute("timeStart"));d[c].setVisible(e>=f&&e<=b);d[c].setAttribute("hidden",Number(!(e>=f&&e<=b)))}highlightCurrentTVProgram()}}function tzStepDown(){var a=ample.query("#tune-tz-tz").text()*1-1,f=(new Date(ample.getElementById("weekdays").selectedDate)).setHours(0,0,0,0)+4*60*60*1000,b=(new Date(ample.getElementById("weekdays").selectedDate)).setHours(0,0,0,0)+(24+4)*60*60*1000;if(a>=-23){ample.query("#tune-tz-tz").text((a<0?"":"+")+a);ample.getElementById("channels_container").firstChild.selectedItem.setAttribute("tz",a);var d=ample.querySelectorAll("p|item");for(var c=0;c<d.length;c++){d[c].addHours(-1);var e=new Date(d[c].getAttribute("timeStart"));d[c].setVisible(e>=f&&e<=b);d[c].setAttribute("hidden",Number(!(e>=f&&e<=b)))}highlightCurrentTVProgram()}}function ontzStepDown(){ontzStepDown.i=ontzStepDown.i||window.setInterval(tzStepDown,150);tzStepDown()}ontzStepDown.i=null;function ontzStepUp(){ontzStepUp.i=ontzStepUp.i||window.setInterval(tzStepUp,150);tzStepUp()}ontzStepUp.i=null;function channelsScrollerMousedown(d){var b=ample.getElementById("channels-scroller"),a=ample.getElementById("ch_outer"),c=ample.getElementById("channels_container");c.firstChild.focus();scrollerMouseMove.oScrollerRect=b.getBoundingClientRect();scrollerMouseMove.delta=d.clientY-scrollerMouseMove.oScrollerRect.top;scrollerMouseMove.oContainerRect=a.getBoundingClientRect();scrollerMouseMove.oContainerScrollHeight=c.firstChild.$getContainer().scrollHeight;scrollerMouseMove.oScrollerHeight=scrollerMouseMove.oScrollerRect.bottom-scrollerMouseMove.oScrollerRect.top;ample.addEventListener("mousemove",scrollerMouseMove,false);ample.addEventListener("mouseup",scrollerMouseUp,false);scrollerMouseMove.isMoving=true;d.preventDefault()}function scrollerMouseMove(c){var b=ample.getElementById("channels_container"),a=ample.getElementById("channels-scroller");if(c.clientY-scrollerMouseMove.delta<scrollerMouseMove.oContainerRect.top){a.style.top=scrollerMouseMove.oContainerRect.top+"px";b.$getContainer().scrollTop=0}else{if(c.clientY-scrollerMouseMove.delta+scrollerMouseMove.oScrollerHeight>scrollerMouseMove.oContainerRect.bottom){a.style.top=(scrollerMouseMove.oContainerRect.bottom-scrollerMouseMove.oScrollerHeight)+"px";b.$getContainer().scrollTop=b.$getContainer().scrollHeight}else{a.style.top=(c.clientY-scrollerMouseMove.delta)+"px";b.$getContainer().scrollTop=scrollerMouseMove.oContainerScrollHeight/(scrollerMouseMove.oContainerRect.bottom-scrollerMouseMove.oContainerRect.top-scrollerMouseMove.delta)*(c.clientY-scrollerMouseMove.delta-scrollerMouseMove.oContainerRect.top)}}c.preventDefault()}scrollerMouseMove.isMoving=false;function scrollerMouseUp(a){ample.removeEventListener("mousemove",scrollerMouseMove,false);ample.removeEventListener("mouseup",scrollerMouseUp,false);scrollerMouseMove.isMoving=false}function isHoliday(a){var e=false,b,d=a.toHolidayDate(),c=a.toHolidayDateFull();if(COUNTRY in HOLIDAYS){if(((a.getDay()==0||a.getDay()==6)&&(HOLIDAYS[COUNTRY][d]!==0&&HOLIDAYS[COUNTRY][c]!==0))||HOLIDAYS[COUNTRY][d]===1||HOLIDAYS[COUNTRY][c]===1){e=true}else{e=false}}else{if(a.getDay()==0||a.getDay()==6){e=true}else{e=false}}return e}function checkIfFavorite(a){return;if(a.attrName=="date"&&a.prevValue!==a.newValue){if(new Date(a.newValue).toCalendarDate("-") in user.favorites){a.target.setFavorite(true)}else{a.target.setFavorite(false)}}}function loadFavoriteDays(){return;ample.ajax({url:SERVER_BASE+"/favdays/",type:"GET",dataType:"text",timeout:TIMEOUT*2.5*1000,complete:function(oRequest,sStatus){if(sStatus!="success"){alert("error and timeout handling")}else{try{user.favorites=eval(String(oRequest.responseText).replace("while(1);",""));var _week=ample.getElementById("weekdays");for(var i=0;i<_week.childNodes.length;i++){var o={target:_week.childNodes[i],attrName:"date",prevValue:null,newValue:_week.childNodes[i].getDate()};checkIfFavorite(o)}}catch(e){alert("error occured while eval:\n"+oRequest.responseText)}}}})}function loadFavoritesDiapason(){return}function updateGooglePlusOne(){ample.getElementById("g-plusone").$getContainer().innerHTML='<div class="g-plusone" data-href="http://www.programma.tv/" data-size="'+(document.body.className=="w400"||document.body.className=="w200"?"small":"medium")+'"></div>';if(window.gapi){gapi.plusone.go("g-plusone")}}var hexcase=0;var b64pad="";function hex_md5(a){return rstr2hex(rstr_md5(str2rstr_utf8(a)))}function b64_md5(a){return rstr2b64(rstr_md5(str2rstr_utf8(a)))}function any_md5(a,b){return rstr2any(rstr_md5(str2rstr_utf8(a)),b)}function hex_hmac_md5(a,b){return rstr2hex(rstr_hmac_md5(str2rstr_utf8(a),str2rstr_utf8(b)))}function b64_hmac_md5(a,b){return rstr2b64(rstr_hmac_md5(str2rstr_utf8(a),str2rstr_utf8(b)))}function any_hmac_md5(a,c,b){return rstr2any(rstr_hmac_md5(str2rstr_utf8(a),str2rstr_utf8(c)),b)}function md5_vm_test(){return hex_md5("abc").toLowerCase()=="900150983cd24fb0d6963f7d28e17f72"}function rstr_md5(a){return binl2rstr(binl_md5(rstr2binl(a),a.length*8))}function rstr_hmac_md5(c,f){var e=rstr2binl(c);if(e.length>16){e=binl_md5(e,c.length*8)}var a=Array(16),d=Array(16);for(var b=0;b<16;b++){a[b]=e[b]^909522486;d[b]=e[b]^1549556828}var g=binl_md5(a.concat(rstr2binl(f)),512+f.length*8);return binl2rstr(binl_md5(d.concat(g),512+128))}function rstr2hex(c){try{hexcase}catch(g){hexcase=0}var f=hexcase?"0123456789ABCDEF":"0123456789abcdef";var b="";var a;for(var d=0;d<c.length;d++){a=c.charCodeAt(d);b+=f.charAt((a>>>4)&15)+f.charAt(a&15)}return b}function rstr2b64(c){try{b64pad}catch(h){b64pad=""}var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b="";var a=c.length;for(var f=0;f<a;f+=3){var k=(c.charCodeAt(f)<<16)|(f+1<a?c.charCodeAt(f+1)<<8:0)|(f+2<a?c.charCodeAt(f+2):0);for(var d=0;d<4;d++){if(f*8+d*6>c.length*8){b+=b64pad}else{b+=g.charAt((k>>>6*(3-d))&63)}}}return b}function rstr2any(m,c){var b=c.length;var l,f,a,n,e;var k=Array(Math.ceil(m.length/2));for(l=0;l<k.length;l++){k[l]=(m.charCodeAt(l*2)<<8)|m.charCodeAt(l*2+1)}var h=Math.ceil(m.length*8/(Math.log(c.length)/Math.log(2)));var g=Array(h);for(f=0;f<h;f++){e=Array();n=0;for(l=0;l<k.length;l++){n=(n<<16)+k[l];a=Math.floor(n/b);n-=a*b;if(e.length>0||a>0){e[e.length]=a}}g[f]=n;k=e}var d="";for(l=g.length-1;l>=0;l--){d+=c.charAt(g[l])}return d}function str2rstr_utf8(c){var b="";var d=-1;var a,e;while(++d<c.length){a=c.charCodeAt(d);e=d+1<c.length?c.charCodeAt(d+1):0;if(55296<=a&&a<=56319&&56320<=e&&e<=57343){a=65536+((a&1023)<<10)+(e&1023);d++}if(a<=127){b+=String.fromCharCode(a)}else{if(a<=2047){b+=String.fromCharCode(192|((a>>>6)&31),128|(a&63))}else{if(a<=65535){b+=String.fromCharCode(224|((a>>>12)&15),128|((a>>>6)&63),128|(a&63))}else{if(a<=2097151){b+=String.fromCharCode(240|((a>>>18)&7),128|((a>>>12)&63),128|((a>>>6)&63),128|(a&63))}}}}}return b}function str2rstr_utf16le(b){var a="";for(var c=0;c<b.length;c++){a+=String.fromCharCode(b.charCodeAt(c)&255,(b.charCodeAt(c)>>>8)&255)}return a}function str2rstr_utf16be(b){var a="";for(var c=0;c<b.length;c++){a+=String.fromCharCode((b.charCodeAt(c)>>>8)&255,b.charCodeAt(c)&255)}return a}function rstr2binl(b){var a=Array(b.length>>2);for(var c=0;c<a.length;c++){a[c]=0}for(var c=0;c<b.length*8;c+=8){a[c>>5]|=(b.charCodeAt(c/8)&255)<<(c%32)}return a}function binl2rstr(b){var a="";for(var c=0;c<b.length*32;c+=8){a+=String.fromCharCode((b[c>>5]>>>(c%32))&255)}return a}function binl_md5(p,k){p[k>>5]|=128<<((k)%32);p[(((k+64)>>>9)<<4)+14]=k;var o=1732584193;var n=-271733879;var m=-1732584194;var l=271733878;for(var g=0;g<p.length;g+=16){var j=o;var h=n;var f=m;var e=l;o=md5_ff(o,n,m,l,p[g+0],7,-680876936);l=md5_ff(l,o,n,m,p[g+1],12,-389564586);m=md5_ff(m,l,o,n,p[g+2],17,606105819);n=md5_ff(n,m,l,o,p[g+3],22,-1044525330);o=md5_ff(o,n,m,l,p[g+4],7,-176418897);l=md5_ff(l,o,n,m,p[g+5],12,1200080426);m=md5_ff(m,l,o,n,p[g+6],17,-1473231341);n=md5_ff(n,m,l,o,p[g+7],22,-45705983);o=md5_ff(o,n,m,l,p[g+8],7,1770035416);l=md5_ff(l,o,n,m,p[g+9],12,-1958414417);m=md5_ff(m,l,o,n,p[g+10],17,-42063);n=md5_ff(n,m,l,o,p[g+11],22,-1990404162);o=md5_ff(o,n,m,l,p[g+12],7,1804603682);l=md5_ff(l,o,n,m,p[g+13],12,-40341101);m=md5_ff(m,l,o,n,p[g+14],17,-1502002290);n=md5_ff(n,m,l,o,p[g+15],22,1236535329);o=md5_gg(o,n,m,l,p[g+1],5,-165796510);l=md5_gg(l,o,n,m,p[g+6],9,-1069501632);m=md5_gg(m,l,o,n,p[g+11],14,643717713);n=md5_gg(n,m,l,o,p[g+0],20,-373897302);o=md5_gg(o,n,m,l,p[g+5],5,-701558691);l=md5_gg(l,o,n,m,p[g+10],9,38016083);m=md5_gg(m,l,o,n,p[g+15],14,-660478335);n=md5_gg(n,m,l,o,p[g+4],20,-405537848);o=md5_gg(o,n,m,l,p[g+9],5,568446438);l=md5_gg(l,o,n,m,p[g+14],9,-1019803690);m=md5_gg(m,l,o,n,p[g+3],14,-187363961);n=md5_gg(n,m,l,o,p[g+8],20,1163531501);o=md5_gg(o,n,m,l,p[g+13],5,-1444681467);l=md5_gg(l,o,n,m,p[g+2],9,-51403784);m=md5_gg(m,l,o,n,p[g+7],14,1735328473);n=md5_gg(n,m,l,o,p[g+12],20,-1926607734);o=md5_hh(o,n,m,l,p[g+5],4,-378558);l=md5_hh(l,o,n,m,p[g+8],11,-2022574463);m=md5_hh(m,l,o,n,p[g+11],16,1839030562);n=md5_hh(n,m,l,o,p[g+14],23,-35309556);o=md5_hh(o,n,m,l,p[g+1],4,-1530992060);l=md5_hh(l,o,n,m,p[g+4],11,1272893353);m=md5_hh(m,l,o,n,p[g+7],16,-155497632);n=md5_hh(n,m,l,o,p[g+10],23,-1094730640);o=md5_hh(o,n,m,l,p[g+13],4,681279174);l=md5_hh(l,o,n,m,p[g+0],11,-358537222);m=md5_hh(m,l,o,n,p[g+3],16,-722521979);n=md5_hh(n,m,l,o,p[g+6],23,76029189);o=md5_hh(o,n,m,l,p[g+9],4,-640364487);l=md5_hh(l,o,n,m,p[g+12],11,-421815835);m=md5_hh(m,l,o,n,p[g+15],16,530742520);n=md5_hh(n,m,l,o,p[g+2],23,-995338651);o=md5_ii(o,n,m,l,p[g+0],6,-198630844);l=md5_ii(l,o,n,m,p[g+7],10,1126891415);m=md5_ii(m,l,o,n,p[g+14],15,-1416354905);n=md5_ii(n,m,l,o,p[g+5],21,-57434055);o=md5_ii(o,n,m,l,p[g+12],6,1700485571);l=md5_ii(l,o,n,m,p[g+3],10,-1894986606);m=md5_ii(m,l,o,n,p[g+10],15,-1051523);n=md5_ii(n,m,l,o,p[g+1],21,-2054922799);o=md5_ii(o,n,m,l,p[g+8],6,1873313359);l=md5_ii(l,o,n,m,p[g+15],10,-30611744);m=md5_ii(m,l,o,n,p[g+6],15,-1560198380);n=md5_ii(n,m,l,o,p[g+13],21,1309151649);o=md5_ii(o,n,m,l,p[g+4],6,-145523070);l=md5_ii(l,o,n,m,p[g+11],10,-1120210379);m=md5_ii(m,l,o,n,p[g+2],15,718787259);n=md5_ii(n,m,l,o,p[g+9],21,-343485551);o=safe_add(o,j);n=safe_add(n,h);m=safe_add(m,f);l=safe_add(l,e)}return Array(o,n,m,l)}function md5_cmn(h,e,d,c,g,f){return safe_add(bit_rol(safe_add(safe_add(e,h),safe_add(c,f)),g),d)}function md5_ff(g,f,k,j,e,i,h){return md5_cmn((f&k)|((~f)&j),g,f,e,i,h)}function md5_gg(g,f,k,j,e,i,h){return md5_cmn((f&j)|(k&(~j)),g,f,e,i,h)}function md5_hh(g,f,k,j,e,i,h){return md5_cmn(f^k^j,g,f,e,i,h)}function md5_ii(g,f,k,j,e,i,h){return md5_cmn(k^(f|(~j)),g,f,e,i,h)}function safe_add(a,d){var c=(a&65535)+(d&65535);var b=(a>>16)+(d>>16)+(c>>16);return(b<<16)|(c&65535)}function bit_rol(a,b){return(a<<b)|(a>>>(32-b))};
