function Errors(){
	this.properties = {
		errorBlockID: 'autogen_error_block',
		errorBlockWidth: '300px',
		showErrorTimeout: 5000
	}

	var _self = this;

	this.errors = {
		success: 'Данные сохранены',
		perm_error: 'Пожалуйста, авторизуйтесь',
		error: 'Ошибка'
	}


	this.Init = function(options){
		_self.properties = $.extend(_self.properties, options);
		_self.create_error_block();
	}

	this.extend_errors = function(errors){
		_self.errors = $.extend(_self.errors, errors);
	}

	this.create_error_block = function(){
		if(!$("#"+_self.properties.errorBlockID).attr("id")){
			$("body").append('<div id="'+_self.properties.errorBlockID+'"></div>');
			$("#"+_self.properties.errorBlockID).css('display', 'none');
			$("#"+_self.properties.errorBlockID).css('position', 'fixed');
			$("#"+_self.properties.errorBlockID).css('z-index', '1000');
			$("#"+_self.properties.errorBlockID).css('width', _self.properties.errorBlockWidth);
		}
	}

	this.show_error_block = function(text, type){
		$("#"+_self.properties.errorBlockID).hide();
		$("#"+_self.properties.errorBlockID).css('right', '10px');

//		var top = $(window).scrollTop() + 10;
		var top = 10;
		$("#"+_self.properties.errorBlockID).css('top', top+'px');

		if(type == 'error'){
			var tpl = '<div class="ajax_notice"><div class="error"><b>Сообщение:</b><br><br>'+text+'</div></div>';
		}else if(type == "success"){
			var tpl = '<div class="ajax_notice"><div class="success"><b>Сообщение:</b><br><br>'+text+'</div></div>';
		}else if(type == "info"){
			var tpl = '<div class="ajax_notice"><div class="info"><b>Сообщение:</b><br><br>'+text+'</div></div>';
		}

		$("#"+_self.properties.errorBlockID).html(tpl);
		$("#"+_self.properties.errorBlockID).fadeIn('slow');

		setTimeout( function(){
			_self.hide_error_block();
		}, _self.properties.showErrorTimeout)

	}

	this.hide_error_block = function(){
		$("#"+_self.properties.errorBlockID).fadeOut('slow');
	}

	_self.Init();

}
