var LitMonth = new Array(); var LitDay = new Array(); var months_en = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); var days_en = new Array("mon", "tue", "wed", "thu", "fri", "sat", "sun"); var months_es = new Array("Enero", "Febrero", "Marzo","Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre","Octubre", "Noviembre", "Diciembre"); var days_es = new Array("lun", "mar", "mié", "jue", "vie", "sáb", "dom"); var months_it = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"); var days_it = new Array("lun", "mar", "mer", "gio", "ven", "sab", "dom"); var months_pt = new Array("Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"); var days_pt = new Array("2fe", "3fe", "4fe", "5fe", "6fe", "sáb", "dom"); var months_ca = new Array("Genera", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliolo", "Agost", "Setembre", "Octubre", "Novembreo", "Desembre"); var days_ca = new Array("Dl", "Dt", "Dc", "Dj", "Dv", "Ds", "Dg"); LitMonth["es"] = months_es; LitMonth["en"] = months_en; LitMonth["it"] = months_it; LitMonth["pt"] = months_pt; LitMonth["ca"] = months_ca; LitDay["es"] = days_es; LitDay["en"] = days_en; LitDay["it"] = days_it; LitDay["pt"] = days_pt; LitDay["ca"] = days_ca; ///////////////////////////////////////////////////////////////////////////////////////////////// // Outer variable to check if a layout table is sent to a windows to be printed. // A new variable is set at the print window document. This one is to avoid syntax errors. var printing =false; function validaSiVacio(campo,nombre) { var texto = campo.value; var ftexto = nombre; if (texto == "") { alert('Campo obligatorio: "' + ftexto + '"'); return false } else { return true; } } function activar(nombreImagen,img) { if (document.images) { document[nombreImagen].src=img; } } function desactivar(nombreImagen,img) { if (document.images) { document[nombreImagen].src=img; } } function exitFunction() { unloadDocument(); } function enterFunction() { window.status =""; } function browserBack() { history.back(); } function browser() { var browser_name = navigator.appName; if (browser_name == "Microsoft Internet Explorer") { return 1; } else if (browser_name == "Netscape"){ return 2; } else { return -1; } } function printAndBack() { window.print(); history.back(); } function doPrint() { if ( arguments.length != 0 ) { var vLay = document.getElementById(arguments[0]); } else { var vLay = document.getElementById("LayoutTable"); } var esIE = 0; // indica si es IE o NS if (navigator.appVersion.indexOf("MSIE") != -1) { esIE = 1; } var j = window.open('','','menubar=no,scrollbars=yes,status=no,dependent=yes,toolbar=yes,height=510,width=700,left=100,top=100'); j.document.open(); j.document.writeln(''); j.document.writeln(''); j.document.writeln(document.title); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); var vTitulo = document.getElementById("TitleBar"); if (vTitulo != null) { j.document.writeln("
"); j.document.writeln(vTitulo.rows[0].innerHTML); j.document.writeln("
"); } j.document.writeln(''); j.document.writeln(vLay.rows[0].cells[0].innerHTML); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.close(); // if ( esIE == 1) // { // j.location.reload(); // } } function doPrintSingle() { if ( arguments.length != 0 ) { var vLay = document.getElementById(arguments[0]); } else { var vLay = document.getElementById("LayoutTable"); } var j = window.open('','','menubar=no,scrollbars=yes,status=no,dependent=yes,toolbar=yes,height=510,width=850,left=0,top=0'); j.document.open(); j.document.writeln(''); j.document.writeln(''); j.document.writeln(document.title); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.writeln(vLay.rows[0].cells[0].innerHTML); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.close(); } function doPrintForm() { var esIE = 0; // indica si es IE o NS if (navigator.appVersion.indexOf("MSIE") != -1) { esIE = 1; } var j = window.open('','','menubar=no,scrollbars=yes,status=no,dependent=yes,toolbar=yes,height=510,width=700,left=100,top=100'); j.document.open(); j.document.writeln(''); j.document.writeln(''); j.document.writeln(document.title); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); var vLogo = document.getElementById("LayoutTableLogo"); if (vLogo != null) { j.document.writeln("
"); j.document.writeln(vLogo.rows[0].innerHTML); j.document.writeln("
"); } var vTitulo = document.getElementById("TitleBar"); if (vTitulo != null) { j.document.writeln("
"); j.document.writeln(vTitulo.rows[0].innerHTML); j.document.writeln("
"); } j.document.writeln(''); /////////////////////////////////// // Try this table for normal forms, if does not exist then try the loop var vLay = document.getElementById("LayoutTable"); if (vLay == null) { for (i=1;;i++) { var vLay = document.getElementById("LayoutTable_"+i); if (vLay == null) break; j.document.writeln(vLay.rows[0].cells[0].innerHTML); } } else { j.document.writeln(vLay.rows[0].cells[0].innerHTML); } j.document.writeln(''); j.document.writeln(''); j.document.writeln(''); j.document.close(); } function activar(nombreImagen,img) { if (document.images) { document[nombreImagen].src=img; } } function desactivar(nombreImagen,img) { if (document.images) { document[nombreImagen].src=img; } } function openCard(u,sub) { var filter ="p1="+u; var sDialog = "" if (sub=="1") { sDialog = "../../employee/eComunicacionFicha.jsp?"+filter; } else { sDialog = "../employee/eComunicacionFicha.jsp?"+filter; } open(sDialog,"","resizable=no,menubar=no,status=no,toolbar=no,titlebar=no,width=500px,height=200px,left=200px,top=170px"); } var sDirVirtual = ""; var sApp = ""; var sMensajeDesconexion = ""; var idTimer = null; function seteaMensaje(){ sMensajeDesconexion = arguments[0]; } function activaTimer(){ sDirVirtual = arguments[0]; sApp = arguments[1]; var iNumMinutes = eval(arguments[2]); idTimer = setTimeout("desconectar()",iNumMinutes * 60 * 1000); } function desconectar(){ var sDesconexion = sDirVirtual + "/core/logout.jsp?logged=yes&Application="+sApp; alert(sMensajeDesconexion); window.location.href = sDesconexion; } function desactivaTemporizador(){ clearTimeout(idTimer); } /************************************************************************************* * Bubble functions */ var descrX = -1; var descrY = -1; /** * */ function setDescriptionPosition(xpos,ypos) { descrX = xpos; descrY = ypos; } /** * Hides the bubble */ function hideDescription() { document.getElementById("Description").style.display = "none"; } /** * Shows the bubble rectangle with an informative message. It assumes that there is a div * element called Description in it. Inside the Description div, it must exist a text * called textContents id. This function should be called on onMouseOver event * handler, and hideDescription can be called on onMouseOut event. */ function showDescription() { var elementToShow = document.getElementById("Description"); var text = document.getElementById("textContents"); // each argument will represent a row in the same cell (no new rows) var iNum = arguments.length; text.innerHTML = arguments[0]; for ( i=1;i= 6) { num = sFecha.indexOf("/"); dia = sFecha.substr(0,num); num1 = sFecha.lastIndexOf("/"); var barra=(num1-(num+1)); mes = sFecha.substr((num+1),barra); if (mes.length == 1) mes = '0' + mes; var l=sFecha.length; any = sFecha.substr((num1+1),l); if (any.length == 2) any = ((any > '30') ? '19' : '20') + any; } var date = new Date(any, mes-1, dia); var mesValidado = date.getMonth() + 1; if ( mes != mesValidado) { try { sError = document.getElementById("errorDate").value; } catch( SomeError) { sError = 'Incorrect Date'; } displayJavaScriptError(sError,0); oFecha.blur(); oFecha.focus(); oFecha.select(); return false; } else { oFecha.value = dia + '/' + mes + '/' + any; return true; } } /////////////////////////////////// // fixed decimal places function function fdp(n,d) { var xx = n.indexOf('.'); var l = n.length; var zstr = '0000000000000000000000'; var theInt = ''; var theFrac = ''; var theNo = ''; rfac = ''; rfacx = 0; nx = 0; var xt = parseInt(d) + 1; var rstr = '' + zstr.substring(1,xt); var rfac = '.' + rstr + '5'; var rfacx = parseFloat(rfac); if (xx == -1 ) { // No fraction theFrac = zstr; theInt = "" + n; } else if (xx == 0) { theInt = '0'; nx = 0 + parseFloat(n) + parseFloat(rfacx); n = nx + zstr; theFrac = '' + n.substring(1, n.length); } else { theInt = n.substring(0,xx); nx = parseFloat(n) + rfacx; n = '' + nx + zstr; theFrac = '' + n.substring(xx+1,xx + 1 + parseInt(d)); var astr = 'd = ' + d; } theFrac = theFrac.substring(0,parseInt(d)); var ii = 0; theNo = theInt + '.' + theFrac; return theNo; } ////////////////////////////////////////// // Assign today date to specific field function getTodayDate(fieldName) { var Avui = new Date(); var Any = Avui.getYear(); var Mes = Avui.getMonth()+1; if (Mes < 10) Mes = "0"+Mes var Dia = Avui.getDate(); var fechaIn = document.getElementById(fieldName); fechaIn.value = Dia + "/" + Mes + "/" + Any; } /////////////////////////////////// // function to control number of input charactes in textarea fields function textCounter(txtField,txtCount,maxlimit) { field = document.getElementById(txtField); cntfield = document.getElementById(txtCount); if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit); else cntfield.value = maxlimit - field.value.length; } ////////////////////////////////////////////////////// // Pair of functions for timer reset // // requirements: // - must exist an iframe named 'resetTimerFrame' // - on main form add the event onmousemove="resetTimer(p1,p2,p3)" // where parameters are the same than activaTimer() function function sendDummyTransaction() { var sent = document.getElementById("timerTrans"); sent.value ="yes"; var sDialog = arguments[0]+"/core/doNothing.jsp"; frames["resetTimerFrame"].location.href = sDialog; } function resetTimer() { var sent = document.getElementById("timerTrans").value; //alert(sent); if (sent == null || sent == "no") { clearTimeout(idTimer); activaTimer(arguments[0],arguments[1],arguments[2]); sendDummyTransaction(arguments[0]); } } function scrollDown(divname) { document.getElementById(divname).doScroll("scrollbarDown"); } function scrollUp(divname) { document.getElementById(divname).doScroll("scrollbarUp"); } function markDeleted(_object){ var _object = _object.parentNode.parentNode; _object.style.textDecorationLineThrough= ! _object.style.textDecorationLineThrough; } function markRead(_object){ var _object = _object.parentNode.parentNode; if ( _object.style.fontStyle != 'oblique') _object.style.fontStyle = 'oblique'; else _object.style.fontStyle = 'normal'; }