/* (c) 2009 – 2010 TV.PROGRAMEK.CZ – All rights reserved.*/
function _tvp(){
   this.eid=function(id){return document.getElementById(id);}
   this.trim=function(s){return s.replace(/^\s+|\s+$/g,"");}
   var width='300px';
   var height='200px';
   var bc='transparent';
   var ctitle='0066cc';
   var cbar='9dc3e9';
   var stations='ct1 ct2 nova prima';
   this.init=function(params){
      var p=params.split(',');
      for(x=0;x<p.length;x++) {
         var pcode=p[x].split(':');
         try{if(pcode[0]&&pcode[1]) {var ec=this.trim(pcode[0])+'=\''+this.trim(pcode[1])+'\';'; eval(ec);}
         }catch(err){alert(err);}
      }
   }
   this.show=function(){
      var root=this.eid('tvp-root');
      var blcheck=0; if(root) blcheck=root.innerHTML.indexOf('tv program'); 
      //if(root&&blcheck>0){
         root.innerHTML='';
         var ifrm = document.createElement("IFRAME");
         ifrm.id = "_tvp_ifrm";
         ifrm.setAttribute("frameborder","0");ifrm.setAttribute("scrolling","no");ifrm.setAttribute("allowTransparency","true");
         if(bc=='transparent'||bc=='')ifrm.allowTransparency="true";else ifrm.style.background='#'+bc;
         ifrm.frameborder="0"; ifrm.scrolling="no";
         ifrm.width=width;
         if(height=='auto'){var st=stations.split(' ');var ch=24+24+(st.length*19);ifrm.height=ch;}else ifrm.height=height;
         ifrm.style.border='none';
         ifrm.src='http://tv.programek.cz/tv-program-widget/?stations='+stations.replace(/ /gi,"|")+'&opt=ctitle:'+ctitle+'|cbar:'+cbar;
         root.appendChild(ifrm);         
      /*}else{
         root.innerHTML='Neplatna instalace Widgetu pro TV program! Kontaktujte spravce tohoto webu a dejte mu o tom prosim vedet.';
      }*/
   }
}
TVPROGRAM = new _tvp();


