
function showplaylist()
{if(document.getElementById('VAMPL'))
document.getElementById('VAMPL').style.display='none';document.getElementById('pageplaylist').style.display='block';var numpl=document.getElementById('num_playlist').value;window.setTimeout("showeachplaylist('"+numpl+"','1')",90);}
function showeachplaylist(numpl,x)
{if(x<=numpl)
{if(document.getElementById('plc'+x))
document.getElementById('plc'+x).style.display='block';var newx=parseInt(x)+1;window.setTimeout("showeachplaylist('"+numpl+"','"+newx+"')",90);}}
function checkplaylist()
{if(document.getElementById('playlistitems').value=='')
{if(document.getElementById('isie6').value==1)
{document.getElementById('popup').style.position='absolute';document.getElementById('popup').style.width="550px";}
document.getElementById('msgplaylist1').style.display='block';document.getElementById('msgplaylist1').innerHTML=document.getElementById('playlist_msg').value;window.setTimeout('closemsgpl()',1000);}}
function calloverlay()
{if(document.getElementById('playlistitems').value!='')
{if(document.getElementById('isie6').value==1)
{document.getElementById('popup').style.position='absolute';document.getElementById('popup').style.width="550px";}
var present_email=document.getElementById("pl_emails1").value;document.getElementById("popup").style.display='block';document.getElementById("pll_emails1").value=present_email;}}
function test(p)
{alert(p);}
var currentPosition=0;var startTime=0;var isVideoStarted=false;var mediaplayer=null;var currentState="";function playerReady(thePlayer){mediaplayer=window.document[thePlayer.id];addListeners();}
function createPlayer(vid){var videoSrc='';var videoType='';var flashvars={videoSrc:videoSrc,videoType:videoType};var attributes={};var params={menu:"false",allowScriptAccess:"always",allowFullScreen:"true",wmode:"transparent"};swfobject.embedSWF(MP_ROOTPATH+'members/mediaplayer.swf?id='+VERSION,"player","540","325","9.0.0","_assets/swf/expressInstall.swf",flashvars,params,attributes);SWFID="player";}
function createPlayerReload(videoSrc,videoType,brightcovePlayerID){var flashvars={videoSrc:videoSrc,videoType:videoType,brightcovePlayerID:brightcovePlayerID};var attributes={};var params={menu:"false",allowScriptAccess:"always",allowFullScreen:"true",wmode:"transparent"};swfobject.embedSWF(MP_ROOTPATH+'members/mediaplayer.swf?id='+VERSION,"player","540","325","9.0.0","_assets/swf/expressInstall.swf",flashvars,params,attributes);SWFID="player";}
function createPlayer1(vid){var s1=new SWFObject(MP_ROOTPATH+'members/mediaplayer.swf','mediaplayer','540','325','9');s1.addParam('allowfullscreen','true');s1.addParam('allowscriptaccess','always');s1.addParam('allownetworking','all');s1.addParam('flashvars','file='+vid+'&autostart=true&backcolor=000000&frontcolor=ffffff&usefullscreen=false&lightcolor=ffffff');s1.write('player');}
function play(video){if(mediaplayer){mediaplayer.sendEvent("LOAD",video);}else{setTimeout("play('"+video+"')",100);}}
function seek(position){if(isVideoStarted){mediaplayer.sendEvent("SEEK",position);}else{setTimeout("seek("+position+")",100);}}
function playandseek(video,position){createPlayer(video);isVideoStarted=false;seek(position);}
function addListeners(){if(mediaplayer){mediaplayer.addModelListener("TIME","positionListener");}else{setTimeout("addListeners()",100);}}
function metaListener(obj){}
function stateListener(obj){}
function loadedListener(obj){}
function positionListener(obj){currentPosition=obj.position;if(currentPosition>0&&!isVideoStarted)
{isVideoStarted=true;}
var tmp=document.getElementById("tim");if(tmp){tmp.innerHTML=currentPosition;}}
function playornotplay(vid,videoID,brightcovePlayerID)
{try{document.getElementById('showvideo').style.height='100%';document.getElementById('showvideo').style.visibility='visible';document.getElementById('showvideo').style.display='block';document.getElementById('player').style.visibility='visible';document.getElementById('vid').style.marginTop="0px";document.getElementById('exportdiv').style.display='none';document.getElementById('export_closelink').style.display='none';}catch(e){}
var videoType='moodio';if(vid.search("www.youtube.com")!=-1){var veideo_temp=vid.split('?v=');vid=veideo_temp[1];videoType='youtube';}else if(vid.search("vimeo.com")!=-1){var veideo_temp=vid.split('vimeo.com/');vid=veideo_temp[1];videoType='vimeo';}
if(brightcovePlayerID>0&&brightcovePlayerID!=5){videoType='brightcove';var temp=brightcovePlayerID;brightcovePlayerID=vid;vid=temp;}
if(brightcovePlayerID==5){videoType='livestream';brightcovePlayerID='';}
try{selectMovie('player').loadVideo(vid,videoType,brightcovePlayerID);}catch(e){createPlayerReload(vid,videoType,brightcovePlayerID);}
if($('#ses_userid').val()!=$('#page_userid').val()||$('#ses_userid').val()==''){$("#thumbPL").hide();$("#listPL").show();setplaylistMP(videoID);}}
function closevideosection()
{document.getElementById('showvideo').style.visibility='hidden';document.getElementById('showvideo_header').style.visibility='hidden';document.getElementById('player').style.visibility='hidden';document.getElementById('player').style.height='100px';document.getElementById('vid').style.marginTop="-170px";document.getElementById('pageplaylist1').style.top='-34px';if(mediaplayer){mediaplayer.sendEvent("PLAY",false);}}
function stripslashes(str){return(str+'').replace('/\0/g','0').replace('/\(.)/g','$1');}
function videoname_click(name)
{document.getElementById('videoname_click1').innerHTML=stripslashes(name);document.getElementById('videoname_click').innerHTML=stripslashes(name);}
function videoname_click_description(des)
{des=des.replace(/\[DC\]/gi,'"');document.getElementById('videodescription').innerHTML=stripslashes(des);}
function setnumofcomments(numcomments)
{document.getElementById('num_comments').innerHTML=stripslashes(numcomments);document.getElementById('maindiv_player_menu1').style.display='none';}
function setrating(rate)
{var ratestr='';for(var i=1;i<=rate;i++)
{ratestr=ratestr+"<img src='"+ajax_url+"images/small_blue_star.gif' alt='[*]'/>";}
for(var j=i;j<=5;j++)
{ratestr=ratestr+"<img src='"+ajax_url+"images/small_black_star.gif' alt='[*]'/>";}
document.getElementById('setrating').innerHTML=ratestr;}
function setdatecity(data)
{document.getElementById('citydate').innerHTML=stripslashes(data);}
function settags(tags)
{document.getElementById('vid_tags').innerHTML=stripslashes(tags);}
function showvideostoadd()
{document.getElementById('addvideos').style.display='block';}
function showvideo()
{var video_string=document.getElementById('video').value;document.getElementById('videos_sestion').innerHTML=video_string;}
function disabledit()
{document.getElementById('createvideo').value='Loadin....';document.getElementById('createvideo').disabled=true;}
function hidevideobox()
{document.getElementById('showvideo').style.visibility='hidden';document.getElementById('showvideo_header').style.visibility='hidden';document.getElementById('player').style.visibility='hidden';document.getElementById('player').style.height='100px';document.getElementById('vid').style.marginTop="-170px";if(mediaplayer){mediaplayer.sendEvent("PLAY",false);}}
function showtooltip(tooltipid)
{document.getElementById("tooltip"+tooltipid).value=1;if(document.getElementById("whichdiv_to_move").value=='')
window.setTimeout("showtooltip1('"+tooltipid+"')",400);}
function showtooltip1(tooltipid)
{if(document.getElementById("tooltip"+tooltipid).value==1&&document.getElementById("whichdiv_to_move").value=='')
{document.getElementById("tool"+tooltipid).style.display='block';}}
function showhidePLHelp()
{if(document.getElementById('pl_help_section').style.display=='none')
document.getElementById('pl_help_section').style.display='block';else
document.getElementById('pl_help_section').style.display='none';}
function selectMovie(movieName)
{if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}
function streamPlay(value){selectMovie(value).playVideo();}
function streamPause(value){selectMovie(value).pauseVideo();}
function setPlayerLoaded()
{}
function add_sitename_embedcode(sitename){var replace="&siteName="+encodeURIComponent(sitename)+"&lang";var subject=document.getElementById('hid_emb_code').value;var str=subject.replace(/&lang/gi,replace);document.getElementById('emb_code').value=str;document.getElementById('v_export_overlay').style.display="none";}
function add_sitename_other(obj){if(obj.value!=""&&obj.value!="www.sitename.com"){var strRegex=new RegExp("^(https:\/\/|http:\/\/|http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");if(strRegex.test(obj.value)){add_sitename_embedcode(obj.value);document.getElementById('expt_new_btn').style.display='block';document.getElementById('v_other_export').style.display='none';document.getElementById('emb_code').select();document.getElementById('hid_video_emb_code_url').value=obj.value;}else{document.getElementById('txt_other_site').style.borderColor='#FF0000';}}}
function show_exist_video_embed_code()
{document.getElementById('v_other_export').style.display='none';document.getElementById('txt_other_site').value=document.getElementById('hid_video_emb_code_url').value
document.getElementById('txt_other_site').style.borderColor='#C5C5C5';}
function get_export_other(){document.getElementById('v_other_export').style.display='block';document.getElementById('txt_other_site').value='www.sitename.com';document.getElementById('txt_other_site').style.borderColor='#C5C5C5';}
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';}}