var LpOverlay = function (id, close, facebook) {
	this.overlay = new Overlay(id, {	width: '535px',
										draggable: true,
										visible: false,
										close: (close || facebook ? true : false),
										modal : true,
										zindex: 1500,
										fixedcenter: true,
										constraintoviewport: true
	});

	// Identifica un overlay a pił passi
	this.overlay.stepOverlay = true;
	
	this.overlay.onShow(function () {
		YAHOO.util.Cookie.remove("JSESSIONID", { domain: conf.domainUrl, path: '/' + (conf.env == 'pvt' ? 'MM3' : '') });
	});
	
	this.overlay.onClose(function () {
		YAHOO.util.Cookie.remove("JSESSIONID", { domain: conf.domainUrl, path: '/' + (conf.env == 'pvt' ? 'MM3' : '') });
	});
	
	this.show = function (anchorShow, text, anchorHide) {
		this.overlay.show(null, this.overlay.generateOverlay(text), null);
	};
	
	this.firstStep = function (type, encryptedProfileId, params) {
		var epid = encryptedProfileId;
		var actionString = (encryptedProfileId ? ((encryptedProfileId.indexOf('-') < 0 ? 'profile-id=' : 'social_network=Facebook&ext-profile-id=') + epid) : '')
		
		if(params) {
			var tmp = new Array();
			for(var key in params)
				tmp[tmp.length] = key + '=' + params[key];
			if(actionString) actionString += '&';
			actionString += tmp.join('&');
		}
		
		// this.overlay.scriptUrl = this.scriptUrl[type] + (this.encryptedProfileId ? '?profile-id=' + this.encryptedProfileId : '');
		this.overlay.scriptUrl = lpsUrls[type] + '?' + actionString;
		this.overlay.setContentByAjax('', null, null, this);
	};
	
	this.nthStep = function (formName, bname, bvalue, type) {
		this.overlay.scriptUrl = lpsUrls[type] + (this.encryptedProfileId ? '?profile-id=' + this.encryptedProfileId : '');
		// this.overlay.scriptUrl = this.scriptUrl[type] + (this.encryptedProfileId ? '?profile-id=' + this.encryptedProfileId : '');
		var actionString = bname + '=' + bvalue;
		this.overlay.setContentByAjax(actionString, null, null, this, formName, true);
	};
};