function addToFavorites(user_id) {
  $.ajax({
	type: "GET",
	url: BASEPATH + 'favorites/create/' + user_id,
	success: function(msg) {
	 // alert(msg);
	 // $('#favourite_added').show();
		Boxy.ask("You have succesfully added this to your favourites!", ["Close"], null, {title: "Add To Favorites",closeable:true,closeText:"[Close]"});

  }});
}

function deleteFavorites(user_id) {
  $.ajax({
	type: "GET",
	url: BASEPATH + 'favorites/delete/' + user_id,
	success: function(msg) {
	 // $('#favourite_added').fadeIn('fast');
	  Boxy.ask("You have succesfully delete this from your favourites!", ["Close"], null, {title: "Delete From Favorites",closeable:true,closeText:"[Close]"});

  }});
}

function setBlockUser(userid)
{
	$.ajax({
	type   : "POST",
	url    : BASEPATH + "Ajax/setBlockUser/" + userid,
	success: function(msg){
					
				   if(msg != ''){
						  if(msg != 'You have successfully blocked this user.'){
							  Boxy.ask(msg, ["Close"], null, {title: "Block User",closeable:true,closeText:"[Close]"});
						  }else{
							  Boxy.ask("You have successfully blocked this user.", ["Close"], null, {title: "Block User",closeable:true,closeText:"[Close]"});
						  }
					 }else{
						 Boxy.ask("Error in blocking user.", ["Close"], null, {title: "Block User",closeable:true,closeText:"[Close]"});
					 }      
								
				}
	});

}

function unBlockUser(userid)
{
	$.ajax({
	type   : "POST",
	url    : BASEPATH + "Ajax/unBlockUser/" + userid,
	success: function(msg){
					
				   if(msg != ''){
						  if(msg != 'You have successfully unblocked the user.'){
							  Boxy.ask("You have successfully unblocked the user.", ["Close"], null, {title: "Unblocking User",closeable:true,closeText:"[Close]"});
						  }else{
							  Boxy.ask("You have successfully unblocked the user.", ["Close"], null, {title: "Unblocking User",closeable:true,closeText:"[Close]"});
						  }
					 }else{
						
						 Boxy.ask("Error in unblocking user.", ["Close"], null, {title: "Unblocking User",closeable:true,closeText:"[Close]"});
					 }      
						  
				}
	});

}

function removeFromFriends(user_id, id) {
  $.ajax({
	type: "GET",
	url: BASEPATH + 'friends/remove/' + user_id,
	success: function(msg) {
	  $("#friend_added").show(); //alert(msg);
	  $('#' + id).show(); 
		  if(msg.substring(0, 5) == 'ERROR') { 
			  if(msg.substring(6, msg.length-1) == ''){
				  Boxy.ask("Oops, try again !!!", ["Close"], null, {title: "Remove From Friends Show",closeable:true,closeText:"[Close]"});
			  }else{
				 
					Boxy.ask(msg.substring(6, msg.length), ["Close"], null, {title: "Remove From Friends Show",closeable:true,closeText:"[Close]"});		  
			  }    
		  }else{
			  Boxy.ask("Your friend has been successfully removed.", ["Close"], null, {title: "Remove From Friends Show",closeable:true,closeText:"[Close]"});		  			  
			  $('#' + id).css('background', '#eee');
			  $('#' + id).fadeOut('normal');
		  }

  }});
}

// Below function removes the connections and shows another layer
function removeFromFriendsShow(user_id, id) {
  $.ajax({
	type: "GET",
	url: BASEPATH + 'friends/remove/' + user_id,
	success: function(msg) {
		$('#' + id).show();
		  if(msg.substring(0, 5) == 'ERROR') { 
			  if(msg.substring(6, msg.length-1) == ''){
				Boxy.ask("Oops, try again !!!", ["Close"], null, {title: "Remove From Friends Show",closeable:true,closeText:"[Close]"});
			  }else{
				Boxy.ask(msg.substring(6, msg.length), ["Close"], null, {title: "Remove From Friends Show",closeable:true,closeText:"[Close]"}); 
			  }    
		  }else{  
			  Boxy.ask("Your friend has been successfully removed.", ["Close"], null, {title: "Remove From Friends Show",closeable:true,closeText:"[Close]"});
		  }

  }});
}

function what_is_both(title)
{
	if(title == 'personal')
	{
		title = "Why create a Personal page? ";
	}
	else
	{
		title="Why create a Professional page?";
	}
	
	img = BASEPATH+"images/registration/why_both.jpg";
	img = '<img width="435" border="0" src="'+img+'"/>';
	Boxy.ask(img, ["Close"], null, {title: title,closeable:true,closeText:"[Close]"});
	$('.question').css('width','435px');
}

function delete_businesses(id) {
	if (confirm("You're about to delete this business lissting. All the information for this business will be deleted. Are you sure?")) {
		$.ajax({ type: "POST",
			     url: BASEPATH + 'businesslistings/delete_business',
			     data: [{name: "bid", value: id}],
			     success: function(data)  {
			     	if (data=="1") 
			     	{
			     		$("#business_"+id).html('');
			     		$("#to_entry_"+id).html('');
			     	}
			   	 }
		});
	}
}