// Copyright Zikula Foundation 2010 - license GNU/LGPLv3 (or at your option, any later version).
var Form={};Form.contextMenu={};Form.contextMenu.visibleMenus={};Form.contextMenu.getCommandArgument=function(a){return $("contentMenuArgument"+a).value};Form.contextMenu.showMenu=function(a,g,b){Form.contextMenu.hideMenu();var d=$(g),c=Event.element(a),f=c.cumulativeOffset();f.left+=c.getWidth()+10;$("contentMenuArgument"+g).value=b;Form.contextMenu.commandArgument=b;Event.observe(document,"click",function(){Form.contextMenu.hideMenu(g)});Form.contextMenu.visibleMenus[g]=true;var e;if(Prototype.Browser.IE==true){$(document.body).insert(d);e={left:0,top:0}}else{e=d.getOffsetParent().positionedOffset()}d.style.display="block";d.style.position="absolute";d.style.left=(f.left-e.left)+"px";d.style.top=(f.top-e.top)+"px";Event.stop(a)};Form.contextMenu.hideMenu=function(){for(var a in Form.contextMenu.visibleMenus){contextMenu=$(a);if(contextMenu!=null){contextMenu.style.display="none"}}Form.contextMenu.visibleMenus={}};Form.contextMenu.commandScript=function(c,b){var a=$(c).value;b(a)};Form.contextMenu.redirect=function(c,b){var a=$(c).value;b=b.replace(/\{commandArgument\}/,a);window.location=b};