







rn.selOn = function() {
	var count=0;
	
	
	$(".uPhotoSmall").find("a").each(
		function ()
		{
			aLinks[count]=$(this).attr("href");
			$(this).attr("href","javascript:;");
			//alert(aLinks[count]);
			count++;			
		}
	);
	
	$('#inList').Selectable(
		{
			accept : 'inElm',
			opacity : 0.5,
			selectedclass : 'selecteditem',
			helperclass : 'selecthelper'

		}
	);		
};				

rn.selOff = function() {
	var count=0;
	$(".uPhotoSmall").find("a").each(
	function ()
		{
			$(this).attr("href",aLinks[count]);
			count++;
		}
	);
	
//need to add custom destroy to interface
//$('#photolistcontainer').SelectableDestroy();
};		
rn.ePX = function() {
	serial = $.Selectserialize('inList');
	if (serial.hash=='')
	{	
		  alert('Select photos to edit by click and drag.');
		  return;
	}
	var tpage=pbwww+"photo/edit/?"+serial.hash;
	window.parent.location = tpage;
};			


rn.ePCX = function() {
	serial = $.Selectserialize('inList');
	if (serial.hash=='')
	{	
		  alert('Select a photo and click Set Cover');
		  return;
	}
	rn.rmsSend({ mod:'album', op:'sC', pi: serial.o[0], ai: currentViewedAlbum},rn.reloadRPC);
};			


rn.mC = function(id,aid) {
	if ($("#newalbum").val()==-1)
	{
		alert('Select a destination category from the drop down.');
		return;
	}
	serial = $.Selectserialize('inList');
	if (serial.o.length<1)
	{	
		  alert('Select photos by click and drag.');
		  return;
	}
	rn.rmsSend({ mod:'album', op:'mC', pl: serial.o, iCatId: $("#newcat").val() },rn.reloadRPC);

};		

rn.pAF = function(oR) {
	var pId=$('#photoid').val();
	rn.rmsSend({ mod:'photo', tar:'photo', op:'pAF', id:pId },rn.pAFr);
};

rn.pRF = function(oR) {
	var pId=$('#photoid').val();
	rn.rmsSend({ mod:'photo', tar:'photo', op:'pRF', id:pId },rn.pRFr);
};

rn.pAFr = function(oRmsR) {
	if (oRmsR['rmsS']==true)
	{
		$('#favtext').html('added to favorites');
		var favcount = parseInt($('#favcount').html());
		$('#favcount').html(favcount+1);
	}
	else if (oRmsR['rmsS']==false)
	{
		alert(oRmsR['rmsM']);
		var pId=$('#favtext').html('added to favorites');
	}	
	else
	{
		alert('Communication Error');			
	}
};	

rn.pRFr = function(oRmsR) {
	if (oRmsR['rmsS']==true)
	{
		$('#favtext').html('removed from favorites');
		var favcount = parseInt($('#favcount').html());
		$('#favcount').html(favcount-1);
	}
	else if (oRmsR['rmsS']==false)
	{
		alert(oRmsR['rmsM']);
		var pId=$('#favtext').html('removed from favorites');
	}	
	else
	{
		alert('Communication Error');			
	}
};
	
rn.pAPOD = function(oR) {
	var pId=$('#photoid').val();
	rn.rmsSend({ mod:'photo', tar:'photo', op:'pAPOD', id:pId },rn.pAPODr);
};

rn.pAPODr = function(oRmsR) {
	if (oRmsR['rmsS']==true)
	{
		$('#podtext').html('set as pod');
	}
	else if (oRmsR['rmsS']==false)
	{
		alert(oRmsR['rmsM']);
	}	
	else
	{
		alert('Communication Error');			
	}
};
	




rn.mA = function(id,aid) {
	if ($("#newalbum").val()==-1)
	{
		alert('Select a destination album from the drop down.');
		return;
	}
	serial = $.Selectserialize('inList');
	if (serial.o.length<1)
	{	
		  alert('Select photos by click and drag.');
		  return;
	}
	rn.rmsSend({ mod:'album', op:'mA', pl: serial.o, id: $("#newalbum").val(), siteid: $("#js_siteid").html(),albumid: $("#js_albumid").html() },rn.reloadRPC);

};		

rn.mC = function(id,aid) {
	if ($("#newalbum").val()==-1)
	{
		alert('Select a destination category from the drop down.');
		return;
	}
	serial = $.Selectserialize('inList');
	if (serial.o.length<1)
	{	
		  alert('Select photos by click and drag.');
		  return;
	}
	rn.rmsSend({ mod:'album', op:'mC', pl: serial.o, iCatId: $("#newcat").val() },rn.reloadRPC);

};	

rn.newA = function() {
	var str=$("#newalbumname").val();
	rn.rmsSend({ mod:'album', op:'newA', name: str },rn.reloadRPC);
};

rn.delA = function(aid) {
	rn.rmsSend({ mod:'album', op:'delA', id: aid },rn.redirectRPC);	
};

rn.renameA = function(o,aid) {
	var str=$("#renamebox").val();
	rn.rmsSend({ mod:'album', op:'renameA', aid: aid, newname: str },rn.redirectRPC);
};

rn.ePFavX = function() {
	serial = $.Selectserialize('inList');
	if (serial.hash=='')
	{	
		  alert('Select photos to remove from favorites by click and drag.');
		  return;
	}
	rn.rmsSend({ mod:'album', op:'removeFav', inList: serial.o },rn.reloadRPC);		
};		



//upload
rn.ulgenid = function(sType,sExtra) {
	rn.rmsSend({ mod:'album', op:'ulgenid', sType:sType, sExtra:sExtra },rn.ulgenid_r);
	return false;
};

rn.ulgenid_r = function(oRmsR) {
	if (oRmsR['rmsS']==true)
	{
		//mysubmit();
		$("input[name=ulid]").val(oRmsR['rmsD']['ulid']);
		//alert(oRmsR['rmsD']['ulid']);
		mysubmit();
		return false;
		//window.parent.location = oRmsR['rmsD']['redirect'];
	}
	else if (oRmsR['rmsS']==false)
	{
		alert(oRmsR['rmsM']);
	}	
	else
	{
		alert('Communication Error');			
	}
};

rn.ulgshid = function() {
	var ulid=$("input[name=ulid]").val();		
	rn.rmsSend({ mod:'album', op:'ulgshid', ulid: ulid },rn.redirectRPC);
};

rn.ulpsid = function() {
	var ulid=$("input[name=ulid]").val();		
	rn.rmsSend({ mod:'album', op:'ulpsid', ulid: ulid },rn.redirectRPC);				
};


rn.ulbsid = function() {
	var ulid=$("input[name=ulid]").val();		
	rn.rmsSend({ mod:'album', op:'ulbsid', ulid: ulid },rn.redirectRPC);				
};



