var tvshows=new Array();

function addTVShow(name,images,imagesl){
	 var ob_t=document.getElementById(name+"_text");
	 if(ob_t==null)ob_t=document.getElementByName(name+"_text");

     for(var i=0;i<tvshows.length;i++)
	      if(tvshows[i].name==name){
               tvshows[i].images=images;
               tvshows[i].imagesl=imagesl;
			   tvshows[i].current=0;
               if(ob_t!=null)
                   ob_t.innerText="1/"+images.length;
			   
			   return;
	      }
 
     var ob=new Object();
	 ob.name=name;
	 ob.images=images;
	 ob.imagesl=imagesl;
	 ob.current=0;
	 tvshows[tvshows.length]=ob;
     if(ob_t!=null)
          ob_t.innerText="1/"+ob.images.length;
}

function TVShow_show(name,c){
     var ob=null;
	 for(var i=0;i<tvshows.length;i++)
	     if(tvshows[i].name==name){ob=tvshows[i];break;}
	 if(ob==null)return;
	 if(ob.images.length==0)return;
	 
	 var ob_img=document.getElementById(name);
	 if(ob_img==null)ob_img=document.getElementByName(name);
	 if(ob_img==null)return;
	 
	 ob.current+=c;
	 if(ob.current>=ob.images.length)ob.current=0;
	 if(ob.current<0)ob.current=ob.images.length-1;
	 ob_img.src=ob.images[ob.current];
	 
	 var ob_t=document.getElementById(name+"_text");
	 if(ob_t==null)ob_t=document.getElementByName(name+"_text");
	 if(ob_t!=null)
	     ob_t.innerText=(ob.current+1)+"/"+ob.images.length;
}

function TVShow_showpic(name){
     var ob=null;
	 for(var i=0;i<tvshows.length;i++)
	     if(tvshows[i].name==name){ob=tvshows[i];break;}
	 if(ob==null)return;
	 if(ob.imagesl.length==0)return;
	 
	 ob.current
	 
	 window.open(ob.imagesl[ob.current],null,'toolbar=0,location=no,directories=0,status=0, scrollbars=no,resizable=1,width=400,height=400,top=0,left=0');
}

function TVShow_prev(name){    TVShow_show(name,-1);  }
function TVShow_next(name){    TVShow_show(name, 1);  }
function TVShow_refresh(name){ TVShow_show(name, 0);  }

