function mediaList(id,d)
{
this.inited=false;
this.cid=id;
this.curidx=-1;
this.dat=null;
this.vidplay=null;
this.total=0;
this.count=0;
this.dispstart=0;
this.doi=d;
//this.stat="";
this.nextpagesize=this.doi.dispcount;
this.initlist=function()
{
var alld="";
var cols=this.doi.dispcols;
var ccol=1;
var cwid=(Math.round(1/cols*100));
alld='
';
var playlist="";
for (x=this.dispstart;x";
alld=alld+''+d+" ";
if(ccol==cols){
alld=alld+"";
ccol=1; }
else
ccol++;
}
alld=alld+"
";
document.getElementById("medialist"+this.cid).innerHTML=alld;
}
this.requestMedia=function()
{
this.dispstart=0;
document.getElementById("medialist"+this.cid).innerHTML="Please Wait...";
var tage=document.getElementById('mediasel'+this.cid+'-tags')
var tag="";
if(tage!=null)
tag=tage.value;
var sort=document.getElementById('mediasel'+this.cid+'-sort').value;
ajaxSend(this.doi.xml+"/xmlxfer?rtype=lib.media&cid="+this.cid+"&cmd=getlist&sort="+sort+"&tag="+tag,{"onComplete":this.doi.updatef});
}
this.hastag=function (mtags,id)
{
for(yy=0;yy0)
{
for(i=0;i'+tg.name;
}
}
if(op!="")
{
op='view all '+op+' ';
document.getElementById("div"+this.cid+"-tagselect").innerHTML=op;;
document.getElementById("div"+this.cid+"-tagdiv").style.display="block";
}
else
document.getElementById("div"+this.cid+"-tagdiv").style.display="none";
this.requestMedia()
}
this.viditema=function(o,idx)
{
var thumb=o.T1;
if(o.TYPE=="2" || (thumb!=null && thumb.indexOf(".mp3")>0))
{
thumb="/i/t/lib/elem.medialib/img/audio.png";
}
else
{
if(thumb!=null && thumb.length>0)
{
var i=thumb.indexOf(".");
if(i>0)
thumb=this.doi.mroot+"i/pdir/"+this.cid+"/"+thumb.substring(0,i)+".jpg";
}
else
thumb="/i/t/lib/elem.medialib/img/video.png";
}
var dv='';
return dv;
}
this.pclip=function()
{
if(this.cvid!=null)
document.getElementById("media"+this.cid+"-"+this.cvid).className="itemdiv";
this.cvid=this.cvid-1;
this.playmedia(this.cvid);
}
this.nclip=function()
{
if(this.cvid!=null)
document.getElementById("media"+this.cid+"-"+this.cvid).className="itemdiv";
this.cvid=this.cvid+1;
this.playmedia(this.cvid);
}
this.updateMediaList=function(res)
{
if(res.responseText.indexOf("err:")!=0)
{
if(res.responseText.indexOf("play.url:")==0)
{
var purl=res.responseText;
var rspit=purl.split(";");
purl=rspit[0].substring(9);
var pidx=rspit[1].substring(9)*1;
this.dat.list[pidx].murl=purl;
this.playmediago(pidx);
}
else
{
if(res.responseText=="")
return;
this.dat=eval('('+res.responseText+')');
this.initlist();
if(this.dat.list!=null && this.dat.list[0].T1!=null && this.dat.list[0].T1.length>0 && this.inited==false)
this.inited=true;
}
}
this.nextprev(this.dat.list.length,this.nextpagesize);
}
this.mediastatus=function(sw)
{
if(sw=="stat:pause")
{
this.stat="pau";
this.mediastatusu();
}
else
{
this.stat="ply";
this.mediastatusu();
}
}
this.mediastatusu=function()
{
if(this.stat=="pau")
document.getElementById("media"+this.cid+"-"+this.cvid).className="itemdiv itemdivp";
else
document.getElementById("media"+this.cid+"-"+this.cvid).className="itemdiv itemdivs";
}
this.playmedia=function(idx)
{
if(this.curidx==idx)
{
if(this.stat=="ply")
m.movieCmd('stop','','','');
else
m.movieCmd('resume','','','');
this.mediastatusu();
return;
}
this.curidx=idx;
if(this.dat.list[idx].T1!=null && this.dat.list[idx].T1.length>0)
{
var mfile=this.dat.list[idx].T1;
if(mfile.indexOf(".mp3")>0 && this.dat.list[idx].VER=="1")
this.playmediago(idx);
else
ajaxSend(this.doi.xml+"/xmlxfer?rtype=lib.media&cid="+this.cid+"&mid="+this.dat.list[idx].IDENTIFIER+"&cmd=geturl&idx="+idx,{"onComplete":this.doi.updatef});
//ajaxSend(this.doi.xml+"/xmlxfer?rtype=lib.media&cid="+this.dat.list[idx].IDENTIFIER+"&cmd=viewct",{"onComplete":this.doi.updatef});
}
else
{
alert("This media file is currently being processed. Please wait for a few minutes and refresh this page.");
}
}
this.getmovieelem=function()
{
var m=document.getElementById("fmplay"+this.cid);
if(!m.movieCmd)
m=document.getElementById("fmplay"+this.cid+"e")
return m;
}
this.playmediago=function(idx)
{
var m=this.getmovieelem();
var mfile=this.dat.list[idx].T1
var previewi=""
var mp=mfile.indexOf(".mp3")
if(mp>0)
preview="/i/t/lib/elem.medialib/img/audio.png";
if(mp>0 && this.dat.list[idx].VER=="1")
fmovie=this.doi.iroot+'/pdir/'+this.cid+'/'+mfile;
else
fmovie=this.dat.list[idx].murl;
//fmovie=this.doi.mroot+'i/pdir/'+this.cid+'/'+mfile+"?adsfasdf=ee";
if(mp>0)
m.movieCmd("setpreview",'','','')
if(this.dat.list[idx].DURATION!=null && this.dat.list[idx].DURATION!="")
m.movieCmd("set.duration",this.dat.list[idx].DURATION/1000,'','')
m.movieCmd('load',fmovie,this.dat.list[idx].TITLE,'');
m.movieCmd('play','','','');
if(this.cvid!=null)
{
var vi=document.getElementById("media"+this.cid+"-"+this.cvid);
if(vi!=null) vi.className="itemdiv";
}
this.cvid=idx;
document.getElementById("media"+this.cid+"-"+this.cvid).className="itemdiv itemdivs";
}
this.ov=function(idx)
{
if(idx!=this.cvid)
document.getElementById("media"+this.cid+"-"+idx).className="itemdiv itemdivh";
}
this.ot=function(idx)
{
if(idx!=this.cvid)
document.getElementById("media"+this.cid+"-"+idx).className="itemdiv";
}
this.updatenextprev=function()
{
var nextstr=" ";
if(this.dispstart>=this.count)
nextstr=nextstr+'Prev ';
startcount=0;
endcount=this.total;
if((this.total/this.count)>20)
{
nstart=this.dispstart-(10*this.count);
nend=1*this.dispstart+(10*this.count);
if(nstart<0)
{
nend=count*20;
nstart=0;
}
if(nend>endcount)
{
nend=Math.round(endcount/this.count)*this.count;
nstart=1*nend-(20*this.count);
}
startcount=nstart;
endcount=nend;
}
if(this.total>this.count)
{
for(i=startcount;i<=endcount;i=i+this.count)
{
ct=Math.round(i/this.count);
if(i==this.dispstart)
{
nextstr=nextstr+'';
nextstr=nextstr+(ct+1);
nextstr=nextstr+" ";
}
else
{
nextstr=nextstr+'';
nextstr=nextstr+(ct+1)+" ";
}
}
}
if(this.total>this.dispstart+this.count)
{
nextstr=nextstr+'Next ';
ndiv=document.getElementById("nextprev"+this.cid+"t");
if(ndiv)
ndiv.innerHTML=nextstr;
ndiv=document.getElementById("nextprev"+this.cid+"b");
if(ndiv)
ndiv.innerHTML=nextstr;
}
else if(feedon==false)
{
//check for feed display
//j$(".nextprev").css("display","none");
}
}
this.jump=function(index){this.dispstart=index;this.initlist();this.updatenextprev()}//this.requestMedia();}
this.nextprev=function(t,c)
{
this.total=t;
this.count=c;
this.updatenextprev();
}
}
if(!Array.indexOf){
Array.prototype.indexOf = function(obj){
for(var i=0; i