Array.prototype.in_array = function(p_val) { for (var i = 0, l = this.length; i < l; i++) { if (this[i] == p_val) { return true; } } return false; } function $id(id) { var element = document.getElementById(id); return $(element); } function $tag(tag_name) { var dom = this.getElementsByTagName(tag_name); var elements = []; for (var i = 0; i < dom.length; i++) { elements[i] = $(dom[i]); } if (elements.length == 1) { elements = elements[0]; } return elements; } function replaceHTML(el, html) { var oldEl = typeof el === "string" ? document.getElementById(el) : el; /*@cc_on // Pure innerHTML is slightly faster in IE oldEl.innerHTML = html; return oldEl; @*/ var newEl = oldEl.cloneNode(false); newEl.innerHTML = html; oldEl.parentNode.replaceChild(newEl, oldEl); return newEl; } function $(o) { o.$id = $id; o.$tag = $tag; o.$clear = function () { while (o.firstChild) { o.removeChild(o.firstChild); } } o.$text = function (str) { o.$clear(); var text_node = document.createTextNode(str); o.appendChild(text_node); } o.$replace = function () { o.$clear(); o.appendChild(o); } return o; } /*Object.prototype.iy_empty = function () { while (this.firstChild) { this.removeChild(this.firstChild); } } Object.prototype.iy_text = function (_txt) { this.iy_empty(); var text_node = document.createTextNode(_txt); this.appendChild(text_node); }*/ /*Object.prototype.iy_id = function (_id) { var element = this.getElementById(_id); return element; }*/ /*Object.prototype.iy_tag = function (_tag) { var elements = this.getElementsByTagName(_tag); if (elements.length == 1) { elements = elements[0]; } return elements; }*/ Object.prototype.iy_replace = function (o) { this.iy_empty(); this.appendChild(o); } window.iy_size = function () { var width = 0; var height = 0; if(typeof(window.innerWidth) == 'number') { width = window.innerWidth; height = window.innerHeight; } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) { width = document.body.clientWidth; height = document.body.clientHeight; } return [width, height]; } window.iy_match = function () { var size = window.iy_size(); var resize_height = size[1] - document.body.clientHeight - 3; window.resizeBy(0, -resize_height); } window.iy_center = function () { var size = window.iy_size(); //window.screenX = (screen.width - size[0]) / 2; //window.screenY = (screen.height - size[1]) / 2; var x = (screen.width - size[0]) / 2; var y = (screen.height - size[1]) / 2; window.moveTo(x, y); } window.iy_open = function (page, name, width, height) { if (!width) width = 1; if (!height) height = 1; var winl = (screen.width - width) / 2; var wint = (screen.height - height) / 2; var settings = 'height=' + height + ','; settings += 'width=' + width + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += 'menubar=no,'; settings += 'location=no,'; settings += 'resizable=no,'; settings += 'scrollbars=no,'; settings += 'status=no'; var win = window.open(page, name, settings); }