// Funciones utilitarias generales function checkCSSClass(obj,c) { if (obj && obj.className) return new RegExp('\\b'+c+'\\b').test(obj.className) return false; } function addCSSClass(obj,c) { if (!checkCSSClass(obj,c)) { obj.className+=(obj.className)?' '+c:c; } } function delCSSClass(obj,c) { if (obj && obj.className) { var rep = (obj.className.match(' '+c))?' '+c:c; obj.className = obj.className.replace(rep,''); } } function replaceCSSClass(obj,c1,c2) { delCSSClass(obj,c1); addCSSClass(obj,c2); } function swapCSSClass(obj,c1,c2) { var c2=(c2)?c2:""; if (checkCSSClass(obj,c1)) { replaceCSSClass(obj,c1,c2); } else { replaceCSSClass(obj,c2,c1); } } function isArray(a) { return (typeof a == 'object') && a.constructor == Array; } function round(value) { return (parseInt(value*100)/100); } function openPopupWindowNew(link,params) { return window.open((link.href?link.href:link), 'popup',params+', width=750px, height=400px, resizable=yes, toolbars=no, scrollbars=yes,'+params); } function is_email(email_str,error_msg,focus_obj) { var email_ok=true; if ((email_str.length < 6)) { email_ok=false; } else if ((email_str.indexOf('@') == -1) || (email_str.indexOf('.') == -1)) { email_ok=false; } else if ((email_str.indexOf('@') == 0) || (email_str.indexOf('.') == 0)) { email_ok=false; } else if (email_str.lastIndexOf("@") != (email_str.indexOf('@')) ) { email_ok=false; } else if ( (email_str.indexOf(".") == (email_str.indexOf('@')-1)) || (email_str.indexOf(".") == (email_str.indexOf('@')+1)) ){ email_ok=false; } else if ((email_str.lastIndexOf(".") == (email_str.length-1)) || (email_str.lastIndexOf(".") == (email_str.length-2)) ) { email_ok=false; } else if(email_str.lastIndexOf(".") < email_str.indexOf("@")) { email_ok=false; } else if(email_str.indexOf(" ")>-1) { email_ok=false; } if ((!email_ok)&&(error_msg)) { alert(error_msg); } if ((!email_ok)&&(focus_obj)) { focus_obj.focus(); } return (email_ok); } function is_empty(valor){ return ((valor==null)||(valor=="")||(valor.length == 0)); } function is_numeric(valor){ var numericExpression = /^[0-9]+$/; return (valor.match(numericExpression)!=null); } function minlength(valor,min) { return (valor.length > min); } function maxlength(valor,max) { return (valor.length <= max); } function is_date(str) { var date_regexp = new RegExp("^([0-9]{1,2})[-//.]([0-9]{1,2})[-//.]([0-9]{2,4})$"); var matches = date_regexp.exec(str); if (!matches) return false; if (matches[3].length == 3) return false; //Fix 2 char Year if (matches[3].length == 2) matches[3] = '20'+matches[3]; var composedDate = new Date(matches[3], (matches[2] - 1), matches[1]); var day_str = String(composedDate.getDate()); if (day_str.length < 2) day_str = "0" + day_str; var month_str = String(composedDate.getMonth()+1); if (month_str.length < 2) month_str = "0" + month_str; var date_str = day_str + '/' + month_str + '/' + composedDate.getFullYear(); return ((composedDate.getMonth() == (matches[2] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[3]))?date_str:false; } function destroy(obj) { obj.destroy && obj.destroy(); purge(obj); // obj.parentNode && obj.parentNode.removeChild(obj); } function purge(obj) { var a = obj.attributes, i, l, n; if (a) { l = a.length; for (i = 0; i < l; i += 1) { n = a[i].name; if (typeof obj[n] === 'function') { obj[n] = null; } } } } /* String.prototype.asNumber = function() { return (this.replace(/[^0-9\-]/g,'')/1); } function isIE() { return (window.navigator.userAgent.indexOf("MSIE")>0); } function is_date(m_strDate){ if (m_strDate=="") { return false; } var m_arrDate = m_strDate.split("/"); var m_DAY = m_arrDate[0]; var m_MONTH = m_arrDate[1]; var m_YEAR = m_arrDate[2]; if(!m_DAY || !m_MONTH || !m_YEAR) { return false; } if(m_YEAR.length != 4) { return false; } m_strDate = m_MONTH + "/" + m_DAY + "/" + m_YEAR; var testDate=new Date(m_strDate); if (testDate.getMonth()+1==m_MONTH){ return true; } else { return false; } } function FileUploader(aplication, reference, request, extraAction, extraReference, referenceObj) { var iframe = document.createElement('IFRAME'); iframe.aplication = aplication; iframe.className = 'fileuploader'; if (aplication) { iframe.style.top = offsetTop(aplication)+((heightObj(aplication)-120)/2)+'px'; iframe.style.top = offsetTop(aplication)+((heightObj(aplication)-120)/2)+'px'; } iframe.referenceObj = referenceObj; var src = '/admin/fileuploader.php?request='+request+(reference?'&reference='+reference:'') +(extraAction?'&extraAction='+extraAction:'') +(extraReference?'&extraReference='+extraReference:''); iframe.src = src; window.fileuploader = iframe; iframe.close = function () { document.body.removeChild(this); } iframe.uploadOk = function (result) { this.aplication.fileUploadOk(result, this.referenceObj); this.close(); } document.body.appendChild(iframe); return iframe; } function AltText(aplication, top, left, text) { var altText = document.createElement('DIV'); altText.className = 'alttext'; altText.style.top = top + 'px'; altText.style.left = left + 'px'; altText.innerHTML = text; altText.aplication = aplication; aplication.altText = altText; altText.close = function () { document.body.removeChild(this); this.aplication.altText = false; } document.body.appendChild(altText); return altText; } String.prototype.normalizeChars = function() { var result = this.toLowerCase(); result = result.replace(/á/g, 'a'); result = result.replace(/é/g, 'e'); result = result.replace(/í/g, 'i'); result = result.replace(/ó/g, 'o'); result = result.replace(/ú/g, 'u'); result = result.replace(/ç/g, 'c'); result = result.replace(/á/g, 'a'); result = result.replace(/é/g, 'e'); result = result.replace(/í/g, 'i'); result = result.replace(/ó/g, 'o'); result = result.replace(/ú/g, 'u'); result = result.replace(/ç/g, 'c'); return result; }; function _blank(url) { if (url) { window.open(url); } return false; }*/