// ver. 1.1 Function.prototype.bind = function(object) { var __method = this; return function() { __method.apply(object, arguments); } } if (!Function.prototype.apply) { Function.prototype.apply = function(oScope, args) { var sarg = []; var rtrn, call; if (!oScope) oScope = window; if (!args) args = []; for (var i = 0; i < args.length; i++) { sarg[i] = "args["+i+"]"; } call = "oScope.__applyTemp__(" + sarg.join(",") + ");"; oScope.__applyTemp__ = this; rtrn = eval(call); return rtrn; } } /*****************************/ /* Estensione metodi String */ /*****************************/ String.prototype.trim = function(){ var output = this.ltrim(); output = output.rtrim(); return output; } String.prototype.ltrim = function(){ var w_space = String.fromCharCode(32); if(v_length < 1){ return""; } var v_length = this.length; var strTemp = ""; var iTemp = 0; while(iTemp < v_length){ if(this.charAt(iTemp) == w_space){ } else{ strTemp = this.substring(iTemp,v_length); break; } iTemp = iTemp + 1; } return strTemp; } String.prototype.rtrim = function(){ var w_space = String.fromCharCode(32); var v_length = this.length; var strTemp = ""; if(v_length < 0){ return""; } var iTemp = v_length -1; while(iTemp > -1){ if(this.charAt(iTemp) == w_space){ } else{ strTemp = this.substring(0,iTemp +1); break; } iTemp = iTemp-1; } return strTemp; } String.prototype.isNumeric = function(){ var filter = /^([0-9])+$/; if (!filter.test(this)) { return false; }else{ return true; }; } String.prototype.replaceAll = function(find,toStr){ var strTmp = this.split(find).join(toStr) return strTmp; } String.prototype.formatGuid = function(){ return this.replace("{","").replace("}","") } String.prototype.urlEncode = function(){ return this.replaceAll("/","%2F").replaceAll("?","%3F").replaceAll("&","%26"); }; /*******************************************/ /******************************/ /* Estensione metodi Document */ /******************************/ document.getElementInformations = function(el){ var lw = el.offsetWidth; var lh = el.offsetHeight; for (var lx=0,ly=0;el!=null; lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent); return {left:lx,top:ly,height:lh,width:lw} } document.getElementsByClassName = function(strClassName){ oElm = this; strTagName = "*" var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); strClassName = strClassName.replace(/\-/g, "\\-"); strClassName = strClassName.replace("[", "\\["); strClassName = strClassName.replace("]", "\\]"); var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)"); var oElement; for(var i=0; ivalMax) valMax=altezza; } for(var j=0;j0){ var vericifa = new RegExp(eval("/"+class1+" /")); return vericifa.test(className+" "); }else{ return false; } break; }; } /* Aggiunta eventi*/ this.addEvent = function(obj, evType, fn) { if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } /* Rimozione eventi*/ this.removeEvent = function(obj, evType, fn) { if ( obj.detachEvent ) { obj.detachEvent( 'on'+evType, obj[evType+fn] ); obj[evType+fn] = null; } else obj.removeEventListener( evType, fn, false ); } /* Cerca attributi all'interno dell'attributo class, per mantenere valido il documento XHTML */ this.attribute = new _e3Attribute(); this.findAll = function(){ var value = this.attribute.findFromCss("popup","A"); var elencoTag = this.attribute.resultSearch; for (var i=0;i