Index: /extensions/rightClick/main.inc.php
===================================================================
--- /extensions/rightClick/main.inc.php	(revision 9981)
+++ /extensions/rightClick/main.inc.php	(revision 9982)
@@ -13,4 +13,40 @@
 define('RIGHTCK_PATH' , PHPWG_PLUGINS_PATH . RIGHTCK_DIR . '/');
 define('RIGHTCK_VER' , '2.1.b');
-include_once( RIGHTCK_PATH . 'rightClick_protect.php');
+
+if ( !function_exists( 'rightClick_protect' ) )
+{
+	if ( defined('IN_ADMIN') and IN_ADMIN ) return false;
+
+	add_event_handler('loc_after_page_header', 'rightClick_protect', 20);
+
+	function  rightClick_protect()
+  {
+		global $template, $user, $conf;
+		if (!isset($conf['rightClick_level']))
+      $Maxlvl = max($conf['available_permission_levels']);
+		else
+      $Maxlvl = $conf['rightClick_level'];
+
+		if ($user['level'] >= $Maxlvl) return;
+
+		$default = array( '#theImage img', '#akPicture', '#colorbox', '#sb-container', );
+		if (!isset($conf['rightClick_selectors']))
+      $conf['rightClick_selectors'] = array();
+
+		$conf['rightClick_selectors'] = array_unique( array_merge($default, $conf['rightClick_selectors']) );
+		
+		$template->set_filenames(array(
+		'rightClick_protect' => dirname(__FILE__) . '/template/rightClick_protect.tpl',
+		));
+		$Path = embellish_url($template->get_template_vars('ROOT_URL').RIGHTCK_PATH);
+		$protect = array(
+			'Dir' 				=> RIGHTCK_DIR,
+			'Path' 				=> $Path,
+			'Version' 			=> RIGHTCK_VER,
+			'Selectors'			=> $conf['rightClick_selectors'],
+			);
+		$template->assign( array( 'RIGHTCK' => $protect ) );
+		$template->parse('rightClick_protect');
+	}
+}
 ?>
Index: tensions/rightClick/rightClick_protect.php
===================================================================
--- /extensions/rightClick/rightClick_protect.php	(revision 9981)
+++ 	(revision )
@@ -1,32 +1,0 @@
-<?php
-/* rightClick */
-if (!defined('PHPWG_ROOT_PATH') or !defined('RIGHTCK_DIR')) die('Hacking attempt!');
-
-if ( !function_exists( 'rightClick_protect' ) ) {
-	if ( defined('IN_ADMIN') and IN_ADMIN ) return false;
-	add_event_handler('loc_after_page_header', 'rightClick_protect', 20);
-
-	function  rightClick_protect() {
-		global $template, $user, $conf;
-		if (!isset($conf['rightClick_level'])) $Maxlvl = max($conf['available_permission_levels']);
-		else $Maxlvl = $conf['rightClick_level'];
-		if ($user['level'] >= $Maxlvl) return;
-		$default = array( '#theImage img', '#akPicture', '#colorbox', '#sb-container', );
-		if (!isset($conf['rightClick_selectors'])) $conf['rightClick_selectors'] = array();
-		$conf['rightClick_selectors'] = array_unique( array_merge($default, $conf['rightClick_selectors']) );
-		
-		$template->set_filenames(array(
-		'rightClick_protect' => dirname(__FILE__) . '/template/rightClick_protect.tpl',
-		));
-		$Path = embellish_url($template->get_template_vars('ROOT_URL').RIGHTCK_PATH);
-		$protect = array(
-			'Dir' 				=> RIGHTCK_DIR,
-			'Path' 				=> $Path,
-			'Version' 			=> RIGHTCK_VER,
-			'Selectors'			=> $conf['rightClick_selectors'],
-			);
-		$template->assign( array( 'RIGHTCK' => $protect ) );
-		$template->parse('rightClick_protect');
-	}
-}
-?>
Index: /extensions/rightClick/template/rightClick_protect.tpl
===================================================================
--- /extensions/rightClick/template/rightClick_protect.tpl	(revision 9981)
+++ /extensions/rightClick/template/rightClick_protect.tpl	(revision 9982)
@@ -1,15 +1,10 @@
-{known_script id="jquery" src=$ROOT_URL|cat:"themes/default/js/jquery.packed.js"}
-{html_head}
+{footer_script require="jquery"}
 <!-- Protected images by the "rightClick" plugin (version {$RIGHTCK.Version}): {$RIGHTCK.Dir}/template/rightClick_protect.tpl -->
-<script type="text/javascript">
-jQuery(document).ready(function($) {ldelim}
-{foreach item=selector from=$RIGHTCK.Selectors name=select}
-	$('{$selector}').each( function() {ldelim}
-		$(this)[0].oncontextmenu = function() {ldelim}
+jQuery(document).ready(function() {ldelim}
+	jQuery('{','|@implode:$RIGHTCK.Selectors}').each( function() {ldelim}
+		jQuery(this)[0].oncontextmenu = function() {ldelim}
 			return false;
 		}
 	});	
-{/foreach}
 });
-</script>  
-{/html_head}
+{/footer_script}
