function openNewWindow(url) {
	if(url!=null && url.length>1){
 		params  = 'width='+screen.width;
 		params += ', height='+screen.height;
 		params += ', top=0, left=0'
 		params += ', fullscreen=yes';

 		newwin=window.open(url,'windowname4');
 		if (window.focus) {newwin.focus()}
 	}
 return false;
}



function butOpenWin_onclick(sURL)  {  		  
	
	var winTop = 25; 		  		  
	var winLeft = (screen.width /2) - 125; 		  
	var windowFeatures = "width=552,height=660,"; 		  
	windowFeatures = windowFeatures + "left=" + winLeft + ","; 		  
	windowFeatures = windowFeatures + "top=" + winTop + ",";
	windowFeatures = windowFeatures + "scrollbars=yes, status=yes"; 
		  		  
	newWindow = window.open(sURL,"popupFoto",windowFeatures);
	if (typeof(newWindow) == "undefined" || newWindow.closed == true)
	{ 
	alert( "No window is open");
	}
	newWindow.focus();
}


function butOpenWinSelectFoto_onclick(sURL)  {  		  
	
	var winTop = 10; 		  		  
	var winLeft = 10; 		  
	var windowFeatures = "width=960,height=660,"; 		  
	windowFeatures = windowFeatures + "left=" + winLeft + ","; 		  
	windowFeatures = windowFeatures + "top=" + winTop + ",";
	windowFeatures = windowFeatures + "scrollbars=yes, status=yes"; 
		  		  
	newWindow = window.open(sURL,"popupFoto",windowFeatures);
	if (typeof(newWindow) == "undefined" || newWindow.closed == true)
	{ 
	alert( "No window is open");
	}
	newWindow.focus();
}

function getElencoMesi(){
	var mesi = new Array();
	var myDate = new Date();
	var nomiMesi = new Array("gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre");
	
	var thisMonth = myDate.getMonth();
	var upperLimit = nomiMesi.length;

	for (var k=thisMonth; k<(thisMonth +upperLimit); k++) {
		var indice = k;
		var anno = myDate.getFullYear();
		if(k>=upperLimit) {
			indice=k-upperLimit;
			anno = anno + 1;	
		}
		mesi.push(new MyTableData(indice + 1, nomiMesi[indice] + ' ' + anno));
	}
		
	var selectMeseDal = document.getElementById('mesedal');
	var selectMeseAl = document.getElementById('meseal');
	for (var z=0; z<mesi.length;z++){
		AddSelectOption(selectMeseDal, mesi[z].text, mesi[z].value, z==0 ? true : false);
		AddSelectOption(selectMeseAl, mesi[z].text, mesi[z].value, z==0 ? true : false);
	}	
}



function AddSelectOption(selectObj, text, value, isSelected){
    if (selectObj != null && selectObj.options != null)
    {
        selectObj.options[selectObj.options.length] = 
            new Option(text, value, false, isSelected);
    }
}


function selectDay(){
	var mySelect = document.getElementById('giorno');
	var mySelect2 = document.getElementById('a_giorno');
	var myDate = new Date();
	var txt='';
	for (var i=0;i<mySelect.length;i++) {
		if(mySelect.options[i].value==myDate.getDate()) {
			mySelect.options[i].selected=true;
			mySelect2.options[i].selected=true;
			return;
		}
    }		
}


function MyTableData(value, text){
	this.value=value;
	this.text = text;
}




