var iPic=1;
var oPic;
var intPic;

	rn.eVFavX = function() {
	serial = $.Selectserialize('inList');
	if (serial.hash=='')
	{	
		  alert('Select photos to remove from favorites by click and drag.');
		  return;
	}
	rn.rmsSend({ mod:'video', op:'removeFav', inList: serial.o },rn.reloadRPC);		
	};

	rn.vchange = function() {
		
		var st=$(oPic).attr('src');
	 	var ndx = st.search(/-/);
		st=st.substring(ndx+1);
	 	var st = parseInt(st.replace(/-\d.jpg/,''));	
		
		
		$(oPic).attr('src','http://209.234.243.165/vt/svt-'+st+'-'+iPic+'.jpg');
		iPic++;
		if (iPic==6) iPic=1;
		clearInterval(intPic);
		intPic=setTimeout("rn.vchange()",700);


	};

	rn.vimgs = function(o) {
		iPic=2;
		oPic=$(o);	
		clearInterval(intPic);
		intPic=setTimeout("rn.vchange()",100);
	};
	rn.vimgt = function(o) {
		iPic=1;
		clearInterval(intPic);
	};	
	
    rn.eVX = function() {
		serial = $.Selectserialize('inList');
		if (serial.hash=='')
		{	
			  alert('Select videos to edit by click and drag.');
			  return;
		}
		var tpage=pbwww+"video/edit/?"+serial.hash;
		window.parent.location = tpage;
	};	
	
    rn.mVA = function(id,aid) {
		if ($("#newalbum").val()==-1)
		{
			alert('Select a destination channel from the drop down.');
			return;
		}
		serial = $.Selectserialize('inList');
		if (serial.o.length<1)
		{	
			  alert('Select videos by click and drag.');
			  return;
		}
		rn.rmsSend({ mod:'video', op:'mVA', pl: serial.o, id: $("#newalbum").val() },rn.reloadRPC);

	};		

    rn.mVC = function(id,aid) {
		if ($("#newcat").val()==-1)
		{
			alert('Select a destination category from the drop down.');
			return;
		}
		serial = $.Selectserialize('inList');
		if (serial.o.length<1)
		{	
			  alert('Select videos by click and drag.');
			  return;
		}
		rn.rmsSend({ mod:'video', op:'mVC', pl: serial.o, iCatId: $("#newcat").val() },rn.reloadRPC);

	};
	
	rn.newVA = function() {
		var str=$("#newalbumname").val();
		rn.rmsSend({ mod:'video', op:'newVA', name: str },rn.reloadRPC);
	};		
	rn.renameVA = function(o,aid) {
		var str=$("#renamebox").val();
		rn.rmsSend({ mod:'video', op:'renameVA', aid: aid, newname: str },rn.redirectRPC);
	};		
    rn.delVA = function(aid) {
		rn.rmsSend({ mod:'video', op:'delVA', id: aid },rn.redirectRPC);		
	};			
	
	rn.ulvsid = function() {
		var ulid=$("input[name=ulid]").val();		
		rn.rmsSend({ mod:'video', op:'ulvsid', ulid: ulid },rn.redirectRPC);				
    };		
	
	rn.pVF = function(oR) {
		var pId=$('#videoid').val();
		rn.rmsSend({ mod:'photo', tar:'video', op:'pVF', id:pId },rn.pVFr);
    };
	rn.pVFr = function(oRmsR) {
		if (oRmsR['rmsS']==true)
		{
			$('#favtext').html('added to favorites');
		}
		else if (oRmsR['rmsS']==false)
		{
			alert(oRmsR['rmsM']);
			var pId=$('#favtext').html('added to favorites');
		}	
		else
		{
			alert('Communication Error');			
		}
    };
	
	rn.voteRecut = function(o) {
		var vid=$('#videoid').val();
		var val=$("input[name='recutvote']:checked").val();	
		rn.rmsSend({ mod:'video', op:'recutvote', vid: vid, val: val  },rn.r_voteRecut);
	};	
	
	rn.r_voteRecut = function(oRmsR) {
		if (oRmsR['rmsS']==true)
		{
			$('#vote1').hide();
			$('#vote2').show();
		}
		else if (oRmsR['rmsS']==false)
		{
			alert(oRmsR['rmsM']);
		}	
		else
		{
			alert('Communication Error');			
		}
	};	
	
	
	
	
	
	