﻿/// <reference path="jquery-1.2.6-vsdoc.js" />
jQuery(document).ready(function() {

    if (punymce) punymce.baseURL = "/js/punymce";

    // Async does not work with punyMCE
    //    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function() {

    jQuery(".HtmlEditorBig,.HtmlEditor").each(function() {

        var textarea = jQuery(this);

        if (punymce) {
            var contentEditor = new punymce.Editor({
                id: textarea.attr("id"),
                toolbar: 'bold,italic,underline,strike,ul,ol,link,unlink',
                plugins: 'Link,Protect,Safari2x',
                resize: false,
                entities: "numeric"
            });
        }

        //            Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(function() {
        //                alert("Value: " + textarea.value);
        //                contentEditor.save();
        //                alert("Value: " + textarea.value);
        //            });
    });


    //    });

    var statusMessage = $(".Forum.PostView .StatusMessage");

    if (statusMessage.length > 0) {
        statusMessage = statusMessage.get(statusMessage.length - 1);
        $.scrollTo($(statusMessage), { speed: 500 });
        //$(".Forum.PostView .StatusMessage").hide().fadeIn(500);
    }

    // Set styles for expert comments
    //    jQuery(".Comments .test").each(function() {
    //        jQuery(this).css("background-color", "#BED600");
    //        jQuery(this).css("margin", "0px");
    //        jQuery(this).css("clear", "both");

    //        jQuery(this).wrapAll("<div class='ExpertOuter' style='padding: 10px; margin: 10px 0px; background-color: #6B1F7C;'>");
    //    });

//    jQuery(".ExpertOuter").children("div").each(function() {

//        var clones;
//        if (!$(this).hasClass("Expert")) {
//            clones = $(this).parent("div").children().clone();
//            $(clones).insertAfter($(this).parent("div"));
//            $(this).parent("div").remove();
//        }
//        else
//            jQuery(this).css("background-color", "#BED600");


//    });

//    jQuery(".ExpertOuter").each(function() {

//        $(this).css("background-color", "#6B1F7C");

//    });    

});
