2 //\ overLIB Hide Form Plugin
3 //\ This file requires overLIB 4.00 or later.
5 //\ Uses an iframe shim to mask system controls for IE v5.5 or higher as suggested in
6 //\ http://dotnetjunkies.com/weblog/jking/posts/488.aspx
8 //\ overLIB 4.00 - You may not remove or change this notice.
9 //\ Copyright Erik Bosrup 1998-2004. All rights reserved.
10 //\ Contributors are listed on the homepage.
11 //\ See http://www.bosrup.com/web/overlib/ for details.
15 if (typeof olInfo == 'undefined' || olInfo.simpleversion < 400) alert('overLIB 4.00 or later is required for the HideForm Plugin.');
17 // Function which generates the popup with an IFRAME shim
18 function generatePopUp(content) {
19 if(!olIe4||olOp||!olIe55||(typeof o3_shadow != 'undefined' && o3_shadow)||(typeof o3_bubble != 'undefined' && o3_bubble)) return;
21 var wd,ht,txt, zIdx = 0;
23 wd = parseInt(o3_width);
24 ht = over.offsetHeight;
25 txt = bckDropSrc(wd,ht,zIdx++);
26 txt += '<div style="position: absolute; top: 0; left: 0; width: '+ wd+'px; z-index: ' + zIdx + ';">' + content + '</div>';
30 // Code for the IFRAME which is used in other places
31 function bckDropSrc(width, height, Z) {
32 return '<iframe frameborder="0" scrolling="no" src="" width="' + width + '" height="' + height + '" style="z-index: ' + Z + '; filter: Beta(Style=0,Opacity=0);"></iframe>';
35 // Hides SELECT boxes that will be under the popup
36 // Checking Gecko version number to try to include other browsers based on the Gecko engine
37 function hideSelectBox() {
38 if(olNs4 || olOp || olIe55) return;
39 var px, py, pw, ph, sx, sw, sy, sh, selEl, v;
43 v = navigator.userAgent.match(/Gecko\/(\d{8})/i);
44 if(!v) return; // return if no string match
48 if (v < 20030624) { // versions less than June 24, 2003 were earlier Netscape browsers
49 px = parseInt(over.style.left);
50 py = parseInt(over.style.top);
52 ph = (o3_aboveheight ? parseInt(o3_aboveheight) : over.offsetHeight);
53 selEl = (olIe4) ? o3_frame.document.all.tags("SELECT") : o3_frame.document.getElementsByTagName("SELECT");
54 for (var i=0; i<selEl.length; i++) {
55 if(!olIe4 && selEl[i].size < 2) continue; // Not IE and SELECT size is 1 or not specified
56 sx = pageLocation(selEl[i],'Left');
57 sy = pageLocation(selEl[i],'Top');
58 sw = selEl[i].offsetWidth;
59 sh = selEl[i].offsetHeight;
60 if((px+pw) < sx || px > (sx+sw) || (py+ph) < sy || py > (sy+sh)) continue;
61 selEl[i].isHidden = 1;
62 selEl[i].style.visibility = 'hidden';
67 // Shows previously hidden SELECT Boxes
68 function showSelectBox() {
69 if(olNs4 || olOp || olIe55) return;
74 v = navigator.userAgent.match(/Gecko\/(\d{8})/i);
80 selEl = (olIe4) ? o3_frame.document.all.tags("SELECT") : o3_frame.document.getElementsByTagName("SELECT");
81 for (var i=0; i<selEl.length; i++) {
82 if(typeof selEl[i].isHidden != 'undefined' && selEl[i].isHidden) {
83 selEl[i].isHidden = 0;
84 selEl[i].style.visibility = 'visible';
90 // function gets the total offset properties of an element
91 // this same function occurs in overlib_mark.js.
92 function pageLocation(o,t){
95 while(o.offsetParent){
105 // reset mouse move routine for NS7 but not NS7.1,Opera, or IE5.5+
106 // It also bypasses Netscape 6 since the modifications mess up the display of popups
107 // and don't work anyways.
108 // Modify mouse move routine while loading so that hideSelectBox()
109 // can be called from the correct location
110 if (!(olNs4 || olOp || olIe55 || navigator.userAgent.indexOf('Netscape6') != -1)) {
111 var MMStr = olMouseMove.toString();
112 var strRe = /(if\s*\(o3_allowmove\s*==\s*1.*\)\s*)/;
113 var f = MMStr.match(strRe);
116 var ls = MMStr.search(strRe);
118 var le = MMStr.substring(ls).search(/[;|}]\n/);
119 MMStr = MMStr.substring(0,ls) + ' { runHook("placeLayer",FREPLACE); if(olHideForm) hideSelectBox(); ' + MMStr.substring(ls + (le != -1 ? le+3 : 0));
120 document.writeln('<script type="text/javascript">\n<!--\n' + MMStr + '\n//-->\n</' + 'script>');
123 f = capExtent.onmousemove.toString().match(/function[ ]+(\w*)\(/);
124 if (f&&f[1] != 'annoymous') capExtent.onmousemove = olMouseMove;
129 // PLUGIN REGISTRATIONS
131 registerHook("createPopup",generatePopUp,FAFTER);
132 registerHook("hideObject",showSelectBox,FAFTER);