
	function ajaxFaves(show)
	{
		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		StartAction();
		
		$.ajaxFileUpload
		(
			{
				url:'/events/faves.php',
				secureuri:false,
				fileElementId:'id_photo',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							ShowError(data.error);
						}else
						{
							FillSuccess();
							
							if(show == 0)
							{
								document.getElementById('infave').style.visibility = "hidden";
								document.getElementById('infave').style.display = "none";
								document.getElementById('fave').style.visibility = "visible";
								document.getElementById('fave').style.display = "";
							}
							else
							{
								document.getElementById('fave').style.visibility = "hidden";
								document.getElementById('fave').style.display = "none";
								document.getElementById('infave').style.visibility = "visible";
								document.getElementById('infave').style.display = "";
							}
							
							window.setTimeout('FSuccess()',1500);	
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)

		return false;

	}

	function delete_tag(idtag, confirm_txt)
	{
   		var Obj; Obg = 'tag_'+idtag;
		var Result; Result = 'true';
		Result = confirm(confirm_txt);
		
		if(Result)
		{		

		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		StartAction();
				
		document.all.tags_form['id_tag_delete'].value = idtag;
		$.ajaxFileUpload
		(
			{
				url:'/events/delete_tag.php',
				secureuri:false,
				fileElementId:'id_tag_delete',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							ShowError(data.error);
						}else
						{
							FillSuccess();
							window.setTimeout('FSuccess()',1500); document.getElementById(Obg).style.display = "none";
							
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)
	}

	return false;
}

	function delete_group(idphoto, idgroup, confirm_txt)
	{
   		var Obj; Obg = 'group_'+idgroup;
		var Result; Result = 'true';
		Result = confirm(confirm_txt);
		
		if(Result)
		{		

		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		StartAction();
		
		document.all.groups_form['id_group_delete'].value = idgroup;
		document.all.groups_form['id_photo_delete'].value = idphoto;
		$.ajaxFileUpload
		(
			{
				url:'/events/delete_group.php',
				secureuri:false,
				fileElementId:'id_group_delete',
				fileElementId2:'id_photo_delete',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							ShowError(data.error);	
						}else
						{
							FillSuccess();
							window.setTimeout('FSuccess()',1500); 
							
							document.getElementById(Obg).style.display = "none";
							sobj = document.getElementById('item'+idgroup); 
							sobj.style.display = "";
							sobj = document.getElementById('itemin'+idgroup); 
							sobj.style.display = "none";
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)
	}
	return false;
}


function add_show(obj1, obj2, obj3, obj4, show) 
{
	var sobj1 = document.getElementById(obj1);
	var sobj2 = document.getElementById(obj2);
	var sobj3 = document.getElementById(obj3);
	var sobj4 = document.getElementById(obj4);	

	sobj3.style.display = "none";
	sobj4.style.display = "";

	if(show == 0)
	{
		sobj1.style.display = "none";
		sobj2.style.display = "";
	}
	else
	{
		sobj1.style.display = "";
		sobj2.style.display = "none";
	}
	return false;
}

function SelectionAdd(groupto)
{
	var sobj;
	
	sobj = document.getElementById('group'); sobj.value = groupto;

		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		StartAction();
				
		$.ajaxFileUpload
		(
			{
				url:'/events/selectionadd.php',
				secureuri:false,
				fileElementId:'add1',
				fileElementId2:'group',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							ShowError(data.error);	
						}else
						{
							FillSuccess();
							window.setTimeout('FSuccess()',1500);
							document.all.GroupsList.insertAdjacentHTML('AfterEnd', '<div ID="group_'+data.group+'"><li><a class="view_group" href="/group/'+data.group+'">'+data.msg+'</a> <a href="" class="group_delete" onClick="return delete_group('+data.photo+', '+data.group+', \''+data.confirmt+'\');">[x]</a></div>');
							sobj = document.getElementById('item'+groupto); 
							sobj.style.display = "none";
							sobj = document.getElementById('itemin'+groupto); 
							sobj.style.display = "";							
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)

	return false;
}


function SelectionSetAdd(setto)
{
	var sobj;
	
	sobj = document.getElementById('set'); sobj.value = setto;

		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		StartAction();
				
		$.ajaxFileUpload
		(
			{
				url:'/events/selectionsetadd.php',
				secureuri:false,
				fileElementId:'add1',
				fileElementId2:'set',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							ShowError(data.error);	
						}else
						{
							FillSuccess();
							window.setTimeout('FSuccess()',1500);
							document.all.SetsList.insertAdjacentHTML('AfterEnd', '<div ID="set_'+data.set+'"><li><a class="view_group" href="/set/'+data.set+'">'+data.msg+'</a> <a href="" class="group_delete" onClick="return delete_set('+data.photo+', '+data.set+', \''+data.confirmt+'\');">[x]</a></div>');
							sobj = document.getElementById('item'+setto); 
							sobj.style.display = "none"; sobj.style.visibility = "hidden";
							sobj = document.getElementById('itemin'+setto); 
							sobj.style.display = ""; sobj.style.visibility = "visible";								
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)

	return false;
}


	function delete_set(idphoto, idset, confirm_txt)
	{
   		var Obj; Obg = 'set_'+idset;
		var Result; Result = 'true';
		Result = confirm(confirm_txt);
		
		if(Result)
		{		

		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		StartAction();
		
		document.all.sets_form['id_set_delete'].value = idset;
		document.all.sets_form['id_photo_delete'].value = idphoto;
		$.ajaxFileUpload
		(
			{
				url:'/events/delete_set.php',
				secureuri:false,
				fileElementId:'id_set_delete',
				fileElementId2:'id_photo_delete',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							ShowError(data.error);	
						}else
						{
							FillSuccess();
							window.setTimeout('FSuccess()',1500); 
							
							document.getElementById(Obg).style.display = "none";
							sobj = document.getElementById('item'+idset); 
							sobj.style.display = ""; sobj.style.visibility = "visible";
							sobj = document.getElementById('itemin'+idset); 
							sobj.style.display = "none"; sobj.style.visibility = "visible";
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)
	}
	return false;
}