Ajout drapeaux isIE7max.
[Epoz.git] / epoz / epoz_core / epoz_iframe_trigger.js.dtml
1 var IFramePrefix = "Iframe_";
2 var IFramePrefixLength = IFramePrefix.length;
3 var DocPrefix = "doc_";
4 var DocPrefixLength = DocPrefix.length;
5
6
7 function raiseEpozRedirect() {
8 docid = document.id;
9 if (!docid) return; // single mode
10 docid = document.id.slice(DocPrefixLength);
11 frameId = IFramePrefix + docid;
12 iframe = window.parent.document.getElementById(frameId);
13 if (iframe)
14 raiseEvent(iframe, "click");
15 }
16
17 function raiseEvent(ob, eventName) {
18 if (browser.isIE55 || browser.isIE6up) {
19 eventName = "on" + eventName;
20 ob.fireEvent(eventName);
21 }
22 else if (browser.isGecko) {
23 event = document.createEvent("MouseEvents");
24 event.initEvent(eventName, true, true);
25 ob.dispatchEvent(event);
26 }
27
28 }
29
30 function addMouseDownListener() {
31 if (browser.isIE55 || browser.isIE6up) {
32 document.attachEvent("onmousedown", raiseEpozRedirect);
33 }
34 else if (browser.isGecko) {
35 document.addEventListener("mousedown", raiseEpozRedirect, false);
36 }
37 }
38
39 window.onload = addMouseDownListener;