function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

function bindFrame(){
    var links = document.getElementsByTagName("a");

    for (i=0; i<links.length; i++){
        var currentLink = links[i];
      
        var linkHref = currentLink.href;

		if (!linkHref.match(/(hex|hut|puzzles|rachacuca|ihave|google)/)){
			currentLink.onmousedown = function () {
				if (this.href.match(/inutilidades.hex.com.br/)) return;
				this.href = "http://inutilidades.hex.com.br/frame/?url=" + encodeURIComponent(this.href);
				this.target = "_new";
			}

		}

    }
}

addEvent(window, 'load', bindFrame);
