var Defaults={defaultInputValues:{fi:{"login":"K&auml;ytt&auml;j&auml;","password":"Salasana","search":"Haku"},en:{"login":"Login","password":"Password","search":"Search"}},footerAds:['silverScreenSlot','tickerBanner','spotlight']};var Application={init:function(lang){var usernameInput=document.getElementById('username');var passwordInput=document.getElementById('password');var searchInput=document.getElementById('hakusana');if(usernameInput){usernameInput.onfocus=function(){Application.clearInput(this,Defaults.defaultInputValues[lang]["login"]);};usernameInput.onblur=function(){Application.defaultInput(this,Defaults.defaultInputValues[lang]["login"]);};}
if(passwordInput){passwordInput.onfocus=function(){Application.clearInput(this,Defaults.defaultInputValues[lang]["password"]);};passwordInput.onblur=function(){Application.defaultInput(this,Defaults.defaultInputValues[lang]["password"]);};}
if(searchInput){searchInput.onfocus=function(){Application.clearInput(this,Defaults.defaultInputValues[lang]["search"]);};searchInput.onblur=function(){Application.defaultInput(this,Defaults.defaultInputValues[lang]["search"]);};}},clearInput:function(inputField,defaultValue){if(inputField.value==defaultValue){inputField.value='';}},defaultInput:function(inputField,defaultValue){if(inputField.value==''){inputField.value=defaultValue;}},hideElement:function(elementId,type){var element=document.getElementById(elementId);if(element){if((arguments.length<2)||(type=="display")){element.style.display='none';}
else{element.style.visibility='hidden';}}},showElement:function(elementId,type){var element=document.getElementById(elementId);if(element){if((arguments.length<2)||(type=="display")){element.style.display='';}
else{element.style.visibility='visible';}}},hideFooterAds:function(){for(var i=0;i<Defaults.footerAds.length;i++){this.hideElement(Defaults.footerAds[i],"visibility");}},showFooterAds:function(){for(var i=0;i<Defaults.footerAds.length;i++){this.showElement(Defaults.footerAds[i],"visibility");}},assignProgramTableOnclicks:function(){}};;function DropMenu(id,hideTimeout,showTimeout){this.timer=null;this.id=id;this.hideTimeout=hideTimeout;this.showTimeout=showTimeout;}
DropMenu.prototype.show=function(){var self=this;var actualShow=function(){Application.hideFooterAds();Application.showElement(self.id);}
if(arguments.length==0){if(this.timer!=null){window.clearTimeout(self.timer);}
this.timer=window.setTimeout(actualShow,this.showTimeout);}
else{actualShow();}}
DropMenu.prototype.hide=function(){var self=this;var actualHide=function(){Application.showFooterAds();Application.hideElement(self.id);}
if(arguments.length==0){if(this.timer!=null){window.clearTimeout(self.timer);}
this.timer=window.setTimeout(actualHide,this.hideTimeout);}}
var channelPagesDropMenu=new DropMenu("channelPagesDropMenuContainer",400,500);var calendarDropMenu=new DropMenu("calendarDropMenuContainer",400,500);var settingsDropMenu=new DropMenu("settingsDropMenuContainer",0,0);function toggleSettingsDropMenu(showMenu){var link=document.getElementById("omatelkkuLink");if(showMenu){settingsDropMenu.show();if(link){link.onclick=function(){return toggleSettingsDropMenu(false);}}}
else{settingsDropMenu.hide();if(link){link.onclick=function(){return toggleSettingsDropMenu(true);}}}
return false;}
function initCheckboxes(containingElementId){var containingElement=document.getElementById(containingElementId);if(containingElement){var inputElements=containingElement.getElementsByTagName('input');for(var i=0;i<inputElements.length;i++){if((inputElements[i].type=='checkbox')||(inputElements[i].type=='radio')){inputElements[i].onclick=function(){var myLabel=document.getElementById(this.id+'Label');if(this.checked){myLabel.className='selected';}
else{myLabel.className='';}
if(this.type=='radio'){var inputElements=document.getElementById(containingElementId).getElementsByTagName('input');for(var j=0;j<inputElements.length;j++){if(!inputElements[j].checked){if((inputElements[j].name==this.name)&&(inputElements[j].id!=this.id)){var label=document.getElementById(inputElements[j].id+"Label");label.className='';}}}}};inputElements[i].onclick();}}}};function SwfBanner(){this.swfFile=null;this.width=null;this.height=null;this.clickTags=new Array();this.clickTagDestinations=new Array();this.backupImage=null;this.backupTarget=null;this.backupHref=null;this.paramNames=new Array();this.paramValues=new Array();this.id=null;this.attributeNames=new Array();this.attributeValues=new Array();}
SwfBanner.prototype.setSwfFile=function(filename){this.swfFile=filename;}
SwfBanner.prototype.setWidth=function(width){this.width=width;}
SwfBanner.prototype.setHeight=function(height){this.height=height;}
SwfBanner.prototype.setDimensions=function(width,height){this.width=width;this.height=height;}
SwfBanner.prototype.setId=function(id){this.addAttribute('id',id);}
SwfBanner.prototype.setClickTag=function(clickTag,destinationUrl){this.addClickTag(clickTag,destinationUrl);}
SwfBanner.prototype.addAttribute=function(attributeName,attributeValue){this.attributeNames.push(attributeName);this.attributeValues.push(attributeValue);}
SwfBanner.prototype.addClickTag=function(clickTag,destinationUrl){this.clickTags.push(clickTag);this.clickTagDestinations.push(destinationUrl);}
SwfBanner.prototype.setBackupImage=function(imagefile){this.backupImage=imagefile;}
SwfBanner.prototype.setBackupTarget=function(target){this.backupTarget=target;}
SwfBanner.prototype.setBackupHref=function(href){this.backupHref=href;}
SwfBanner.prototype.addParam=function(name,value){this.paramNames.push(name);this.paramValues.push(value);}
SwfBanner.prototype.write=function(){if((this.swfFile!=null)&&(this.width!=null)&&(this.height!=null)){swfFullUrl=this.swfFile;var firstClickTag=true;for(var i=0;i<this.clickTags.length;i++){if(firstClickTag){swfFullUrl+="?";firstClickTag=false;}
else{swfFullUrl+="&";}
if((this.clickTags[i]!=null)&&(this.clickTagDestinations[i]!=null)){swfFullUrl+=this.clickTags[i]+"="+this.clickTagDestinations[i];}}
document.write('<object type = "application/x-shockwave-flash" data = "'+swfFullUrl+'" width = "'+this.width+'" height = "'+this.height+'"');for(var i=0;i<this.attributeNames.length;i++){document.write(' '+this.attributeNames[i]+'="'+this.attributeValues[i]+'"');}
document.write('>');document.write('<param name = "movie" value= "'+swfFullUrl+'" />');for(var i=0;i<this.paramNames.length;i++){document.write('<param name = "');document.write(this.paramNames[i]);document.write('" value = "');document.write(this.paramValues[i]);document.write('" />');}
if(this.backupImage!=null){var aElementOpened=false;if((this.backupHref!=null)||((this.clickTagDestinations.length>0)&&(this.clickTagDestinations[0]!=null))){var backupHref=this.clickTagDestinations[0];if(this.backupHref!=null){backupHref=this.backupHref;}
document.write('<a href = "'+backupHref+'"');if(this.backupTarget!=null){document.write(' target = "'+this.backupTarget+'"');}
document.write('>');aElementOpened=true;}
document.write('<img src = "'+this.backupImage+'" width = "'+this.width+'" height = "'+this.height+'" border = "0" />');if(aElementOpened){document.write('</a>');}}
document.write('</object>');}};if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return"";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;;var popupWindow="";function popup(osoite){if(!popupWindow.close&&popupWindow.location){popupWindow.location.href=address;}
else{var top=(screen.height/2)-235;var left=(screen.width/2)-449;var width=895;var height=370;popupWindow=window.open(osoite,"SameWindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,fullscreen=0,height="+height+",width="+width+",top="+top+",left="+left);if(!popupWindow.opener)popupWindow.opener=self;if(window.focus)popupWindow.focus();}
return false;}
function flashPopup(osoite){popup(osoite);}
function fullScreenPopup(osoite){var width=screen.width;var height=screen.height;fullScreenWindow=window.open(osoite,"FullScreenWindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,fullscreen=0,height="+height+",width="+width+",top=0,left=0");fullScreenWindow.focus();return false;};function createXMLHttpRequest(){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else{if(window.ActiveXObject){try{xhr=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{xhr=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}}
return xhr;}
function setLoadingBar(indicatorText,elementId){var indicatorElement=document.getElementById(elementId);if(indicatorElement){indicatorElement.innerHTML=indicatorText+'<br /><img src="http://images.telkku.com/img/theme_default/loadingbar.gif" width="220" height="19" alt="" />';}}
function setLoadingIndicator(indicatorText,elementId){var indicatorElement=document.getElementById(elementId);if(indicatorElement){indicatorElement.innerHTML=indicatorText+'<br /><img src="http://images.telkku.com/img/theme_default/loadingindicator.gif" width="32" height="32" alt="" />';}};var tmLoc='statistik-gallup.net';var tmImg1=new Image();var tmImg2=new Image();function getTMqs(furl,dotl,tmac,tmcc,enc,sec){var n=new Date();var loc=window.location.href;var prot=window.location.protocol;if(furl.indexOf('R>')==0){furl=furl.substring(2);loc=furl;}
if(loc.indexOf('#')!=-1)
loc=loc.substring(0,loc.indexOf('#'));if(loc.length>256){loc=loc.substring(0,253)+'...';}
if(sec){if(loc.indexOf('?')!=-1){loc+='&'+sec.join('&');}else{loc+='?'+sec.join('&');}}
if(window.parent!=window.self){var ref=parent.document.referrer;}else{var ref=document.referrer;}
var esc=function(str){return str.replace(/\*/g,'%2a').replace(/#/g,'%23')};var qs=esc(loc)+'*'+esc(furl)+'*'+esc(dotl)+'*'+esc(ref)+'*'+navigator.javaEnabled()+'/';if(window.screen){qs+=screen.width+'x'+screen.height+'/'+screen.colorDepth+'/';}else{qs+='//';};qs+=tmac+'/'+tmcc+'/'+enc+'/'+n.getTime()+'/';tmImg1.onload=function(){tmImg2.src=prot+'//'+tmLoc+'/V11'+qs};tmImg1.src=prot+'//'+tmLoc+'/VC'+n.getTime();};(function($){jQuery.fn.extend({getUrlParam:function(strParamName){strParamName=escape(unescape(strParamName));var returnVal=new Array();var qString=null;if($(this).attr("nodeName")=="#document"){if(window.location.search.search(strParamName)>-1){qString=window.location.search.substr(1,window.location.search.length).split("&");}}else if($(this).attr("src")!="undefined"){var strHref=$(this).attr("src")
if(strHref.indexOf("?")>-1){var strQueryString=strHref.substr(strHref.indexOf("?")+1);qString=strQueryString.split("&");}}else if($(this).attr("href")!="undefined"){var strHref=$(this).attr("href")
if(strHref.indexOf("?")>-1){var strQueryString=strHref.substr(strHref.indexOf("?")+1);qString=strQueryString.split("&");}}else{return null;}
if(qString==null)return null;for(var i=0;i<qString.length;i++){if(escape(unescape(qString[i].split("=")[0]))==strParamName){returnVal.push(qString[i].split("=")[1]);}}
if(returnVal.length==0)return null;else if(returnVal.length==1)return returnVal[0];else return returnVal;}});})(jQuery);;(function(A){A.flashPlayerVersion=function(){var D,B=null,I=false,H="ShockwaveFlash.ShockwaveFlash";if(!(D=navigator.plugins["Shockwave Flash"])){try{B=new ActiveXObject(H+".7")}catch(G){try{B=new ActiveXObject(H+".6");D=[6,0,21];B.AllowScriptAccess="always"}catch(F){if(D&&D[0]===6){I=true}}if(!I){try{B=new ActiveXObject(H)}catch(E){D="X 0,0,0"}}}if(!I&&B){try{D=B.GetVariable("$version")}catch(C){}}}else{D=D.description}D=D.match(/^[A-Za-z\s]*?(\d+)(\.|,)(\d+)(\s+r|,)(\d+)/);return[D[1]*1,D[3]*1,D[5]*1]}();A.flashExpressInstaller="expressInstall.swf";A.hasFlashPlayer=(A.flashPlayerVersion[0]!==0);A.hasFlashPlayerVersion=function(C){var B=A.flashPlayerVersion;C=(/string|integer/.test(typeof C))?C.toString().split("."):C;return(C)?(B[0]>=(C.major||C[0]||B[0])&&B[1]>=(C.minor||C[1]||B[1])&&B[2]>=(C.release||C[2]||B[2])):(B[0]!==0)};A.flash=function(M){if(!A.hasFlashPlayer){return false}var C=M.swf||"",K=M.params||{},E=document.createElement("body"),B,L,H,D,J,I,G,F;M.height=M.height||180;M.width=M.width||320;if(M.hasVersion&&!A.hasFlashPlayerVersion(M.hasVersion)){A.extend(M,{id:"SWFObjectExprInst",height:Math.max(M.height,137),width:Math.max(M.width,214)});C=M.expressInstaller||A.flashExpressInstaller;K={flashvars:{MMredirectURL:window.location.href,MMplayerType:(A.browser.msie&&A.browser.win)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}if(M.flashvars&&typeof K==="object"){A.extend(K,{flashvars:M.flashvars})}for(J in(I=["swf","expressInstall","hasVersion","params","flashvars"])){delete M[I[J]]}B=[];for(J in M){if(typeof M[J]==="object"){L=[];for(I in M[J]){L.push(I.replace(/([A-Z])/,"-$1").toLowerCase()+":"+M[J][I]+";")}M[J]=L.join("")}B.push(J+'="'+M[J]+'"')}M=B.join(" ");if(typeof K==="object"){B=[];for(J in K){if(typeof K[J]==="object"){L=[];for(I in K[J]){if(typeof K[J][I]==="object"){H=[];for(G in K[J][I]){if(typeof K[J][I][G]==="object"){D=[];for(F in K[J][I][G]){D.push(F.replace(/([A-Z])/,"-$1").toLowerCase()+":"+K[J][I][G][F]+";")}K[J][I][G]=D.join("")}H.push(G+"{"+K[J][I][G]+"}")}K[J][I]=H.join("")}L.push(window.escape(I)+"="+window.escape(K[J][I]))}K[J]=L.join("&amp;")}B.push('<PARAM NAME="'+J+'" VALUE="'+K[J]+'">')}K=B.join("")}if(!(/style=/.test(M))){M+=' style="vertical-align:text-top;"'}if(!(/style=(.*?)vertical-align/.test(M))){M=M.replace(/style="/,'style="vertical-align:text-top;')}if(A.browser.msie){M+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';K='<PARAM NAME="movie" VALUE="'+C+'">'+K}else{M+=' type="application/x-shockwave-flash" data="'+C+'"'}E.innerHTML="<OBJECT "+M+">"+K+"</OBJECT>";return A(E.firstChild)};A.fn.flash=function(C){if(!A.hasFlashPlayer){return this}var B=0,D;while((D=this.eq(B++))[0]){D.html(A.flash(A.extend({},C)));if(D[0].firstChild.getAttribute("id")==="SWFObjectExprInst"){B=this.length}}return this}}(jQuery));;jQuery.fn.extend({everyTime:function(interval,label,fn,times,belay){return this.each(function(){jQuery.timer.add(this,interval,label,fn,times,belay);});},oneTime:function(interval,label,fn){return this.each(function(){jQuery.timer.add(this,interval,label,fn,1);});},stopTime:function(label,fn){return this.each(function(){jQuery.timer.remove(this,label,fn);});}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{'ms':1,'cs':10,'ds':100,'s':1000,'das':10000,'hs':100000,'ks':1000000},timeParse:function(value){if(value==undefined||value==null)
return null;var result=this.regex.exec(jQuery.trim(value.toString()));if(result[2]){var num=parseInt(result[1],10);var mult=this.powers[result[2]]||1;return num*mult;}else{return value;}},add:function(element,interval,label,fn,times,belay){var counter=0;if(jQuery.isFunction(label)){if(!times)
times=fn;fn=label;label=interval;}
interval=jQuery.timer.timeParse(interval);if(typeof interval!='number'||isNaN(interval)||interval<=0)
return;if(times&&times.constructor!=Number){belay=!!times;times=0;}
times=times||0;belay=belay||false;if(!element.$timers)
element.$timers={};if(!element.$timers[label])
element.$timers[label]={};fn.$timerID=fn.$timerID||this.guid++;var handler=function(){if(belay&&this.inProgress)
return;this.inProgress=true;if((++counter>times&&times!==0)||fn.call(element,counter)===false)
jQuery.timer.remove(element,label,fn);this.inProgress=false;};handler.$timerID=fn.$timerID;if(!element.$timers[label][fn.$timerID])
element.$timers[label][fn.$timerID]=window.setInterval(handler,interval);if(!this.global[label])
this.global[label]=[];this.global[label].push(element);},remove:function(element,label,fn){var timers=element.$timers,ret;if(timers){if(!label){for(label in timers)
this.remove(element,label,fn);}else if(timers[label]){if(fn){if(fn.$timerID){window.clearInterval(timers[label][fn.$timerID]);delete timers[label][fn.$timerID];}}else{for(var fn in timers[label]){window.clearInterval(timers[label][fn]);delete timers[label][fn];}}
for(ret in timers[label])break;if(!ret){ret=null;delete timers[label];}}
for(ret in timers)break;if(!ret)
element.$timers=null;}}}});if(jQuery.browser.msie)
jQuery(window).one("unload",function(){var global=jQuery.timer.global;for(var label in global){var els=global[label],i=els.length;while(--i)
jQuery.timer.remove(els[i],label);}});;(function($){jQuery.fn.extend({hasVerticalScrollBar:function(){return $(this).attr("clientHeight")<$(this).attr("scrollHeight");},hasHorizontalScrollBar:function(){return $(this).attr("clientWidth")<$(this).attr("scrollWidth");}});var defaults={showDelay:1,hideDelay:1,hoverOverTipContent:false,checkEnvironment:function(){return true;},onShow:function(){},show:function(content){content.show();},hide:function(content){content.hide();},click:false};function checkOptions(options){for(optionName in defaults){options[optionName]=typeof options[optionName]=="undefined"?defaults[optionName]:options[optionName];}}
function handleTooltipPosition(tooltip,viewport){var farRight=tooltip.x+tooltip.width;var rightSideOk=!(farRight>viewport.width());var bottom=tooltip.y+tooltip.height;var bottomSideOk=!(bottom>(viewport.height()+viewport.scrollTop()));if(!rightSideOk&&!bottomSideOk){var offsetX=farRight-viewport.width();tooltip.x-=tooltip.width+50;var offsetY=tooltip.height;tooltip.y-=offsetY;}else{if(!rightSideOk){var offsetX=farRight-viewport.width();tooltip.x-=offsetX;}
if(!bottomSideOk){var offsetY=tooltip.height;tooltip.y-=offsetY;}}}
jQuery.fn.extend({tip:function(options){checkOptions(options);if(options.hide){$(options.content).data("hover",false).data("contentHover",false).hide();}
var content=$(options.content);var parent=$(this)
var viewport={width:function(){return $("html").hasVerticalScrollBar()?$(window).width()-20:$(window).width();},height:function(){return $("html").hasHorizontalScrollBar()?$(window).height()-20:$(window).height();},clientWidth:function(){return $("html").attr("clientWidth");},clientHeight:function(){return $("html").attr("clientHeight");},scrollWidth:function(){return $("html").attr("scrollWidth");},scrollHeight:function(){return $("html").attr("scrollHeight");},scrollTop:function(){return $(window).scrollTop();},scrollLeft:function(){return $(window).scrollLeft();}};var tooltip={width:content.width(),height:content.height(),x:0,y:0};if(options.click){$(this).click(function(mouseEvent){tooltip.x=mouseEvent.pageX+5;tooltip.y=mouseEvent.pageY+parent.height();handleTooltipPosition(tooltip,viewport);content.css("position","absolute").css("top",tooltip.y).css("left",tooltip.x);if(options.checkEnvironment()){options.show(content);options.onShow(parent,content,options);}
return false;});}else{$(this).hover(function(mouseEvent){$(this).data("hover",true);content.oneTime(options.showDelay,function(){if(parent.data("hover")){var top=parent.offset().top+parent.height();var left=mouseEvent.pageX+5;tooltip.x=mouseEvent.pageX+5;tooltip.y=mouseEvent.pageY+parent.height();handleTooltipPosition(tooltip,viewport);content.css("position","absolute").css("top",tooltip.y).css("left",tooltip.x);if(options.checkEnvironment()){options.show($(this));options.onShow(parent,content,options);}
if(options.hoverOverTipContent){$(this).hover(function(){parent.data("contentHover",true);},function(){$(this).oneTime(options.hideDelay,function(){options.hide($(this));});});}}});},function(mouseEvent){$(this).data("hover",false);content.oneTime(options.hideDelay,function(){if(!parent.data("contentHover")){options.hide($(this));}});});}}});})(jQuery);;var $j=jQuery.noConflict();;function SmokeScreen(_contentContainer){this.programInfoOpacity=0.6;this.hidables=new Array();this.contentContainer=_contentContainer;if(typeof SmokeScreen._initialized=="undefined"){SmokeScreen.prototype.open=function(content,fallback,frame,loader){this.hideHidables();this.contentCopy=content;this.fallbackCopy=fallback;this.frameCopy=frame;this.loaderCopy=loader;if(jQuery.browser.msie){window.scrollTo(0,0);$j("html").css("overflow","hidden");}
$j("#opacityOverlay").width(screen.width).height(screen.height);$j(this.contentContainer).width($j("#mainContent").width()).height(screen.height);if(showDominance){$j("#opacityOverlay").show().fadeTo(0,1,function(){});}else{$j("#opacityOverlay").show().fadeTo(0,this.programInfoOpacity,function(){});}
$j(this.contentContainer).show();var selfRef=this;if(frame!=null){frame.show(this.contentContainer);$j("a#closeWindow").click(function(){if(jQuery.browser.msie){$j("html").css("overflow","auto");}
selfRef.close();return false;});}
loader.show();content.fetch(10000,function(status,errorText){if(status==false){fallback.fetch();}else{if(showDominance){addDominance();}}});};SmokeScreen.prototype.close=function(){this.showHidables();if(jQuery.browser.msie){$j("html").css("overflow","auto");}

	$j(this.contentContainer).hide();$j("#opacityOverlay").hide();
	if(showDominance){
		hideDominance();
	}
};

SmokeScreen.prototype.addHidable=function(id){
	this.hidables.push(id);
};

SmokeScreen.prototype.hideHidables=function(){
	for(i=0;i<this.hidables.length;i++){
		var hidableElement=$j(this.hidables[i]);
		var height=$j(hidableElement).height();
		var width=$j(hidableElement).width();
		$j(this.hidables[i]+"Wrapper").width(width).height(height);
		$j(hidableElement).hide();
	}
};

SmokeScreen.prototype.showHidables=function(){
	for(i=0;i<this.hidables.length;i++){
		$j(this.hidables[i]).show();
	}
}

SmokeScreen.prototype.pushContent=function(
	content,fallback){content.fetch(10000,function(status,errorText){
	if(status==false){
		fallback.fetch();
//		$j.get("/TelkkuInfo/fail?to=10000&errText="+errorText);
	}
	});}
SmokeScreen._initialized=true;}}
function ProgramContent(_target,_params){this.target=_target;this.params=_params;if(typeof ProgramContent._initialized=="undefined"){ProgramContent.prototype.fetch=function(timeout,statusCallback){var contentTarget=this.target;$j.ajax({type:"POST",url:"/TelkkuInfo/info",timeout:timeout,data:this.params,success:function(response){$j(contentTarget).html("");$j(contentTarget).append($j(response).find(".paragraph,.buttons"));getTMqs('','','telkkucom_fi','fi','ISO-8859-1',new Array('tmsec=lisatietoikkuna'));$j("#programInfoContainer #ads:first").html("<iframe src='http://www.telkku.com/TelkkuInfo/view/advert.jsp' scrolling='no'></iframe>");statusCallback(true,"none");},error:function(request,textStatus,errorThrown){statusCallback(false,textStatus);}});}
ProgramContent._initialized=true;}}
function ErrorContent(_target,_source){this.target=_target;this.source=_source;if(typeof ErrorContent._initialized=="undefined"){ErrorContent.prototype.fetch=function(){$j(this.target).html($j(this.source).clone().children());}
ErrorContent._initialized=true;}}
function Frame(_contentId){this.contentId=_contentId;if(typeof Frame._initialized=="undefined"){Frame.prototype.show=function(targetId){$j(targetId).html($j(this.contentId).clone());};Frame._initialized=true;}}
function Loader(_sourceId,_targetId){this.sourceId=_sourceId;this.targetId=_targetId;if(typeof Loader._initialized=="undefined"){Loader.prototype.show=function(){$j(this.targetId).html($j(this.sourceId).clone());$j(this.targetId+" "+this.sourceId).show();};Loader._initialized=true;}};var smoke=new SmokeScreen("#programInfoContainer");smoke.addHidable("#topBanner");smoke.addHidable("#silverScreenSlot");smoke.addHidable("#brandFlash");smoke.addHidable("#textAdSlotLeft");smoke.addHidable("#tickerBanner");var fallbackContent=new ErrorContent("#programContent","#errorMessage");var programInfoFrame=new Frame("#programInfoWindow");var loader=new Loader("#loader","#programContent");function openSmoke(programId,userId){var program=new ProgramContent("#programContent","oid="+programId+"&username="+userId);smoke.open(program,fallbackContent,programInfoFrame,loader);}
function User(){this.hasScript=true;this.username="";if(typeof User._initialized=="undefined"){User.prototype.setJavascript=function(_hasScript){this.hasScript=_hasScript;};User.prototype.hasJavascript=function(){return this.hasScript;};User.prototype.setUsername=function(_username){this.username=_username;};User.prototype.getUsername=function(){return this.username;};User._initialized=true;}}
function getComments(programId){$j("#programInfoContainer").hide();$j.ajax({type:"POST",url:"/TelkkuInfo/comments",data:"programId="+programId+"&domain="+location.hostname,success:function(response){$j("#programInfoContainer").html(response);$j("#programInfoContainer").show();$j("a#closeWindow").click(function(){smoke.close();});}});}
function doFavorite(programId){$j.ajax({type:"POST",url:"http://"+location.hostname+"/favorite?oid="+programId,success:function(response){$j(response).find("message").each(function(){var message=$j(this).text();if(message=="ok"){window.location.reload(true);}else{var tokens=message.split(":");var reason=tokens[1];if(reason=="login"){var signInMsg="<p class='notice'>T&auml;m&auml; toiminto on tarkoitettu vain Telkun rekister&ouml;ityneille k&auml;ytt&auml;jille. <br /><br />Mik&auml;li sinulla jo on k&auml;ytt&auml;j&auml;tunnus, voit kirjautua sis&auml;&auml;n p&auml;&auml;ikkunan oikeassa laidassa olevalla lomakkeella. Jos et ole viel&auml; rekister&ouml;itynyt Telkun k&auml;ytt&auml;j&auml;ksi voit tehd&auml; sen ilmaiseksi <a href='telkku?tila=rekisteroitymislomake' target='_blank'>t&auml;&auml;lt&auml;</a>.</p>";$j("#description").html(signInMsg);}else if(reason=="db"){var dbMsg="<p class='notice'>Tietokantavirhe! Yrit&auml; my&ouml;hemmin uudelleen.</p>";$j("#description").html(dbMsg);}}});}});}
function removeFavorite(programId){$j.ajax({type:"POST",url:"http://"+location.hostname+"/favorite?action=remove&oid="+programId,success:function(response){$j(response).find("message").each(function(){var message=$j(this).text();if(message=="ok"){window.location.reload(true);}else{}});}});}
$j(document).ready(function(){var opacityOverlay=$j("#opacityOverlay");var programInfoContainer=$j("#programInfoContainer");if(user!=null){if(user.hasJavascript()){$j("#ohjelmataulu td a").addClass("programInfo").attr("href","#");}}
$j("a.programInfo").click(function(e){var programId=$j(this).attr("id");programId=programId.replace("oid","");var program=new ProgramContent("#programContent","oid="+programId+"&username="+user.getUsername());smoke.open(program,fallbackContent,programInfoFrame,loader);return false;});});;var user=new User();;var smokeFadeTime=500;var smokeOpacity=0.7;function openSmokeScreen(ajaxUrl){var opacityOverlay=$j("#opacityOverlay");var mediaOverlay=$j("#mediaOverlay");opacityOverlay.width(screen.width).height(screen.height);mediaOverlay.load("http://"+location.hostname+"/Smokescreen/smoke",{video:ajaxUrl},function(){opacityOverlay.show().fadeTo(smokeFadeTime,smokeOpacity,function(){$j("#silverScreenSlot").hide();$j("#topBanner").hide();$j("#tickerBanner").hide();mediaOverlay.show();});});}
function closeSmokeScreen(){var opacityOverlay=$j("#opacityOverlay");var mediaOverlay=$j("#mediaOverlay");opacityOverlay.fadeTo(smokeFadeTime,0,function(){opacityOverlay.hide()
mediaOverlay.hide();$j("#silverScreenSlot").show();$j("#topBanner").show();$j("#tickerBanner").show();});};var baseUrl="http://images.telkku.com/navi/";function loadCss(cssFile){var cssElement=document.createElement("link");cssElement.setAttribute("rel","stylesheet");cssElement.setAttribute("type","text/css");cssElement.setAttribute("href",cssFile);document.getElementsByTagName("head")[0].appendChild(cssElement);}
function addBranding(brand,logoWidth,bannerHtml){var url=baseUrl+brand+"/";loadCss("http://images.telkku.com/navi/override-css.php?brand="+brand+"&w="+logoWidth);$j("#createAccountBtn a img").attr("src",url+"create_account.gif");$j("#loginBtn img").attr("src",url+"login.gif");$j("#logoutBtn a img").attr("src",url+"logout.gif");$j("#settingsBtn a img").attr("src",url+"settings.gif");$j("#brandnavContainer").append(bannerHtml);if(jQuery.browser.msie){$j("#brandnavContainer img").css("left","-3px").css("position","relative");}}
var bannerHtml="<a href='http://www.telkku.com/klikkaus?tunniste=netanttilabrandnav'><img src='http://images.telkku.com/bannerit/anttilaNavi/anttila_banneri.gif'></a>";
