//CPI Software www.cpis.es
function FormatDate(fdtipo)
  {
  // fdtipo puede ser u=LastModified, t=Today, i=+Time, S=Short
  //da = new Date()    //no vale
  //alert(fdtipo + " \n  u:" + fdtipo.indexOf("u"));
  if (fdtipo.indexOf("u")>"-1") {da = new Date(document.lastModified);}
	if (fdtipo.indexOf("t")>"-1") {da = new Date();}
	var txDia=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
  var txMes=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Setiembre","Octubre","Noviembre","Diciembre")
	fd_ds = txDia[da.getDay()]
	fd_sep = " de "
	fd_mes = txMes[da.getMonth()]
	if (fdtipo.indexOf("S")>"-1") 
	         {
	         fd_ds = fd_ds.substr(0,3); fd_mes = fd_mes.substr(0,3);fd_sep="-";
	         }
  txDate = fd_ds +  ", " + da.getDate() + fd_sep + fd_mes + fd_sep + da.getFullYear();
  if (fdtipo.indexOf("i")>0) txDate = txDate + "  " + FormatTime(6);
	return txDate;
	}
function FormatTime(tlong)	
  {
  var wTime;
  da = new Date()
  wHora=da.getHours(); if (wHora<10) wHora="0"+wHora
  wMinu=da.getMinutes(); if (wMinu<10) wMinu="0"+wMinu
  wSegu=da.getSeconds(); if (wSegu<10) wSegu="0"+wSegu
  if (tlong == "4") wTime = wHora + ":" + Wminu;
  if (tlong == "6") wTime = wHora + ":" + wMinu + ":" + wSegu;
  return wTime;
  }