﻿/// <reference path="jquery-1.2.6.js"/>
/// <reference path="ui/ui.core.js"/>
/// <reference path="ui/ui.dialog.js"/>
/// <reference path="ui/ui.draggable.js"/>
/// <reference path="ui/ui.resizable.js"/>

$(function () {
    
    if (($.browser.msie && $.browser.version < 7)) {
        $("#dialogdiv").dialog({
            autoOpen: false,
            bgiframe: true,
            resizable: false,
            minHeight: 600,
            dialogClass: 'modaldialog',
            beforeclose: function () { beforeCloseDialog() },
            modal: true,
            overlay: {
                backgroundColor: '#000',
                opacity: 0.5
            }
        });

    }
    else {
        $("#dialogdiv").dialog({
            autoOpen: false,
            bgiframe: true,
            resizable: false,
            dialogClass: 'modaldialog',
            beforeclose: function () { beforeCloseDialog() },
            modal: true,
            overlay: {
                backgroundColor: '#000',
                opacity: 0.5
            }
        });


    }

    
});


function positionTipDialog(title) {
//    hideWindowedControls();
    $('#ui-dialog-title-dialogdiv').text(title);
    $("#dialogdiv").dialog('open');
    $("#dialogdiv").parent().appendTo($("form:first"));
    
    $(".loginInput:first").focus();


//    dlg.parent().appendTo('/html/body/form[0]');

//    $(".ui-dialog").data('position.dialog', 'center');

    if( ($(window).width() / 2 - $(".ui-dialog").width() / 2) > 0)
        $(".ui-dialog").css('left', $(window).width() / 2 - $(".ui-dialog").width() / 2);


    if (($(window).height() / 2 - $(".ui-dialog").height() / 2) > 0)
        $(".ui-dialog").css('top', ($(window).height() / 2 - $(".ui-dialog").height() / 2) + $(window).scrollTop() );

    return false;

}


function beforeCloseDialog() {
    $(".jQueryClearTipDialogLabel").text("");
}

function closeTipDialog() {
    //location.href = '.';
    $("#dialogdiv").dialog('close');
//    showWindowedControls();
}
