//==============================================================================
// Perl-Xml-Web-Portal
// Ing. Sauro Silvestri
// Pal Informatica s.r.l.
//------------------------------------------------------------------------------
// 12.04.2010 - Versione 1.6
//==============================================================================

function https(pathname) {location = "https://" + location.host + pathname;}

function http(pathname) {location = "http://" + location.host + pathname;}

function check(fieldName) {

	if (fieldName == "data_dal") {
		stringa = document.del00.data_dal.value.replace(/[^\d]/g,"");
		data = checkData(stringa);
  	document.del00.data_dal.value = data;		
	}
	else if	(fieldName == "data_al"){
		stringa = document.del00.data_al.value.replace(/[^\d]/g,"");
		data = checkData(stringa);		
  	document.del00.data_al.value = data;		
	}

}

function checkData(stringa) {

	if (stringa.length == 0) { return ""; }

  gg = stringa.substr(0,2);
  mm = stringa.substr(2,2);
  aa = stringa.substr(4,4);
  aa = aa.length == 1 ? "0" + aa : aa;
  if (aa.length == 2) {
  	if (aa >= "00" && aa <= "20") {	aa = "20" + aa;	}
  	else { aa = "19" + aa; }
  }
   
	data = new Date(aa, mm-1, gg);
	daa = data.getFullYear().toString();
	dmm = (data.getMonth()+1).toString();
	dmm = dmm.length == 1 ? "0" + dmm : dmm;
	dgg = data.getDate().toString();
	dgg = dgg.length == 1 ? "0" + dgg : dgg;
	ddata = dgg + "/" + dmm + "/" + daa;

	return ddata;
	
}

function MM_openBrWindow(URL, winName, features) {
	window.open(URL, winName, features);
}
