
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

function position(page_element_id, default_mode) {

    "use strict";

    /* Default mode can be "basic" or "column" */

    var page = document.getElementById(page_element_id);
    var isso = document.getElementById("isso-thread");
    var first_call = true;

    this.column = function() {
        if (first_call) {
            isso.style.position = "fixed";
        }
        else {
            var handler = function() {
                isso.style.position = "fixed";
                page.removeEventListener("transitionend", handler);
            };
            page.addEventListener("transitionend", handler);
        }
        page.style.marginLeft = "5%";
        isso.style.left = "calc(" + page.clientWidth + "px + 10%)";
        isso.style.right = "3%";
        isso.style.top = "2%";
        isso.style.bottom = "2%";
    };

    this.basic = function() {
        isso.style.position = "static";
        page.style.marginLeft = (window.innerWidth - page.clientWidth) / 2 + "px";
    };

    /* Switch to default mode before setting a transition */
    if (default_mode == "column") {
        this.column();
    }
    else {
        this.basic();
    }
    first_call = false;

    page.style.transition = "margin-left 1s";
};



@@ -837,103 +837,115 @@
     
-page.style.marginLeft = %225%25%22;%0A        isso.style.left = %22calc(%22 + page.clientWidth + %22px + 10%25)
+isso.style.left = page.getBoundingClientRect().left + page.clientWidth%0A                          + 40 + %22px
 %22;%0A 
@@ -975,10 +975,12 @@
  = %22
-3%25
+10px
 %22;%0A 
@@ -1000,26 +1000,28 @@
 tyle.top = %22
-2%25
+10px
 %22;%0A        i
@@ -1044,10 +1044,12 @@
  = %22
-2%25
+10px
 %22;%0A 

use right margin for comments