2 * This section around grayOut came from here:
3 * http://www.codingforums.com/archive/index.php/t-151720.html
4 * Assumed public domain
6 * Init like this in your main html script, this also reapplies the gray
8 * lws_gray_out(true,{'zindex':'499'});
12 * lws_gray_out(false);
18 var h = document.compatMode === "CSS1Compat" &&
20 document.documentElement.clientHeight :
21 document.body.clientHeight;
22 var w = document.compatMode === "CSS1Compat" &&
24 document.documentElement.clientWidth :
25 document.body.clientWidth;
26 var pageWidth, pageHeight, t;
29 (document.body.scrollWidth || document.body.scrollHeight)) {
30 t = document.body.scrollWidth;
31 pageWidth = (w > t) ? ("" + w + "px") : ("" + (t) + "px");
32 t = document.body.scrollHeight;
33 pageHeight = (h > t) ? ("" + h + "px") : ("" + (t) + "px");
34 } else if (document.body.offsetWidth) {
35 t = document.body.offsetWidth;
36 pageWidth = (w > t) ? ("" + w + "px") : ("" + (t) + "px");
37 t = document.body.offsetHeight;
38 pageHeight =(h > t) ? ("" + h + "px") : ("" + (t) + "px");
43 return (ptype === 1) ? pageWidth : pageHeight;
46 function addEvent( obj, type, fn ) {
47 if ( obj.attachEvent ) {
48 obj["e" + type + fn] = fn;
49 obj[type+fn] = function() { obj["e" + type + fn]( window.event );};
50 obj.attachEvent("on" + type, obj[type + fn]);
52 obj.addEventListener(type, fn, false);
55 function removeEvent( obj, type, fn ) {
56 if ( obj.detachEvent ) {
57 obj.detachEvent("on" + type, obj[type + fn]);
58 obj[type + fn] = null;
60 obj.removeEventListener(type, fn, false);
63 function lws_gray_out(vis, _options) {
65 var options = _options || {};
66 var zindex = options.zindex || 50;
67 var opacity = options.opacity || 70;
68 var opaque = (opacity / 100);
69 var bgcolor = options.bgcolor || "#000000";
70 var dark = document.getElementById("darkenScreenObject");
73 var tbody = document.getElementsByTagName("body")[0];
74 var tnode = document.createElement("div");
75 tnode.style.position = "absolute";
76 tnode.style.top = "0px";
77 tnode.style.left = "0px";
78 tnode.style.overflow = "hidden";
79 tnode.style.display ="none";
80 tnode.id = "darkenScreenObject";
81 tbody.appendChild(tnode);
82 dark = document.getElementById("darkenScreenObject");
85 dark.style.opacity = opaque;
86 dark.style.MozOpacity = opaque;
87 // dark.style.filter ='alpha(opacity='+opacity+')';
88 dark.style.zIndex = zindex;
89 dark.style.backgroundColor = bgcolor;
90 dark.style.width = gsize(1);
91 dark.style.height = gsize(0);
92 dark.style.display = "block";
93 addEvent(window, "resize",
95 dark.style.height = gsize(0);
96 dark.style.width = gsize(1);
100 dark.style.display = "none";
101 removeEvent(window, "resize",
103 dark.style.height = gsize(0);
104 dark.style.width = gsize(1);
111 * end of grayOut related stuff
114 function new_ws(urlpath, protocol)
116 if (typeof MozWebSocket != "undefined")
117 return new MozWebSocket(urlpath, protocol);
119 return new WebSocket(urlpath, protocol);
124 if (s.search("<") !== -1)
125 return "invalid string";