var AddBlacklistOverlay = function (id) {
	this.overlay = new Overlay(id, {	width: '350px',
										draggable: true,
										visible: false,
										zindex: 1000,
										fixedcenter: true,
										constraintoviewport: true
	});

	// Identifica un overlay a pił passi
	this.overlay.stepOverlay = true;
		
	this.show = function (anchorShow, text, anchorHide) {
		this.overlay.show(null, this.overlay.generateOverlay(text), null);
	};
	
	this.stepOne = function (overlay, t_pid, t_nick, aaa_fn, iconId, pType) {
		this.overlay.scriptUrl = "http://" + conf.baseUrl + "/overlay_manager/aggiungi_blacklist";
		var actionString = 'overlay=' + overlay + '&t_profile_id=' + t_pid + '&t_nick=' + t_nick + '&aaa_fn=' + aaa_fn + (iconId ? '&iconId=' + iconId : '') + (pType ? '&pType=' + pType : '');
		
		// definisce cosa fare nello step 2, in realtą chiama step 2
		this.overlay.setContentByAjax(actionString, null, null, this);
	};
	
	this.stepTwo = function (t_pid, t_nick, iconId, pType) {
		this.overlay.scriptUrl = "http://" + conf.baseUrl + "/gui_manager/aggiungi_blacklist";
		var actionString = 't_profile_id=' + t_pid + '&t_nick=' + t_nick + (iconId ? '&element_id=' + iconId : '') + (pType ? '&pType=' + pType : '');
		
		this.show(null, this.overlay.loaderContent.body, null);
		this.overlay.getResultByAjax(actionString, this, this.setBodyByResult);
	};
	
	this.setBodyByResult = function (obj, pResult) {
		var data = pResult.params;
		var responseText = pResult.header + pResult.body;
		
		UserActions.modified[data.t_profile_id] = obj.overlay.isSuccessResponse(pResult.result);
		obj.show(null, responseText, null);
		
		if(obj.overlay.isSuccessResponse(pResult.result) && data.pType == 'video') obj.changeForVideo(data.t_profile_id, data.t_nick, data.aaa_fn, data.element_id, data.pType);
	};
	
	this.changeForVideo = function (t_pid, t_nick, aaa_fn, elId, pType) {
		YAHOO.util.Dom.get(elId).innerHTML = '<a title="Togli dalla blacklist" class="elimina" href="javascript:UserActions[\'blacklist_remove_on\'](\'' + t_pid + '\', \'' + t_nick + '\', \'' + aaa_fn + '\', \'' + elId + '\', \'' + pType + '\');"><span></span></a>';		
	};
};