Index: /trunk/comments.php
===================================================================
--- /trunk/comments.php	(revision 13864)
+++ /trunk/comments.php	(revision 13865)
@@ -207,6 +207,4 @@
 if (isset($action))
 {
-  check_pwg_token();
-
   $comment_author_id = get_comment_author_id($comment_id);
 
@@ -217,4 +215,5 @@
     if ('delete' == $action)
     {
+      check_pwg_token();
       delete_user_comment($comment_id);
       $perform_redirect = true;
@@ -223,4 +222,5 @@
     if ('validate' == $action)
     {
+      check_pwg_token();
       validate_user_comment($comment_id);
       $perform_redirect = true;
@@ -231,4 +231,5 @@
       if (!empty($_POST['content']))
       {
+        check_pwg_token();
         update_user_comment(
           array(
@@ -503,6 +504,5 @@
         $url,
         array(
-          'edit' => $comment['comment_id'],
-          'pwg_token' => get_pwg_token(),
+          'edit' => $comment['comment_id']
           )
         );
@@ -515,4 +515,5 @@
         $tpl_comment['IMAGE_ID'] = $comment['image_id'];
         $tpl_comment['CONTENT'] = $comment['content'];
+        $tpl_comment['PWG_TOKEN'] = get_pwg_token();
       }
     }
Index: /trunk/include/picture_comment.inc.php
===================================================================
--- /trunk/include/picture_comment.inc.php	(revision 13864)
+++ /trunk/include/picture_comment.inc.php	(revision 13865)
@@ -199,5 +199,4 @@
             'action'=>'edit_comment',
             'comment_to_edit'=>$row['id'],
-            'pwg_token' => get_pwg_token(),
             )
           );
@@ -208,4 +207,5 @@
             $tpl_comment['KEY'] = $key;
             $tpl_comment['CONTENT'] = $row['content'];
+            $tpl_comment['PWG_TOKEN'] = get_pwg_token();
           }
       }
Index: /trunk/picture.php
===================================================================
--- /trunk/picture.php	(revision 13864)
+++ /trunk/picture.php	(revision 13865)
@@ -333,7 +333,6 @@
       redirect($url_self);
     }
-    case 'edit_comment' :
-    {
-      check_pwg_token();
+    case 'edit_comment':
+    {
       include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
       check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID);
@@ -344,4 +343,5 @@
         if (!empty($_POST['content']))
         {
+          check_pwg_token();
           $comment_action = update_user_comment(
             array(
@@ -375,12 +375,11 @@
           }
           unset($_POST['content']);
-          break;
         }
         else
         {
           $edit_comment = $_GET['comment_to_edit'];
-          break;
         }
       }
+      break;
     }
     case 'delete_comment' :
Index: /trunk/themes/default/fix-ie5-ie6.css
===================================================================
--- /trunk/themes/default/fix-ie5-ie6.css	(revision 13864)
+++ /trunk/themes/default/fix-ie5-ie6.css	(revision 13865)
@@ -51,16 +51,10 @@
 
 .filter LABEL INPUT,
