﻿

function DismissAlert() {
    var dismiss_alert_btn = $(this);
    if (confirm('Are you sure you want to dismiss this alert?')) {
        $(this).parent().animate({ left: "+=100px" }).animate({ left: "-5000px", height: "0px", width:"0px"});
        $.post("/Alerts/Dismiss/" + $(this).attr("data"), function() {
            AnimateFlash("Alert Dismissed", "info");
        });
    }
}

function AnimateFlash(message, type) {
    var content = '<img src="/Content/FileIcons/' + (type == "error" ? "cross" : "tick") + '.png" /> ' + message;
    $('#flash').html(content);
    $('#flash').animate({
        opacity: ".85"
    }, 500, null, function() {
        $('#flash').animate({ opacity: "0.85" }, 5000);
        $('#flash').animate({ opacity: "0" }, 800)
    });
}

function showNotifyBar() {
    //('#notify_bar').css("opacity", 0).show(600).animate({ opacity: 1 }, 600);
    $('#notify_bar').show();
    $('#notify_bar').animate(
        {
            opacity: 0.7
        }, 700).animate(
        {
            opacity: 1
        }, 700).animate(
        {
            opacity: 0.7
        }, 700).animate(
        {
            opacity: 1
        }, 700, function() { showNotifyBar();  });

        
}

function togglePane() {
    toggle_pane = document.getElementById("toggle_pane");
    toggle_pane_link = document.getElementById("toggle_pane_link");

    if (toggle_pane.style.width != "" && toggle_pane.style.width != "10px") {
        toggle_pane_link.innerHTML = "<img src=\"/content/img/show_arrow_right.jpg\" />";
        $("#toggle_pane").animate({
            width: "10px"
        }, 600);
        $("#fluid_pane").animate({
            width: "870px"
        }, 1000);
    }
    else {
        $("#toggle_pane").animate({
            width: "190px"
        }, 1000, function() {
            toggle_pane_link.innerHTML = "<img src=\"/content/img/hide_arrow_right.jpg\" /> Hide";
        });
        $("#fluid_pane").animate({
            width: "690px"
        }, 600);
    }
}

function ActivateDocInfoLink() {
    $(".doc-info .doc_link").click(function() {
        var element = $(this).get(0);

        var pos = getAbsolutePos(element);

        $(this).parent()
              .children(".doc_details")
              .show()
              .hover(null, function() { $(this).hide() })
              .css("left", "-50px").css("top", "-25px");
        return false;
    });
} 