
function ChiudiFinestra() {
window.close();
}

function NewWindowSel() {
win2=window.open("Selezione.aspx","NewWindow","toolbar=no,fullscreen=yes,resizable=yes,directories=no,menubar=no,scrollbars=yes,width=1024,height=768");
}

function NewWindowCredits() {
win2=window.open("credits.aspx","NewWindow","resizable=no,width=700,height=600");
}

function NewWindowLink() {
win2=window.open("motori.aspx","NewWindow","resizable=no,width=800,height=850");
}

function NewWindowClausole() {
win2=window.open("clausole.aspx","NewWindow","resizable=no,width=700,height=600");
}

function NewWindowDisclaimer() {
win2=window.open("disclaimer.aspx","NewWindow","resizable=yes,scrollbars=yes");
}

function NewWindowPrivacy() {
win2=window.open("privacy.aspx","NewWindow","resizable=no,width=700,height=400");
}

function NewWindowCopyright() {
win2=window.open("copyright.aspx","NewWindow","resizable=no,width=700,height=500");
}

function NewWindowCreditsOut() {
win2=window.open("../credits.aspx","NewWindow","resizable=no,width=700,height=600");
}

function NewWindowStatistiche() {
win2=window.open("statistiche.aspx","NewWindow","resizable=yes,scrollbars=yes");
}
function NewWindowLinkOut() {
win2=window.open("../motori.aspx","NewWindow","resizable=no,width=800,height=850");
}

function NewWindowClausoleOut() {
win2=window.open("../clausole.aspx","NewWindow","resizable=no,width=700,height=600");
}

function NewWindowDisclaimerOut() {
win2=window.open("../disclaimer.aspx","NewWindow","resizable=no,width=700,height=850");
}

function NewWindowprivacyOut() {
win2=window.open("../privacy.aspx","NewWindow","resizable=no,width=700,height=400");
}

function NewWindowCopyrightOut() {
win2=window.open("../copyright.aspx","NewWindow","resizable=no,width=700,height=500");
}
function NewWindowStatisticheOut() {
win2=window.open("../statistiche.aspx","NewWindow","resizable=yes,scrollbars=yes");
}
/*
function NewWindowLink() {
	win2=window.open("Pippo.htm","NewWindow","resizable=no,width=400,height=300");
}
function right(e) {
 if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
	alert("Spiacenti, il tasto destro del mouse e' disabilitato");
	return false;
}
return true;
}

document.onmousedown=right;

if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
*/

function posiziona(){
	var w=screen.width;
	var x=(w-500)/2;
	window.moveTo(x,0);
}

function verifica(form) {   
  if (form.txtcognome.value == "") {     
    alert("Occorre riempire il campo Cognome:");     
    return false;   
  } else if (form.txtnome.value== "") {     
    alert("Occorre riempire il campo Nome:");     
    return false; 
  } else if (form.txtresidenza.value == "") {     
    alert("Occorre riempire il campo Residenza:");     
    return false;  
  } else if (form.txtcap.value == "") {     
    alert("Occorre riempire il campo C.A.P.:");     
    return false;
  } else if (form.txtindirizzo.value == "") {     
    alert("Occorre riempire il campo Indirizzo:");     
    return false;
  } else if (form.txtcivico.value == "") {     
    alert("Occorre riempire il campo Numero Civico:");     
    return false;
  } else if (form.txtdocumento.value == "") {     
    alert("Occorre riempire il campo Documento:");     
    return false;
  } else if(form.txtFrom.value.indexOf('@', 0)== -1)  {     
    alert("L'indirizzo di e-mail non e' valido.");     
    return false; 
  }   
  alert("Il modulo e' stato accettato.");   
    return true; 
} 

 /* } else if (form.txttelefono.value == "") {     
    alert("Occorre riempire il campo Telefono:");     
    return false;*/
    
var map = null;
var geocoder = null;

function load() 
	{
    	if (GBrowserIsCompatible()) 
	  	{
        	// Crea mappa
			map = new GMap2(document.getElementById("map"));
        	
			// Creo GeoCoder Max 1.6 query/sec
			geocoder = new GClientGeocoder();
		
			// Imposta centro su Carrara (LAT 44.0834, LONG 10.0999)
			map.setCenter(new GLatLng(44.0834, 10.0999), 5);
			
			// Visualizza controlli - TIPO MAPPA
			map.addControl(new GMapTypeControl());
			
			// Visualizza controlli - ZOOM GRANDE
			map.addControl(new GLargeMapControl());

      	}
    }

// Crea il marker con la label passata come parametro
function createMarker(point, label) 
{
	// Variabile marker
	var marker = new GMarker(point);
  	
	// Crea listener per il click sull'oggetto
	GEvent.addListener(marker, "click", function() 
	{
    	marker.openInfoWindowHtml(label);
  	});
  
  	return marker;
}

// Traduce indirizzo inserito in coordinate tramite GeoCoder, altrimenti cerca nel database
function showAddress(address) 
{
	geocoder.getLatLng(address,
    function(point) 
	{
    	if (!point) 
		{
        	// Indirizzo non trovato, cerca nel database.
			alert(address + " non trovato!");
      	} 
		else 
		{
        	// Indirizzo trovato, centra la mappa ;)
			map.setCenter(point, 10);
			
			// Crea il marker
			map.addOverlay(createMarker(point, address));
      	}
    });
}


function conta(){
	var lenMax=500
	var strlength=document.modulo.testo.value.length
	total = eval("500")
	char = eval(document.modulo.testo.value.length)
	left = eval(total - char)
	if (left <= "-1")
		{
			var dif = eval(char - 500)
			var value = document.modulo.testo.value.substr(0,char-dif);
			document.modulo.testo.value = value;
			var left = "0"
		}
	document.modulo.quanti.value=left
}