-.filter LABEL SELECT,
-.filter LABEL SPAN,
-.filter LABEL TEXTAREA {
+.filter LABEL SELECT {
   display: block;
   margin: 0.5em 0;
 }
 .filter FIELDSET * LABEL INPUT,
-.filter FIELDSET * LABEL SELECT,
-.filter FIELDSET * LABEL TEXTAREA,
-.filter LABEL SPAN INPUT,
-.filter LABEL SPAN SELECT,
-.filter LABEL SPAN TEXTAREA {
+.filter FIELDSET * LABEL SELECT {
 	display: inline;
 	vertical-align: top;
Index: /trunk/themes/default/template/comment_list.tpl
===================================================================
--- /trunk/themes/default/template/comment_list.tpl	(revision 13864)
+++ /trunk/themes/default/template/comment_list.tpl	(revision 13865)
@@ -44,12 +44,12 @@
 		{if isset($comment.IN_EDIT)}
 		<a name="edit_comment"></a>
-		<form  method="post" action="{$comment.U_EDIT}" class="filter" id="editComment">
-			<fieldset>
-				<legend>{'Edit a comment'|@translate}</legend>
-				<label>{'Comment'|@translate}<textarea name="content" id="contenteditid" rows="5" cols="80">{$comment.CONTENT|@escape}</textarea></label>
-				<input type="hidden" name="key" value="{$comment.KEY}">
+		<form method="post" action="{$comment.U_EDIT}" id="editComment">
+			<p><label>{'Edit a comment'|@translate} :</label></p>
+			<p><textarea name="content" id="contenteditid" rows="5" cols="80">{$comment.CONTENT|@escape}</textarea></p>
+			<p><input type="hidden" name="key" value="{$comment.KEY}">
+				<input type="hidden" name="pwg_token" value="{$comment.PWG_TOKEN}">
 				<input type="hidden" name="image_id" value="{$comment.IMAGE_ID|@default:$current.id}">
 				<input type="submit" value="{'Submit'|@translate}">
-			</fieldset>
+			</p>
 		</form>
 		{else}
Index: /trunk/themes/default/template/index.tpl
===================================================================
--- /trunk/themes/default/template/index.tpl	(revision 13864)
+++ /trunk/themes/default/template/index.tpl	(revision 13865)
@@ -8,5 +8,5 @@
 			<span class="pwg-icon pwg-icon-sort">&nbsp;</span><span class="pwg-button-text">{'Sort order'|@translate}</span>
 		</a>
-		<div id="sortOrderBox" class="switchBox" style="display:none">
+		<div id="sortOrderBox" class="switchBox">
 			<div class="switchBoxTitle">{'Sort order'|@translate}</div>
 			{foreach from=$image_orders item=image_order name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
@@ -19,23 +19,12 @@
 		</div>
 		{footer_script}{literal}
-$(document).ready(function() {
-  $("#sortOrderBox").css({'top':0,'left':0});
-  var sortOrderBox_width = $("#sortOrderBox").outerWidth(true);
-  var sortOrderBox_height = $("#sortOrderBox").outerHeight(true);
-  
-  $("#sortOrderLink").click(function() {
-    $("#sortOrderBox").toggle();
-    
-    if ($(this).offset().left + sortOrderBox_width > $(window).width()) {
-      $("#sortOrderBox").css("left", $(window).width() - sortOrderBox_width - 5);
-    } else {
-      $("#sortOrderBox").css("left", $(this).offset().left);
-    }
-    $("#sortOrderBox").css("top", $(this).offset().top + $(this).outerHeight(true));
-  });
-  
-  $("#sortOrderBox").bind("mouseleave", function() {
-    $(this).hide();
-  });
+$("#sortOrderLink").click(function() {
+	var elt = $("#sortOrderBox");
+	elt.css("left", Math.min( $(this).offset().left, $(window).width() - elt.outerWidth(true) - 5))
+		.css("top", $(this).offset().top + $(this).outerHeight(true))
+		.toggle();
+});
+$("#sortOrderBox").on("mouseleave", function() {
+	$(this).hide();
 });
 		{/literal}{/footer_script}
@@ -47,5 +36,5 @@
 			<span class="pwg-icon pwg-icon-sizes">&nbsp;</span><span class="pwg-button-text">{'Photo sizes'|@translate}</span>
 		</a>
-		<div id="derivativeSwitchBox" class="switchBox" style="display:none">
+		<div id="derivativeSwitchBox" class="switchBox">
 			<div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
 			{foreach from=$image_derivatives item=image_derivative name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
@@ -58,23 +47,12 @@
 		</div>
 		{footer_script}{literal}
-$(document).ready(function() {
-  $("#derivativeSwitchBox").css({'top':0,'left':0});
-  var derivativeSwitchBox_width = $("#derivativeSwitchBox").outerWidth(true);
-  var derivativeSwitchBox_height = $("#derivativeSwitchBox").outerHeight(true);
-  
-  $("#derivativeSwitchLink").click(function() {
-    $("#derivativeSwitchBox").toggle();
-    
-    if ($(this).offset().left + derivativeSwitchBox_width > $(window).width()) {
-      $("#derivativeSwitchBox").css("left", $(window).width() - derivativeSwitchBox_width - 5);
-    } else {
-      $("#derivativeSwitchBox").css("left", $(this).offset().left);
-    }
-    $("#derivativeSwitchBox").css("top", $(this).offset().top + $(this).outerHeight(true));
-  });
-  
-  $("#derivativeSwitchBox").bind("mouseleave", function() {
-    $(this).hide();
-  });
+$("#derivativeSwitchLink").click(function() {
+	var elt = $("#derivativeSwitchBox");
+	elt.css("left", Math.min( $(this).offset().left, $(window).width() - elt.outerWidth(true) - 5))
+		.css("top", $(this).offset().top + $(this).outerHeight(true))
+		.toggle();
+});
+$("#derivativeSwitchBox").on("mouseleave", function() {
+	$(this).hide();
 });
 		{/literal}{/footer_script}
Index: /trunk/themes/default/template/picture.tpl
===================================================================
--- /trunk/themes/default/template/picture.tpl	(revision 13864)
+++ /trunk/themes/default/template/picture.tpl	(revision 13865)
@@ -36,23 +36,12 @@
 }
 
-$(document).ready(function() {
-  $("#derivativeSwitchBox").css({'top':0,'left':0});
-  var derivativeSwitchBox_width = $("#derivativeSwitchBox").outerWidth(true);
-  var derivativeSwitchBox_height = $("#derivativeSwitchBox").outerHeight(true);
-  
-  $("#derivativeSwitchLink").click(function() {
-    $("#derivativeSwitchBox").toggle();
-    
-    if ($(this).offset().left + derivativeSwitchBox_width > $(window).width()) {
-      $("#derivativeSwitchBox").css("left", $(window).width() - derivativeSwitchBox_width - 5);
-    } else {
-      $("#derivativeSwitchBox").css("left", $(this).offset().left);
-    }
-    $("#derivativeSwitchBox").css("top", $(this).offset().top + $(this).outerHeight(true));
-  });
-  
-  $("#derivativeSwitchBox").bind("mouseleave click", function() {
-    $(this).hide();
-  });
+$("#derivativeSwitchLink").click(function() {
+	var elt = $("#derivativeSwitchBox");
+	elt.css("left", Math.min( $(this).offset().left, $(window).width() - elt.outerWidth(true) - 5))
+		.css("top", $(this).offset().top + $(this).outerHeight(true))
+		.toggle();
+});
+$("#derivativeSwitchBox").on("mouseleave click", function() {
+	$(this).hide();
 });
 {/literal}{/footer_script}
@@ -60,5 +49,5 @@
   <span class="pwg-icon pwg-icon-sizes">&nbsp;</span><span class="pwg-button-text">{'Photo sizes'|@translate}</span>
 </a>
-<div id="derivativeSwitchBox" class="switchBox" style="display:none">
+<div id="derivativeSwitchBox" class="switchBox">
   <div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
   {foreach from=$current.unique_derivatives item=derivative key=derivative_type}
@@ -210,5 +199,5 @@
 	{/if}
 	{if $display_info.categories and isset($related_categories)}
-	<div id="Categories"  class="imageInfo">
+	<div id="Categories" class="imageInfo">
 		<dt>{'Albums'|@translate}</dt>
 		<dd>
@@ -306,5 +295,5 @@
 		elt.style.left = (ePos.offsetLeft)+"px";
 		elt.style.top = (ePos.offsetTop+ePos.offsetHeight)+"px";
-		elt.style.display="";
+		elt.style.display="block";
 	}
 	else
@@ -351,13 +340,13 @@
 			<div id="commentAdd">
 				<h4>{'Add a comment'|@translate}</h4>
-				<form  method="post" action="{$comment_add.F_ACTION}" id="addComment" >
+				<form method="post" action="{$comment_add.F_ACTION}" id="addComment" >
 					{if $comment_add.SHOW_AUTHOR}
-						<p><label>{'Author'|@translate}&nbsp;:</label></p>
+						<p><label>{'Author'|@translate} :</label></p>
 						<p><input type="text" name="author" /></p>
-						<p><label>{'Comment'|@translate}&nbsp;:</label></p>
+						<p><label>{'Comment'|@translate} :</label></p>
 					{/if}
 					<p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>
 					<p><input type="hidden" name="key" value="{$comment_add.KEY}" />
-						<input class="submit" type="submit" value="{'Submit'|@translate}"></p>
+						<input type="submit" value="{'Submit'|@translate}"></p>
 				</form>
 			</div>
Index: /trunk/themes/default/theme.css
===================================================================
--- /trunk/themes/default/theme.css	(revision 13864)
+++ /trunk/themes/default/theme.css	(revision 13865)
@@ -271,4 +271,5 @@
 
 .commentElement {
+	border-radius: 5px;
 	margin: 5px;
 	padding: 2px 0 0 2px;
@@ -367,6 +368,8 @@
 	border-radius: 4px;
 	z-index: 100;
-    text-align:left;
-	position: absolute; /*left, right set through js*/
+	text-align:left;
+	display: none;
+	position: absolute;
+	left: 0; top: 0; /*left, right set through js*/
 }
 
@@ -529,7 +532,4 @@
 }
 
-.filter UL {
-  margin: 0;
-}
 .filter UL,
 .filter LABEL {
@@ -558,7 +558,5 @@
 /*IE6 needs override because of > selector*/
 .filter LABEL>INPUT,
-.filter LABEL>SELECT,
-.filter LABEL>SPAN,
-.filter LABEL>TEXTAREA {
+.filter LABEL>SELECT {
 	display: block;
 	margin: 0.5em 0;
@@ -566,9 +564,5 @@
 
 .filter FIELDSET * LABEL>INPUT,
-.filter FIELDSET * LABEL>SELECT,
-.filter FIELDSET * LABEL>TEXTAREA,
-.filter SPAN>INPUT,
-.filter SPAN>SELECT,
-.filter SPAN>TEXTAREA {
+.filter FIELDSET * LABEL>SELECT {
 	display: inline;
 	vertical-align: top;
@@ -576,10 +570,4 @@
 }
 
-
-
-
-.filter INPUT[type="submit"] {
-	margin-top: 1em;
-}
 
 .properties UL {
@@ -805,11 +793,7 @@
 
 #commentAdd input[type="text"],
-#commentAdd textarea {
-	max-width: 100%;
-	width: 100%;
-}
-
-#pictureCommentList .commentElement {
-	border-radius: 5px;
+#comments TEXTAREA {
+	max-width: 99%;
+	width: 99%;
 }
 
@@ -825,6 +809,8 @@
 #pictureCommentList .navigationBar	{ float: right; margin-bottom: 5px;}
 #pictureComments h4					{ margin: 0;}
-#pictureComments form p				{ margin: 5px 0; text-align: left;}
-#pictureComments form p textarea		{ margin: 10px 0;}
+#comments FORM P	 {
+	margin: 5px 0; text-align: left;
+}
+
 #pictureComments INPUT[type=submit]	{ margin: 0;}
 
