function Valida() {
	var messaggio;
	var errorfound;
	
	errorfound = false;
	
	if ( (window.document.frmBio.txtNome.value)=="" && !errorfound ) {
		errorfound = true;
		messaggio = "Il nome dell'autore è obbligatorio";
	}
	if ((window.document.frmBio.selGiorno.value)=="" && !errorfound ) {
		errorfound = true;
		messaggio = "Il giorno di nascita dell'autore è obbligatorio";
	}
	if ((window.document.frmBio.selMese.value)=="" && !errorfound ) {
		errorfound = true;
		messaggio = "Il mese di nascita dell'autore è obbligatorio";
	}
	if ((window.document.frmBio.txtAnno.value)=="" && !errorfound ) {
		errorfound = true;
		messaggio = "L'anno di  nascita dell'autore è obbligatorio";
	}
	if ((window.document.frmBio.txtTesto.value)=="" && !errorfound ) {
		errorfound = true;
		messaggio = "Il testo della biografia è obbligatorio";
	}
	if (errorfound) {
		alert(messaggio)
	}
	else {
		window.document.frmBio.submit();
	}
}

function InserisciNews(){
	window.location.href="biografia.asp?cod=I";
}
function Menu(){
	window.location.href="biografiamenu.asp";
}
function Cerca(){
	window.location.href="biografiemenu.asp";
}
function cercabio(){
	window.document.frmBio.submit();
}

function vai(id,g,m){
	window.document.frmbioaltre.id.value=id;
	window.document.frmbioaltre.g.value=g;
	window.document.frmbioaltre.m.value=m;
	window.document.frmbioaltre.submit();
}

function scopri(){
  var messaggio;
	var errorfound;
	
	errorfound = false;
	
  if (((window.document.frmscopri.g.value)>31 || (window.document.frmscopri.g.value)<1) && !errorfound ) {
    errorfound = true;
		messaggio = "Il giorno inserito non è valido";
	}
	if (((window.document.frmscopri.m.value)>12|| (window.document.frmscopri.m.value)<1) && !errorfound ) {
    errorfound = true;
		messaggio = "Il mese inserito non è valido";
	}
	if (errorfound) {
		alert(messaggio)
	}
	else {
		window.document.frmscopri.submit()
	} 
  }
  
  function showMonth(id) {
  var url=window.location.href;
  var newUrl=url;
  var pos1, pos2, end, oldVal;
  if (url.indexOf("?")<0)
    newUrl=url+"?m="+id+"&g=1";
  else {
    pos1 = url.indexOf("?m=");
    if (pos1<0) {
      pos1 = url.indexOf("&m=");
      if (pos1<0) {
        newUrl=url+"&m="+id;
      } else {
        pos2 = pos1+3;
        end  = url.indexOf("&", pos2);
        if (end<0) end=url.length;
        oldVal=url.substring(pos2,end);
        newUrl=url.replace("m="+oldVal,"m="+id);
        newUrl = newUrl + "&g=1";
      }
    } else {
      pos2 = pos1+3;
      end  = url.indexOf("&", pos2);
      if (end<0) end=url.length;
      oldVal=url.substring(pos2,end);
      newUrl=url.replace("m="+oldVal,"m="+id);
      newUrl = newUrl + "&g=1";
    }
  }
  window.location.href=newUrl;
}

function promozione(id,g,m){
	var props = "toolbar=no,location=no,scrollbars=no,resizable=no,width=468,height=430,top=20,left=10";
	window.open("../biografie/promo.asp", "Promo", props).focus();
}
