
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - ++resource++conf.skin.common.javascripts/patches.js - */
// http://www.episode3.aero/portal_javascripts/++resource++conf.skin.common.javascripts/patches.js?original=1
(function(){if(window.kukit&&kukit.ut){kukit.ut.registerEventListener=function(elem,event,func){registerEventListener(elem,event,func)}}
if(window.jQuery&&jQuery.event.special){jQuery(['getData','setData','remove']).each(function(){jQuery.event.special[this]={setup: function(){return true},teardown: function(){return true}}})}
registerEventListener(window,'load', function(){if(window.PopupWindow_getXYPosition){var Offset=function(node){this.left=0;this.top=0;while(node){this.left+=node.offsetLeft;this.top+=node.offsetTop;node=node.offsetParent}}
PopupWindow_getXYPosition=function(anchorname){var anchor=document.getElementById(anchorname);var portal=document.getElementById('visual-portal-wrapper');anchor_offset=new Offset(anchor);portal_offset=new Offset(portal);this.x=anchor_offset.left-portal_offset.left;this.y=anchor_offset.top-portal_offset.top}}});if(!window.XMLHttpRequest){window.XMLHttpRequest=function(){if(window.ActiveXObject){var names=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(var i in names){try{return new ActiveXObject(names[i])}
catch(e){}}}}}
if(!window.Sarissa)
window.Sarissa={clearChildNodes: function(){}}})();jQuery(document).ready(function(){});

/* - ++resource++conf.app.library.javascripts/contextualmenu.js - */
// http://www.episode3.aero/portal_javascripts/++resource++conf.app.library.javascripts/contextualmenu.js?original=1
ep3ContextualMenu={}
ep3ContextualMenu.LIBFILE_ID_MATCH=/.*WP[0-9].*-.*-V[0-9]*\.[0-9]*-*\.*/
ep3ContextualMenu.init=function(){jQuery('body').click(ep3ContextualMenu.hideContextualMenus)}
ep3ContextualMenu.usefulUrl=function(href){var url=href.split('?')[0];if(url.substr(url.length-1)=='/'){url=url.substr(0,url.length-1)}
return url}
ep3ContextualMenu.isLibcontentLink=function(href){if((/@@/.test(href))) return false;if(!(/\/library\/./.test(href))) return false;if((/\/reviews\/./.test(href))) return false;url=ep3ContextualMenu.usefulUrl(href);var steps=url.split('/');var last=steps[steps.length-1];if(ep3ContextualMenu.LIBFILE_ID_MATCH.test(last)) return true;var antelast=steps[steps.length-2];if(ep3ContextualMenu.LIBFILE_ID_MATCH.test(antelast)) return false;return true}
ep3ContextualMenu.bindContextualMenus=function(root){root=jQuery(root);root.find('a').each(function(){if(ep3ContextualMenu.isLibcontentLink(this.href)){ep3ContextualMenu.bindContextualMenu(this)}})}
ep3ContextualMenu.bindContextualMenu=function(anchor){var anchor=jQuery(anchor);anchor.rightClick(function(){ep3ContextualMenu.displayContextualMenu(anchor);return false})}
ep3ContextualMenu.displayContextualMenu=function(anchor){ep3ContextualMenu.hideContextualMenus();if(anchor.siblings('ul.contextListItems').length>0){ep3ContextualMenu.showContextualMenu(anchor)}
else{if(!anchor.parent().hasClass('contextuallink')){var container=jQuery('<span class="contextuallink"></span>');container.append(anchor.clone());ep3ContextualMenu.bindContextualMenu(container.find('a'));anchor.replaceWith(container)}
else{container=anchor.parent()}
var url=ep3ContextualMenu.usefulUrl(anchor.attr('href'));url=url+'/@@contextualmenu';jQuery.get(url, function(html){container.append(html);ep3ContextualMenu.showContextualMenu(container);ep3ContextualMenu.bindFavoriteLink(container);ep3ContextualMenu.bindSubscribeLink(container)})}}
ep3ContextualMenu.showContextualMenu=function(anchor){var menu=anchor.parent().find('.contextListItems');menu.show()}
ep3ContextualMenu.hideContextualMenus=function(){jQuery(document).find('.contextListItems').hide()}
ep3ContextualMenu.removeContextualMenu=function(container){jQuery(container).find('.contextListItems').remove()}
ep3ContextualMenu.subscribe_confirm="You are going to be assigned as technical review of the document. ";ep3ContextualMenu.subscribe_confirm+="Please note that all comments must be done in the review room during the allocated time. ";ep3ContextualMenu.subscribe_confirm+="As technical reviewer you will receive an email as soon as the document is ready for approval. ";ep3ContextualMenu.subscribe_confirm+="Do you confirm your subscription ?";ep3ContextualMenu.unsubscribe_confirm="You are going to be unassigned from the technical review of the document. "
ep3ContextualMenu.unsubscribe_confirm+="Do you confirm your unsubscription ?";ep3ContextualMenu.bindSubscribeLink=function(root){root.find('.subscribeAction').click(function(){if(!confirm(ep3ContextualMenu.subscribe_confirm)){return false}
ep3ContextualMenu.removeContextualMenu();alert("You have subscribed to the review")});root.find('.unsubscribeAction').click(function(){if(!confirm(ep3ContextualMenu.unsubscribe_confirm)){return false}
ep3ContextualMenu.removeContextualMenu();alert("You have unsubscribed from the review")});root.find('.subscribeActionDisabled').unbind('click').click(function(){var msg="Sorry, the technical review of this deliverable is now closed, ";msg+="contact the EP3 QCO for more details";alert(msg);ep3ContextualMenu.hideContextualMenus();return false})}
ep3ContextualMenu.bindFavoriteLink=function(root){root=jQuery(root);root.find('.favoriteAction').click(function(){var url=root.find('a')[0].href;var id=url.split('/')[url.split('/').length-1];var image=jQuery(this).find('img');jQuery.getJSON(url+'/@@togglefavorite', function(is_favorite){if(is_favorite){image.attr('src','favorite_icon.gif');library.displayPortalMessage(id+" added to favorites")}
else{image.attr('src','favorite_icon_disabled.gif');library.displayPortalMessage(id+" removed from favorites")}})})}
jQuery(document).ready(function(){ep3ContextualMenu.init();jQuery('#library-listing-table').each(function(){ep3ContextualMenu.bindContextualMenus(this)})
jQuery('#workspace').each(function(){ep3ContextualMenu.bindContextualMenus(this)})
jQuery('.searchResults').each(function(){ep3ContextualMenu.bindContextualMenus(this)})
jQuery('.portletRecent').each(function(){ep3ContextualMenu.bindContextualMenus(this)})
jQuery('ul.portletNavigationTree').each(function(){ep3ContextualMenu.bindContextualMenus(this)})})


