﻿/****************************************
TWA Modal Dialog Box JavaScript Functions
By Tim Oliver - 19-4-2009

Powered by jQuery and jQuery UI
****************************************/

/* Main Entry - Called from Flash file */
function openLogIn() {

    //container is the origin of this element
    var origin = $('#container').position();
    
    //get the dialog box from the DOM
    var dialog = $('#TP_login');
    
    //set location of the dialog to under the mouse (with 25px leeway as well)
    dialog.css({ 'left': '100px', 'top': '200px', 'position': 'absolute' });

    //set it as draggable and constrain movement to within the main content div
    dialog.draggable({ handle: '#TP_login > .header', containment: '#contentWrapper' });

    //finally, show the dialog box
    dialog.slideDown(300);
}

/* Close the Dialog box when the user hits the 'X' button */
function TP_HideModalBox() {
    //get the dialog box from the DOM 
    var dialog = $('#TP_login');

    //disable the draggable code
    dialog.draggable('disable');

    //hide the dialog
    dialog.slideUp(300);
}