﻿/// <reference path="C:\svn\bokatag\trunk\BokaTag\BokaTag\Scripts\jquery-1.3.2-vsdoc.js" />
//
// Global bt
//
// Dependent on jquery-1.3.2.min.js, jquery-ui-1.7.1.custom.min.js

// Instead of using global variables and functions put them in this function.
var bt = function() { };

bt.selectors = function() { };
bt.selectors.quickViewContent = "#bt_container #QuickView .content";
bt.selectors.quickViewLoading = "#bt_container #QuickView .loading";
bt.selectors.helpMessage = "#bt_container .help-message";
bt.selectors.legendHelpLink = "#bt_container legend a.help";
bt.selectors.h3HelpLink = "#bt_container h3 a.help";
bt.selectors.h4HelpLink = "#bt_container h4 a.help";

bt.dimQuickView = function() {
    $(bt.selectors.quickViewLoading).fadeIn("fast");
};

bt.clearQuickView = function() {
    $(bt.selectors.quickViewLoading).fadeOut("fast");
};

bt.postWithFeedback = function(url, data, callback) {
    bt.dimQuickView();
    $.post(url, data, function() { callback(data); });
    bt.clearQuickView();
};

$(document).ready(function() {

    // Hide/show help text behavior
    $(bt.selectors.helpMessage).addClass("hide").addClass("ie6-dummy-fix").toggle("blind");

    $(bt.selectors.legendHelpLink).live("click", function() {
        $(this).parent("span").parent("legend").next(".help-message").removeClass("hide").toggle("blind");
    });

    $(bt.selectors.h3HelpLink).live("click", function() {
        $(this).parent("span").parent("h3").next(".help-message").removeClass("hide").toggle("blind");
    });

    $(bt.selectors.h4HelpLink).live("click", function() {
        $(this).parent("span").parent("h4").next(".help-message").removeClass("hide").toggle("blind");
    });
    // Hide/show help text behavior - end

    // On submit disable submit button
    $('form').submit(function() {
        bt.disableButtons();
    });
    
});

bt.disableButtons = function() {
    $('input[type="submit"]', this).click(function(event) { event.stopPropagation(); return false; }); //.fadeOut('slow');
    $('input[type="button"]', this).click(function(event) { event.stopPropagation(); return false; }); //.fadeOut('slow');
}