var GrabOverlay = function (id) {
	this.overlay = new Overlay(id, {	width: "250px",
										draggable: true,
										visible: false,
										zindex: 1000,
										fixedcenter: true,
										constraintoviewport: true
	});

	// Metodo di connessione
	this.overlay.connectionMethod = 'POST';
	
	// Chiamata Ajax
	this.overlay.scriptUrl = "http://" +  location.hostname + "/grabbing/step2";
	
	// Riempie la finestra al primo passo
	this.stepOne = function (overlay, email, pwd, disclaimer) {
		// var actionString = 'email=' + email + '&pwd=' + pwd + 'overlay=' + overlay;
		var actionString = 'email=' + email + '&pwd=' + pwd+ '&disclaimer=' + disclaimer;
		this.overlay.setContentByAjax(actionString, null, null, this);
	};	
	
	// Riempie la finestra al secondo passo
	this.stepTwo = function (overlay, uid) {
		var actionString = 'uid=' + uid;
		this.overlay.stepTwo(actionString, null, null, this);
	};
	
	// La variabile text contiene il response della ajaxCall
	this.show = function (anchorShow, text ,anchorHide) {
		this.overlay.show(null, this.overlay.generateOverlay(text), null);
	};
};

OverlayConfiguration.grab = new GrabOverlay('textOverlay');
OverlayManager.grab = function (args) {
	OverlayConfiguration.grab.stepOne('grab', args[0], args[1], args[2]);
};