// copyright CIIP spa - Cicli Integrati Impianti Primari
// autore: Cesare Orsini e-mail: orsini@ciip.it

function stat_meteo(){

var oggi = new Date()
var anno_corrente = ""
anno_corrente = String(oggi.getFullYear())
mese_corrente =String(oggi.getMonth()+1)


// verifica campi immessi
if (document.form1.anno.value == "")
  {
    alert("Inserire un valore per il campo \"ANNO\".");
    document.form1.anno.focus();
    return (false);
}

if (document.form1.mese.value == "")
  {
    alert("Inserire un valore per il campo \"MESE\".");
    document.form1.mese.focus();
    return (false);
  }

var x_anno = String(document.form1.anno.value)
var x_mese = String(document.form1.mese.value)
var x_report=""


if (x_anno > anno_corrente) {
alert("Anno superiore al corrente !");
    document.form1.anno.focus();
    return (false);	
}

if (x_mese > mese_corrente && x_anno == anno_corrente) {
alert("Mese superiore al mese corrente !");
    document.form1.mese.focus();
    return (false);		
}


if (x_mese == "00"){
	if (x_anno == anno_corrente) {x_report = "report\\NOAAYR.TXT"}
	else{ x_report = "report\\NOAAPRYR"+x_anno+".TXT"}
}
else{
if (x_mese==mese_corrente && x_anno==anno_corrente){ x_report = "report\\NOAAMO.TXT"}
else {x_report = "report\\NOAAPRMO"+x_anno+x_mese+".TXT"}
}
if (x_anno=="2004" && x_mese >"00" && x_mese<"08") {alert("I dati sono disponibili a partire da AGOSTO 2004 !!")}
else{
popup = window.open(x_report,"_new")
}
}
