]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/media/js/osqa.main.js
fixes OSQA-439. IE should work again. Sorry about that. Thanks for the patches...
[osqa.git] / forum / skins / default / media / js / osqa.main.js
index d929a16fb5a4c515f7771c73f37aea5c9c5922d9..79cda45e948d52adfeb4620fb8a2424cc9e782cd 100644 (file)
@@ -1,7 +1,15 @@
 var response_commands = {\r
+    refresh_page: function() {\r
+        window.location.reload(true)\r
+    },\r
+    \r
     update_post_score: function(id, inc) {\r
         var $score_board = $('#post-' + id + '-score');\r
-        $score_board.html(parseInt($score_board.html()) + inc)\r
+        var current = parseInt($score_board.html())\r
+        if (isNaN(current)){\r
+            current = 0;\r
+        }\r
+        $score_board.html(current + inc)\r
     },\r
 \r
     update_user_post_vote: function(id, vote_type) {\r
@@ -41,10 +49,7 @@ var response_commands = {
         }\r
     },\r
 \r
-    mark_accepted: function(id) {\r
-        $('.accepted-answer').removeClass('accepted-answer');\r
-        $('.accept-answer.on').removeClass('on');\r
-        \r
+    mark_accepted: function(id) {        \r
         var $answer = $('#answer-container-' + id);\r
         $answer.addClass('accepted-answer');\r
         $answer.find('.accept-answer').addClass('on');\r
@@ -56,31 +61,6 @@ var response_commands = {
         $answer.find('.accept-answer').removeClass('on');\r
     },\r
 \r
-    update_comment_score: function(id, inc) {\r
-        var $comment_score = $('#comment-' + id + '-score');\r
-        var count = parseInt($comment_score.html());\r
-\r
-        if (isNaN(count))\r
-            count = 0;\r
-\r
-        count += inc;\r
-\r
-        if (count == 0)\r
-            count = '';\r
-\r
-        $comment_score.html(count);\r
-    },\r
-\r
-    update_likes_comment_mark: function(id, like_type) {\r
-        var $comment_like_mark = $("#comment-" + id + "-like");\r
-\r
-        if (like_type == "on") {\r
-            $comment_like_mark.addClass("on");\r
-        } else {\r
-            $comment_like_mark.removeClass("on");    \r
-        }\r
-    },\r
-\r
     remove_comment: function(id) {\r
         var $comment = $('#comment-' + id);\r
         $comment.css('background', 'red')\r
@@ -89,7 +69,7 @@ var response_commands = {
         });\r
     },\r
 \r
-    insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url) {\r
+    insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url) {\r
         var $container = $('#comments-container-' + post_id);\r
         var skeleton = $('#new-comment-skeleton-' + post_id).html().toString();\r
 \r
@@ -97,7 +77,8 @@ var response_commands = {
                 .replace(new RegExp('%COMMENT%', 'g'), comment)\r
                 .replace(new RegExp('%USERNAME%', 'g'), username)\r
                 .replace(new RegExp('%PROFILE_URL%', 'g'), profile_url)\r
-                .replace(new RegExp('%DELETE_URL%', 'g'), delete_url);\r
+                .replace(new RegExp('%DELETE_URL%', 'g'), delete_url)\r
+                .replace(new RegExp('%EDIT_URL%', 'g'), edit_url);\r
 \r
         $container.append(skeleton);\r
 \r
@@ -121,6 +102,16 @@ var response_commands = {
         }\r
     },\r
 \r
+    unmark_deleted: function(post_type, post_id) {\r
+        if (post_type == 'answer') {\r
+            var $answer = $('#answer-container-' + post_id);\r
+            $answer.removeClass('deleted');\r
+        } else {\r
+            var $container = $('#question-table');\r
+            $container.removeClass('deleted');\r
+        }\r
+    },\r
+\r
     set_subscription_button: function(text) {\r
         $('.subscription_switch').html(text);\r
     },\r
@@ -130,127 +121,373 @@ var response_commands = {
     }\r
 }\r
 \r
-function show_message(object, msg) {\r
-    var div = $('<div class="vote-notification"><h3>' + msg + '</h3>(' +\r
-    'click to close' + ')</div>');\r
+function show_dialog (extern) {\r
+    var default_close_function = function($diag) {\r
+        $diag.fadeOut('fast', function() {\r
+            $diag.remove();\r
+        });\r
+    }\r
+\r
+    var options = {\r
+        extra_class: '',\r
+        pos: {\r
+            x: ($(window).width() / 2) + $(window).scrollLeft(),\r
+            y: ($(window).height() / 2) + $(window).scrollTop()\r
+        },\r
+        dim: false, \r
+        yes_text: messages.ok,\r
+        yes_callback: default_close_function,\r
+        no_text: messages.cancel,\r
+        show_no: false,\r
+        close_on_clickoutside: false\r
+    }\r
+\r
+    $.extend(options, extern);\r
+\r
+    if (options.event != undefined) {\r
+        options.pos = {x: options.event.pageX, y: options.event.pageY};\r
+    }\r
+\r
+    var html = '<div class="dialog ' + options.extra_class + '" style="display: none;">'\r
+             + '<div class="dialog-content">' + options.html + '</div><div class="dialog-buttons">';\r
 \r
-    div.click(function(event) {\r
-        $(".vote-notification").fadeOut("fast", function() { $(this).remove(); });\r
+    if (options.show_no) {\r
+        html += '<button class="dialog-no">' + options.no_text + '</button>';\r
+    }\r
+\r
+    html += '<button class="dialog-yes">' + options.yes_text + '</button>'\r
+            + '</div></div>';\r
+\r
+    $dialog = $(html);\r
+    $('body').append($dialog);\r
+    var message = $('.dialog-content')[0];\r
+    message.style.visibility = "hidden";\r
+\r
+    if (options.dim === false) {\r
+        $dialog.css({\r
+            visibility: 'hidden',\r
+            display: 'block'\r
+        });\r
+\r
+        options.dim = {w: $dialog.width(), h: $dialog.height()};\r
+\r
+        $dialog.css({\r
+            width: 1,\r
+            height: 1,\r
+            visibility: 'visible'\r
+        });\r
+    }\r
+\r
+    $dialog.css({\r
+        top: options.pos.y,\r
+        left: options.pos.x\r
     });\r
 \r
-    object.parent().append(div);\r
-    div.fadeIn("fast");\r
+    $dialog.animate({\r
+        top: "-=" + (options.dim.h / 2),\r
+        left: "-=" + (options.dim.w / 2),\r
+        width: options.dim.w,\r
+        height: options.dim.h\r
+    }, 200, function() {\r
+        message.style.visibility = "visible";\r
+    });\r
+\r
+    $dialog.find('.dialog-no').click(function() {\r
+        default_close_function($dialog);\r
+    });\r
+\r
+    $dialog.find('.dialog-yes').click(function() {\r
+        options.yes_callback($dialog);\r
+    });\r
+\r
+    if (options.close_on_clickoutside) {\r
+        $dialog.one('clickoutside', function() {\r
+            default_close_function($dialog);\r
+        });\r
+    }\r
+\r
+    return $dialog;\r
 }\r
 \r
-function process_ajax_response(data, el) {\r
+function show_message(evt, msg, callback) {\r
+    var $dialog = show_dialog({\r
+        html: msg,\r
+        extra_class: 'warning',\r
+        event: evt,\r
+        yes_callback: function() {\r
+            $dialog.fadeOut('fast', function() {\r
+                $dialog.remove();\r
+            });\r
+            if (callback) {\r
+                callback();\r
+            }\r
+        },\r
+        close_on_clickoutside: true\r
+    });\r
+}\r
+\r
+function load_prompt(evt, el, url) {\r
+    $.get(url, function(data) {\r
+        var doptions = {\r
+         html: data,\r
+            extra_class: 'prompt',\r
+            yes_callback: function() {\r
+                var postvars = {};\r
+                $dialog.find('input, textarea, select').each(function() {\r
+                    postvars[$(this).attr('name')] = $(this).val();\r
+                });\r
+                $.post(url, postvars, function(data) {\r
+                    $dialog.fadeOut('fast', function() {\r
+                        $dialog.remove();\r
+                    });\r
+                    process_ajax_response(data, evt);\r
+                }, 'json');\r
+            },\r
+            show_no: true\r
+        }\r
+\r
+        if (!el.is('.centered')) {\r
+            doptions.event = evt;\r
+        }\r
+\r
+        var $dialog = show_dialog(doptions);\r
+    });\r
+}\r
+\r
+function process_ajax_response(data, evt, callback) {\r
     if (!data.success && data['error_message'] != undefined) {\r
-        show_message(el, data.error_message)\r
+        show_message(evt, data.error_message, function() {if (callback) callback(true);});\r
+        end_command(false);\r
     } else if (typeof data['commands'] != undefined){\r
         for (var command in data.commands) {\r
             response_commands[command].apply(null, data.commands[command])\r
         }\r
 \r
         if (data['message'] != undefined) {\r
-            show_message(el, data.message)\r
+            show_message(evt, data.message, function() {if (callback) callback(false);})\r
+        } else {\r
+            if (callback) callback(false);\r
         }\r
+        end_command(true);\r
+    }\r
+}\r
+\r
+var running = false;\r
+\r
+function start_command() {\r
+    $('body').append($('<div id="command-loader"></div>'));\r
+    running = true;\r
+}\r
+\r
+function end_command(success) {\r
+    if (success) {\r
+        $('#command-loader').addClass('success');\r
+        $('#command-loader').fadeOut("slow", function() {\r
+            $('#command-loader').remove();\r
+            running = false;\r
+        });\r
+    } else {\r
+        $('#command-loader').remove();\r
+        running = false;\r
     }\r
 }\r
 \r
 $(function() {\r
-    $('a.ajax-command').live('click', function() {\r
+    $('a.ajax-command').live('click', function(evt) {\r
+        if (running) return false;\r
+\r
+        $('.context-menu-dropdown').slideUp('fast');\r
+\r
         var el = $(this);\r
-        $.getJSON(el.attr('href'), function(data) {\r
-            process_ajax_response(data, el);\r
-        });\r
+\r
+        if (el.is('.withprompt')) {\r
+            load_prompt(evt, el, el.attr('href'));\r
+        } else if(el.is('.confirm')) {\r
+            var doptions = {\r
+                html: messages.confirm,\r
+                extra_class: 'confirm',\r
+                yes_callback: function() {\r
+                    start_command();\r
+                    $.getJSON(el.attr('href'), function(data) {\r
+                        process_ajax_response(data, evt);\r
+                        $dialog.fadeOut('fast', function() {\r
+                            $dialog.remove();\r
+                        });\r
+                    });\r
+                },\r
+                yes_text: messages.yes,\r
+                show_no: true,\r
+                no_text: messages.no\r
+            }\r
+\r
+            if (!el.is('.centered')) {\r
+                doptions.event = evt;\r
+            }\r
+            var $dialog = show_dialog(doptions);\r
+        } else {\r
+            start_command();\r
+            $.getJSON(el.attr('href'), function(data) {\r
+                process_ajax_response(data, evt);\r
+            });\r
+        }\r
 \r
         return false\r
     });\r
 \r
+    $('.context-menu').each(function() {\r
+        var $menu = $(this);\r
+        var $trigger = $menu.find('.context-menu-trigger');\r
+        var $dropdown = $menu.find('.context-menu-dropdown');\r
+\r
+        $trigger.click(function() {\r
+            $dropdown.slideToggle('fast', function() {\r
+                if ($dropdown.is(':visible')) {\r
+                   $dropdown.one('clickoutside', function() {\r
+                       if ($dropdown.is(':visible'))\r
+                            $dropdown.slideUp('fast');\r
+                    });\r
+                }\r
+            });    \r
+        });\r
+    });\r
+\r
     $('div.comment-form-container').each(function() {\r
         var $container = $(this);\r
-        var $form = $container.find('form');\r
-        var $textarea = $container.find('textarea');\r
-        var $button = $container.find('input[type="submit"]');\r
-        var $chars_left_message = $('.comment-chars-left');\r
-        var $chars_counter = $container.find('.comments-char-left-count');\r
-\r
         var $comment_tools = $container.parent().find('.comment-tools');\r
-        var $add_comment_link = $comment_tools.find('.add-comment-link');\r
         var $comments_container = $container.parent().find('.comments-container');\r
+        \r
+        var $form = $container.find('form');\r
 \r
-        var max_length = parseInt($chars_counter.html());\r
-        var comment_in_form = false;\r
+        if ($form.length) {\r
+            var $textarea = $container.find('textarea');\r
+            var textarea = $textarea.get(0);\r
+            var $button = $container.find('.comment-submit');\r
+            var $cancel = $container.find('.comment-cancel');\r
+            var $chars_left_message = $container.find('.comments-chars-left-msg');\r
+            var $chars_togo_message = $container.find('.comments-chars-togo-msg');\r
+            var $chars_counter = $container.find('.comments-char-left-count');\r
 \r
-        function cleanup_form() {\r
-            $textarea.val('');\r
-            $chars_counter.html(max_length);\r
-            $chars_left_message.removeClass('warn');\r
-            comment_in_form = false;\r
-        }\r
+            var $add_comment_link = $comment_tools.find('.add-comment-link');\r
+\r
+            var chars_limits = $chars_counter.html().split('|');\r
+\r
+            var min_length = parseInt(chars_limits[0]);\r
+            var max_length = parseInt(chars_limits[1]);\r
+\r
+            var warn_length = max_length - 30;\r
+            var current_length = 0;\r
+            var comment_in_form = false;\r
+            var interval = null;\r
+\r
+            var hcheck = !($.browser.msie || $.browser.opera);\r
+\r
+            $textarea.css("padding-top", 0).css("padding-bottom", 0).css("resize", "none");\r
+            textarea.style.overflow = 'hidden';\r
 \r
-        cleanup_form();\r
 \r
-        function calculate_chars_left() {\r
-            var length = $textarea.val().length;\r
-            var allow = true;\r
+            function cleanup_form() {\r
+                $textarea.val('');\r
+                $textarea.css('height', 80);\r
+                $chars_counter.html(max_length);\r
+                $chars_left_message.removeClass('warn');\r
+                comment_in_form = false;\r
+                current_length = 0;\r
+\r
+                $chars_left_message.hide();\r
+                $chars_togo_message.show();\r
+\r
+                $chars_counter.removeClass('warn');\r
+                $chars_counter.html(min_length);\r
+                $button.attr("disabled","disabled");\r
+\r
+                interval = null;\r
+            }\r
+\r
+            cleanup_form();\r
+\r
+            function process_form_changes() {\r
+                var length = $textarea.val().replace(/[ ]{2,}/g," ").length;\r
+\r
+                if (current_length == length)\r
+                    return;\r
+\r
+                if (length < warn_length && current_length >= warn_length) {\r
+                    $chars_counter.removeClass('warn');\r
+                } else if (current_length < warn_length && length >= warn_length){\r
+                    $chars_counter.addClass('warn');\r
+                }\r
 \r
-            if (length < max_length) {\r
-                if (length < max_length * 0.75) {\r
-                    $chars_left_message.removeClass('warn');\r
+                if (length < min_length) {\r
+                    $chars_left_message.hide();\r
+                    $chars_togo_message.show();\r
+                    $chars_counter.html(min_length - length);\r
                 } else {\r
-                    $chars_left_message.addClass('warn');\r
+                    length = $textarea.val().length;\r
+                    $chars_togo_message.hide();\r
+                    $chars_left_message.show();\r
+                    $chars_counter.html(max_length - length);\r
                 }\r
-            } else {\r
-                allow = false;\r
+\r
+                if (length > max_length || length < min_length) {\r
+                    $button.attr("disabled","disabled");\r
+                } else {\r
+                    $button.removeAttr("disabled");\r
+                }\r
+\r
+                var current_height = textarea.style.height;\r
+                if (hcheck)\r
+                    textarea.style.height = "0px";\r
+\r
+                var h = Math.max(80, textarea.scrollHeight);\r
+                textarea.style.height = current_height;\r
+                $textarea.animate({height: h + 'px'}, 50);\r
+\r
+                current_length = length;\r
             }\r
 \r
-            $chars_counter.html(max_length - length);\r
-            return allow;\r
-        }\r
+            function show_comment_form() {\r
+                $container.slideDown('slow');\r
+                $add_comment_link.fadeOut('slow');\r
+                $textarea.focus();\r
+                window.setInterval(function() {\r
+                    process_form_changes();\r
+                }, 200);\r
+            }\r
 \r
-        function show_comment_form() {\r
-            $container.slideDown('slow');\r
-            $add_comment_link.fadeOut('slow');\r
-        }\r
+            function hide_comment_form() {\r
+                if (interval != null) {\r
+                    window.clearInterval(interval);\r
+                    interval = null;\r
+                }\r
+                $container.slideUp('slow');\r
+                $add_comment_link.fadeIn('slow');\r
+            }\r
 \r
-        function hide_comment_form() {\r
-            $container.slideUp('slow');\r
-            $add_comment_link.fadeIn('slow');\r
-        }\r
+            $add_comment_link.click(function(){\r
+                cleanup_form();\r
+                show_comment_form();\r
+                return false;\r
+            });\r
 \r
-        $add_comment_link.click(function(){\r
-            cleanup_form();\r
-            show_comment_form();\r
-            return false;\r
-        });\r
+            $('#' + $comments_container.attr('id') + ' .comment-edit').live('click', function() {\r
+                var $link = $(this);\r
+                var comment_id = /comment-(\d+)-edit/.exec($link.attr('id'))[1];\r
+                var $comment = $('#comment-' + comment_id);\r
 \r
-        $comment_tools.find('.show-all-comments-link').click(function() {\r
-            $comments_container.find('.not_top_scorer').slideDown('slow');\r
-            $(this).fadeOut('slow');\r
-            $comment_tools.find('.comments-showing').fadeOut('slow');\r
-            return false;\r
-        });\r
+                comment_in_form = comment_id;\r
 \r
-        $('#' + $comments_container.attr('id') + ' .comment-edit').live('click', function() {\r
-            var $link = $(this);\r
-            var comment_id = /comment-(\d+)-edit/.exec($link.attr('id'))[1];\r
-            var $comment = $link.parents('.comment');\r
-            var comment_text = $comment.find('.comment-text').text().trim();\r
-\r
-            comment_in_form = comment_id;\r
-            $textarea.val(comment_text);\r
-            calculate_chars_left();\r
-            $comment.slideUp('slow');\r
-            show_comment_form();\r
-            return false;\r
-        });\r
+                $.get($link.attr('href'), function(data) {\r
+                    $textarea.val(data);\r
+                });\r
+\r
+                $comment.slideUp('slow');\r
+                show_comment_form();\r
+                return false;\r
+            });\r
 \r
-        $textarea.keyup(calculate_chars_left);\r
+            $button.click(function(evt) {\r
+                if (running) return false;\r
 \r
-        $button.click(function() {\r
-            if ($textarea.val().length > max_length) {\r
-                show_message($button, "Your comment exceeds the max number of characters allowed.");\r
-            } else {\r
                 var post_data = {\r
                     comment: $textarea.val()\r
                 }\r
@@ -259,18 +496,39 @@ $(function() {
                     post_data['id'] = comment_in_form;\r
                 }\r
 \r
+                start_command();\r
                 $.post($form.attr('action'), post_data, function(data) {\r
-                    process_ajax_response(data, $button);\r
+                    process_ajax_response(data, evt, function(error) {\r
+                        if (!error) {\r
+                            cleanup_form();\r
+                            hide_comment_form();\r
+                        }\r
+                    });\r
+\r
+                }, "json");\r
+\r
+                return false;\r
+            });\r
+\r
+            $cancel.click(function(event) {\r
+                if (confirm("You will lose all of your changes in this comment.  Do you still wish to proceed?")){\r
+                    if (comment_in_form) {\r
+                        $comment = $('#comment-' + comment_in_form).slideDown('slow');\r
+                    }\r
+                    hide_comment_form();\r
                     cleanup_form();\r
-                }, "json")\r
-            }\r
+                }\r
+                return false;\r
+            });\r
+        }\r
 \r
-            hide_comment_form();\r
+        $comment_tools.find('.show-all-comments-link').click(function() {\r
+            $comments_container.find('.not_top_scorer').slideDown('slow');\r
+            $(this).fadeOut('slow');\r
+            $comment_tools.find('.comments-showing').fadeOut('slow');\r
             return false;\r
         });\r
     });\r
-\r
-            \r
 });\r
 \r
 //var scriptUrl, interestingTags, ignoredTags, tags, $;\r
@@ -294,7 +552,8 @@ function pickedTags(){
 \r
         var call_settings = {\r
             type:'POST',\r
-            url:url\r
+            url:url,\r
+            data: ''\r
         };\r
         if (callback !== false){\r
             call_settings.success = callback;\r
@@ -421,17 +680,19 @@ function pickedTags(){
         init: function(){\r
             collectPickedTags();\r
             setupHideIgnoredQuestionsControl();\r
-            $("#interestingTagInput, #ignoredTagInput").autocomplete(tags, {\r
+            $("#interestingTagInput, #ignoredTagInput").autocomplete(messages.matching_tags_url, {\r
                 minChars: 1,\r
                 matchContains: true,\r
                 max: 20,\r
-                multiple: true,\r
-                multipleSeparator: " ",\r
-                formatItem: function(row, i, max) {\r
-                    return row.n + " ("+ row.c +")";\r
+                /*multiple: false, - the favorite tags and ignore tags don't let you do multiple tags\r
+                multipleSeparator: " "*/\r
+\r
+                formatItem: function(row, i, max, value) {\r
+                    return row[1] + " (" + row[2] + ")";\r
                 },\r
-                formatResult: function(row, i, max){\r
-                    return row.n;\r
+\r
+                formatResult: function(row, i, max, value){\r
+                    return row[1];\r
                 }\r
 \r
             });\r
@@ -441,11 +702,6 @@ function pickedTags(){
     };\r
 }\r
 \r
-$(document).ready( function(){\r
-    if (window.tags != undefined)\r
-        pickedTags().init();\r
-});\r
-\r
 Hilite={elementid:"content",exact:true,max_nodes:1000,onload:true,style_name:"hilite",style_name_suffix:true,debug_referrer:""};Hilite.search_engines=[["local","q"],["cnprog\\.","q"],["google\\.","q"],["search\\.yahoo\\.","p"],["search\\.msn\\.","q"],["search\\.live\\.","query"],["search\\.aol\\.","userQuery"],["ask\\.com","q"],["altavista\\.","q"],["feedster\\.","q"],["search\\.lycos\\.","q"],["alltheweb\\.","q"],["technorati\\.com/search/([^\\?/]+)",1],["dogpile\\.com/info\\.dogpl/search/web/([^\\?/]+)",1,true]];Hilite.decodeReferrer=function(d){var g=null;var e=new RegExp("");for(var c=0;c<Hilite.search_engines.length;c++){var f=Hilite.search_engines[c];e.compile("^http://(www\\.)?"+f[0],"i");var b=d.match(e);if(b){var a;if(isNaN(f[1])){a=Hilite.decodeReferrerQS(d,f[1])}else{a=b[f[1]+1]}if(a){a=decodeURIComponent(a);if(f.length>2&&f[2]){a=decodeURIComponent(a)}a=a.replace(/\'|"/g,"");a=a.split(/[\s,\+\.]+/);return a}break}}return null};Hilite.decodeReferrerQS=function(f,d){var b=f.indexOf("?");var c;if(b>=0){var a=new String(f.substring(b+1));b=0;c=0;while((b>=0)&&((c=a.indexOf("=",b))>=0)){var e,g;e=a.substring(b,c);b=a.indexOf("&",c)+1;if(e==d){if(b<=0){return a.substring(c+1)}else{return a.substring(c+1,b-1)}}else{if(b<=0){return null}}}}return null};Hilite.hiliteElement=function(f,e){if(!e||f.childNodes.length==0){return}var c=new Array();for(var b=0;b<e.length;b++){e[b]=e[b].toLowerCase();if(Hilite.exact){c.push("\\b"+e[b]+"\\b")}else{c.push(e[b])}}c=new RegExp(c.join("|"),"i");var a={};for(var b=0;b<e.length;b++){if(Hilite.style_name_suffix){a[e[b]]=Hilite.style_name+(b+1)}else{a[e[b]]=Hilite.style_name}}var d=function(m){var j=c.exec(m.data);if(j){var n=j[0];var i="";var h=m.splitText(j.index);var g=h.splitText(n.length);var l=m.ownerDocument.createElement("SPAN");m.parentNode.replaceChild(l,h);l.className=a[n.toLowerCase()];l.appendChild(h);return l}else{return m}};Hilite.walkElements(f.childNodes[0],1,d)};Hilite.hilite=function(){var a=Hilite.debug_referrer?Hilite.debug_referrer:document.referrer;var b=null;a=Hilite.decodeReferrer(a);if(a&&((Hilite.elementid&&(b=document.getElementById(Hilite.elementid)))||(b=document.body))){Hilite.hiliteElement(b,a)}};Hilite.walkElements=function(d,f,e){var a=/^(script|style|textarea)/i;var c=0;while(d&&f>0){c++;if(c>=Hilite.max_nodes){var b=function(){Hilite.walkElements(d,f,e)};setTimeout(b,50);return}if(d.nodeType==1){if(!a.test(d.tagName)&&d.childNodes.length>0){d=d.childNodes[0];f++;continue}}else{if(d.nodeType==3){d=e(d)}}if(d.nextSibling){d=d.nextSibling}else{while(f>0){d=d.parentNode;f--;if(d.nextSibling){d=d.nextSibling;break}}}}};if(Hilite.onload){if(window.attachEvent){window.attachEvent("onload",Hilite.hilite)}else{if(window.addEventListener){window.addEventListener("load",Hilite.hilite,false)}else{var __onload=window.onload;window.onload=function(){Hilite.hilite();__onload()}}}};\r
 \r
 var mediaUrl = function(resource){\r
@@ -774,14 +1030,69 @@ var notify = function() {
             visible = true;\r
         },\r
         close: function(doPostback) {\r
-            if (doPostback) {\r
-               $.post(scriptUrl + $.i18n._("messages/") +\r
-                $.i18n._("markread/"), { formdata: "required" });\r
-            }\r
             $(".notify").fadeOut("fast");\r
             $("body").css("margin-top", "0");\r
             visible = false;\r
         },\r
         isVisible: function() { return visible; }\r
     };\r
-} ();
\ No newline at end of file
+} ();\r
+\r
+/*\r
+ * jQuery outside events - v1.1 - 3/16/2010\r
+ * http://benalman.com/projects/jquery-outside-events-plugin/\r
+ *\r
+ * Copyright (c) 2010 "Cowboy" Ben Alman\r
+ * Dual licensed under the MIT and GPL licenses.\r
+ * http://benalman.com/about/license/\r
+ */\r
+(function($,c,b){$.map("click dblclick mousemove mousedown mouseup mouseover mouseout change select submit keydown keypress keyup".split(" "),function(d){a(d)});a("focusin","focus"+b);a("focusout","blur"+b);$.addOutsideEvent=a;function a(g,e){e=e||g+b;var d=$(),h=g+"."+e+"-special-event";$.event.special[e]={setup:function(){d=d.add(this);if(d.length===1){$(c).bind(h,f)}},teardown:function(){d=d.not(this);if(d.length===0){$(c).unbind(h)}},add:function(i){var j=i.handler;i.handler=function(l,k){l.target=k;j.apply(this,arguments)}}};function f(i){$(d).each(function(){var j=$(this);if(this!==i.target&&!j.has(i.target).length){j.triggerHandler(e,[i.target])}})}}})(jQuery,document,"outside");\r
+\r
+$(document).ready( function(){\r
+    pickedTags().init();\r
+\r
+    $('input#bnewaccount').click(function() {\r
+        $('#bnewaccount').disabled=true;\r
+    });\r
+});\r
+\r
+function yourWorkWillBeLost(e) {\r
+    if(browserTester('chrome')) {\r
+        return "Are you sure you want to leave?  Your work will be lost.";\r
+    } else if(browserTester('safari')) {\r
+        return "Are you sure you want to leave?  Your work will be lost.";\r
+    } else {\r
+        if(!e) e = window.event;\r
+        e.cancelBubble = true;\r
+        e.returnValue = 'If you leave, your work will be lost.';\r
+\r
+        if (e.stopPropagation) {\r
+            e.stopPropagation();\r
+            e.preventDefault();\r
+        }\r
+        return e;\r
+    }\r
+}\r
+\r
+function browserTester(browserString) {\r
+    return navigator.userAgent.toLowerCase().indexOf(browserString) > -1;\r
+}\r
+\r
+// Add missing IE functionality\r
+if (!window.addEventListener) {\r
+    if (window.attachEvent) {\r
+        window.addEventListener = function (type, listener, useCapture) {\r
+            window.attachEvent('on' + type, listener);\r
+        };\r
+        window.removeEventListener = function (type, listener, useCapture) {\r
+            window.detachEvent('on' + type, listener);\r
+        };\r
+    } else {\r
+        window.addEventListener = function (type, listener, useCapture) {\r
+            window['on' + type] = listener;\r
+        };\r
+        window.removeEventListener = function (type, listener, useCapture) {\r
+            window['on' + type] = null;\r
+        };\r
+    }\r
+}
\ No newline at end of file