function UserProfile()
{
    this.request				= BASE_URL + 'indexajax.php?action=Friends';
}

UserProfile.prototype.reportViolation = function(id, login) 
{
	var ajaxResponseErrors 	= null;
	var request = BASE_URL + 'indexajax.php?action=USRAdvice&start=add';
	
	request += '&usra_code=NDT';
	request += '&usra_subject=Zgłoszenie nadurzycia w profilu';
	request += '&usra_description=' + login + ' - '+ id;
	request += '&usrzu_id='+ id;
	
	$.ajax({
		type: "get",
		url: request,
		dataType: "xml",
		global: false,
		success: function(xml)
		{
			$("response > result", xml).each ( function() {
				ajaxResponseErrors = ($(this).text());
			});
	
			if(ajaxResponseErrors == 1)	{
				element = $('#zglos-naduzycie');
                element.after('Zgłoszono nadużycie');
                element.remove();
				msginfo("Zgłoszenie zostało wysłane");
			} else {
				msginfo("Nie możesz zgłosić nadużycia na samego siebie");
			}
		}
	});
}

UserProfile.prototype.invite = function(id) 
{
	var obj		    		= this;
	var argv		    	= arguments;
	var ajaxResponseErrors 	= null;
	var request = this.request;
	
	request += '&start=invite';
	request += '&id=' + id;
	
	$.ajax({
		type: "get",
		url: request,
		dataType: "xml",
		global: false,
		success: function(xml)
		{
			$("response > error", xml).each ( function() {
				ajaxResponseErrors = ($(this).text());
			});
	
			if(ajaxResponseErrors == 0)	{
				$('#zapros-mnie').text("Zaproszenie zostało wysłane");
				msginfo("Zaproszenie zostało wysłane");
			} else if(ajaxResponseErrors == 1) {
				new UserLogin().show(function(){argv.callee.apply(obj,argv)});
			} else if(ajaxResponseErrors == 2) {
				msginfo("Nie można zaprosić samego siebie");
			} else if(ajaxResponseErrors == 3) {
				msginfo("Nie można zaprosić blokowanej osoby");
			} else if(ajaxResponseErrors == 4) {
				msginfo("Osoba zablokowała Cię, nie możesz jej zaprosić");
			} else if(ajaxResponseErrors == 5) {
				msginfo("Już jesteście znajomymi!");
			}
		}
	});
}

UserProfile.prototype.ban = function(id) 
{
	var obj		    		= this;
	var argv		    	= arguments;
	var ajaxResponseErrors 	= null;
	var request = this.request;
	
	request += '&start=ban';
	request += '&id=' + id;
	
	$.ajax({
		type: "get",
		url: request,
		dataType: "xml",
		global: false,
		success: function(xml)
		{
			$("response > error", xml).each ( function() {
				ajaxResponseErrors = ($(this).text());
			});
	
			if(ajaxResponseErrors == 0)	{
				$('#zablokuj').hide();
				$('#odblokuj').show();
				msginfo("Użytkownik został zablokowany");
			} else if(ajaxResponseErrors == 1) {
				new UserLogin().show(function(){argv.callee.apply(obj,argv)});
			} else if(ajaxResponseErrors == 2) {
				msginfo("Nie można zablokować samego siebie");
			}
		}
	});
}

UserProfile.prototype.unBan = function(id) 
{
	var obj		    		= this;
	var argv		    	= arguments;
	var ajaxResponseErrors 	= null;
	var request = this.request;
	
	request += '&start=unBan';
	request += '&id=' + id;
	
	$.ajax({
		type: "get",
		url: request,
		dataType: "xml",
		global: false,
		success: function(xml)
		{
			$("response > error", xml).each ( function() {
				ajaxResponseErrors = ($(this).text());
			});
	
			if(ajaxResponseErrors == 0)	{
				$('#zablokuj').show();
				$('#odblokuj').hide();
				msginfo("Użytkownik został odblokowany");
			} else if(ajaxResponseErrors == 1) {
				new UserLogin().show(function(){argv.callee.apply(obj,argv)});
			} else if(ajaxResponseErrors == 2) {
				msginfo("Nie można odblokować samego siebie");
			}
		}
	});
}
