function initForms(){
	aInput = document.getElementsByTagName("input")
	aTextAreas = document.getElementsByTagName("textarea")
	aButtons = [];
	aText = [];
	
	for (var i=0; i<aInput.length; i++){
		switch(aInput[i].type){
			case 'text':
				aText[aText.length] = aInput[i];
				break;
			case 'password':
				aText[aText.length] = aInput[i];
				break;	
			case 'button':
				aButtons[aButtons.length] = aInput[i];
				break;
		}
	}
	
	for (var i=0; i<aButtons.length; i++){
		aButtons[i].onmouseover = function(){
			this.className = 'buttonhover'
		}
		aButtons[i].onmouseout = function(){
			this.className = 'button'
		}
	}
	
	for (var i=0; i<aText.length; i++){
		aText[i].onfocus = function(){
			this.className = 'textfocus'
		}
		aText[i].onblur = function(){
			this.className = 'text'
		}
	}

	for (var i=0; i<aTextAreas.length; i++){
		aTextAreas[i].onfocus = function(){
			this.className = 'textfocus'
		}
		aTextAreas[i].onblur = function(){
			this.className = 'text'
		}
	}		

}

function form1_validator(formid){

myform = document.getElementById(formid);
//controllo email
	if(myform.mittente.value == "" || myform.mittente.value.indexOf('@') < 0 || myform.mittente.value.indexOf('.') < 0 || myform.mittente.value.length < 6){
	    alert("Inserire un indirizzo e-mail valido");
	    myform.mittente.focus();
		return;
  	}
	
	//controllo oggetto
	if (myform.oggetto.value == ""){
		alert("Inserire l'oggetto del messaggio");
		myform.oggetto.focus();
		return;
	}
	
	//controllo testo
	if (myform.corpo.value == ""){
	    alert("Inserire il testo del messaggio");
	    myform.corpo.focus();
		return;
	}
	
	myform.submit();
}

function validateGuestBookForm(formid){

myform = document.getElementById(formid);
//controllo email
	
	
	//controllo oggetto
	if (myform.name.value == ""){
		alert("Inserire il proprio nome");
		myform.name.focus();
		return;
	}
	
	if(myform.email.value == "" || myform.email.value.indexOf('@') < 0 || myform.email.value.indexOf('.') < 0 || myform.email.value.length < 6){
	    alert("Inserire un indirizzo e-mail valido");
	    myform.email.focus();
		return;
  	}
	
	//controllo testo
	if (myform.message.value == ""){
	    alert("Inserire il testo del messaggio");
	    myform.message.focus();
		return;
	}
	
	myform.submit();
}

function fullScreen(theURL) {

window.open(theURL, '', 'fullscreen=yes, scrollbars=yes, width=' + screen.width + ', height='+ screen.height);
}
