
function xmlhttpvdpl(strURL,a){if(a=='addemail'||a=='removeemail')
{}
else
{document.getElementById('loader_playlist1').style.display='block';document.getElementById('playlist_img').style.display='none';}
var xmlHttpReq5=false;var self=this;if(window.XMLHttpRequest){self.xmlHttpReq5=new XMLHttpRequest();}
else if(window.ActiveXObject){self.xmlHttpReq5=new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq5.open('POST',strURL,true);self.xmlHttpReq5.setRequestHeader('Content-Type','application/x-www-form-urlencoded');self.xmlHttpReq5.onreadystatechange=function(){if(self.xmlHttpReq5.readyState==4){updatenextvdpl(self.xmlHttpReq5.responseText);if(a=='addemail'||a=='removeemail')
{}
else
{document.getElementById('loader_playlist1').style.display='none';document.getElementById('playlist_img').style.display='block';}}}
self.xmlHttpReq5.send(getquerynextvdpl(a));}
function closeplaylistdivvid()
{if(document.getElementById('addedvid'))
document.getElementById('addedvid').style.display='none';}
function getquerynextvdpl(a)
{if(a=='drag')
{var mode=document.getElementById('playlist_style').value;var playlistitems=document.getElementById('playlistitems').value;if(playlistitems=='')
{playlistitems=document.getElementById('dragitem').value;}
else
{playlistitems=playlistitems+"*"+document.getElementById('dragitem').value;}
var numemails=document.getElementById('numemails').value;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}
var plli=playlistitems;var done=0;var array2=plli.split("*");var array1=new Array;for(var i=0;i<array2.length;i++)
{var xx=true;var ArrayVal=array2[i];for(var j=i+1;j<array2.length;j++)
{if(array2[j]==ArrayVal)
{xx=false;done=1;}}
if(xx==true)
array1.push(ArrayVal)}
if(done==1)
{window.setTimeout("closeplaylistdivvid()",2200);}
qstr='PL='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;document.getElementById('dragitem').value='';}
if(a=='remove')
{var mode=document.getElementById('playlist_style').value;var removeid=document.getElementById('removepl').value;var playlistitems=document.getElementById('playlistitems').value;var newids=playlistitems.split('*');var playlistitems1='';for(var oid in newids)
{if(oid<newids.length)
{if(newids[oid])
{if(playlistitems1!=''&&newids[oid]!=removeid)
var playlistitems1=playlistitems1+"*"+newids[oid];if(playlistitems1==''&&newids[oid]!=removeid)
var playlistitems1=newids[oid];}}}
playlistitems=playlistitems1;var numemails=document.getElementById('numemails').value;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}
qstr='PL='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;document.getElementById('dragitem').value='';}
if(a=='addemail')
{var mode=document.getElementById('playlist_style').value;var playlistitems=document.getElementById('playlistitems').value;var numemails=1;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}numemails=parseInt(numemails);qstr='PL='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;}
if(a=='removeemail')
{var mode=document.getElementById('playlist_style').value;var playlistitems=document.getElementById('playlistitems').value;var numemails=document.getElementById('numemails').value;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}numemails=parseInt(numemails)-1;qstr='PL='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;}
if(a=='menu')
{var mode=a;var playlistitems=document.getElementById('playlistitems').value;var numemails=document.getElementById('numemails').value;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}numemails=parseInt(numemails);qstr='PL='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;}
if(a=='menu1')
{var mode=document.getElementById('playlist_style').value;;var playlistitems1=document.getElementById('playlistitems').value;var playlistitems1=playlistitems1.split('*');var playlistitems='';for(var a in playlistitems1)
{if(playlistitems1[a]!='')
{if(playlistitems=='')
{playlistitems=playlistitems1[a];}
else
{playlistitems=playlistitems+'*'+playlistitems1[a];}}}
var numemails=1;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}numemails=parseInt(numemails);qstr='PL='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;}
if(a=='list')
{var mode=a;var playlistitems=document.getElementById('playlistitems').value;var numemails=document.getElementById('numemails').value;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}numemails=parseInt(numemails);qstr='PL='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;}
if(a=='sendemail')
{var mode=document.getElementById('playlist_style').value;;var playlistitems=document.getElementById('playlistitems').value;var numemails=document.getElementById('numemails').value;var emailstr='';for(var e=1;e<=numemails;e++)
{if(e==1)
{var emailstr=document.getElementById('pl_emails'+e).value;}
else
{var emailstr=emailstr+"*"+document.getElementById('pl_emails'+e).value;}}numemails=parseInt(numemails);qstr='sendemail='+escape(mode)+"|"+escape(playlistitems)+"|"+escape(numemails)+"|"+emailstr;window.setTimeout('closemsg_emails()',1011);}
if(a=='saveplaylist')
{var playlistname=document.getElementById('saveplaylist').value;var playlistitems=document.getElementById('playlistitems').value;var mempageid=document.getElementById('session_page_id').value;qstr='saveplaylist='+escape(playlistname)+"[**]"+escape(playlistitems)+"[**]"+escape(mempageid);window.setTimeout('showdet()',900);}
if(a=='removeall')
{var mode=document.getElementById('playlist_style').value;document.getElementById('dragitem').value='';qstr='removeall='+escape(mode)}
return qstr;}
function showdet()
{document.getElementById('createplaylist').style.display='none';document.getElementById('msgplaylist').style.display='block';window.setTimeout('closemsg4()',1411);}
function closemsg4()
{document.getElementById('createplaylist').style.display='block';document.getElementById('msgplaylist').style.display='none';}
function updatenextvdpl(str){document.getElementById("myPlaylist").innerHTML=str;}
function addtoplaylist()
{if(document.getElementById('dragitem').value!='')
{javascript:xmlhttpvdpl(ajax_url+'myplaylist.php','drag');}}
function playplaylist(x)
{if(document.getElementById('playlist_style').value=='menu')
{if(document.getElementById('playplaylist').value==1)
{if(x=='1')
{document.getElementById('lastplaylistbox').style.backgroundImage='url('+WEBTV_AJAXPATH+'images/thumbnail_moodio_background_active.gif)';window.setTimeout("playplaylist('2')",200);}
if(x=='2')
{document.getElementById('lastplaylistbox').style.backgroundImage='url('+WEBTV_AJAXPATH+'images/old_thumbnail_moodio_background.gif)';window.setTimeout("playplaylist('1')",200);}}
else
{document.getElementById('lastplaylistbox').style.backgroundImage='url('+WEBTV_AJAXPATH+'images/old_thumbnail_moodio_background.gif)';document.getElementById('playplaylist').value=0;}}
if(document.getElementById('playlist_style').value=='list')
{if(document.getElementById('playplaylist').value==1)
{if(x=='1')
{document.getElementById('lastplaylistbox1').style.backgroundImage='url('+WEBTV_AJAXPATH+'images/mini_thumbnail_moodio_background_active.gif)';window.setTimeout("playplaylist('2')",200);}
if(x=='2')
{document.getElementById('lastplaylistbox1').style.backgroundImage='url('+WEBTV_AJAXPATH+'images/empty_mini_thumbnail_background.gif)';window.setTimeout("playplaylist('1')",200);}}
else
{document.getElementById('lastplaylistbox1').style.backgroundImage='url('+WEBTV_AJAXPATH+'images/empty_mini_thumbnail_background.gif)';document.getElementById('playplaylist').value=0;}}}
function deletenow()
{javascript:xmlhttpvdpl(ajax_url+'myplaylist.php','remove')}
function deleteachplaylist()
{window.setTimeout('deletenow()',400)}
function changeplaylistsave(x)
{}
function changeplaylistsave1(y,a,b)
{if(document.getElementById('playlistitems').value!='')
{var c=document.getElementById('session_page_id').value;xmlhttpvdidemail_PL(a,'addtoplaylist',b,c);}
else
{document.getElementById('msgplaylist2').style.display='block';document.getElementById('msgplaylist2').innerHTML=document.getElementById('playlisterror1').value;window.setTimeout('closemsg1()',1700);}}
function closemsg1()
{document.getElementById('msgplaylist2').style.display='none';}
function hideshowplaylist()
{var done=0;if(document.getElementById('playlist').style.display=='block')
{done=1;document.getElementById('playlist').style.display='none';document.getElementById('playlist_img').src=ajax_url1+'signin/images/plus.gif';}
if(document.getElementById('playlist').style.display=='none'&&done==0)
{document.getElementById('playlist').style.display='block';document.getElementById('playlist_img').src=ajax_url1+'signin/images/minus.gif';}}