
/*-----------------------------
	Set Msg Div 
-----------------------------*/

function getUrlVars(){    
	
	var vars = [], hash;    
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');     
	
	for(var i = 0; i < hashes.length; i++)    {
		
		hash = hashes[i].split('=');        
		vars.push(hash[0]);        
		vars[hash[0]] = hash[1];
	}    
	
	return vars;
}



var hash = getUrlVars();



function setMsg(){
	
	var message = [];
	message[0] = "Operazione effettuata con successo";
	message[1] = "Le Password non corrispondono";
	message[2] = "Username gi&aacute; presente";
	message[3] = "Codice di verifica non valido";
	message[4] = "Tutti i campi sono obbligatori";
	message[5] = "Indirizzo mail non valido oppure gli indirizzi mail non coincidono";
	message[6] = "Accetta i termini e Abilita il trattamento dei dati";
	message[7] = "Invito inviato ai tuoi amici";
	
	if((hash['msg']) && (message[hash['msg']])){
		
		document.getElementById("msg").setAttribute((document.all ? 'className' : 'class'), 'alert');	
		document.getElementById("msg").innerHTML=message[hash['msg']];	
	}
}


/*-----------------------------
	Set Data 
-----------------------------*/

var i=0;


function setI(a){
	i = a-1;	
}
function setData(){
	
	option = document.getElementById('day').selectedIndex;
	day = document.getElementById('day').options[option].value;
	
	option = document.getElementById('month').selectedIndex;
	month = document.getElementById('month').options[option].value;
	
	option = document.getElementById('year').selectedIndex;
	year = document.getElementById('year').options[option].value;
	
	document.getElementById("data").value = day+"-"+month+"-"+year;
}



function addInput(){
	
	document.getElementById('invita').innerHTML += '<input name="amico'+i+'" type="text" class="inputBox" value="Nome Amico" onfocus="this.value=\'\'"/> <input name="mail'+i+'" type="text" class="inputBox" value="La Sua Mail" onfocus="this.value=\'\'" />';
	
	i++;
	
	document.getElementById("inviti").value = i + 1;
	
}