/**
*
*  Author:
*  Fabio Baleani, fable80@hotmail.it
*
*/

function getPageHeightWithScroll(){
	if (window.innerHeight && window.scrollMaxY) yWithScroll = window.innerHeight + window.scrollMaxY; //FF
	else if (document.body.scrollHeight > document.body.offsetHeight) yWithScroll = document.body.scrollHeight; // all but Explorer Mac
	else yWithScroll = document.documentElement.scrollHeight; // IE6 Strict, Mozilla (not FF) and Safari
	
	return yWithScroll;
}

var Step = Class.create({ 
						
	values: new Hash(),
	
	initialize: function(_firstStep){
		this.changeTo(_firstStep);
	},
	
	changeTo: function(_step){
		switch (_step)
		{
		case 1: {
			$("tutorial").update("Seleziona sulla cartina l'area geografica della tua startup");
			break;
			}
		case 2: {
			$("tutorial").update("Inserisci il capitale di cui hai bisogno (numero intero o decimale, max 2 mln)");
			new Effect.Move("freccia", { x: 210, y: $("freccia").offsetTop, mode: 'absolute' });
			break;
			}
		case 3: {
			$("tutorial").update("Seleziona il settore di attivitą della tua startup");
			new Effect.Move("freccia", { x: 450, y: $("freccia").offsetTop, mode: 'absolute' });
			break;
			}
		case 4: {
			$("tutorial").update("Seleziona il tipo di operatore (privato, pubblico o entrambi)");
			new Effect.Move("freccia", { x: 677, y: $("freccia").offsetTop, mode: 'absolute' });
			break;
			}
		default: {$("tutorial").update(""); break }
		}
		
		for(var c=0;c<4;c++){
			if(c+1!=_step){
				new Effect.Opacity("step"+(c+1), {duration:0.5, to:0.3});
				$("curtain"+(c+1)).style.display="block";
			}
			else{
				new Effect.Opacity("step"+(c+1), {duration:0.5, to:1});
				$("curtain"+(c+1)).style.display="none";
			}
		}

	},
	
	setValue: function(_step,_value){
		this.values.set( _step,_value);
		if(_step=='operator') {
			window.open('result.php?location='+this.values.get('location')+'&venture='+this.values.get('venture')+'&area='+this.values.get('area')+'&operator='+this.values.get('operator'),'_self'); 
		}
	}
  
});