var IFramePrefix = "Iframe_";
var IFramePrefixLength = IFramePrefix.length;
var DocPrefix = "doc_";
var DocPrefixLength = DocPrefix.length;


function raiseEpozRedirect() {
	docid = document.id;
	if (!docid) return; // single mode
	docid = document.id.slice(DocPrefixLength);
	frameId = IFramePrefix + docid;
	iframe = window.parent.document.getElementById(frameId);
	if (iframe)
		raiseEvent(iframe, "click");
}

function raiseEvent(ob, eventName) {
    if (browser.isIE55 || browser.isIE6up) {
    	eventName = "on" + eventName;
    	ob.fireEvent(eventName);
    }
    else if (browser.isGecko) {
    	event = document.createEvent("MouseEvents");
    	event.initEvent(eventName, true, true);
    	ob.dispatchEvent(event);
    }

}

function addMouseDownListener() {
    if (browser.isIE55 || browser.isIE6up) {
		document.attachEvent("onmousedown", raiseEpozRedirect);
    }
    else if (browser.isGecko) {
		document.addEventListener("mousedown", raiseEpozRedirect, false);
    }
}

window.onload = addMouseDownListener;