app/jquery/jquery-ui.dialog.js
author Lennard de Rijk <ljvderijk@gmail.com>
Wed, 01 Jul 2009 16:28:27 +0200
changeset 2474 b8e25769880d
parent 2420 645f4de26f99
child 2749 4e2789b8e86d
permissions -rw-r--r--
Move getMenusForScope to the end of the View class. Adhering to our principle that we the methods we use for generating our menus can be usually found at the bottom of the View class.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     1
/*
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     2
 * jQuery UI Dialog 1.6
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     3
 *
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     4
 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     5
 * Dual licensed under the MIT (MIT-LICENSE.txt)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     6
 * and GPL (GPL-LICENSE.txt) licenses.
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     7
 *
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     8
 * http://docs.jquery.com/UI/Dialog
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     9
 *
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    10
 * Depends:
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    11
 *	ui.core.js
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    12
 *	ui.draggable.js
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    13
 *	ui.resizable.js
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    14
 */
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    15
(function($) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    16
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    17
var setDataSwitch = {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    18
	dragStart: "start.draggable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    19
	drag: "drag.draggable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    20
	dragStop: "stop.draggable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    21
	maxHeight: "maxHeight.resizable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    22
	minHeight: "minHeight.resizable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    23
	maxWidth: "maxWidth.resizable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    24
	minWidth: "minWidth.resizable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    25
	resizeStart: "start.resizable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    26
	resize: "drag.resizable",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    27
	resizeStop: "stop.resizable"
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    28
};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    29
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    30
$.widget("ui.dialog", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    31
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    32
	_init: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    33
		this.originalTitle = this.element.attr('title');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    34
		this.options.title = this.options.title || this.originalTitle;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    35
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    36
		var self = this,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    37
			options = this.options,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    38
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    39
			uiDialogContent = this.element
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    40
				.removeAttr('title')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    41
				.addClass('ui-dialog-content')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    42
				.wrap('<div></div>')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    43
				.wrap('<div></div>'),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    44
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    45
			uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent())
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    46
				.addClass('ui-dialog-container')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    47
				.css({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    48
					position: 'relative',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    49
					width: '100%',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    50
					height: '100%'
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    51
				}),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    52
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    53
			uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>'))
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    54
				.addClass('ui-dialog-titlebar')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    55
				.mousedown(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    56
					self.moveToTop();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    57
				})
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    58
				.prependTo(uiDialogContainer),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    59
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    60
			uiDialogTitlebarClose = $('<a href="#"/>')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    61
				.addClass('ui-dialog-titlebar-close')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    62
				.attr('role', 'button')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    63
				.appendTo(uiDialogTitlebar),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    64
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    65
			uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    66
				.text(options.closeText)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    67
				.appendTo(uiDialogTitlebarClose),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    68
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    69
			title = options.title || '&nbsp;',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    70
			titleId = $.ui.dialog.getTitleId(this.element),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    71
			uiDialogTitle = $('<span/>')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    72
				.addClass('ui-dialog-title')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    73
				.attr('id', titleId)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    74
				.html(title)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    75
				.prependTo(uiDialogTitlebar),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    76
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    77
			uiDialog = (this.uiDialog = uiDialogContainer.parent())
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    78
				.appendTo(document.body)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    79
				.hide()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    80
				.addClass('ui-dialog')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    81
				.addClass(options.dialogClass)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    82
				.css({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    83
					position: 'absolute',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    84
					width: options.width,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    85
					height: options.height,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    86
					overflow: 'hidden',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    87
					zIndex: options.zIndex
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    88
				})
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    89
				// setting tabIndex makes the div focusable
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    90
				// setting outline to 0 prevents a border on focus in Mozilla
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    91
				.attr('tabIndex', -1).css('outline', 0).keydown(function(ev) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    92
					(options.closeOnEscape && ev.keyCode
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    93
						&& ev.keyCode == $.ui.keyCode.ESCAPE && self.close());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    94
				})
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    95
				.attr({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    96
					role: 'dialog',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    97
					'aria-labelledby': titleId
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    98
				})
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    99
				.mouseup(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   100
					self.moveToTop();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   101
				}),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   102
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   103
			uiDialogButtonPane = (this.uiDialogButtonPane = $('<div></div>'))
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   104
				.addClass('ui-dialog-buttonpane')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   105
				.css({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   106
					position: 'absolute',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   107
					bottom: 0
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   108
				})
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   109
				.appendTo(uiDialog),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   110
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   111
			uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   112
				.hover(
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   113
					function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   114
						$(this).addClass('ui-dialog-titlebar-close-hover');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   115
					},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   116
					function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   117
						$(this).removeClass('ui-dialog-titlebar-close-hover');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   118
					}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   119
				)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   120
				.mousedown(function(ev) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   121
					ev.stopPropagation();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   122
				})
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   123
				.click(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   124
					self.close();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   125
					return false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   126
				});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   127
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   128
		uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   129
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   130
		(options.draggable && $.fn.draggable && this._makeDraggable());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   131
		(options.resizable && $.fn.resizable && this._makeResizable());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   132
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   133
		this._createButtons(options.buttons);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   134
		this._isOpen = false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   135
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   136
		(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   137
		(options.autoOpen && this.open());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   138
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   139
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   140
	destroy: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   141
		(this.overlay && this.overlay.destroy());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   142
		this.uiDialog.hide();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   143
		this.element
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   144
			.unbind('.dialog')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   145
			.removeData('dialog')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   146
			.removeClass('ui-dialog-content')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   147
			.hide().appendTo('body');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   148
		this.uiDialog.remove();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   149
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   150
		(this.originalTitle && this.element.attr('title', this.originalTitle));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   151
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   152
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   153
	close: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   154
		if (false === this._trigger('beforeclose', null, { options: this.options })) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   155
			return;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   156
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   157
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   158
		(this.overlay && this.overlay.destroy());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   159
		this.uiDialog
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   160
			.hide(this.options.hide)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   161
			.unbind('keypress.ui-dialog');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   162
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   163
		this._trigger('close', null, { options: this.options });
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   164
		$.ui.dialog.overlay.resize();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   165
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   166
		this._isOpen = false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   167
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   168
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   169
	isOpen: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   170
		return this._isOpen;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   171
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   172
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   173
	// the force parameter allows us to move modal dialogs to their correct
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   174
	// position on open
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   175
	moveToTop: function(force) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   176
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   177
		if ((this.options.modal && !force)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   178
			|| (!this.options.stack && !this.options.modal)) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   179
			return this._trigger('focus', null, { options: this.options });
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   180
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   181
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   182
		var maxZ = this.options.zIndex, options = this.options;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   183
		$('.ui-dialog:visible').each(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   184
			maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   185
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   186
		(this.overlay && this.overlay.$el.css('z-index', ++maxZ));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   187
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   188
		//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   189
		//  http://ui.jquery.com/bugs/ticket/3193
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   190
		var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') };
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   191
		this.uiDialog.css('z-index', ++maxZ);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   192
		this.element.attr(saveScroll);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   193
		this._trigger('focus', null, { options: this.options });
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   194
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   195
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   196
	open: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   197
		if (this._isOpen) { return; }
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   198
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   199
		this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   200
		(this.uiDialog.next().length && this.uiDialog.appendTo('body'));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   201
		this._position(this.options.position);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   202
		this.uiDialog.show(this.options.show);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   203
		(this.options.autoResize && this._size());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   204
		this.moveToTop(true);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   205
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   206
		// prevent tabbing out of modal dialogs
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   207
		(this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   208
			if (event.keyCode != $.ui.keyCode.TAB) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   209
				return;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   210
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   211
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   212
			var tabbables = $(':tabbable', this),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   213
				first = tabbables.filter(':first')[0],
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   214
				last  = tabbables.filter(':last')[0];
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   215
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   216
			if (event.target == last && !event.shiftKey) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   217
				setTimeout(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   218
					first.focus();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   219
				}, 1);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   220
			} else if (event.target == first && event.shiftKey) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   221
				setTimeout(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   222
					last.focus();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   223
				}, 1);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   224
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   225
		}));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   226
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   227
		this.uiDialog.find(':tabbable:first').focus();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   228
		this._trigger('open', null, { options: this.options });
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   229
		this._isOpen = true;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   230
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   231
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   232
	_createButtons: function(buttons) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   233
		var self = this,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   234
			hasButtons = false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   235
			uiDialogButtonPane = this.uiDialogButtonPane;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   236
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   237
		// remove any existing buttons
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   238
		uiDialogButtonPane.empty().hide();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   239
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   240
		$.each(buttons, function() { return !(hasButtons = true); });
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   241
		if (hasButtons) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   242
			uiDialogButtonPane.show();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   243
			$.each(buttons, function(name, fn) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   244
				$('<button type="button"></button>')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   245
					.text(name)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   246
					.click(function() { fn.apply(self.element[0], arguments); })
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   247
					.appendTo(uiDialogButtonPane);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   248
			});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   249
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   250
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   251
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   252
	_makeDraggable: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   253
		var self = this,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   254
			options = this.options;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   255
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   256
		this.uiDialog.draggable({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   257
			cancel: '.ui-dialog-content',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   258
			helper: options.dragHelper,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   259
			handle: '.ui-dialog-titlebar',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   260
			start: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   261
				self.moveToTop();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   262
				(options.dragStart && options.dragStart.apply(self.element[0], arguments));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   263
			},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   264
			drag: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   265
				(options.drag && options.drag.apply(self.element[0], arguments));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   266
			},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   267
			stop: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   268
				(options.dragStop && options.dragStop.apply(self.element[0], arguments));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   269
				$.ui.dialog.overlay.resize();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   270
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   271
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   272
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   273
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   274
	_makeResizable: function(handles) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   275
		handles = (handles === undefined ? this.options.resizable : handles);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   276
		var self = this,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   277
			options = this.options,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   278
			resizeHandles = typeof handles == 'string'
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   279
				? handles
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   280
				: 'n,e,s,w,se,sw,ne,nw';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   281
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   282
		this.uiDialog.resizable({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   283
			cancel: '.ui-dialog-content',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   284
			helper: options.resizeHelper,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   285
			maxWidth: options.maxWidth,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   286
			maxHeight: options.maxHeight,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   287
			minWidth: options.minWidth,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   288
			minHeight: options.minHeight,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   289
			start: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   290
				(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   291
			},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   292
			resize: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   293
				(options.autoResize && self._size.apply(self));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   294
				(options.resize && options.resize.apply(self.element[0], arguments));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   295
			},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   296
			handles: resizeHandles,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   297
			stop: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   298
				(options.autoResize && self._size.apply(self));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   299
				(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   300
				$.ui.dialog.overlay.resize();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   301
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   302
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   303
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   304
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   305
	_position: function(pos) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   306
		var wnd = $(window), doc = $(document),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   307
			pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   308
			minTop = pTop;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   309
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   310
		if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   311
			pos = [
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   312
				pos == 'right' || pos == 'left' ? pos : 'center',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   313
				pos == 'top' || pos == 'bottom' ? pos : 'middle'
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   314
			];
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   315
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   316
		if (pos.constructor != Array) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   317
			pos = ['center', 'middle'];
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   318
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   319
		if (pos[0].constructor == Number) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   320
			pLeft += pos[0];
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   321
		} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   322
			switch (pos[0]) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   323
				case 'left':
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   324
					pLeft += 0;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   325
					break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   326
				case 'right':
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   327
					pLeft += wnd.width() - this.uiDialog.outerWidth();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   328
					break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   329
				default:
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   330
				case 'center':
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   331
					pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   332
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   333
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   334
		if (pos[1].constructor == Number) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   335
			pTop += pos[1];
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   336
		} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   337
			switch (pos[1]) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   338
				case 'top':
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   339
					pTop += 0;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   340
					break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   341
				case 'bottom':
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   342
					// Opera check fixes #3564, can go away with jQuery 1.3
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   343
					pTop += ($.browser.opera ? window.innerHeight : wnd.height()) - this.uiDialog.outerHeight();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   344
					break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   345
				default:
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   346
				case 'middle':
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   347
					// Opera check fixes #3564, can go away with jQuery 1.3
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   348
					pTop += (($.browser.opera ? window.innerHeight : wnd.height()) - this.uiDialog.outerHeight()) / 2;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   349
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   350
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   351
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   352
		// prevent the dialog from being too high (make sure the titlebar
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   353
		// is accessible)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   354
		pTop = Math.max(pTop, minTop);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   355
		this.uiDialog.css({top: pTop, left: pLeft});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   356
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   357
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   358
	_setData: function(key, value){
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   359
		(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   360
		switch (key) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   361
			case "buttons":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   362
				this._createButtons(value);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   363
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   364
			case "closeText":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   365
				this.uiDialogTitlebarCloseText.text(value);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   366
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   367
			case "draggable":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   368
				(value
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   369
					? this._makeDraggable()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   370
					: this.uiDialog.draggable('destroy'));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   371
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   372
			case "height":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   373
				this.uiDialog.height(value);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   374
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   375
			case "position":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   376
				this._position(value);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   377
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   378
			case "resizable":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   379
				var uiDialog = this.uiDialog,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   380
					isResizable = this.uiDialog.is(':data(resizable)');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   381
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   382
				// currently resizable, becoming non-resizable
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   383
				(isResizable && !value && uiDialog.resizable('destroy'));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   384
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   385
				// currently resizable, changing handles
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   386
				(isResizable && typeof value == 'string' &&
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   387
					uiDialog.resizable('option', 'handles', value));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   388
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   389
				// currently non-resizable, becoming resizable
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   390
				(isResizable || this._makeResizable(value));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   391
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   392
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   393
			case "title":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   394
				$(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   395
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   396
			case "width":
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   397
				this.uiDialog.width(value);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   398
				break;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   399
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   400
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   401
		$.widget.prototype._setData.apply(this, arguments);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   402
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   403
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   404
	_size: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   405
		var container = this.uiDialogContainer,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   406
			titlebar = this.uiDialogTitlebar,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   407
			content = this.element,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   408
			tbMargin = (parseInt(content.css('margin-top'), 10) || 0)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   409
				+ (parseInt(content.css('margin-bottom'), 10) || 0),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   410
			lrMargin = (parseInt(content.css('margin-left'), 10) || 0)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   411
				+ (parseInt(content.css('margin-right'), 10) || 0);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   412
		content.height(container.height() - titlebar.outerHeight() - tbMargin);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   413
		content.width(container.width() - lrMargin);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   414
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   415
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   416
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   417
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   418
$.extend($.ui.dialog, {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   419
	version: "1.6",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   420
	defaults: {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   421
		autoOpen: true,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   422
		autoResize: true,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   423
		bgiframe: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   424
		buttons: {},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   425
		closeOnEscape: true,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   426
		closeText: 'close',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   427
		draggable: true,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   428
		height: 200,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   429
		minHeight: 100,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   430
		minWidth: 150,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   431
		modal: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   432
		overlay: {},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   433
		position: 'center',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   434
		resizable: true,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   435
		stack: true,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   436
		width: 300,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   437
		zIndex: 1000
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   438
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   439
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   440
	getter: 'isOpen',
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   441
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   442
	uuid: 0,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   443
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   444
	getTitleId: function($el) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   445
		return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   446
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   447
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   448
	overlay: function(dialog) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   449
		this.$el = $.ui.dialog.overlay.create(dialog);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   450
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   451
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   452
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   453
$.extend($.ui.dialog.overlay, {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   454
	instances: [],
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   455
	events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   456
		function(event) { return event + '.dialog-overlay'; }).join(' '),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   457
	create: function(dialog) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   458
		if (this.instances.length === 0) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   459
			// prevent use of anchors and inputs
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   460
			// we use a setTimeout in case the overlay is created from an
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   461
			// event that we're going to be cancelling (see #2804)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   462
			setTimeout(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   463
				$('a, :input').bind($.ui.dialog.overlay.events, function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   464
					// allow use of the element if inside a dialog and
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   465
					// - there are no modal dialogs
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   466
					// - there are modal dialogs, but we are in front of the topmost modal
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   467
					var allow = false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   468
					var $dialog = $(this).parents('.ui-dialog');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   469
					if ($dialog.length) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   470
						var $overlays = $('.ui-dialog-overlay');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   471
						if ($overlays.length) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   472
							var maxZ = parseInt($overlays.css('z-index'), 10);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   473
							$overlays.each(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   474
								maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   475
							});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   476
							allow = parseInt($dialog.css('z-index'), 10) > maxZ;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   477
						} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   478
							allow = true;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   479
						}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   480
					}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   481
					return allow;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   482
				});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   483
			}, 1);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   484
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   485
			// allow closing by pressing the escape key
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   486
			$(document).bind('keydown.dialog-overlay', function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   487
				(dialog.options.closeOnEscape && event.keyCode
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   488
						&& event.keyCode == $.ui.keyCode.ESCAPE && dialog.close());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   489
			});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   490
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   491
			// handle window resize
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   492
			$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   493
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   494
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   495
		var $el = $('<div></div>').appendTo(document.body)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   496
			.addClass('ui-dialog-overlay').css($.extend({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   497
				borderWidth: 0, margin: 0, padding: 0,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   498
				position: 'absolute', top: 0, left: 0,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   499
				width: this.width(),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   500
				height: this.height()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   501
			}, dialog.options.overlay));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   502
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   503
		(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   504
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   505
		this.instances.push($el);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   506
		return $el;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   507
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   508
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   509
	destroy: function($el) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   510
		this.instances.splice($.inArray(this.instances, $el), 1);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   511
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   512
		if (this.instances.length === 0) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   513
			$('a, :input').add([document, window]).unbind('.dialog-overlay');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   514
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   515
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   516
		$el.remove();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   517
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   518
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   519
	height: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   520
		// handle IE 6
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   521
		if ($.browser.msie && $.browser.version < 7) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   522
			var scrollHeight = Math.max(
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   523
				document.documentElement.scrollHeight,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   524
				document.body.scrollHeight
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   525
			);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   526
			var offsetHeight = Math.max(
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   527
				document.documentElement.offsetHeight,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   528
				document.body.offsetHeight
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   529
			);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   530
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   531
			if (scrollHeight < offsetHeight) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   532
				return $(window).height() + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   533
			} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   534
				return scrollHeight + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   535
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   536
		// handle Opera
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   537
		} else if ($.browser.opera) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   538
			return Math.max(
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   539
				window.innerHeight,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   540
				$(document).height()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   541
			) + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   542
		// handle "good" browsers
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   543
		} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   544
			return $(document).height() + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   545
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   546
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   547
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   548
	width: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   549
		// handle IE 6
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   550
		if ($.browser.msie && $.browser.version < 7) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   551
			var scrollWidth = Math.max(
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   552
				document.documentElement.scrollWidth,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   553
				document.body.scrollWidth
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   554
			);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   555
			var offsetWidth = Math.max(
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   556
				document.documentElement.offsetWidth,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   557
				document.body.offsetWidth
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   558
			);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   559
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   560
			if (scrollWidth < offsetWidth) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   561
				return $(window).width() + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   562
			} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   563
				return scrollWidth + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   564
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   565
		// handle Opera
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   566
		} else if ($.browser.opera) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   567
			return Math.max(
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   568
				window.innerWidth,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   569
				$(document).width()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   570
			) + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   571
		// handle "good" browsers
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   572
		} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   573
			return $(document).width() + 'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   574
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   575
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   576
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   577
	resize: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   578
		/* If the dialog is draggable and the user drags it past the
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   579
		 * right edge of the window, the document becomes wider so we
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   580
		 * need to stretch the overlay. If the user then drags the
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   581
		 * dialog back to the left, the document will become narrower,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   582
		 * so we need to shrink the overlay to the appropriate size.
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   583
		 * This is handled by shrinking the overlay before setting it
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   584
		 * to the full document size.
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   585
		 */
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   586
		var $overlays = $([]);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   587
		$.each($.ui.dialog.overlay.instances, function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   588
			$overlays = $overlays.add(this);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   589
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   590
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   591
		$overlays.css({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   592
			width: 0,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   593
			height: 0
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   594
		}).css({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   595
			width: $.ui.dialog.overlay.width(),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   596
			height: $.ui.dialog.overlay.height()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   597
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   598
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   599
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   600
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   601
$.extend($.ui.dialog.overlay.prototype, {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   602
	destroy: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   603
		$.ui.dialog.overlay.destroy(this.$el);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   604
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   605
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   606
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   607
})(jQuery);