function check_occupanti_camere(var1,var2)
	{
	var min = document.bol_motorebooking[var1].value;
	if (document.bol_motorebooking[var2].value > document.bol_motorebooking[var1].value)
		{
		alert("Numero camere superiore al numero degli occupanti");
		document.bol_motorebooking[var2].value = min;
		}
	}

function check_camere_occupanti(var1,var2)
	{
	var min = document.bol_motorebooking[var1].value;
	if (document.bol_motorebooking[var2].value < document.bol_motorebooking[var1].value)
		{
		alert("Numero occupanti inferiore al numero delle camere");
		document.bol_motorebooking[var2].value = min;
		}
	}

function check_occupanti_camere_formail(var1,var2)
	{
	var min = document.form1[var1].value;
	if (document.form1[var2].value > document.form1[var1].value)
		{
		alert("Numero camere superiore al numero degli occupanti");
		document.form1[var2].value = min;
		}
	}

function check_camere_occupanti_formail(var1,var2)
	{
	var min = document.form1[var1].value;
	if (document.form1[var2].value < document.form1[var1].value)
		{
		alert("Numero occupanti inferiore al numero delle camere");
		document.form1[var2].value = min;
		}
	}


function startLoad()
{
	var loader = document.createElement('div');
	loader.setAttribute('id', 'loader');
	document.body.appendChild(loader);
	
	var loaderBox = document.createElement('div');
	loaderBox.setAttribute('id', 'loader-box');
	document.body.appendChild(loaderBox);
	
	var loaderAnim = document.createElement('ul');
	loaderAnim.setAttribute('id', 'loader-anim');
	loaderAnim.innerHTML = '<li id="loader-item-0"></li><li id="loader-item-1"></li><li id="loader-item-2"></li><li id="loader-item-3"></li><li id="loader-item-4"></li>';
	document.getElementById('loader-box').appendChild(loaderAnim);
	
	setInterval('loaderChange()', 400);
}

var loaderItemSelected = 0;
function loaderChange()
{
	for(x = 0; x < 5; x++)
	{
		if(x != loaderItemSelected)
		{
			document.getElementById('loader-item-' + x).style.backgroundColor = '#333333';
		}
		else
		{
			document.getElementById('loader-item-' + x).style.backgroundColor = '#FFFFFF';
		}
	}
	
	loaderItemSelected = ++loaderItemSelected % 5;
}

function verify_motorepiccolo() 
	{
	var themessage = "I seguenti campi sono obbligatori: ";
	if (document.bol_motorebooking.start_date.value=="") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.bol_motorebooking.start_date.value=="gg/mm/aaaa") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.bol_motorebooking.end_date.value=="")
		{
		themessage = themessage + " - Data partenza";
		}
	if (document.bol_motorebooking.end_date.value=="gg/mm/aaaa")
		{
		themessage = themessage + " - Data partenza";
		}
	if (document.bol_motorebooking.comune_motore.value=="")
		{
		themessage = themessage + " - Destinazione";
		}

	if (themessage == "I seguenti campi sono obbligatori: ") 
		{
		document.bol_motorebooking.submit();
		}
	else 
		{
		alert(themessage);
		return false;
	   }
	startLoad();
	}

function verify_motorepiccolo_mini() 
	{
	var themessage = "I seguenti campi sono obbligatori: ";
	if (document.mini_motorebooking.start_date.value=="") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.mini_motorebooking.start_date.value=="gg/mm/aaaa") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.mini_motorebooking.end_date.value=="")
		{
		themessage = themessage + " - Data partenza";
		}
	if (document.mini_motorebooking.end_date.value=="gg/mm/aaaa")
		{
		themessage = themessage + " - Data partenza";
		}
	if (document.mini_motorebooking.comune_motore.value=="")
		{
		themessage = themessage + " - Destinazione";
		}

	if (themessage == "I seguenti campi sono obbligatori: ") 
		{
		document.mini_motorebooking.submit();
		}
	else 
		{
		alert(themessage);
		return false;
	   }
	}
	
function verify_motorebooking() 
	{
	var themessage = "I seguenti campi sono obbligatori: ";
	if (document.bol_motorebooking.start_date.value=="") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.bol_motorebooking.start_date.value=="gg/mm/aaaa") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.bol_motorebooking.end_date.value=="")
		{
		themessage = themessage + " - Data partenza";
		}
	if (document.bol_motorebooking.end_date.value=="gg/mm/aaaa")
		{
		themessage = themessage + " - Data partenza";
		}
	if (document.bol_motorebooking.comune_motore.value=="")
		{
		themessage = themessage + " - Zona";
		}

	if (themessage == "I seguenti campi sono obbligatori: ") 
		{
		document.bol_motorebooking.submit();
		}
	else 
		{
		alert(themessage);
		return false;
	   }
	}
		
function verify_motoreftp() 
	{
	var themessage = "I seguenti campi sono obbligatori: ";
	if (document.bol_motoreftp.start_date.value=="") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.bol_motoreftp.start_date.value=="gg/mm/aaaa") 
		{
		themessage = themessage + " - Data arrivo";
		}
	if (document.bol_motoreftp.end_date.value=="")
		{
		themessage = themessage + " - Data partenza";
		}
	if (document.bol_motoreftp.end_date.value=="gg/mm/aaaa")
		{
		themessage = themessage + " - Data partenza";
		}

	if (themessage == "I seguenti campi sono obbligatori: ") 
		{
		document.bol_motoreftp.submit();
		}
	else 
		{
		alert(themessage);
		return false;
	   }
	}
