
	// -- run this script on page load
	$(document).ready(function(){
		
		
	});
	
	/**
	 * Function for hiding user
	 */
	function HideUser(userID, user_removed_text)
	{		
		// -- this is performed when admin removes user
		if(userID != "" && userID != null)
		{	
			var url = "generic_functions/hide_user.php";

			// -- seemed to be impossibly difficult to remove user and then redirect user back to userlist
			// -- all other versions of this failed, only using two alerts, first on callback and second after post worked
			// -- currently this works perfectly in Firefox
			// -- in IE this just redirects to front page i.e http://www.jobgo.fi/
			// -- in Safari and Opera it doesn't redirect at all
			$.ajax({
				async: false,
				type: "POST",
				url: url,
				dataType: "text",
				data: "reg_id="+userID
			});
			var redirect_url = "http://"+location.host+"/s.php?srt=us";
			window.location.href = redirect_url;
			alert(user_removed_text);		
		}
		// -- this is performed when user removes him/herself
		else
		{	
			var url = "generic_functions/hide_user.php";
			$.post(url, {}, function(){ location.href="index.php"; });
		}
	}
	
	function HideUserByAdmin(userID, confirm_text, user_removed_text)
	{
		if( confirm( confirm_text ) )
		{
			HideUser(userID, user_removed_text);
			if(!$.browser.mozilla)
			{
				var redirect_url = "http://"+location.host+"/s.php?srt=us";
				if($.browser.opera || $.browser.safari)
					window.location = redirect_url;
				else
					window.location.href = redirect_url;
			}						
			return true;
		}
		
		else return false;
	}
		
	function SwitchFromAgentToUser()
	{
		var url = "generic_functions/switch_from_agent_to_user.php";
		$.post(url, {}, function(){ location.href='index.php'; });
	}