1449 lines
47 KiB
JavaScript
1449 lines
47 KiB
JavaScript
// //
|
|
// JavaScript Functions //
|
|
// //
|
|
//////////////////////////////////////
|
|
// Algunas variables Globales
|
|
|
|
var HOY=new Date();
|
|
// Algunos formatos para fechas.
|
|
var NLDF="D/M/YY"; // para columnas en las queries INFORMIX
|
|
var IFDF="D/M/YY"; // para columnas en SQL según DBDATE
|
|
// Algunos formatos para nros.
|
|
var NF2="##"
|
|
var NF3="###"
|
|
var NF4="#.###"
|
|
var NF5="##.###"
|
|
var NF6="###.###"
|
|
var NF7="#.###.###"
|
|
var NF8="##.###.###"
|
|
var NF9="###.###.###"
|
|
var NF09="***.***.***"
|
|
var NFY9="&&&.&&&.&&&&"
|
|
var NF10="#.###.###.###"
|
|
var NF11="##.###.###.###"
|
|
var NF12="###.###.###.###"
|
|
var baseHtml="";
|
|
// Inline Character Constants
|
|
var BACKSPACE = "\b"
|
|
var TAB = "\t"
|
|
var CR = "\r"
|
|
var LF = "\n"
|
|
var CRLF = "\r\n"
|
|
var FF = "\f"
|
|
var DQUOTE = '\"'
|
|
var SQUOTE = "\'"
|
|
var BACKSLASH = "\\"
|
|
|
|
//
|
|
// Date Object Enhanced Methods
|
|
//
|
|
Date.prototype.getFullYear = getFullYear;
|
|
Date.prototype.getActualMonth = getActualMonth;
|
|
Date.prototype.getActualDay = getActualDay;
|
|
Date.prototype.getCalendarDay= getCalendarDay;
|
|
Date.prototype.getCalendarMonth= getCalendarMonth;
|
|
Date.prototype.getYearDay= getYearDay;
|
|
function DateFromN(ndia) {
|
|
// Esta función devuelve una fecha en formato "DD/MM/YY"
|
|
// a partir de un nro de día entre 1 y 366 del año actual
|
|
//
|
|
if ( ndia < 0 )
|
|
return ""
|
|
var yea=HOY.getYear();
|
|
if ( ndia >365 ) {
|
|
yea=yea+1;
|
|
ndia=ndia-365
|
|
}
|
|
var nmes = new Array(12);
|
|
nmes[0] = 31;
|
|
nmes[1] = 28;
|
|
nmes[2] = 31;
|
|
nmes[3] = 30;
|
|
nmes[4] = 31;
|
|
nmes[5] = 30;
|
|
nmes[6] = 31;
|
|
nmes[7] = 31;
|
|
nmes[8] = 30;
|
|
nmes[9] = 31;
|
|
nmes[10] = 30
|
|
nmes[11] = 31;
|
|
var sumadias=0;
|
|
for ( var i=0 ; i <= 11 ; i++) {
|
|
suma=nmes[i]+sumadias;
|
|
if (suma >= ndia )
|
|
break;
|
|
sumadias=suma;
|
|
}
|
|
var dia=ndia-sumadias;
|
|
// alert("Datos :"+dia+" Nro Dia: "+ndia+" Mes: "+mes+" SumaDias: "+sumadias+" Suma:"+suma+" Mes:"+i);
|
|
var mes=i+1;
|
|
// alert("Es Día :"+dia+" del mes "+mes);
|
|
return dia+"/"+mes+"/"+yea;
|
|
}
|
|
function AsignaFecha(stringDate,fecha) {
|
|
// Esta función asigna el día, mes y año de la cadena stringDate
|
|
// a la variable de tipo date pasada como argumento "fecha"
|
|
|
|
if ( stringDate == "" )
|
|
return "" ;
|
|
var s_fecha=DateUnformat(stringDate+"");
|
|
if ( s_fecha == "" )
|
|
return "" ;
|
|
if ( s_fecha.substring(0,1) == "-" ) {
|
|
alert("-> ¡ Fecha no Válida! ¡ Debe ser una fecha en formato dd/mm/aa!");
|
|
return "-1";
|
|
}
|
|
var day=HOY.getDate();
|
|
var yea=HOY.getYear();
|
|
var mon=HOY.getMonth()+1;
|
|
var pos=s_fecha.indexOf("/");
|
|
if (pos == -1) {
|
|
if ( s_fecha.length == 1 || s_fecha.length == 2 )
|
|
day=parseInt(s_fecha);
|
|
if ( s_fecha.length == 3 || s_fecha.length == 4 ) {
|
|
day=parseInt(s_fecha.substring(0,2));
|
|
mon=s_fecha.substring(2,s_fecha.length);
|
|
}
|
|
if ( s_fecha.length == 5 ) {
|
|
day=parseInt(s_fecha.substring(0,2));
|
|
mon=s_fecha.substring(2,3);
|
|
yea=parseInt(s_fecha.substring(3,s_fecha.length));
|
|
}
|
|
if ( s_fecha.length == 6 ) {
|
|
day=parseInt(s_fecha.substring(0,2));
|
|
mon=s_fecha.substring(2,4);
|
|
yea=parseInt(s_fecha.substring(4,s_fecha.length));
|
|
}
|
|
}
|
|
else {
|
|
var lastPos=s_fecha.substring(pos+1,s_fecha.length).indexOf("/");
|
|
if ( lastPos == -1 ) {
|
|
day = parseInt(s_fecha.substring(0,pos));
|
|
mon = s_fecha.substring(pos+1,s_fecha.length);
|
|
}
|
|
else {
|
|
lastPos=pos+lastPos+1;
|
|
day = parseInt(s_fecha.substring(0,pos));
|
|
mon = s_fecha.substring(pos+1,lastPos);
|
|
yea = parseInt(s_fecha.substring(lastPos+1,s_fecha.length));
|
|
}
|
|
}
|
|
fecha.setDate(day);
|
|
fecha.setMonth(mon-1);
|
|
fecha.setYear(yea);
|
|
return 0;
|
|
}
|
|
|
|
function getYearDay() {
|
|
var nday = this.getDate();
|
|
var nmon = this.getMonth();
|
|
var nyea = this.getYear();
|
|
var nmes = new Array(12);
|
|
nmes[0] = 31;
|
|
nmes[1] = daysInFebruary (nyea)
|
|
nmes[2] = 31;
|
|
nmes[3] = 30;
|
|
nmes[4] = 31;
|
|
nmes[5] = 30;
|
|
nmes[6] = 31;
|
|
nmes[7] = 31;
|
|
nmes[8] = 30;
|
|
nmes[9] = 31;
|
|
nmes[10] = 30
|
|
nmes[11] = 31;
|
|
var sumadias=0;
|
|
for ( var i=0 ; i < nmon; i++ )
|
|
sumadias=nmes[i]+sumadias;
|
|
var dia=sumadias+nday;
|
|
// alert("El Día es:"+dia+" del año");
|
|
return dia;
|
|
}
|
|
|
|
function getFullYear() {
|
|
var n = this.getYear();
|
|
if ( n >= 0 && n <= 70 )
|
|
n += 2000;
|
|
else
|
|
n += 1900;
|
|
return n;
|
|
}
|
|
function getActualMonth() {
|
|
var n = this.getMonth();
|
|
n += 1;
|
|
return n;
|
|
}
|
|
function getActualDay() {
|
|
var n = this.getDay();
|
|
n += 1;
|
|
return n;
|
|
}
|
|
function getCalendarDay() {
|
|
var n = this.getDay();
|
|
var ndia = new Array(7);
|
|
ndia[0] = "Domingo";
|
|
ndia[1] = "Lunes";
|
|
ndia[2] = "Martes";
|
|
ndia[3] = "Miércoles";
|
|
ndia[4] = "Jueves";
|
|
ndia[5] = "Viernes";
|
|
ndia[6] = "Sábado";
|
|
return ndia[n];
|
|
}
|
|
function getCalendarMonth() {
|
|
var n = this.getMonth();
|
|
var nmes = new Array(12);
|
|
nmes[0] = "Enero";
|
|
nmes[1] = "Febrero";
|
|
nmes[2] = "Marzo";
|
|
nmes[3] = "Abril";
|
|
nmes[4] = "Mayo";
|
|
nmes[5] = "Junio";
|
|
nmes[6] = "Julio";
|
|
nmes[7] = "Agosto";
|
|
nmes[8] = "Septiembre";
|
|
nmes[9] = "Octubre";
|
|
nmes[10] = "Noviembre";
|
|
nmes[11] = "Diciembre";
|
|
return nmes[n];
|
|
}
|
|
function stringMonth(n) {
|
|
var nmes = new Array(12);
|
|
nmes[0] = "Enero";
|
|
nmes[1] = "Febrero";
|
|
nmes[2] = "Marzo";
|
|
nmes[3] = "Abril";
|
|
nmes[4] = "Mayo";
|
|
nmes[5] = "Junio";
|
|
nmes[6] = "Julio";
|
|
nmes[7] = "Agosto";
|
|
nmes[8] = "Septiembre";
|
|
nmes[9] = "Octubre";
|
|
nmes[10] = "Noviembre";
|
|
nmes[11] = "Diciembre";
|
|
return nmes[n];
|
|
}
|
|
|
|
// End Date Objects
|
|
/*
|
|
Varialbles para el Scroll:
|
|
MESSAGE = "Your message" -- The text you want to scroll.
|
|
[Put into scroll.msg]
|
|
DELAY = 50 -- The delay (in milliseconds)
|
|
between each shift left.
|
|
[Put into scroll.delay]
|
|
POSITION = 100 -- How many spaces should lead the
|
|
message when it starts?
|
|
[Put into scroll.pos]
|
|
status_scroll -- true o false si scroll activado
|
|
*/
|
|
var status_scroll = false
|
|
// No scroll activado
|
|
var POSITION = 100
|
|
var DELAY = 50
|
|
var MESSAGE = " Cuentas a Pagar "
|
|
var scroll = new statusMessageObject()
|
|
|
|
function decode(str) {
|
|
return unescape(str);
|
|
}
|
|
function encode(str) {
|
|
return escape(str);
|
|
}
|
|
|
|
function getCookie(Name) {
|
|
var search = "NETSCAPE_LIVEWIRE." + Name + "=";
|
|
var RetStr = "";
|
|
var Offset = 0;
|
|
var end = 0;
|
|
if (document.cookie.length > 0) {
|
|
offset = document.cookie.indexOf(search);
|
|
if (offset != -1) {
|
|
offset += search.length;
|
|
end = document.cookie.indexOf(";",offset);
|
|
if (end == -1) {
|
|
end = document.cookie.length
|
|
}
|
|
RetStr = decode(document.cookie.substring(offset,end));
|
|
}
|
|
}
|
|
return(RetStr);
|
|
}
|
|
function setCookie(Name,Value,Expire) {
|
|
document.cokie = "NETSCAPE_LIVEWIRE." + Name + "="
|
|
+ encode(Value)
|
|
+ ((Expire == null) ? "" : ("; expires=" + Expire.toGMTString()));
|
|
}
|
|
function chk_login() {
|
|
if (client.es_inicio == 1 ) {
|
|
top.close();
|
|
redirect("initial.html?ipw=1");
|
|
return false;
|
|
}
|
|
else
|
|
return true;
|
|
}
|
|
function abreVentana(ulrPath,winName) {
|
|
// if (ulrPath != null) {
|
|
now=new Date();
|
|
var n = now.getSeconds();
|
|
stringArgs=" ";
|
|
numArgs=abreVentana.arguments.length;
|
|
if (numArgs >2) {
|
|
for (var i=1; i < numArgs; i++) {
|
|
stringArgs=stringArgs+","+abreVentana.arguments[i];
|
|
};
|
|
};
|
|
stringArgs="\""+stringArgs+"\"";
|
|
NvaVentana=window.open(ulrPath,winName+n,stringArgs);
|
|
return NvaVentana;
|
|
// };
|
|
}
|
|
|
|
function cierraVentana(Ventana) {
|
|
if (Ventana != null) {
|
|
Ventana.close();
|
|
return;
|
|
};
|
|
}
|
|
|
|
function NetHelp(topic) {
|
|
window.open("help.html#" + topic , "HelpWin",
|
|
"toolbar=no,directories=no,menubar=no,status=no,scrollbars=no,resizable=yes,width=400,height=500")
|
|
}
|
|
|
|
function loadHelp() {
|
|
if (parent.main.document.URL.indexOf("multi_entry.html") >= 0)
|
|
NetHelp("entry");
|
|
else if (parent.main.document.URL.indexOf("report") >= 0)
|
|
NetHelp("reports");
|
|
else if (parent.main.document.URL.indexOf("user_info.html") >= 0 ||
|
|
parent.main.document.URL.indexOf("_pw.html") >= 0)
|
|
NetHelp("prefs");
|
|
else if (parent.main.document.URL.indexOf("edit_entry") >= 0)
|
|
NetHelp("edit_entry");
|
|
else if (parent.main.document.URL.indexOf("admin.html") >= 0 ||
|
|
parent.main.document.URL.indexOf("add_") >= 0 ||
|
|
parent.main.document.URL.indexOf("edit_") >= 0)
|
|
NetHelp("admin");
|
|
else
|
|
NetHelp("intro");
|
|
}
|
|
|
|
function DbsError(status,dbstatus)
|
|
{
|
|
// Hay un problemilla: status es true en las operaciones de
|
|
// connect pero es un numérico en el resto.
|
|
// por eso siempre será true en las peticiones SQL
|
|
//
|
|
client.status=status;
|
|
client.dbstatus=dbstatus;
|
|
client.majorErrorCode=database.majorErrorCode();
|
|
client.majorErrorMessage= database.majorErrorMessage();
|
|
client.minorErrorCode =database.minorErrorCode();
|
|
client.minorErrorMessage=database.minorErrorMessage();
|
|
if ( status == true )
|
|
return;
|
|
if ( dbstatus == 0 )
|
|
return;
|
|
|
|
if (client.is_trans == true)
|
|
database.rollbackTransaction();
|
|
redirect('error.html')
|
|
|
|
}
|
|
function chkBrowser() {
|
|
browser = request.agent;
|
|
if (browser.indexOf("Mozilla/") != -1) {
|
|
ver = browser.substring(8,9)
|
|
verNum = parseInt(ver)
|
|
if (verNum > 2 ) {
|
|
return;
|
|
}
|
|
redirect("wrongbrw.html")
|
|
}
|
|
}
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- makes generated html easier to read -->
|
|
function writeln(text)
|
|
{
|
|
write(text + '\n');
|
|
}
|
|
function wbuttons(text)
|
|
{
|
|
write(' ndoc=\''+text+'\');'+'\n');
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- change all single quotes to '' so they won't cause trouble in queries -->
|
|
function escQuote (query_string) {
|
|
var new_string = "";
|
|
var query_len = query_string.length;
|
|
var c;
|
|
|
|
if (query_string == "" || query_string.indexOf("'") < 0)
|
|
return query_string;
|
|
|
|
for (var i = 0; i < query_len; i++) {
|
|
c = query_string.charAt(i);
|
|
if (c != '\'') new_string += c;
|
|
else new_string += "''";
|
|
}
|
|
return new_string;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- change single quotes to \' so they won't cause trouble in Java Script -->
|
|
function backslashQuote (s) {
|
|
var new_string = "";
|
|
var len = s.length;
|
|
var c;
|
|
|
|
if (s == "" || s.indexOf("'") < 0)
|
|
return s;
|
|
|
|
for (var i = 0; i < len; i++) {
|
|
c = s.charAt(i);
|
|
if (c != '\'') new_string += c;
|
|
else new_string += "\\'";
|
|
}
|
|
return new_string;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- do database query and construct string containing ids and names: -->
|
|
<!-- id1 | name1 || id2 | name2 || ... -->
|
|
<!-- because properties of LiveWire objects can only be strings, not -->
|
|
<!-- complex objects. -->
|
|
function createIdNameString(queryString) {
|
|
var query;
|
|
var temp;
|
|
|
|
temp = "";
|
|
query = database.cursor(queryString);
|
|
while (query.next())
|
|
temp += query[0]+" | "+query[1]+" || ";
|
|
query.close();
|
|
return temp;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- do database query and construct string containing ids and names: -->
|
|
<!-- id1 | name1 (group1) || id2 | name2 (group2) || ... -->
|
|
<!-- because properties of LiveWire objects can only be strings, not -->
|
|
<!-- complex objects. -->
|
|
function createIdNameGroupString(query_string) {
|
|
var query;
|
|
var temp;
|
|
|
|
temp = "";
|
|
query = database.cursor(query_string);
|
|
while (query.next()) {
|
|
if ((query[2]+"").indexOf("No Group") >= 0)
|
|
temp += query[0]+" | "+query.fullname+" || ";
|
|
else
|
|
temp += query[0]+" | "+query.fullname+" ("+query[2]+") || ";
|
|
}
|
|
query.close();
|
|
return temp;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- check whether the login cookie is set. return true if set, false -->
|
|
<!-- false if not -->
|
|
function loggedIn() {
|
|
var today = new Date;
|
|
|
|
if (client.id == "null" || client.id == null)
|
|
return false;
|
|
if (! client["login"+((today.getYear()+today.getMonth())*client.id)])
|
|
return false;
|
|
if (client["login"+((today.getYear()+today.getMonth())*client.id)] != "yes")
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- set the cookie used to check if user has logged in -->
|
|
function setLoggedIn() {
|
|
var today = new Date();
|
|
|
|
client["login"+((today.getYear()+today.getMonth())*client.id)] = "yes";
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- unset the cookie used to check if user has logged in -->
|
|
function setLoggedOut() {
|
|
var today = new Date();
|
|
|
|
if (client.id != null && client.id != "null")
|
|
client["login"+((today.getYear()+today.getMonth())*client.id)] = null;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- constructor for object used to step through id|name lists -->
|
|
function IdNameObj() {
|
|
this.id = "";
|
|
this.name = "";
|
|
this.currPos = 0;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- get next id/name pair from id|name string: id name || id name || ... -->
|
|
function getNextItem(s,item) {
|
|
var nextPos;
|
|
|
|
nextPos = s.indexOf(" |",item.currPos);
|
|
item.id = s.substring(item.currPos,nextPos);
|
|
item.currPos = nextPos+3;
|
|
nextPos = s.indexOf(" ||", item.currPos);
|
|
item.name = s.substring(item.currPos,nextPos);
|
|
item.currPos = nextPos+4;
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- write a multi select list with the list of items in selectList -->
|
|
<!-- selected. list and selectList must both be sorted -->
|
|
<!-- returns true if all items in selectList were found in list, false -->
|
|
<!-- if not. -->
|
|
function writeSelectMultiOptions(list,selectList) {
|
|
var item = new IdNameObj();
|
|
var selectItem = new IdNameObj;
|
|
var allItemsFound = true;
|
|
|
|
getNextItem(selectList,selectItem);
|
|
while (item.currPos < list.length) {
|
|
getNextItem(list,item);
|
|
// current item in select list not found in list
|
|
if (item.name > selectItem.name &&
|
|
selectItem.currPos < selectList.length) {
|
|
getNextItem(selectList,selectItem);
|
|
allItemsFound = false;
|
|
}
|
|
if (item.id == selectItem.id) {
|
|
writeln(" <option value=\""+item.id+"\" selected>"+item.name);
|
|
if (selectItem.currPos < selectList.length)
|
|
getNextItem(selectList,selectItem);
|
|
}
|
|
else
|
|
writeln(" <option value=\""+item.id+"\">"+item.name);
|
|
}
|
|
return allItemsFound;
|
|
}
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- write a select list with the user's default property selected -->
|
|
function writeSelectOptions(list,client_prop) {
|
|
var item = new IdNameObj();
|
|
|
|
while (item.currPos < list.length) {
|
|
getNextItem(list,item);
|
|
if (item.id == client_prop)
|
|
writeln(" <option value=\""+item.id+"\" selected>"+item.name);
|
|
else
|
|
writeln(" <option value=\""+item.id+"\">"+item.name);
|
|
}
|
|
}
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- write the items in list as hidden fields, each named -->
|
|
<!-- <name_prefix><item.id> and with value <item.name> -->
|
|
<!-- this can be useful when you want to pass both the id and name as the -->
|
|
<!-- result of a select (put the id in the select list and use -->
|
|
<!-- request[name_prefix+request.selected_item] to get the name) -->
|
|
function writeHiddenList(list,name_prefix) {
|
|
var item = new IdNameObj();
|
|
|
|
while (item.currPos < list.length) {
|
|
getNextItem(list,item);
|
|
writeln(" <input type=\"hidden\" name=\""+name_prefix+item.id+"\" "+
|
|
"value=\""+item.name+"\">");
|
|
}
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- return "Y" if user has admin privileges, "N" if not -->
|
|
function lookupAdminStatus(user_id) {
|
|
var query;
|
|
|
|
query = database.cursor("select admin from user where id="+user_id);
|
|
if (query.next()) {
|
|
if (query.admin+"" == "Y") {
|
|
query.close();
|
|
return "Y";
|
|
}
|
|
else {
|
|
query.close();
|
|
return "N";
|
|
}
|
|
}
|
|
else {
|
|
query.close();
|
|
return "N";
|
|
}
|
|
}
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- Load the user's default project and hour type preferences and list of -->
|
|
<!-- default projects from the database -->
|
|
function loadPrefs() {
|
|
var query;
|
|
|
|
if (client.defproject == null || client.defproject == null ||
|
|
client.defproject == "null" || client.defproject == "null") {
|
|
query = database.cursor(
|
|
"select def_project,def_category from user where id="+client.id);
|
|
if (query.next()) {
|
|
client.defproject = query.def_project;
|
|
client.defcategory = query.def_category;
|
|
}
|
|
query.close();
|
|
}
|
|
if (client.active_project_list == null || client.active_project_list ==
|
|
"null" || client.active_project_list == "")
|
|
client.active_project_list = createIdNameString(
|
|
"select distinct id,name from project,user_projects where "+
|
|
"project_id=id and user_id="+client.id+" order by name");
|
|
}
|
|
|
|
function entriesExist(from_where) {
|
|
var query;
|
|
|
|
query = database.cursor("select count(*) "+from_where);
|
|
if (query.next()) {
|
|
if (query[0] == 0) {
|
|
query.close();
|
|
return false;
|
|
}
|
|
else {
|
|
query.close();
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
<!-- ===================================================================== -->
|
|
|
|
<!-- page flow is defined here!! -->
|
|
<!-- check if prevPage is valid, and if not, redirect to login screen -->
|
|
function checkPrevPage(currPage) {
|
|
<!-- seems to be weird pointer problems when: -->
|
|
<!-- currPrevPage = client.prevPage; -->
|
|
<!-- client.prevPage = currPage; -->
|
|
<!-- then, currPrevPage == lti_entry.html -->
|
|
<!-- tried it this way to return right away instead of going through all -->
|
|
<!-- if statements -->
|
|
var cp = currPage;
|
|
var pp = client.prevPage;
|
|
|
|
if (!database.connected())
|
|
redirect("initial.html?err=1");
|
|
if (!loggedIn() && cp != "login.html")
|
|
redirect("initial.html?err=1");
|
|
|
|
<!-- these pages have no prerequisites: (other than login) -->
|
|
<!-- multi_entry.html, user_info.html, get_dates.html, -->
|
|
<!-- admin.html, logout.html -->
|
|
if (cp == "multi_entry.html" || cp == "user_info.html" ||
|
|
cp == "get_dates.html" || cp == "admin.html" ||
|
|
cp == "logout.html") {
|
|
client.prevPage = cp;
|
|
return;
|
|
}
|
|
|
|
if ((cp == "login.html") && (pp != "initial.html submit"))
|
|
redirect("initial.html?err=1");
|
|
|
|
client.prevPage = currPage;
|
|
}
|
|
|
|
|
|
<!-- ===================================================================== -->
|
|
|
|
function w_auxiliar(nombre,titulo,clave,valor) {
|
|
if ( valor == "" || valor == null )
|
|
window.open("w_auxiliar.html?"+baseHtml+"&obj="+ nombre+"&titulo="+titulo,
|
|
"w_"+ nombre,"toolbar=yes,directories=no,menubar=yes,status=no,scrollbars=no,resizable=yes,width=450,height=500");
|
|
else
|
|
// window.open('o_'+ nombre +'.html?waux=2&'+clave+'='+valor,
|
|
window.open("w_auxiliar.html?"+baseHtml+"&obj="+ nombre+"&titulo="+titulo+"&clave="+clave+"&valor="+valor,
|
|
"w_"+ nombre,"toolbar=yes,directories=no,menubar=yes,status=no,scrollbars=yes,resizable=yes,width=450,height=500");
|
|
}
|
|
|
|
function Confirmar(mensaje) {
|
|
|
|
return confirm(mensaje);
|
|
}
|
|
|
|
function setStatus(mensaje) {
|
|
window.status=mensaje;
|
|
return true;
|
|
}
|
|
|
|
|
|
<!-- misc.js // misc. utilities routines
|
|
// locate the frame "fname" under the sub-tree of window objects rooted
|
|
// at "cur".
|
|
function find_frame(cur,fname){
|
|
if(cur.name == fname){
|
|
// alert("Frames="+cur.name);
|
|
return cur;
|
|
}else{
|
|
var i, j = cur.frames.length;
|
|
for(i = 0; i < j; i++){
|
|
var chd = find_frame(cur.frames[i],fname);
|
|
if(chd != null)
|
|
return chd;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// load a URL into the frame "fname"
|
|
function load_url(fname,url){
|
|
var frame = find_frame(top,fname);
|
|
if(frame != null)
|
|
frame.location = url;
|
|
}
|
|
|
|
// get the value from various form elements.
|
|
function get_value(type,elem){
|
|
var i, j, k;
|
|
if(type == "text"){
|
|
// return the "value" of a input field of type "text". It is
|
|
// supposed to work with textarea too (not in 2.0b3 though)
|
|
return (elem.value == "") ? elem.defaultValue : elem.value;
|
|
} else if(type == "select"){
|
|
// return the "value" of the selected option in a "select"
|
|
// (doens't work with "multiple")
|
|
j = elem.length;
|
|
k = -1;
|
|
var opts = elem.options;
|
|
for(i = 0; i < j; i++){
|
|
if(opts[i].selected){
|
|
k=i ; break;
|
|
// return opts[i].value;
|
|
} else if(opts[i].defaultSelected){
|
|
k = i;
|
|
}
|
|
}
|
|
return (k >= 0) ? ("" + opts[k].value) : null;
|
|
// return elem.options[elem.selectedIndex].value;
|
|
} else if(type == "radio"){
|
|
// return the "value" of a radio group
|
|
j = elem.length;
|
|
k = -1;
|
|
for(i = 0; i < j; i++){
|
|
if(elem[i].status){
|
|
k=i ; break;
|
|
} else if(elem[i].defaultStatus){
|
|
k = i;
|
|
}
|
|
}
|
|
return (k >= 0) ? elem[k].value : null;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
function emptyField(textObj)
|
|
{
|
|
if (textObj.value.length == 0) return true;
|
|
for (var i=0; i<textObj.value.length; i++) {
|
|
var ch = textObj.value.charAt(i);
|
|
if (ch != ' ' && ch !='\t' ) return false;
|
|
}
|
|
return true;
|
|
}
|
|
function pos_form(obj,name){
|
|
for(i = 0; i <= obj.elements.length; i++){
|
|
if ( obj.elements[i].name == name )
|
|
break ;
|
|
}
|
|
if ( i > obj.length )
|
|
return -1;
|
|
return i;
|
|
}
|
|
|
|
// misc.ls -->
|
|
|
|
function test()
|
|
{
|
|
alert(window.location+'\rFunción probada con éxito')
|
|
}
|
|
|
|
function StringClip(full,i_cadena)
|
|
// Esta función es para quitar los blancos por detrás de la cadena
|
|
// si "full" es true quita los blancos por delante de la cadena
|
|
// Control de si la cadena contiene "null" y devolver " "
|
|
// cadena string de entrada
|
|
// Esto sería una solución mejor pero no funciona porque
|
|
// asigna un valor numérico a ch
|
|
// var ch = cadena.charAt(i);
|
|
// if (ch != ' ' && ch !='\t' ) break;
|
|
// Parece que si se usa la misma variable para ambos bucles for
|
|
// Livewire da error diciendo que la variable no es numérica.
|
|
// Por eso se ha asignado variables diferentes.
|
|
{
|
|
var ipos=0;
|
|
var lpos=0;
|
|
var cadena=i_cadena+"";
|
|
|
|
if (!cadena || cadena == " " )
|
|
return " "
|
|
|
|
lpos=cadena.length;
|
|
if (lpos <= 1 )
|
|
return cadena;
|
|
if (cadena == "null")
|
|
return " ";
|
|
// debug("->"+cadena+"<- "+lpos);
|
|
for (var i=lpos-1; i > 1 ; i--) {
|
|
// debug("-->"+i+"<--")
|
|
if (cadena.substring(i,i+1) != " " ) break;
|
|
}
|
|
// debug("--"+ipos+"--"+i+"--"+lpos+"--")
|
|
if ( i > 0 )
|
|
lpos=i+1;
|
|
|
|
if ( full == true ) {
|
|
for (var j=1 ; j<cadena.length ; j++ ) {
|
|
if (cadena.substring(j-1,j) != " " ) break;
|
|
}
|
|
if ( j > 0 )
|
|
ipos=j-1;
|
|
}
|
|
// alert("Cadena: "+cadena.substring(ipos,lpos)+"<-->"+i+"logg="+cadena.length);
|
|
return cadena.substring(ipos,lpos)
|
|
}
|
|
function isNroThis(obj) {
|
|
nro=parseInt(obj.value)
|
|
if ( nro+1 > 0 )
|
|
return
|
|
else {
|
|
alert("El valor no es correcto");
|
|
obj.focus();
|
|
}
|
|
}
|
|
// Aquí van las funciones de para convertir nros a cadenas y viceversa
|
|
// El control de los decimales no es correcto
|
|
// pero tan solo afecta al formateo no al valor.
|
|
function NroToString(obj,formato) {
|
|
obj.value=NroFormat(obj.value,formato);
|
|
obj.select();
|
|
}
|
|
function NroFormat(stringNro,formato) {
|
|
// Formateamos un Nro
|
|
// Ojo los decimales no salen bien del todo
|
|
//
|
|
// ... y si el nro no viene en un char y es realmente un nro ??
|
|
//debug(stringNro)
|
|
//debug(formato)
|
|
if (!formato)
|
|
return stringNro+" ";
|
|
nro=NroUnformat(stringNro+" ");
|
|
if ( nro.length > 0 )
|
|
c_nro=nro+" ";
|
|
else
|
|
return "0" ;
|
|
// debug(c_nro)
|
|
// debug(formato);
|
|
|
|
var cadena="";
|
|
var j=c_nro.length-2;
|
|
var f_size=formato.length;
|
|
var MaxChar=0;
|
|
var f_char="";
|
|
var v_char="";
|
|
var i=0;
|
|
// ¿ Cuántos caracteres caben en el formato ?? ///
|
|
for (i=f_size-1; i >= 0 ; i--) {
|
|
f_char=formato.substring(i,i+1);
|
|
if ( f_char == "#" || f_char == "-" ||
|
|
f_char == "&" || f_char == "*" || f_char == "0" )
|
|
MaxChar++;
|
|
}
|
|
if ( MaxChar < j+1 )
|
|
return "valor excedido";
|
|
// alert(MaxChar+c_nro+formato+j);
|
|
for (i=f_size-1; i >= 0 ; i--) {
|
|
f_char=formato.substring(i,i+1);
|
|
if (j >=0 ) {
|
|
// alert(cadena+"--"+i+"-"+j+"--"+c_nro.substring(j,j+1)+"--"+formato.substring(i,i+1))
|
|
if ( c_nro.substring(j,j+1) == "," ) {
|
|
cadena=","+cadena; j--;
|
|
} else {
|
|
v_char=c_nro.substring(j,j+1);
|
|
if ( f_char == "#" || f_char == "-" ||
|
|
f_char == "&" || f_char == "*" || f_char == "0" ) {
|
|
cadena=v_char+cadena ; j--;
|
|
}else
|
|
cadena=f_char+cadena ;
|
|
}
|
|
} else {
|
|
if ( f_char == "#" || f_char == "-" )
|
|
cadena=" "+cadena;
|
|
if ( f_char == "&" || f_char == "*" || f_char == "0" )
|
|
cadena=f_char+cadena;
|
|
if ( f_char == "." && formato.substring(0,1) != "#" )
|
|
cadena=formato.substring(0,1)+cadena;
|
|
}
|
|
}
|
|
// alert(cadena.length)
|
|
return cadena;
|
|
}
|
|
function StringToNro(obj,formato) {
|
|
var nro=NroUnformat(obj.value);
|
|
if ( nro == "0" )
|
|
nro=""
|
|
obj.value=nro;
|
|
}
|
|
|
|
function NroUnformat(c_nro) {
|
|
// Quitar todo lo que sobra a la cadena para ser Integer ...
|
|
if (!c_nro)
|
|
return "0";
|
|
var SepDecimal=",";
|
|
var nro="";
|
|
for (var i=0 ; i <= c_nro.length; i++) {
|
|
if ( c_nro.substring(i,i+1) == "-" ||
|
|
c_nro.substring(i,i+1) == SepDecimal ||
|
|
c_nro.substring(i,i+1) == "0" ||
|
|
c_nro.substring(i,i+1) == "1" ||
|
|
c_nro.substring(i,i+1) == "2" ||
|
|
c_nro.substring(i,i+1) == "3" ||
|
|
c_nro.substring(i,i+1) == "4" ||
|
|
c_nro.substring(i,i+1) == "5" ||
|
|
c_nro.substring(i,i+1) == "6" ||
|
|
c_nro.substring(i,i+1) == "7" ||
|
|
c_nro.substring(i,i+1) == "8" ||
|
|
c_nro.substring(i,i+1) == "9" )
|
|
nro=nro+c_nro.substring(i,i+1);
|
|
}
|
|
return nro;
|
|
}
|
|
|
|
// the fixYear JavaScript function
|
|
// if date < 70, convert to 20xx, so 7/22/00 will mean 7/22/2000
|
|
// Informix thinks two digit years are 19xx and LiveWire can't deal
|
|
// with dates before 1970
|
|
// this function should be called *after* the date has been checked for
|
|
// validity, since it does not do that type of error checking
|
|
// returns the date with a 4 digit year if the year is less than 2000
|
|
function fixYear(date) {
|
|
var date_len = date.length;
|
|
var firstSlash = date.indexOf("/");
|
|
var secondSlash = date.lastIndexOf("/");
|
|
if (firstSlash == secondSlash) {
|
|
var today = new Date();
|
|
date += "/"+today.getYear();
|
|
return date;
|
|
}
|
|
var year = date.substring(secondSlash+1,date_len);
|
|
|
|
if (year < 70) {
|
|
year = eval(year)+1900;
|
|
date = date.substring(0,date.lastIndexOf("/")+1);
|
|
date += year;
|
|
}
|
|
return date;
|
|
}
|
|
//=====================================================================
|
|
// the checkDate Java Script function
|
|
// returns true if date is valid, false if not. alerts if date is invalid
|
|
// takes date field and field_name (for use in invalid alert)
|
|
function checkDate(date_field,field_name) {
|
|
var first_slash = date_field.value.indexOf("/");
|
|
if (date_field.value == "/" || first_slash == -1) {
|
|
alert(field_name+": El formato válido de fecha debe ser dd/mm/yy !");
|
|
date_field.focus();
|
|
date_field.select();
|
|
return false;
|
|
}
|
|
var second_slash = eval(date_field.value.indexOf("/",first_slash+1));
|
|
var day = date_field.value.substring(0,first_slash);
|
|
var mon;
|
|
var yr;
|
|
if (second_slash == -1) {
|
|
var today = new Date();
|
|
mon = date_field.value.substring(first_slash+1,date_field.value.length);
|
|
yr = today.getYear();
|
|
}
|
|
else {
|
|
mon = date_field.value.substring(first_slash+1,second_slash);
|
|
yr = date_field.value.substring(second_slash+1,date_field.value.length);
|
|
}
|
|
|
|
if (eval(mon) < 1 || eval(mon) > 12 || eval(day) < 1 || eval(day) > 31) {
|
|
alert(field_name+": Fecha no Válida! Debe ser una fecha en formato dd/mm/yy!");
|
|
date_field.focus();
|
|
date_field.select();
|
|
return false;
|
|
}
|
|
if ((mon == 4 || mon == 6 || mon == 9 || mon == 11) &&
|
|
(day < 1 || day > 30)) {
|
|
alert(field_name+": "+day+" no es un número de día válido en el mes "+mon+". Un número de día entre 1 y 30");
|
|
date_field.focus();
|
|
date_field.select();
|
|
return false;
|
|
}
|
|
if (mon == 2 && (day < 1 || day > 29)) {
|
|
alert(field_name+": "+day+" no es un número de día válido. Un número de día entre 1 y 28");
|
|
date_field.focus();
|
|
date_field.select();
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
// =====================================================================
|
|
// the dateCmp Java Script function
|
|
// compares two (valid) dates.
|
|
// returns -1 if d1 < d2, 0 if d1 = d2, and 1 if d1 > d2
|
|
function dateCmp(date1,date2) {
|
|
if (date1 == date2)
|
|
return 0;
|
|
var month1,day1,year1,month2,day2,year2;
|
|
year1 = date1.substring(date1.lastIndexOf("/")+1,date1.length);
|
|
year2 = date2.substring(date2.lastIndexOf("/")+1,date2.length);
|
|
// make 96 and 1996 equal
|
|
if (year1.length != year2.length)
|
|
if (year1.length == 4)
|
|
if (eval(year2) >= 70) year2 = 1900+eval(year2);
|
|
else year2 = 2000+eval(year2);
|
|
else if (year2.length == 4)
|
|
if (eval(year1) >= 70) year1 = 1900+eval(year1);
|
|
else year1 = 2000+eval(year1);
|
|
if (eval(year1) < eval(year2))
|
|
return -1;
|
|
if (eval(year1) > eval(year2))
|
|
return 1;
|
|
|
|
day1 = date1.substring(0,date1.indexOf("/"));
|
|
day2 = date2.substring(0,date2.indexOf("/"));
|
|
if (eval(day1) < eval(day2))
|
|
return -1;
|
|
if (eval(day1) > eval(day2))
|
|
return 1;
|
|
|
|
month1 = date1.substring(date1.indexOf("/")+1,date1.lastIndexOf("/"));
|
|
month2 = date2.substring(date2.indexOf("/")+1,date2.lastIndexOf("/"));
|
|
if (eval(month1) < eval(month2))
|
|
return -1;
|
|
if (eval(month1) > eval(month2))
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|
|
// =====================================================================
|
|
// write the checkTextQuotes Java Script function
|
|
// check for single or double quotes and alert if found
|
|
// returns true if field is ok, false if invalid
|
|
// arguments:
|
|
// quote_type single, double or both (single double)
|
|
// field field value to check
|
|
// label label for alert
|
|
function checkTextQuotes(quote_type,field,label) {
|
|
if (! field)
|
|
return true;
|
|
if (quote_type.indexOf("single") >= 0)
|
|
if (field.indexOf("'") >= 0) {
|
|
alert("Etiqueta incorrecta "+label+"! Las comillas simples (') no están permitidas en "+label+".");
|
|
return false;
|
|
}
|
|
if (quote_type.indexOf("double") >= 0)
|
|
if (field.indexOf("\"") >= 0) {
|
|
alert("Etiqueta incorrecta "+label+"! Las comillas dobles (\") no están permitidas en "+label+".");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/* ============================================================
|
|
|
|
FUNCTION: datetoString( mydate )
|
|
|
|
DESCRIPTION: This function parses out each part of a date
|
|
object and returns the string representation of that date.
|
|
Note however that the time part of a date object (which
|
|
contains both date and time) is left out of the return string).
|
|
|
|
============================================================ */
|
|
|
|
function datetoString ( mydate ) {
|
|
var resultstr = ""
|
|
if(mydate) {
|
|
|
|
resultstr += mydate.getDate() + "/" +
|
|
(mydate.getMonth()+1) + "/" +
|
|
mydate.getYear();
|
|
|
|
return resultstr;
|
|
}
|
|
else {
|
|
return resultstr;
|
|
}
|
|
}
|
|
function datetoNString ( s_fecha ) {
|
|
// Quitar todo lo que sobra a la cadena ...
|
|
if (s_fecha == "" )
|
|
return "";
|
|
var pos=s_fecha.indexOf("/");
|
|
if (pos == -1) {
|
|
return "";
|
|
}
|
|
else {
|
|
var n_fecha="";
|
|
var day=0;
|
|
var yea=0;
|
|
var mon=0;
|
|
var lastPos=s_fecha.substring(pos+1,s_fecha.length).indexOf("/");
|
|
if ( lastPos == -1 ) {
|
|
day = s_fecha.substring(0,pos);
|
|
mon = s_fecha.substring(pos+1,s_fecha.length);
|
|
}
|
|
else {
|
|
lastPos=pos+lastPos+1;
|
|
day = s_fecha.substring(0,pos);
|
|
mon = s_fecha.substring(pos+1,lastPos);
|
|
yea = parseInt(s_fecha.substring(lastPos+1,s_fecha.length));
|
|
}
|
|
var s_day=day+"";
|
|
var s_mon=mon+"";
|
|
var s_yea=yea+"";
|
|
if ( day < 10 )
|
|
s_day="0"+day;
|
|
if ( mon < 10 )
|
|
s_mon="0"+mon;
|
|
}
|
|
n_fecha=s_day+s_mon+s_yea;
|
|
return n_fecha;
|
|
}
|
|
/* ============================================================
|
|
Las siguientes funciones son para el control de digitación de
|
|
fechas, su uso en la páginas debería ser:
|
|
onBlur="ToStringDate(this,IF_DF)"
|
|
onFocus="UnfrmtStrDate(this,IF_DF)"
|
|
Los formatos están definidos más arriba
|
|
NLDF="2Y/M/D"
|
|
IFDF="D/M/2Y"
|
|
============================================================ */
|
|
function UnfrmtStrDate(obj,formato) {
|
|
obj.value=DateUnformat(obj.value);
|
|
}
|
|
|
|
function ToStringDate(obj,formato) {
|
|
var s_fecha=DateFormat(obj.value,formato);
|
|
if (s_fecha == "-1") {
|
|
// alert("Dato: "+obj.value+" No válido.");
|
|
obj.value="";
|
|
obj.focus();
|
|
obj.select();
|
|
} else
|
|
obj.value=s_fecha;
|
|
}
|
|
function DateFormat(stringDate,formato) {
|
|
// Formateamos una cadena como fecha formato especificado
|
|
// por lo comprobado hasta hoy 5/3/97 el formato para
|
|
// las queries debe ser YY/MM/DD y no el de DBDATE
|
|
// sin embargo para la entrada de datos vale el DBDATE
|
|
// A mi tampoco me cuadra mucho esto pero hay que hacerlo
|
|
// funcionar ¿ Vale ?
|
|
var f_size=formato.length;
|
|
if ( stringDate == "" )
|
|
return "" ;
|
|
var s_fecha=DateUnformat(stringDate);
|
|
// alert(stringDate+" --"+s_fecha+" -- "+ formato)
|
|
if ( s_fecha == "" )
|
|
return "" ;
|
|
if ( s_fecha.substring(0,1) == "-" ) {
|
|
alert("-> ¡ Fecha no Válida! ¡ Debe ser una fecha en formato dd/mm/aa!");
|
|
return "-1";
|
|
}
|
|
var cadena="";
|
|
var day=HOY.getDate();
|
|
var yea=HOY.getYear();
|
|
var mon=HOY.getMonth()+1;
|
|
var pos=s_fecha.indexOf("/");
|
|
if (pos == -1) {
|
|
if ( s_fecha.length == 1 || s_fecha.length == 2 )
|
|
day=s_fecha;
|
|
if ( s_fecha.length == 3 || s_fecha.length == 4 ) {
|
|
day=s_fecha.substring(0,2);
|
|
mon=s_fecha.substring(2,s_fecha.length);
|
|
}
|
|
if ( s_fecha.length == 5 ) {
|
|
day=s_fecha.substring(0,2);
|
|
mon=s_fecha.substring(2,3);
|
|
yea=parseInt(s_fecha.substring(3,s_fecha.length));
|
|
}
|
|
if ( s_fecha.length == 6 ) {
|
|
day=s_fecha.substring(0,2);
|
|
mon=s_fecha.substring(2,4);
|
|
yea=parseInt(s_fecha.substring(4,s_fecha.length));
|
|
}
|
|
}
|
|
else {
|
|
var lastPos=s_fecha.substring(pos+1,s_fecha.length).indexOf("/");
|
|
if ( lastPos == -1 ) {
|
|
day = s_fecha.substring(0,pos);
|
|
mon = s_fecha.substring(pos+1,s_fecha.length);
|
|
}
|
|
else {
|
|
lastPos=pos+lastPos+1;
|
|
day = s_fecha.substring(0,pos);
|
|
mon = s_fecha.substring(pos+1,lastPos);
|
|
yea = parseInt(s_fecha.substring(lastPos+1,s_fecha.length));
|
|
}
|
|
}
|
|
if ( mon.substring(0,1) == "0" )
|
|
mon=mon.substring(1,2);
|
|
if ( day.substring(0,1) == "0" )
|
|
day=day.substring(1,2);
|
|
|
|
// alert("dia: "+day+" Mes: "+mon+" Año: "+yea+"--"+s_fecha.length)
|
|
if ( day + 1 >0 && mon + 1 > 0 && yea + 1 > 0 )
|
|
var i=0
|
|
else
|
|
return "-1";
|
|
if ( eval(mon) < 1 || eval(mon) > 12 ) {
|
|
alert("-> "+mon+" no es un número de mes válido. Un número de mes entre 1 y 12");
|
|
return "-1";
|
|
}
|
|
if ((mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12 ) && (day < 1 || day > 31)){
|
|
alert("-> "+day+" no es un número de día válido en el mes "+mon+". Un número de día entre 1 y 31");
|
|
return "-1";
|
|
}
|
|
if ((mon == 4 || mon == 6 || mon == 9 || mon == 11) && (day < 1 || day > 30)) {
|
|
alert("-> "+day+" no es un número de día válido en el mes "+mon+". Un número de día entre 1 y 30");
|
|
return "-1";
|
|
}
|
|
if (mon == 2 && (day < 1 || day > 29)) {
|
|
alert("-> "+day+" no es un número de día válido. Un número de dái entre 1 y 28");
|
|
return "-1";
|
|
}
|
|
s_yea=yea+" "
|
|
if ( s_yea.length > 3 )
|
|
yea=s_yea.substring(2,4);
|
|
if ( s_yea.length == 2 ) {
|
|
s_yea=HOY.getYear()+" ";
|
|
yea=s_yea.substring(0,1)+yea;
|
|
}
|
|
var i=0;
|
|
|
|
if ( formato == "D/M/YY" || formato == "D/M/2Y" ) {
|
|
cadena=day+"/"+mon+"/"+yea
|
|
}
|
|
if ( formato == "YY/M/D" || formato == "2Y/M/D" ) {
|
|
cadena=yea+"/"+mon+"/"+day
|
|
}
|
|
return cadena
|
|
}
|
|
|
|
function set_hoy() {
|
|
day=HOY.getDate();
|
|
yea=HOY.getYear();
|
|
mon=HOY.getMonth()+1;
|
|
var s_fecha=day+"/"+mon+"/"+yea
|
|
return s_fecha;
|
|
}
|
|
function set_ahora() {
|
|
t_hou=HOY.getHours();
|
|
t_min=HOY.getMinutes();
|
|
t_sec=HOY.getSeconds()+1;
|
|
var s_ahora=t_hou+":"+t_min+":"+t_sec
|
|
return s_ahora;
|
|
}
|
|
function DateUnformat(s_fecha) {
|
|
// Quitar todo lo que sobra a la cadena ...
|
|
if (s_fecha == "" )
|
|
return "";
|
|
var n_fecha="";
|
|
if ( s_fecha.substring(0,1) == "+" )
|
|
s_fecha=set_hoy();
|
|
for (var i=0 ; i <= s_fecha.length; i++) {
|
|
if ( s_fecha.substring(i,i+1) == "-" )
|
|
n_fecha=n_fecha+"/";
|
|
if ( s_fecha.substring(i,i+1) == "/" ||
|
|
s_fecha.substring(i,i+1) == "0" ||
|
|
s_fecha.substring(i,i+1) == "1" ||
|
|
s_fecha.substring(i,i+1) == "2" ||
|
|
s_fecha.substring(i,i+1) == "3" ||
|
|
s_fecha.substring(i,i+1) == "4" ||
|
|
s_fecha.substring(i,i+1) == "5" ||
|
|
s_fecha.substring(i,i+1) == "6" ||
|
|
s_fecha.substring(i,i+1) == "7" ||
|
|
s_fecha.substring(i,i+1) == "8" ||
|
|
s_fecha.substring(i,i+1) == "9" )
|
|
n_fecha=n_fecha+s_fecha.substring(i,i+1);
|
|
}
|
|
if (n_fecha.length <= 0 )
|
|
return "-1";
|
|
else
|
|
return n_fecha;
|
|
}
|
|
/*
|
|
Copyright (C) 1996 Frequency Graphics All Rights Reserved.
|
|
Feel free to reuse this code snippet
|
|
provided this header remains in tact
|
|
Andy Augustine 3.17.96 [www.FreqGrafx.com/411/]
|
|
send comments to <mohammed@freqgrafx.com>
|
|
These are the default values for the global variables which will
|
|
be stored in the properties of the <B>scroll</B> variable:
|
|
|
|
MESSAGE = "Your message" -- The text you want to scroll.
|
|
[Put into scroll.msg]
|
|
|
|
DELAY = 50 -- The delay (in milliseconds)
|
|
between each shift left.
|
|
[Put into scroll.delay]
|
|
|
|
POSITION = 100 -- How many spaces should lead the
|
|
message when it starts?
|
|
[Put into scroll.pos]
|
|
Puede cargarse como <body onLoad="scroller()">
|
|
*/
|
|
function statusMessageObject(p,d) {
|
|
this.msg = MESSAGE
|
|
this.out = " "
|
|
this.pos = POSITION
|
|
this.delay = DELAY
|
|
this.i = 0
|
|
this.reset = clearMessage
|
|
}
|
|
|
|
function clearMessage() {
|
|
this.pos = POSITION
|
|
}
|
|
|
|
function scroller() {
|
|
//
|
|
// add spaces to beggining of message
|
|
//
|
|
for (scroll.i = 0; scroll.i < scroll.pos; scroll.i++) {
|
|
scroll.out += " "
|
|
}
|
|
|
|
//
|
|
// if you're still have leading spaces, just
|
|
// add custom string to tail of message
|
|
// OR else if the string is running off the
|
|
// screen, only add the characters left
|
|
//
|
|
if (scroll.pos >= 0)
|
|
scroll.out += scroll.msg
|
|
else scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length)
|
|
|
|
window.status = scroll.out
|
|
|
|
// set parameters for next run
|
|
scroll.out = " "
|
|
scroll.pos--
|
|
|
|
// if you're at the end of the message,
|
|
// reset parameters to start again
|
|
if (scroll.pos < -(scroll.msg.length)) {
|
|
scroll.reset()
|
|
}
|
|
|
|
setTimeout ('scroller()',scroll.delay)
|
|
}
|
|
|
|
function buttonsLetrasNros(BaseHtml,todos){
|
|
writeln("<BR><A HREF='"+ BaseHtml + "A'><IMG SRC='images/letras/letter_A.gif' BORDER=0 ></A>");
|
|
writeln("<A HREF='"+ BaseHtml + "B'><IMG SRC='images/letras/letter_B.gif' BORDER=0></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "C'><IMG SRC='images/letras/letter_C.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "D'><IMG SRC='images/letras/letter_D.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "E'><IMG SRC='images/letras/letter_E.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "F'><IMG SRC='images/letras/letter_F.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "G'><IMG SRC='images/letras/letter_G.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "H'><IMG SRC='images/letras/letter_H.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "I'><IMG SRC='images/letras/letter_I.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "J'><IMG SRC='images/letras/letter_J.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "K'><IMG SRC='images/letras/letter_K.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "L'><IMG SRC='images/letras/letter_L.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "M'><IMG SRC='images/letras/letter_M.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "N'><IMG SRC='images/letras/letter_N.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "O'><IMG SRC='images/letras/letter_O.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "P'><IMG SRC='images/letras/letter_P.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "Q'><IMG SRC='images/letras/letter_Q.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "R'><IMG SRC='images/letras/letter_R.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "S'><IMG SRC='images/letras/letter_S.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "T'><IMG SRC='images/letras/letter_T.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "U'><IMG SRC='images/letras/letter_U.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "V'><IMG SRC='images/letras/letter_V.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "W'><IMG SRC='images/letras/letter_w.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "X'><IMG SRC='images/letras/letter_X.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "Y'><IMG SRC='images/letras/letter_Y.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "Z'><IMG SRC='images/letras/letter_Z.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "0'><IMG SRC='images/numeros/number_0.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "1'><IMG SRC='images/numeros/number_1.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "2'><IMG SRC='images/numeros/number_2.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "3'><IMG SRC='images/numeros/number_3.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "4'><IMG SRC='images/numeros/number_4.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "5'><IMG SRC='images/numeros/number_5.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "6'><IMG SRC='images/numeros/number_6.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "7'><IMG SRC='images/numeros/number_7.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "8'><IMG SRC='images/numeros/number_8.gif' BORDER=0 ></A>")
|
|
writeln("<A HREF='"+ BaseHtml + "9'><IMG SRC='images/numeros/number_9.gif' BORDER=0 ></A>")
|
|
if ( todos == true ) {
|
|
writeln("<A HREF='"+ BaseHtml + "all'><B><H2>Todos</B></H2></A>")
|
|
}
|
|
}
|
|
function isEmpty(s) {
|
|
return ((s == null) || (s.length == 0))
|
|
}
|
|
// Returns true if string s is empty or
|
|
// whitespace characters only.
|
|
function isWhitespace (s){
|
|
var i;
|
|
// Is s empty?
|
|
if (isEmpty(s)) return true;
|
|
// Search through string's characters one by one
|
|
// until we find a non-whitespace character.
|
|
// When we do, return false; if we don't, return true.
|
|
for (i = 0; i < s.length; i++) {
|
|
// Check that current character isn't whitespace.
|
|
// var c = s.charAt(i);
|
|
// if (whitespace.indexOf(c) == -1) return false;
|
|
if ( s.substring(i,i+1) != " " ) return false;
|
|
}
|
|
// All characters are whitespace.
|
|
return true;
|
|
}
|
|
// daysInFebruary (INTEGER year)
|
|
//
|
|
// Given integer argument year,
|
|
// returns number of days in February of that year.
|
|
function daysInFebruary (year)
|
|
{ // February has 29 days in any year evenly divisible by four,
|
|
// EXCEPT for centurial years which are not also divisible by 400.
|
|
return ( ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
|
|
}
|
|
function substChar(cadena,oldChar,newChar) {
|
|
if (!newChar)
|
|
return cadena+" ";
|
|
var resultString="";
|
|
var f_size=cadena.length;
|
|
var l_size=oldChar.length;
|
|
for (var i=0; i < f_size ; i++) {
|
|
c_char=cadena.substring(i,i+l_size);
|
|
if ( c_char == oldChar )
|
|
resultString=resultString+newChar;
|
|
else
|
|
resultString=resultString+c_char;
|
|
}
|
|
return resultString;
|
|
}
|