Share Pastebin
Guest
Public paste!

Alcides Fonseca

By: a guest | Aug 25th, 2007 | Syntax: JavaScript | Size: 0.68 KB | Hits: 220 | Expires: Never
Copy text to clipboard
  1. // Prototype extra javascript stuff
  2. // http://alcides.ideias3.com
  3.  
  4. Position.GetWindowSize = function(w) {
  5.         var width, height;
  6.         w = w ? w : window;
  7.         this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
  8.         this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
  9.        
  10.         return this;
  11. }
  12.  
  13. String.prototype.trim = function() {
  14.         return this.replace(/^\s+|\s+$/g,"");
  15. }
  16.  
  17. Array.prototype.haskey = function(item) {
  18.   var j = 0;
  19.    while (j < this.length) {
  20.       if (this[j] == item) {
  21.           return true;
  22.       } else { j++; }
  23.    }
  24.    return false;
  25. }