// JavaScript Document
// geovillage


  var Today = new Date();

  var option_day = "";
  var n_day = 1;
  var select_giorno = "";
  
  var giorni_mese;
  var option_month;
  var option_month_en;
  var select_mese = "";
  var select_mese_en = "";
  
  var option_year;
  var select_anno = "";
  var anno = 2011;
  

  
  var week, month;
    
  switch (Today.getDay()) {
    case 0:
      week = "dom";
      break;
    case 1:
      week = "lun";
      break;
    case 2:
      week = "mar";
      break;
    case 3:
      week = "mer";
      break;
    case 4:
      week = "gio";
      break;
    case 5:
      week = "ven";
      break;
    case 6:
      week = "sab";
      break;
  }
  
//quanti giorni ha questo mese?
if((Today.getMonth() == 10) ||(Today.getMonth() == 3)||(Today.getMonth() == 5)||(Today.getMonth() == 8)) {
	giorni_mese = 30;
	}else { giorni_mese = 31;}
if ((Today.getMonth() == 1)){ giorni_mese = 29}



//creo la select con i giorni   
for (i=1;i<= 31;i++) {
	if (i < 10){
	n_day = "0" + i;
	}else {n_day = i;}
	if ( Today.getDate() == i) {
	option_day = option_day + "<option selected='selected' value='" + n_day + "'>" + n_day + "</option>"; 
	} else {
	option_day = option_day + "<option value='" + n_day + "'>" + n_day + "</option>"; 
	}
}

select_giorno = "<select id='day2' name='day2'>" + option_day + "</select>";


//creo la select con il mese
for (i=0;i<= 11;i++) {
switch (i) {
    case 0:
      month = "gen";
	  month_en ="jan";
      break;
    case 1:
      month = "feb";
	  month_en ="feb";
      break;
    case 2:
      month = "mar";
	  month_en ="mar";
      break;
    case 3:
      month = "apr";
	  month_en ="apr";
      break;
    case 4:
      month = "mag";
	  month_en ="may";
      break;
    case 5:
      month = "giu";
	  month_en ="jun";
      break;
    case 6:
      month = "lug";
	  month_en ="jul";
      break;
    case 7:
      month = "ago";
	  month_en ="ago";
      break;
    case 8:
      month = "set";
      month_en ="set";
	  break;
    case 9:
      month = "ott";
      month_en ="oct";
	  break;
    case 10:
      month = "nov";
      month_en ="nov";
	  break;
    case 11:
      month = "dic";
	  month_en ="dic";
      break;
  }
  if ( i <= 8 ) { value_month = "0"+ (i + 1); }else{ value_month=i+1;}
  if(Today.getMonth() == i) {  
  option_month = option_month + "<option selected='selected' value='"+ value_month +"'>" + month + "</option>";
  option_month_en = option_month_en + "<option selected='selected' value='"+ value_month +"'>" + month_en + "</option>";
} else  {
  option_month = option_month + "<option value='"+ value_month +"'>" + month + "</option>";
  option_month_en = option_month_en + "<option value='"+ value_month +"'>" + month_en + "</option>";
	}
 }

//creo la select con l'anno

for (i=0;i<= 5;i++) {
	if (Today.getFullYear() == anno) {	option_year = option_year + "<option select='selected' value='"+ anno +"'>" + anno + "</option>";}
	else { option_year = option_year + "<option value='"+ anno +"'>" + anno + "</option>";}
	anno++;
}



select_giorno = "<select id='day2' name='day2'>" + option_day + "</select> ";

select_mese = "<select id='month2' name='month2'>" + option_month + "</select> ";

select_mese_en = "<select id='month2' name='month2'>" + option_month_en + "</select> ";

select_anno = "<select id='year2'>" + option_year + "</select> ";
