﻿///// <reference path="jquery-1.4.1-vsdoc.js" />

//// This is the initial jQuery starting point.  The 'main' function is run once the DOM of every page is established.

//  $(document).ready(function() {
//    main();
//  });

//  function main() {
//    // Nothing to do at this time
//  }


// This function must be called with all modal dialog boxes which have fields that
// require validation.  It performs a call to the ASP.Net function, "Page_ClientValidate()",
// and then continues on calling "CloseModalDialog()" if the validation is okay.
// Note: Surprisingly, companion functions like "ValidatorValidate()" do not work, 
// perhaps due to the way ThickBox rearranges DOM elements.
function CheckValidationBeforeClose(element, group) {
    if (Page_ClientValidate(group))
        CloseModalDialog(element);
}
//function pageLoad() {
//    tb_init('a.thickbox, area.thickbox, input.thickbox');
//}

// Used to close a ThickBox modal dialog and then force a postback,
// which a server-side control is seemingly unable to do on its own
// when fired from within the confines of a ThickBox object.
function CloseModalDialog(element) {
    tb_remove();
    setTimeout('__doPostBack(\'' + element.name + '\',\'\')', 500);  // 500ms seems to give ThickBox enough time to remove itself
}