function doconcat(str1, str2) { return str1 + str2; } function groupval(str, nom, islg, isln, isnm) { var sTemp = ''; if (islg == 1) {sTemp = sTemp + islegal(str,nom);} if (isln == 1) {sTemp = sTemp + islength(str,nom);} if (isnm == 1) {sTemp = sTemp + isnum(str,nom);} return sTemp; } function islegal(str,nom) { var inc = "&;`'{}[]"; var temp = ''; if (str.length > 0) { for (var i=0; i< str.length; i++) { temp = "" + str.substring(i, i+1); if (inc.indexOf(temp) != "-1") { return "El campo "+nom+" tiene caracteres ilegales \n"; break; } } return ''; } else {return '';} } function islength(str,nom) { if (str.length == 0) {return 'Debe completar el campo ' + nom + '\n';} else {return '';} } function isnum(str,nom) { var inc = "0123456789.,"; var temp = ''; if (str.length > 0) { for (var i=0; i< str.length; i++) { temp = "" + str.substring(i, i+1); if (inc.indexOf(temp) == "-1") { return "El campo "+ nom + " debe ser un numero \n"; break; } } return ''; } else {return '';} } function isNumBool(str) { var inc = "0123456789.,-"; var temp = ''; if (str.length > 0) { for (var i=0; i< str.length; i++) { temp = "" + str.substring(i, i+1); if (inc.indexOf(temp) == "-1") { return false; break; } } return true; } else {return true;} } function openWin(sPath, wid, hei) { var iLeft = 0; iLeft = (screen.width / 2) - (wid / 2); var iTop = 0; iTop = (screen.height / 2) - (hei / 2); window.open(sPath,"Viajes","width="+wid+",height="+hei+",status=no,toolbar=no,menubar=no,scrollbars=yes,top="+iTop+",left="+iLeft+""); } function openWin2(sPath, wid, hei, name) { var iLeft = 0; iLeft = (screen.width / 2) - (wid / 2); var iTop = 0; iTop = (screen.height / 2) - (hei / 2); return window.open(sPath,name,"width="+wid+",height="+hei+",status=no,toolbar=no,menubar=no,scrollbars=yes,top="+iTop+",left="+iLeft+""); } function openWinSinScroll(sPath, wid, hei, name) { var iLeft = 0; iLeft = (screen.width / 2) - (wid / 2); var iTop = 0; iTop = (screen.height / 2) - (hei / 2); return window.open(sPath,name,"width="+wid+",height="+hei+",status=no,toolbar=no,menubar=no,scrollbars=no,top="+iTop+",left="+iLeft+""); } function updtenv(str) { openWin("mkUpdtEnvioCorreo.jsp?ndocumentos="+str, 50, 50); } function islegal2(str,nom) { var inc = "ñÑ,-º.+_ª|#%áéíóúÁÉÍÓÚ"; var temp = ''; if (str.length > 0) { for (var i=0; i< str.length; i++) { temp = "" + str.substring(i, i+1); if (inc.indexOf(temp) != "-1") { return "El campo "+nom+" tiene caracteres ilegales \n"; break; } } return ''; } else {return '';} } /* ================================================================== LTrim(string) : Returns a copy of a string without leading spaces. ================================================================== */ function LTrim(str) { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { // We have a string with leading blank(s)... var j=0, i = s.length; // Iterate from the far left of string until we // don't have any more whitespace... while (j < i && whitespace.indexOf(s.charAt(j)) != -1) j++; // Get the substring from the first non-whitespace // character to the end of the string... s = s.substring(j, i); } return s; } /* ================================================================== RTrim(string) : Returns a copy of a string without trailing spaces. ================================================================== */ function RTrim(str) { // We don't want to trip JUST spaces, but also tabs, // line feeds, etc. Add anything else you want to // "trim" here in Whitespace var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { // We have a string with trailing blank(s)... var i = s.length - 1; // Get length of string // Iterate from the far right of string until we // don't have any more whitespace... while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--; // Get the substring from the front of the string to // where the last non-whitespace character is... s = s.substring(0, i+1); } return s; } /* ============================================================= Trim(string) : Returns a copy of a string without leading or trailing spaces ============================================================= */ function Trim(str) { return RTrim(LTrim(str)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } function nullstr(str) { if(str == null) { return ""; } if(str == 'null') { return ""; } return str; } function replaceOll(str, str1, str2) { var sResult = str; while(sResult.indexOf(str1) >-1) {sResult = sResult.replace(str1,str2);} return sResult; } function getCaretPos(elem) { var i = 0; if ( elem.isTextEdit && elem.caretPos ) { var bookmark = "~"; var orig = elem.value; var caretPos = elem.caretPos; caretPos.text = bookmark; var str = elem.value; str = replaceOll(str,'\r',''); i = elem.value.search( bookmark ); var i2 = str.search( bookmark ); elem.value = orig; setSelectionRange(elem, i2, i2); } return i; } function getLine(elem) { var e = elem; var i = getCaretPos(e); var str = e.value; var v1 = str.substring(0,i) var v2 = v1.substring(v1.lastIndexOf('\n')); var v3 = str.substring(i); var v4 = v3.substring(0,(v3.indexOf('\n')==-1)?v3.length:v3.indexOf('\n')); var v5 = v2 + v4; v5 = replaceOll(v5,'\n',''); v5 = replaceOll(v5,'\r',''); v5 = replaceOll(v5,'>>',''); return Trim(v5); } function storeCaret (textEl) { if (textEl.createTextRange) {textEl.caretPos = document.selection.createRange().duplicate();} } function fullScreen(theURL) { window.open(theURL, '', 'fullscreen=yes, scrollbars=auto'); } function setSelectionRange(input, selectionStart, selectionEnd) { if (input.setSelectionRange) { input.focus(); input.setSelectionRange(selectionStart, selectionEnd); } else if (input.createTextRange) { var range = input.createTextRange(); range.collapse(true); range.moveEnd('character', selectionEnd); range.moveStart('character', selectionStart); range.select(); } } function getSelection() { return document.selection.createRange().text; } function goCopy(str) { window.clipboardData.setData("text",str); } function cleancrlf(str) { str = replaceOll(str,'\n',''); str = replaceOll(str,'\r',''); str = replaceOll(str,'>>',''); return str; } function openOcatLib(sPnr) { try{if(iWin.documment == null){}}catch(er){iWin = null;} if (iWin == null) { var iLeft = 0; iLeft = (screen.width / 2) - (800 / 2); var iTop = 0; iTop = (screen.height / 2) - (600 / 2); iWin = window.open('mkOcat2.jsp?pnr='+sPnr,"marian","width=900,height=475,status=no,toolbar=no,menubar=no,scrollbars=yes,top=20,left="+iLeft+""); iWin.focus(); } else { iWin.focus(); iWin.form1.sComando.value = 'rt'+sPnr; iWin.send(); iWin.focus(); } } /*****************FUNCIÓN QUE ENVÍA UN CORREO CON LOS PARÁMETROS QUE RECIBE*************************************************************************************/ /* email - dirección de correo electrónico a la que enviar el correo */ /* subject - asunto del correo */ /* body - cuerpo del mensaje */ /* automatic - 'Y' se envía el correo directamente sin la posibilidad */ /* de modificar ninguno de los valores de los parámetros que envíamos */ /* 'N' se da la posibilidad de modificar los valores de los parámetros */ /* envíados */ /* key - clave del mensaje tipo para buscarlo en BBDD (tabla TMENSAJES - campo VKEY) */ /* params - parametros de los tags que hay que sustituir en el cuerpo del mensaje al usar 'key' y obtenerlo de BBDD */ /* formato = '|PARAMNAME1-PARAMVALUE1|PARAMNAME2-PARAMVALUE2' */ /***************************************************************************************************************************************************************/ function sendEmail(email,subject,body,automatic,key,params){ var dimension='width=780,height=600'; if(automatic=='Y'){ dimension='width=600,height=120'; mywindow=window.open("../jsp/gnSendEmail.jsp?sEmail="+email+"&sSubject="+subject+"&sBody="+body+"&sSend="+automatic+"&sKey="+key+"&sParams="+params,"emailwindow",dimension); mywindow.moveTo(200,300); }else{ mywindow=window.open("../jsp/gnSendEmail.jsp?sEmail="+email+"&sSubject="+subject+"&sBody="+body+"&sSend="+automatic+"&sKey="+key+"&sParams="+params,"emailwindow",dimension); } } /****************************************************************************************************************************************************************/ //Para validar que el email este completo correctamente function validateEmail(email){ var isCorrectForm1=false; var isCorrectForm2=false; for(i=0;i