Autocomplete - Version 0.1.2

Version Notes

We have a github project that people can contribute to, and make it a better extension

Download this release

Release Info

Developer Jay Patel
Extension Autocomplete
Version 0.1.2
Comparing to
See all releases


Version 0.1.2

app/code/local/KD/Adminsuggest/Model/Observer.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class KD_Adminsuggest_Model_Observer {
4
+ public function addJS($observer){
5
+ $controller = $observer->getAction();
6
+ var_dump($controller);
7
+ $layout = $controller->getLayout();
8
+ var_dump($layout);
9
+ $block = $layout->createBlock('core/text');
10
+ $block->setText(
11
+ ''
12
+ );
13
+ $layout->getBlock('js')->append($block);
14
+
15
+ }
16
+ }
17
+ ?>
app/code/local/KD/Adminsuggest/controllers/IndexController.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class KD_Adminsuggest_IndexController extends Mage_Core_Controller_Front_Action{
4
+
5
+ function callAPI($method, $url, $data = false) {
6
+ $curl = curl_init();
7
+
8
+ switch ($method)
9
+ {
10
+ case "POST":
11
+ curl_setopt($curl, CURLOPT_POST, 1);
12
+
13
+ if ($data)
14
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
15
+ break;
16
+ case "PUT":
17
+ curl_setopt($curl, CURLOPT_PUT, 1);
18
+ break;
19
+ default:
20
+ if ($data)
21
+ $url = sprintf("%s?%s", $url, http_build_query($data));
22
+ }
23
+
24
+ // Optional Authentication:
25
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
26
+ curl_setopt($curl, CURLOPT_USERPWD, "username:password");
27
+
28
+ curl_setopt($curl, CURLOPT_URL, $url);
29
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
30
+
31
+ return curl_exec($curl);
32
+ }
33
+
34
+ public function indexAction(){
35
+ $data = $_GET;
36
+ $result = json_decode($this->callAPI("GET", "http://anywhere.ebay.com/services/suggest/", $data ));
37
+ $this->getResponse()->setHeader('Content-type', 'application/json');
38
+ $post_data = json_encode($result[1]);
39
+ $this->getResponse()->setBody($post_data);
40
+ }
41
+
42
+ }
43
+
44
+
45
+ ?>
app/code/local/KD/Adminsuggest/etc/config.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <KD_Adminsuggest>
5
+ <version>0.1.0</version>
6
+ </KD_Adminsuggest>
7
+ </modules>
8
+
9
+ <global>
10
+ <models>
11
+ <kd_adminsuggest>
12
+ <class>KD_Adminsuggest_Model</class>
13
+ </kd_adminsuggest>
14
+ </models>
15
+ </global>
16
+ <frontend>
17
+ <routers>
18
+ <adminsuggest>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>KD_Adminsuggest</module>
22
+ <frontName>adminsuggest</frontName>
23
+ </args>
24
+ </adminsuggest>
25
+ </routers>
26
+ </frontend>
27
+ <adminhtml>
28
+ <layout>
29
+ <updates>
30
+ <kd_adminsuggest>
31
+ <file>adminsuggest.xml</file>
32
+ </kd_adminsuggest>
33
+ </updates>
34
+ </layout>
35
+ </adminhtml>
36
+
37
+ </config>
app/design/adminhtml/default/default/layout/adminsuggest.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <layout>
3
+ <adminhtml_catalog_product_new>
4
+ <reference name="head">
5
+ <action method="addJs">
6
+ <script>kd/jquery.js</script>
7
+ </action>
8
+ <action method="addJs">
9
+ <script>kd/jquery-ui.js</script>
10
+ </action>
11
+ <action method="addJs">
12
+ <script>kd/ready.js</script>
13
+ </action>
14
+ <action method="addJs">
15
+ <script>kd/adminsuggest.js</script>
16
+ </action>
17
+ <action method="addCss">
18
+ <stylesheet>jquery-ui.css</stylesheet>
19
+ </action>
20
+ <action method="addCss">
21
+ <stylesheet>adminsuggest.css</stylesheet>
22
+ </action>
23
+ <block type="page/html" template="kd/adminsuggest.phtml" output="toHtml" name="adminsuggest"></block>
24
+ </reference>
25
+ </adminhtml_catalog_product_new>
26
+ </layout>
app/design/adminhtml/default/default/template/kd/adminsuggest.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ <?php
3
+ $rootURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
4
+ ?>
5
+ var rootURL = '<?= $rootURL ?>';
6
+ </script>
app/design/adminhtml/default/default/template/kd/extensioncontent.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ jQuery.noConflict();
3
+ // Custom compare function (optional) that sorts case insensitive
4
+ var cmp = function(a, b) {
5
+ n1 = (a.data.isFolder === "true");
6
+ n2 = (b.data.isFolder === "true");
7
+ return (n1 > n2 ? -1 : n1 < n2 ? 1 : 0);
8
+ };
9
+ function addHiddenInput(key, value){
10
+ var key_string = "extensioncontent[" + key + "]";
11
+ jQuery('<input type="hidden" class="field" name="'+ key_string +'" value="' + value + '" />').appendTo('#extensioncontent');
12
+ }
13
+ jQuery(function(){
14
+ jQuery("#tree").dynatree({
15
+ checkbox: true,
16
+ selectMode: 3,
17
+ onSelect: function(select, node){
18
+ jQuery("#extensioncontent").empty();
19
+ var contents = node.tree.getSelectedNodes(true).each(function(data){
20
+ addHiddenInput(data.data.key, data.data.title) ;
21
+ //alert(data.data.key);
22
+ //jQuery("#extensioncontent").val(contents);
23
+ });
24
+
25
+ } ,
26
+ children: <?= $this->getProjectDirectoryStructureJson(); ?>
27
+
28
+ });
29
+ var node = jQuery("#tree").dynatree("getRoot");
30
+ node.sortChildren(cmp, true);
31
+
32
+ });
33
+
34
+ </script>
35
+
36
+ <div class="entry-edit">
37
+ <div class="entry-edit-head">
38
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Contents") ?></h4>
39
+ </div>
40
+ <div id="extensioncontent"></div>
41
+ <?php foreach ($this->getMageTargets() as $_value=>$_label): ?>
42
+ <span><?php echo $_value ?>: <?php echo $_label ?></span><br />
43
+ <?php endforeach ?>
44
+ <div id="tree">
45
+ </div>
46
+ </div>
app/etc/modules/KD_Adminsuggest.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <KD_Adminsuggest>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </KD_Adminsuggest>
8
+ </modules>
9
+ </config>
js/kd/adminsuggest.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+ ready(function(){
3
+ function split( val ) {
4
+ return val.split( /,\s*/ );
5
+ }
6
+ function extractLast( term ) {
7
+ return split( term ).pop();
8
+ }
9
+ /*var inputText = document.getElementById('name');
10
+ inputText.onkeyup = function(){
11
+ if(this.value.length >= 3) {
12
+ alert('someone wrote: '+ this.value );
13
+ }
14
+ }*/
15
+ /* jQuery('#name').keyup(function(){
16
+ var searchText = jQuery(this).val();
17
+ if(searchText.length >=3) {
18
+ alert('someone wrote:' + searchText);
19
+ }
20
+ });*/
21
+
22
+ jQuery('#name').autocomplete({
23
+ source: function(request, response){
24
+ jQuery.getJSON( rootURL + "/adminsuggest/index/index", {
25
+ v: "json",
26
+ q: request.term
27
+ },response );
28
+ } ,
29
+ search: function() {
30
+ // custom minLength
31
+ var term = extractLast( this.value );
32
+ if ( term.length < 2 ) {
33
+ return false;
34
+ }
35
+ },
36
+ focus: function() {
37
+ // prevent value inserted on focus
38
+ return false;
39
+ }
40
+ });
41
+ });
js/kd/extensioncontent.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery.noConflict();
js/kd/jquery-ui.custom.js ADDED
@@ -0,0 +1,11727 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery UI 1.8.24
3
+ *
4
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI
9
+ */
10
+ (function( $, undefined ) {
11
+
12
+ // prevent duplicate loading
13
+ // this is only a problem because we proxy existing functions
14
+ // and we don't want to double proxy them
15
+ $.ui = $.ui || {};
16
+ if ( $.ui.version ) {
17
+ return;
18
+ }
19
+
20
+ $.extend( $.ui, {
21
+ version: "1.8.24",
22
+
23
+ keyCode: {
24
+ ALT: 18,
25
+ BACKSPACE: 8,
26
+ CAPS_LOCK: 20,
27
+ COMMA: 188,
28
+ COMMAND: 91,
29
+ COMMAND_LEFT: 91, // COMMAND
30
+ COMMAND_RIGHT: 93,
31
+ CONTROL: 17,
32
+ DELETE: 46,
33
+ DOWN: 40,
34
+ END: 35,
35
+ ENTER: 13,
36
+ ESCAPE: 27,
37
+ HOME: 36,
38
+ INSERT: 45,
39
+ LEFT: 37,
40
+ MENU: 93, // COMMAND_RIGHT
41
+ NUMPAD_ADD: 107,
42
+ NUMPAD_DECIMAL: 110,
43
+ NUMPAD_DIVIDE: 111,
44
+ NUMPAD_ENTER: 108,
45
+ NUMPAD_MULTIPLY: 106,
46
+ NUMPAD_SUBTRACT: 109,
47
+ PAGE_DOWN: 34,
48
+ PAGE_UP: 33,
49
+ PERIOD: 190,
50
+ RIGHT: 39,
51
+ SHIFT: 16,
52
+ SPACE: 32,
53
+ TAB: 9,
54
+ UP: 38,
55
+ WINDOWS: 91 // COMMAND
56
+ }
57
+ });
58
+
59
+ // plugins
60
+ $.fn.extend({
61
+ propAttr: $.fn.prop || $.fn.attr,
62
+
63
+ _focus: $.fn.focus,
64
+ focus: function( delay, fn ) {
65
+ return typeof delay === "number" ?
66
+ this.each(function() {
67
+ var elem = this;
68
+ setTimeout(function() {
69
+ $( elem ).focus();
70
+ if ( fn ) {
71
+ fn.call( elem );
72
+ }
73
+ }, delay );
74
+ }) :
75
+ this._focus.apply( this, arguments );
76
+ },
77
+
78
+ scrollParent: function() {
79
+ var scrollParent;
80
+ if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
81
+ scrollParent = this.parents().filter(function() {
82
+ return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
83
+ }).eq(0);
84
+ } else {
85
+ scrollParent = this.parents().filter(function() {
86
+ return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
87
+ }).eq(0);
88
+ }
89
+
90
+ return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
91
+ },
92
+
93
+ zIndex: function( zIndex ) {
94
+ if ( zIndex !== undefined ) {
95
+ return this.css( "zIndex", zIndex );
96
+ }
97
+
98
+ if ( this.length ) {
99
+ var elem = $( this[ 0 ] ), position, value;
100
+ while ( elem.length && elem[ 0 ] !== document ) {
101
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
102
+ // This makes behavior of this function consistent across browsers
103
+ // WebKit always returns auto if the element is positioned
104
+ position = elem.css( "position" );
105
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
106
+ // IE returns 0 when zIndex is not specified
107
+ // other browsers return a string
108
+ // we ignore the case of nested elements with an explicit value of 0
109
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
110
+ value = parseInt( elem.css( "zIndex" ), 10 );
111
+ if ( !isNaN( value ) && value !== 0 ) {
112
+ return value;
113
+ }
114
+ }
115
+ elem = elem.parent();
116
+ }
117
+ }
118
+
119
+ return 0;
120
+ },
121
+
122
+ disableSelection: function() {
123
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
124
+ ".ui-disableSelection", function( event ) {
125
+ event.preventDefault();
126
+ });
127
+ },
128
+
129
+ enableSelection: function() {
130
+ return this.unbind( ".ui-disableSelection" );
131
+ }
132
+ });
133
+
134
+ // support: jQuery <1.8
135
+ if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
136
+ $.each( [ "Width", "Height" ], function( i, name ) {
137
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
138
+ type = name.toLowerCase(),
139
+ orig = {
140
+ innerWidth: $.fn.innerWidth,
141
+ innerHeight: $.fn.innerHeight,
142
+ outerWidth: $.fn.outerWidth,
143
+ outerHeight: $.fn.outerHeight
144
+ };
145
+
146
+ function reduce( elem, size, border, margin ) {
147
+ $.each( side, function() {
148
+ size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
149
+ if ( border ) {
150
+ size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
151
+ }
152
+ if ( margin ) {
153
+ size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
154
+ }
155
+ });
156
+ return size;
157
+ }
158
+
159
+ $.fn[ "inner" + name ] = function( size ) {
160
+ if ( size === undefined ) {
161
+ return orig[ "inner" + name ].call( this );
162
+ }
163
+
164
+ return this.each(function() {
165
+ $( this ).css( type, reduce( this, size ) + "px" );
166
+ });
167
+ };
168
+
169
+ $.fn[ "outer" + name] = function( size, margin ) {
170
+ if ( typeof size !== "number" ) {
171
+ return orig[ "outer" + name ].call( this, size );
172
+ }
173
+
174
+ return this.each(function() {
175
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
176
+ });
177
+ };
178
+ });
179
+ }
180
+
181
+ // selectors
182
+ function focusable( element, isTabIndexNotNaN ) {
183
+ var nodeName = element.nodeName.toLowerCase();
184
+ if ( "area" === nodeName ) {
185
+ var map = element.parentNode,
186
+ mapName = map.name,
187
+ img;
188
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
189
+ return false;
190
+ }
191
+ img = $( "img[usemap=#" + mapName + "]" )[0];
192
+ return !!img && visible( img );
193
+ }
194
+ return ( /input|select|textarea|button|object/.test( nodeName )
195
+ ? !element.disabled
196
+ : "a" == nodeName
197
+ ? element.href || isTabIndexNotNaN
198
+ : isTabIndexNotNaN)
199
+ // the element and all of its ancestors must be visible
200
+ && visible( element );
201
+ }
202
+
203
+ function visible( element ) {
204
+ return !$( element ).parents().andSelf().filter(function() {
205
+ return $.curCSS( this, "visibility" ) === "hidden" ||
206
+ $.expr.filters.hidden( this );
207
+ }).length;
208
+ }
209
+
210
+ $.extend( $.expr[ ":" ], {
211
+ data: $.expr.createPseudo ?
212
+ $.expr.createPseudo(function( dataName ) {
213
+ return function( elem ) {
214
+ return !!$.data( elem, dataName );
215
+ };
216
+ }) :
217
+ // support: jQuery <1.8
218
+ function( elem, i, match ) {
219
+ return !!$.data( elem, match[ 3 ] );
220
+ },
221
+
222
+ focusable: function( element ) {
223
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
224
+ },
225
+
226
+ tabbable: function( element ) {
227
+ var tabIndex = $.attr( element, "tabindex" ),
228
+ isTabIndexNaN = isNaN( tabIndex );
229
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
230
+ }
231
+ });
232
+
233
+ // support
234
+ $(function() {
235
+ var body = document.body,
236
+ div = body.appendChild( div = document.createElement( "div" ) );
237
+
238
+ // access offsetHeight before setting the style to prevent a layout bug
239
+ // in IE 9 which causes the elemnt to continue to take up space even
240
+ // after it is removed from the DOM (#8026)
241
+ div.offsetHeight;
242
+
243
+ $.extend( div.style, {
244
+ minHeight: "100px",
245
+ height: "auto",
246
+ padding: 0,
247
+ borderWidth: 0
248
+ });
249
+
250
+ $.support.minHeight = div.offsetHeight === 100;
251
+ $.support.selectstart = "onselectstart" in div;
252
+
253
+ // set display to none to avoid a layout bug in IE
254
+ // http://dev.jquery.com/ticket/4014
255
+ body.removeChild( div ).style.display = "none";
256
+ });
257
+
258
+ // jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
259
+ if ( !$.curCSS ) {
260
+ $.curCSS = $.css;
261
+ }
262
+
263
+
264
+
265
+
266
+
267
+ // deprecated
268
+ $.extend( $.ui, {
269
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
270
+ plugin: {
271
+ add: function( module, option, set ) {
272
+ var proto = $.ui[ module ].prototype;
273
+ for ( var i in set ) {
274
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
275
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
276
+ }
277
+ },
278
+ call: function( instance, name, args ) {
279
+ var set = instance.plugins[ name ];
280
+ if ( !set || !instance.element[ 0 ].parentNode ) {
281
+ return;
282
+ }
283
+
284
+ for ( var i = 0; i < set.length; i++ ) {
285
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
286
+ set[ i ][ 1 ].apply( instance.element, args );
287
+ }
288
+ }
289
+ }
290
+ },
291
+
292
+ // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
293
+ contains: function( a, b ) {
294
+ return document.compareDocumentPosition ?
295
+ a.compareDocumentPosition( b ) & 16 :
296
+ a !== b && a.contains( b );
297
+ },
298
+
299
+ // only used by resizable
300
+ hasScroll: function( el, a ) {
301
+
302
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
303
+ if ( $( el ).css( "overflow" ) === "hidden") {
304
+ return false;
305
+ }
306
+
307
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
308
+ has = false;
309
+
310
+ if ( el[ scroll ] > 0 ) {
311
+ return true;
312
+ }
313
+
314
+ // TODO: determine which cases actually cause this to happen
315
+ // if the element doesn't have the scroll set, see if it's possible to
316
+ // set the scroll
317
+ el[ scroll ] = 1;
318
+ has = ( el[ scroll ] > 0 );
319
+ el[ scroll ] = 0;
320
+ return has;
321
+ },
322
+
323
+ // these are odd functions, fix the API or move into individual plugins
324
+ isOverAxis: function( x, reference, size ) {
325
+ //Determines when x coordinate is over "b" element axis
326
+ return ( x > reference ) && ( x < ( reference + size ) );
327
+ },
328
+ isOver: function( y, x, top, left, height, width ) {
329
+ //Determines when x, y coordinates is over "b" element
330
+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
331
+ }
332
+ });
333
+
334
+ })( jQuery );
335
+ /*!
336
+ * jQuery UI Widget 1.8.24
337
+ *
338
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
339
+ * Dual licensed under the MIT or GPL Version 2 licenses.
340
+ * http://jquery.org/license
341
+ *
342
+ * http://docs.jquery.com/UI/Widget
343
+ */
344
+ (function( $, undefined ) {
345
+
346
+ // jQuery 1.4+
347
+ if ( $.cleanData ) {
348
+ var _cleanData = $.cleanData;
349
+ $.cleanData = function( elems ) {
350
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
351
+ try {
352
+ $( elem ).triggerHandler( "remove" );
353
+ // http://bugs.jquery.com/ticket/8235
354
+ } catch( e ) {}
355
+ }
356
+ _cleanData( elems );
357
+ };
358
+ } else {
359
+ var _remove = $.fn.remove;
360
+ $.fn.remove = function( selector, keepData ) {
361
+ return this.each(function() {
362
+ if ( !keepData ) {
363
+ if ( !selector || $.filter( selector, [ this ] ).length ) {
364
+ $( "*", this ).add( [ this ] ).each(function() {
365
+ try {
366
+ $( this ).triggerHandler( "remove" );
367
+ // http://bugs.jquery.com/ticket/8235
368
+ } catch( e ) {}
369
+ });
370
+ }
371
+ }
372
+ return _remove.call( $(this), selector, keepData );
373
+ });
374
+ };
375
+ }
376
+
377
+ $.widget = function( name, base, prototype ) {
378
+ var namespace = name.split( "." )[ 0 ],
379
+ fullName;
380
+ name = name.split( "." )[ 1 ];
381
+ fullName = namespace + "-" + name;
382
+
383
+ if ( !prototype ) {
384
+ prototype = base;
385
+ base = $.Widget;
386
+ }
387
+
388
+ // create selector for plugin
389
+ $.expr[ ":" ][ fullName ] = function( elem ) {
390
+ return !!$.data( elem, name );
391
+ };
392
+
393
+ $[ namespace ] = $[ namespace ] || {};
394
+ $[ namespace ][ name ] = function( options, element ) {
395
+ // allow instantiation without initializing for simple inheritance
396
+ if ( arguments.length ) {
397
+ this._createWidget( options, element );
398
+ }
399
+ };
400
+
401
+ var basePrototype = new base();
402
+ // we need to make the options hash a property directly on the new instance
403
+ // otherwise we'll modify the options hash on the prototype that we're
404
+ // inheriting from
405
+ // $.each( basePrototype, function( key, val ) {
406
+ // if ( $.isPlainObject(val) ) {
407
+ // basePrototype[ key ] = $.extend( {}, val );
408
+ // }
409
+ // });
410
+ basePrototype.options = $.extend( true, {}, basePrototype.options );
411
+ $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
412
+ namespace: namespace,
413
+ widgetName: name,
414
+ widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
415
+ widgetBaseClass: fullName
416
+ }, prototype );
417
+
418
+ $.widget.bridge( name, $[ namespace ][ name ] );
419
+ };
420
+
421
+ $.widget.bridge = function( name, object ) {
422
+ $.fn[ name ] = function( options ) {
423
+ var isMethodCall = typeof options === "string",
424
+ args = Array.prototype.slice.call( arguments, 1 ),
425
+ returnValue = this;
426
+
427
+ // allow multiple hashes to be passed on init
428
+ options = !isMethodCall && args.length ?
429
+ $.extend.apply( null, [ true, options ].concat(args) ) :
430
+ options;
431
+
432
+ // prevent calls to internal methods
433
+ if ( isMethodCall && options.charAt( 0 ) === "_" ) {
434
+ return returnValue;
435
+ }
436
+
437
+ if ( isMethodCall ) {
438
+ this.each(function() {
439
+ var instance = $.data( this, name ),
440
+ methodValue = instance && $.isFunction( instance[options] ) ?
441
+ instance[ options ].apply( instance, args ) :
442
+ instance;
443
+ // TODO: add this back in 1.9 and use $.error() (see #5972)
444
+ // if ( !instance ) {
445
+ // throw "cannot call methods on " + name + " prior to initialization; " +
446
+ // "attempted to call method '" + options + "'";
447
+ // }
448
+ // if ( !$.isFunction( instance[options] ) ) {
449
+ // throw "no such method '" + options + "' for " + name + " widget instance";
450
+ // }
451
+ // var methodValue = instance[ options ].apply( instance, args );
452
+ if ( methodValue !== instance && methodValue !== undefined ) {
453
+ returnValue = methodValue;
454
+ return false;
455
+ }
456
+ });
457
+ } else {
458
+ this.each(function() {
459
+ var instance = $.data( this, name );
460
+ if ( instance ) {
461
+ instance.option( options || {} )._init();
462
+ } else {
463
+ $.data( this, name, new object( options, this ) );
464
+ }
465
+ });
466
+ }
467
+
468
+ return returnValue;
469
+ };
470
+ };
471
+
472
+ $.Widget = function( options, element ) {
473
+ // allow instantiation without initializing for simple inheritance
474
+ if ( arguments.length ) {
475
+ this._createWidget( options, element );
476
+ }
477
+ };
478
+
479
+ $.Widget.prototype = {
480
+ widgetName: "widget",
481
+ widgetEventPrefix: "",
482
+ options: {
483
+ disabled: false
484
+ },
485
+ _createWidget: function( options, element ) {
486
+ // $.widget.bridge stores the plugin instance, but we do it anyway
487
+ // so that it's stored even before the _create function runs
488
+ $.data( element, this.widgetName, this );
489
+ this.element = $( element );
490
+ this.options = $.extend( true, {},
491
+ this.options,
492
+ this._getCreateOptions(),
493
+ options );
494
+
495
+ var self = this;
496
+ this.element.bind( "remove." + this.widgetName, function() {
497
+ self.destroy();
498
+ });
499
+
500
+ this._create();
501
+ this._trigger( "create" );
502
+ this._init();
503
+ },
504
+ _getCreateOptions: function() {
505
+ return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
506
+ },
507
+ _create: function() {},
508
+ _init: function() {},
509
+
510
+ destroy: function() {
511
+ this.element
512
+ .unbind( "." + this.widgetName )
513
+ .removeData( this.widgetName );
514
+ this.widget()
515
+ .unbind( "." + this.widgetName )
516
+ .removeAttr( "aria-disabled" )
517
+ .removeClass(
518
+ this.widgetBaseClass + "-disabled " +
519
+ "ui-state-disabled" );
520
+ },
521
+
522
+ widget: function() {
523
+ return this.element;
524
+ },
525
+
526
+ option: function( key, value ) {
527
+ var options = key;
528
+
529
+ if ( arguments.length === 0 ) {
530
+ // don't return a reference to the internal hash
531
+ return $.extend( {}, this.options );
532
+ }
533
+
534
+ if (typeof key === "string" ) {
535
+ if ( value === undefined ) {
536
+ return this.options[ key ];
537
+ }
538
+ options = {};
539
+ options[ key ] = value;
540
+ }
541
+
542
+ this._setOptions( options );
543
+
544
+ return this;
545
+ },
546
+ _setOptions: function( options ) {
547
+ var self = this;
548
+ $.each( options, function( key, value ) {
549
+ self._setOption( key, value );
550
+ });
551
+
552
+ return this;
553
+ },
554
+ _setOption: function( key, value ) {
555
+ this.options[ key ] = value;
556
+
557
+ if ( key === "disabled" ) {
558
+ this.widget()
559
+ [ value ? "addClass" : "removeClass"](
560
+ this.widgetBaseClass + "-disabled" + " " +
561
+ "ui-state-disabled" )
562
+ .attr( "aria-disabled", value );
563
+ }
564
+
565
+ return this;
566
+ },
567
+
568
+ enable: function() {
569
+ return this._setOption( "disabled", false );
570
+ },
571
+ disable: function() {
572
+ return this._setOption( "disabled", true );
573
+ },
574
+
575
+ _trigger: function( type, event, data ) {
576
+ var prop, orig,
577
+ callback = this.options[ type ];
578
+
579
+ data = data || {};
580
+ event = $.Event( event );
581
+ event.type = ( type === this.widgetEventPrefix ?
582
+ type :
583
+ this.widgetEventPrefix + type ).toLowerCase();
584
+ // the original event may come from any element
585
+ // so we need to reset the target on the new event
586
+ event.target = this.element[ 0 ];
587
+
588
+ // copy original event properties over to the new event
589
+ orig = event.originalEvent;
590
+ if ( orig ) {
591
+ for ( prop in orig ) {
592
+ if ( !( prop in event ) ) {
593
+ event[ prop ] = orig[ prop ];
594
+ }
595
+ }
596
+ }
597
+
598
+ this.element.trigger( event, data );
599
+
600
+ return !( $.isFunction(callback) &&
601
+ callback.call( this.element[0], event, data ) === false ||
602
+ event.isDefaultPrevented() );
603
+ }
604
+ };
605
+
606
+ })( jQuery );
607
+ /*!
608
+ * jQuery UI Mouse 1.8.24
609
+ *
610
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
611
+ * Dual licensed under the MIT or GPL Version 2 licenses.
612
+ * http://jquery.org/license
613
+ *
614
+ * http://docs.jquery.com/UI/Mouse
615
+ *
616
+ * Depends:
617
+ * jquery.ui.widget.js
618
+ */
619
+ (function( $, undefined ) {
620
+
621
+ var mouseHandled = false;
622
+ $( document ).mouseup( function( e ) {
623
+ mouseHandled = false;
624
+ });
625
+
626
+ $.widget("ui.mouse", {
627
+ options: {
628
+ cancel: ':input,option',
629
+ distance: 1,
630
+ delay: 0
631
+ },
632
+ _mouseInit: function() {
633
+ var self = this;
634
+
635
+ this.element
636
+ .bind('mousedown.'+this.widgetName, function(event) {
637
+ return self._mouseDown(event);
638
+ })
639
+ .bind('click.'+this.widgetName, function(event) {
640
+ if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
641
+ $.removeData(event.target, self.widgetName + '.preventClickEvent');
642
+ event.stopImmediatePropagation();
643
+ return false;
644
+ }
645
+ });
646
+
647
+ this.started = false;
648
+ },
649
+
650
+ // TODO: make sure destroying one instance of mouse doesn't mess with
651
+ // other instances of mouse
652
+ _mouseDestroy: function() {
653
+ this.element.unbind('.'+this.widgetName);
654
+ if ( this._mouseMoveDelegate ) {
655
+ $(document)
656
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
657
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
658
+ }
659
+ },
660
+
661
+ _mouseDown: function(event) {
662
+ // don't let more than one widget handle mouseStart
663
+ if( mouseHandled ) { return };
664
+
665
+ // we may have missed mouseup (out of window)
666
+ (this._mouseStarted && this._mouseUp(event));
667
+
668
+ this._mouseDownEvent = event;
669
+
670
+ var self = this,
671
+ btnIsLeft = (event.which == 1),
672
+ // event.target.nodeName works around a bug in IE 8 with
673
+ // disabled inputs (#7620)
674
+ elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
675
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
676
+ return true;
677
+ }
678
+
679
+ this.mouseDelayMet = !this.options.delay;
680
+ if (!this.mouseDelayMet) {
681
+ this._mouseDelayTimer = setTimeout(function() {
682
+ self.mouseDelayMet = true;
683
+ }, this.options.delay);
684
+ }
685
+
686
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
687
+ this._mouseStarted = (this._mouseStart(event) !== false);
688
+ if (!this._mouseStarted) {
689
+ event.preventDefault();
690
+ return true;
691
+ }
692
+ }
693
+
694
+ // Click event may never have fired (Gecko & Opera)
695
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
696
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
697
+ }
698
+
699
+ // these delegates are required to keep context
700
+ this._mouseMoveDelegate = function(event) {
701
+ return self._mouseMove(event);
702
+ };
703
+ this._mouseUpDelegate = function(event) {
704
+ return self._mouseUp(event);
705
+ };
706
+ $(document)
707
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
708
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
709
+
710
+ event.preventDefault();
711
+
712
+ mouseHandled = true;
713
+ return true;
714
+ },
715
+
716
+ _mouseMove: function(event) {
717
+ // IE mouseup check - mouseup happened when mouse was out of window
718
+ if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
719
+ return this._mouseUp(event);
720
+ }
721
+
722
+ if (this._mouseStarted) {
723
+ this._mouseDrag(event);
724
+ return event.preventDefault();
725
+ }
726
+
727
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
728
+ this._mouseStarted =
729
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
730
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
731
+ }
732
+
733
+ return !this._mouseStarted;
734
+ },
735
+
736
+ _mouseUp: function(event) {
737
+ $(document)
738
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
739
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
740
+
741
+ if (this._mouseStarted) {
742
+ this._mouseStarted = false;
743
+
744
+ if (event.target == this._mouseDownEvent.target) {
745
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
746
+ }
747
+
748
+ this._mouseStop(event);
749
+ }
750
+
751
+ return false;
752
+ },
753
+
754
+ _mouseDistanceMet: function(event) {
755
+ return (Math.max(
756
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
757
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
758
+ ) >= this.options.distance
759
+ );
760
+ },
761
+
762
+ _mouseDelayMet: function(event) {
763
+ return this.mouseDelayMet;
764
+ },
765
+
766
+ // These are placeholder methods, to be overriden by extending plugin
767
+ _mouseStart: function(event) {},
768
+ _mouseDrag: function(event) {},
769
+ _mouseStop: function(event) {},
770
+ _mouseCapture: function(event) { return true; }
771
+ });
772
+
773
+ })(jQuery);
774
+ /*!
775
+ * jQuery UI Position 1.8.24
776
+ *
777
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
778
+ * Dual licensed under the MIT or GPL Version 2 licenses.
779
+ * http://jquery.org/license
780
+ *
781
+ * http://docs.jquery.com/UI/Position
782
+ */
783
+ (function( $, undefined ) {
784
+
785
+ $.ui = $.ui || {};
786
+
787
+ var horizontalPositions = /left|center|right/,
788
+ verticalPositions = /top|center|bottom/,
789
+ center = "center",
790
+ support = {},
791
+ _position = $.fn.position,
792
+ _offset = $.fn.offset;
793
+
794
+ $.fn.position = function( options ) {
795
+ if ( !options || !options.of ) {
796
+ return _position.apply( this, arguments );
797
+ }
798
+
799
+ // make a copy, we don't want to modify arguments
800
+ options = $.extend( {}, options );
801
+
802
+ var target = $( options.of ),
803
+ targetElem = target[0],
804
+ collision = ( options.collision || "flip" ).split( " " ),
805
+ offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
806
+ targetWidth,
807
+ targetHeight,
808
+ basePosition;
809
+
810
+ if ( targetElem.nodeType === 9 ) {
811
+ targetWidth = target.width();
812
+ targetHeight = target.height();
813
+ basePosition = { top: 0, left: 0 };
814
+ // TODO: use $.isWindow() in 1.9
815
+ } else if ( targetElem.setTimeout ) {
816
+ targetWidth = target.width();
817
+ targetHeight = target.height();
818
+ basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
819
+ } else if ( targetElem.preventDefault ) {
820
+ // force left top to allow flipping
821
+ options.at = "left top";
822
+ targetWidth = targetHeight = 0;
823
+ basePosition = { top: options.of.pageY, left: options.of.pageX };
824
+ } else {
825
+ targetWidth = target.outerWidth();
826
+ targetHeight = target.outerHeight();
827
+ basePosition = target.offset();
828
+ }
829
+
830
+ // force my and at to have valid horizontal and veritcal positions
831
+ // if a value is missing or invalid, it will be converted to center
832
+ $.each( [ "my", "at" ], function() {
833
+ var pos = ( options[this] || "" ).split( " " );
834
+ if ( pos.length === 1) {
835
+ pos = horizontalPositions.test( pos[0] ) ?
836
+ pos.concat( [center] ) :
837
+ verticalPositions.test( pos[0] ) ?
838
+ [ center ].concat( pos ) :
839
+ [ center, center ];
840
+ }
841
+ pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
842
+ pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
843
+ options[ this ] = pos;
844
+ });
845
+
846
+ // normalize collision option
847
+ if ( collision.length === 1 ) {
848
+ collision[ 1 ] = collision[ 0 ];
849
+ }
850
+
851
+ // normalize offset option
852
+ offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
853
+ if ( offset.length === 1 ) {
854
+ offset[ 1 ] = offset[ 0 ];
855
+ }
856
+ offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
857
+
858
+ if ( options.at[0] === "right" ) {
859
+ basePosition.left += targetWidth;
860
+ } else if ( options.at[0] === center ) {
861
+ basePosition.left += targetWidth / 2;
862
+ }
863
+
864
+ if ( options.at[1] === "bottom" ) {
865
+ basePosition.top += targetHeight;
866
+ } else if ( options.at[1] === center ) {
867
+ basePosition.top += targetHeight / 2;
868
+ }
869
+
870
+ basePosition.left += offset[ 0 ];
871
+ basePosition.top += offset[ 1 ];
872
+
873
+ return this.each(function() {
874
+ var elem = $( this ),
875
+ elemWidth = elem.outerWidth(),
876
+ elemHeight = elem.outerHeight(),
877
+ marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
878
+ marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
879
+ collisionWidth = elemWidth + marginLeft +
880
+ ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
881
+ collisionHeight = elemHeight + marginTop +
882
+ ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
883
+ position = $.extend( {}, basePosition ),
884
+ collisionPosition;
885
+
886
+ if ( options.my[0] === "right" ) {
887
+ position.left -= elemWidth;
888
+ } else if ( options.my[0] === center ) {
889
+ position.left -= elemWidth / 2;
890
+ }
891
+
892
+ if ( options.my[1] === "bottom" ) {
893
+ position.top -= elemHeight;
894
+ } else if ( options.my[1] === center ) {
895
+ position.top -= elemHeight / 2;
896
+ }
897
+
898
+ // prevent fractions if jQuery version doesn't support them (see #5280)
899
+ if ( !support.fractions ) {
900
+ position.left = Math.round( position.left );
901
+ position.top = Math.round( position.top );
902
+ }
903
+
904
+ collisionPosition = {
905
+ left: position.left - marginLeft,
906
+ top: position.top - marginTop
907
+ };
908
+
909
+ $.each( [ "left", "top" ], function( i, dir ) {
910
+ if ( $.ui.position[ collision[i] ] ) {
911
+ $.ui.position[ collision[i] ][ dir ]( position, {
912
+ targetWidth: targetWidth,
913
+ targetHeight: targetHeight,
914
+ elemWidth: elemWidth,
915
+ elemHeight: elemHeight,
916
+ collisionPosition: collisionPosition,
917
+ collisionWidth: collisionWidth,
918
+ collisionHeight: collisionHeight,
919
+ offset: offset,
920
+ my: options.my,
921
+ at: options.at
922
+ });
923
+ }
924
+ });
925
+
926
+ if ( $.fn.bgiframe ) {
927
+ elem.bgiframe();
928
+ }
929
+ elem.offset( $.extend( position, { using: options.using } ) );
930
+ });
931
+ };
932
+
933
+ $.ui.position = {
934
+ fit: {
935
+ left: function( position, data ) {
936
+ var win = $( window ),
937
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
938
+ position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
939
+ },
940
+ top: function( position, data ) {
941
+ var win = $( window ),
942
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
943
+ position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
944
+ }
945
+ },
946
+
947
+ flip: {
948
+ left: function( position, data ) {
949
+ if ( data.at[0] === center ) {
950
+ return;
951
+ }
952
+ var win = $( window ),
953
+ over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
954
+ myOffset = data.my[ 0 ] === "left" ?
955
+ -data.elemWidth :
956
+ data.my[ 0 ] === "right" ?
957
+ data.elemWidth :
958
+ 0,
959
+ atOffset = data.at[ 0 ] === "left" ?
960
+ data.targetWidth :
961
+ -data.targetWidth,
962
+ offset = -2 * data.offset[ 0 ];
963
+ position.left += data.collisionPosition.left < 0 ?
964
+ myOffset + atOffset + offset :
965
+ over > 0 ?
966
+ myOffset + atOffset + offset :
967
+ 0;
968
+ },
969
+ top: function( position, data ) {
970
+ if ( data.at[1] === center ) {
971
+ return;
972
+ }
973
+ var win = $( window ),
974
+ over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
975
+ myOffset = data.my[ 1 ] === "top" ?
976
+ -data.elemHeight :
977
+ data.my[ 1 ] === "bottom" ?
978
+ data.elemHeight :
979
+ 0,
980
+ atOffset = data.at[ 1 ] === "top" ?
981
+ data.targetHeight :
982
+ -data.targetHeight,
983
+ offset = -2 * data.offset[ 1 ];
984
+ position.top += data.collisionPosition.top < 0 ?
985
+ myOffset + atOffset + offset :
986
+ over > 0 ?
987
+ myOffset + atOffset + offset :
988
+ 0;
989
+ }
990
+ }
991
+ };
992
+
993
+ // offset setter from jQuery 1.4
994
+ if ( !$.offset.setOffset ) {
995
+ $.offset.setOffset = function( elem, options ) {
996
+ // set position first, in-case top/left are set even on static elem
997
+ if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
998
+ elem.style.position = "relative";
999
+ }
1000
+ var curElem = $( elem ),
1001
+ curOffset = curElem.offset(),
1002
+ curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
1003
+ curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
1004
+ props = {
1005
+ top: (options.top - curOffset.top) + curTop,
1006
+ left: (options.left - curOffset.left) + curLeft
1007
+ };
1008
+
1009
+ if ( 'using' in options ) {
1010
+ options.using.call( elem, props );
1011
+ } else {
1012
+ curElem.css( props );
1013
+ }
1014
+ };
1015
+
1016
+ $.fn.offset = function( options ) {
1017
+ var elem = this[ 0 ];
1018
+ if ( !elem || !elem.ownerDocument ) { return null; }
1019
+ if ( options ) {
1020
+ if ( $.isFunction( options ) ) {
1021
+ return this.each(function( i ) {
1022
+ $( this ).offset( options.call( this, i, $( this ).offset() ) );
1023
+ });
1024
+ }
1025
+ return this.each(function() {
1026
+ $.offset.setOffset( this, options );
1027
+ });
1028
+ }
1029
+ return _offset.call( this );
1030
+ };
1031
+ }
1032
+
1033
+ // jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
1034
+ if ( !$.curCSS ) {
1035
+ $.curCSS = $.css;
1036
+ }
1037
+
1038
+ // fraction support test (older versions of jQuery don't support fractions)
1039
+ (function () {
1040
+ var body = document.getElementsByTagName( "body" )[ 0 ],
1041
+ div = document.createElement( "div" ),
1042
+ testElement, testElementParent, testElementStyle, offset, offsetTotal;
1043
+
1044
+ //Create a "fake body" for testing based on method used in jQuery.support
1045
+ testElement = document.createElement( body ? "div" : "body" );
1046
+ testElementStyle = {
1047
+ visibility: "hidden",
1048
+ width: 0,
1049
+ height: 0,
1050
+ border: 0,
1051
+ margin: 0,
1052
+ background: "none"
1053
+ };
1054
+ if ( body ) {
1055
+ $.extend( testElementStyle, {
1056
+ position: "absolute",
1057
+ left: "-1000px",
1058
+ top: "-1000px"
1059
+ });
1060
+ }
1061
+ for ( var i in testElementStyle ) {
1062
+ testElement.style[ i ] = testElementStyle[ i ];
1063
+ }
1064
+ testElement.appendChild( div );
1065
+ testElementParent = body || document.documentElement;
1066
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
1067
+
1068
+ div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";
1069
+
1070
+ offset = $( div ).offset( function( _, offset ) {
1071
+ return offset;
1072
+ }).offset();
1073
+
1074
+ testElement.innerHTML = "";
1075
+ testElementParent.removeChild( testElement );
1076
+
1077
+ offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 );
1078
+ support.fractions = offsetTotal > 21 && offsetTotal < 22;
1079
+ })();
1080
+
1081
+ }( jQuery ));
1082
+ /*!
1083
+ * jQuery UI Draggable 1.8.24
1084
+ *
1085
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
1086
+ * Dual licensed under the MIT or GPL Version 2 licenses.
1087
+ * http://jquery.org/license
1088
+ *
1089
+ * http://docs.jquery.com/UI/Draggables
1090
+ *
1091
+ * Depends:
1092
+ * jquery.ui.core.js
1093
+ * jquery.ui.mouse.js
1094
+ * jquery.ui.widget.js
1095
+ */
1096
+ (function( $, undefined ) {
1097
+
1098
+ $.widget("ui.draggable", $.ui.mouse, {
1099
+ widgetEventPrefix: "drag",
1100
+ options: {
1101
+ addClasses: true,
1102
+ appendTo: "parent",
1103
+ axis: false,
1104
+ connectToSortable: false,
1105
+ containment: false,
1106
+ cursor: "auto",
1107
+ cursorAt: false,
1108
+ grid: false,
1109
+ handle: false,
1110
+ helper: "original",
1111
+ iframeFix: false,
1112
+ opacity: false,
1113
+ refreshPositions: false,
1114
+ revert: false,
1115
+ revertDuration: 500,
1116
+ scope: "default",
1117
+ scroll: true,
1118
+ scrollSensitivity: 20,
1119
+ scrollSpeed: 20,
1120
+ snap: false,
1121
+ snapMode: "both",
1122
+ snapTolerance: 20,
1123
+ stack: false,
1124
+ zIndex: false
1125
+ },
1126
+ _create: function() {
1127
+
1128
+ if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
1129
+ this.element[0].style.position = 'relative';
1130
+
1131
+ (this.options.addClasses && this.element.addClass("ui-draggable"));
1132
+ (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
1133
+
1134
+ this._mouseInit();
1135
+
1136
+ },
1137
+
1138
+ destroy: function() {
1139
+ if(!this.element.data('draggable')) return;
1140
+ this.element
1141
+ .removeData("draggable")
1142
+ .unbind(".draggable")
1143
+ .removeClass("ui-draggable"
1144
+ + " ui-draggable-dragging"
1145
+ + " ui-draggable-disabled");
1146
+ this._mouseDestroy();
1147
+
1148
+ return this;
1149
+ },
1150
+
1151
+ _mouseCapture: function(event) {
1152
+
1153
+ var o = this.options;
1154
+
1155
+ // among others, prevent a drag on a resizable-handle
1156
+ if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
1157
+ return false;
1158
+
1159
+ //Quit if we're not on a valid handle
1160
+ this.handle = this._getHandle(event);
1161
+ if (!this.handle)
1162
+ return false;
1163
+
1164
+ if ( o.iframeFix ) {
1165
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
1166
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
1167
+ .css({
1168
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
1169
+ position: "absolute", opacity: "0.001", zIndex: 1000
1170
+ })
1171
+ .css($(this).offset())
1172
+ .appendTo("body");
1173
+ });
1174
+ }
1175
+
1176
+ return true;
1177
+
1178
+ },
1179
+
1180
+ _mouseStart: function(event) {
1181
+
1182
+ var o = this.options;
1183
+
1184
+ //Create and append the visible helper
1185
+ this.helper = this._createHelper(event);
1186
+
1187
+ this.helper.addClass("ui-draggable-dragging");
1188
+
1189
+ //Cache the helper size
1190
+ this._cacheHelperProportions();
1191
+
1192
+ //If ddmanager is used for droppables, set the global draggable
1193
+ if($.ui.ddmanager)
1194
+ $.ui.ddmanager.current = this;
1195
+
1196
+ /*
1197
+ * - Position generation -
1198
+ * This block generates everything position related - it's the core of draggables.
1199
+ */
1200
+
1201
+ //Cache the margins of the original element
1202
+ this._cacheMargins();
1203
+
1204
+ //Store the helper's css position
1205
+ this.cssPosition = this.helper.css("position");
1206
+ this.scrollParent = this.helper.scrollParent();
1207
+
1208
+ //The element's absolute position on the page minus margins
1209
+ this.offset = this.positionAbs = this.element.offset();
1210
+ this.offset = {
1211
+ top: this.offset.top - this.margins.top,
1212
+ left: this.offset.left - this.margins.left
1213
+ };
1214
+
1215
+ $.extend(this.offset, {
1216
+ click: { //Where the click happened, relative to the element
1217
+ left: event.pageX - this.offset.left,
1218
+ top: event.pageY - this.offset.top
1219
+ },
1220
+ parent: this._getParentOffset(),
1221
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
1222
+ });
1223
+
1224
+ //Generate the original position
1225
+ this.originalPosition = this.position = this._generatePosition(event);
1226
+ this.originalPageX = event.pageX;
1227
+ this.originalPageY = event.pageY;
1228
+
1229
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
1230
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
1231
+
1232
+ //Set a containment if given in the options
1233
+ if(o.containment)
1234
+ this._setContainment();
1235
+
1236
+ //Trigger event + callbacks
1237
+ if(this._trigger("start", event) === false) {
1238
+ this._clear();
1239
+ return false;
1240
+ }
1241
+
1242
+ //Recache the helper size
1243
+ this._cacheHelperProportions();
1244
+
1245
+ //Prepare the droppable offsets
1246
+ if ($.ui.ddmanager && !o.dropBehaviour)
1247
+ $.ui.ddmanager.prepareOffsets(this, event);
1248
+
1249
+
1250
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
1251
+
1252
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
1253
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
1254
+
1255
+ return true;
1256
+ },
1257
+
1258
+ _mouseDrag: function(event, noPropagation) {
1259
+
1260
+ //Compute the helpers position
1261
+ this.position = this._generatePosition(event);
1262
+ this.positionAbs = this._convertPositionTo("absolute");
1263
+
1264
+ //Call plugins and callbacks and use the resulting position if something is returned
1265
+ if (!noPropagation) {
1266
+ var ui = this._uiHash();
1267
+ if(this._trigger('drag', event, ui) === false) {
1268
+ this._mouseUp({});
1269
+ return false;
1270
+ }
1271
+ this.position = ui.position;
1272
+ }
1273
+
1274
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
1275
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
1276
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
1277
+
1278
+ return false;
1279
+ },
1280
+
1281
+ _mouseStop: function(event) {
1282
+
1283
+ //If we are using droppables, inform the manager about the drop
1284
+ var dropped = false;
1285
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
1286
+ dropped = $.ui.ddmanager.drop(this, event);
1287
+
1288
+ //if a drop comes from outside (a sortable)
1289
+ if(this.dropped) {
1290
+ dropped = this.dropped;
1291
+ this.dropped = false;
1292
+ }
1293
+
1294
+ //if the original element is no longer in the DOM don't bother to continue (see #8269)
1295
+ var element = this.element[0], elementInDom = false;
1296
+ while ( element && (element = element.parentNode) ) {
1297
+ if (element == document ) {
1298
+ elementInDom = true;
1299
+ }
1300
+ }
1301
+ if ( !elementInDom && this.options.helper === "original" )
1302
+ return false;
1303
+
1304
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
1305
+ var self = this;
1306
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
1307
+ if(self._trigger("stop", event) !== false) {
1308
+ self._clear();
1309
+ }
1310
+ });
1311
+ } else {
1312
+ if(this._trigger("stop", event) !== false) {
1313
+ this._clear();
1314
+ }
1315
+ }
1316
+
1317
+ return false;
1318
+ },
1319
+
1320
+ _mouseUp: function(event) {
1321
+ //Remove frame helpers
1322
+ $("div.ui-draggable-iframeFix").each(function() {
1323
+ this.parentNode.removeChild(this);
1324
+ });
1325
+
1326
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
1327
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
1328
+
1329
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
1330
+ },
1331
+
1332
+ cancel: function() {
1333
+
1334
+ if(this.helper.is(".ui-draggable-dragging")) {
1335
+ this._mouseUp({});
1336
+ } else {
1337
+ this._clear();
1338
+ }
1339
+
1340
+ return this;
1341
+
1342
+ },
1343
+
1344
+ _getHandle: function(event) {
1345
+
1346
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
1347
+ $(this.options.handle, this.element)
1348
+ .find("*")
1349
+ .andSelf()
1350
+ .each(function() {
1351
+ if(this == event.target) handle = true;
1352
+ });
1353
+
1354
+ return handle;
1355
+
1356
+ },
1357
+
1358
+ _createHelper: function(event) {
1359
+
1360
+ var o = this.options;
1361
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
1362
+
1363
+ if(!helper.parents('body').length)
1364
+ helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
1365
+
1366
+ if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
1367
+ helper.css("position", "absolute");
1368
+
1369
+ return helper;
1370
+
1371
+ },
1372
+
1373
+ _adjustOffsetFromHelper: function(obj) {
1374
+ if (typeof obj == 'string') {
1375
+ obj = obj.split(' ');
1376
+ }
1377
+ if ($.isArray(obj)) {
1378
+ obj = {left: +obj[0], top: +obj[1] || 0};
1379
+ }
1380
+ if ('left' in obj) {
1381
+ this.offset.click.left = obj.left + this.margins.left;
1382
+ }
1383
+ if ('right' in obj) {
1384
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
1385
+ }
1386
+ if ('top' in obj) {
1387
+ this.offset.click.top = obj.top + this.margins.top;
1388
+ }
1389
+ if ('bottom' in obj) {
1390
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
1391
+ }
1392
+ },
1393
+
1394
+ _getParentOffset: function() {
1395
+
1396
+ //Get the offsetParent and cache its position
1397
+ this.offsetParent = this.helper.offsetParent();
1398
+ var po = this.offsetParent.offset();
1399
+
1400
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
1401
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
1402
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
1403
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
1404
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
1405
+ po.left += this.scrollParent.scrollLeft();
1406
+ po.top += this.scrollParent.scrollTop();
1407
+ }
1408
+
1409
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
1410
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
1411
+ po = { top: 0, left: 0 };
1412
+
1413
+ return {
1414
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
1415
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
1416
+ };
1417
+
1418
+ },
1419
+
1420
+ _getRelativeOffset: function() {
1421
+
1422
+ if(this.cssPosition == "relative") {
1423
+ var p = this.element.position();
1424
+ return {
1425
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
1426
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
1427
+ };
1428
+ } else {
1429
+ return { top: 0, left: 0 };
1430
+ }
1431
+
1432
+ },
1433
+
1434
+ _cacheMargins: function() {
1435
+ this.margins = {
1436
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
1437
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
1438
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
1439
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
1440
+ };
1441
+ },
1442
+
1443
+ _cacheHelperProportions: function() {
1444
+ this.helperProportions = {
1445
+ width: this.helper.outerWidth(),
1446
+ height: this.helper.outerHeight()
1447
+ };
1448
+ },
1449
+
1450
+ _setContainment: function() {
1451
+
1452
+ var o = this.options;
1453
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
1454
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
1455
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
1456
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
1457
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
1458
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
1459
+ ];
1460
+
1461
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
1462
+ var c = $(o.containment);
1463
+ var ce = c[0]; if(!ce) return;
1464
+ var co = c.offset();
1465
+ var over = ($(ce).css("overflow") != 'hidden');
1466
+
1467
+ this.containment = [
1468
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
1469
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
1470
+ (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
1471
+ (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
1472
+ ];
1473
+ this.relative_container = c;
1474
+
1475
+ } else if(o.containment.constructor == Array) {
1476
+ this.containment = o.containment;
1477
+ }
1478
+
1479
+ },
1480
+
1481
+ _convertPositionTo: function(d, pos) {
1482
+
1483
+ if(!pos) pos = this.position;
1484
+ var mod = d == "absolute" ? 1 : -1;
1485
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
1486
+
1487
+ return {
1488
+ top: (
1489
+ pos.top // The absolute mouse position
1490
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
1491
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
1492
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
1493
+ ),
1494
+ left: (
1495
+ pos.left // The absolute mouse position
1496
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
1497
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
1498
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
1499
+ )
1500
+ };
1501
+
1502
+ },
1503
+
1504
+ _generatePosition: function(event) {
1505
+
1506
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
1507
+ var pageX = event.pageX;
1508
+ var pageY = event.pageY;
1509
+
1510
+ /*
1511
+ * - Position constraining -
1512
+ * Constrain the position to a mix of grid, containment.
1513
+ */
1514
+
1515
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
1516
+ var containment;
1517
+ if(this.containment) {
1518
+ if (this.relative_container){
1519
+ var co = this.relative_container.offset();
1520
+ containment = [ this.containment[0] + co.left,
1521
+ this.containment[1] + co.top,
1522
+ this.containment[2] + co.left,
1523
+ this.containment[3] + co.top ];
1524
+ }
1525
+ else {
1526
+ containment = this.containment;
1527
+ }
1528
+
1529
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
1530
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
1531
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
1532
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
1533
+ }
1534
+
1535
+ if(o.grid) {
1536
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
1537
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
1538
+ pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
1539
+
1540
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
1541
+ pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
1542
+ }
1543
+
1544
+ }
1545
+
1546
+ return {
1547
+ top: (
1548
+ pageY // The absolute mouse position
1549
+ - this.offset.click.top // Click offset (relative to the element)
1550
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
1551
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
1552
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
1553
+ ),
1554
+ left: (
1555
+ pageX // The absolute mouse position
1556
+ - this.offset.click.left // Click offset (relative to the element)
1557
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
1558
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
1559
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
1560
+ )
1561
+ };
1562
+
1563
+ },
1564
+
1565
+ _clear: function() {
1566
+ this.helper.removeClass("ui-draggable-dragging");
1567
+ if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
1568
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
1569
+ this.helper = null;
1570
+ this.cancelHelperRemoval = false;
1571
+ },
1572
+
1573
+ // From now on bulk stuff - mainly helpers
1574
+
1575
+ _trigger: function(type, event, ui) {
1576
+ ui = ui || this._uiHash();
1577
+ $.ui.plugin.call(this, type, [event, ui]);
1578
+ if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
1579
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
1580
+ },
1581
+
1582
+ plugins: {},
1583
+
1584
+ _uiHash: function(event) {
1585
+ return {
1586
+ helper: this.helper,
1587
+ position: this.position,
1588
+ originalPosition: this.originalPosition,
1589
+ offset: this.positionAbs
1590
+ };
1591
+ }
1592
+
1593
+ });
1594
+
1595
+ $.extend($.ui.draggable, {
1596
+ version: "1.8.24"
1597
+ });
1598
+
1599
+ $.ui.plugin.add("draggable", "connectToSortable", {
1600
+ start: function(event, ui) {
1601
+
1602
+ var inst = $(this).data("draggable"), o = inst.options,
1603
+ uiSortable = $.extend({}, ui, { item: inst.element });
1604
+ inst.sortables = [];
1605
+ $(o.connectToSortable).each(function() {
1606
+ var sortable = $.data(this, 'sortable');
1607
+ if (sortable && !sortable.options.disabled) {
1608
+ inst.sortables.push({
1609
+ instance: sortable,
1610
+ shouldRevert: sortable.options.revert
1611
+ });
1612
+ sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
1613
+ sortable._trigger("activate", event, uiSortable);
1614
+ }
1615
+ });
1616
+
1617
+ },
1618
+ stop: function(event, ui) {
1619
+
1620
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
1621
+ var inst = $(this).data("draggable"),
1622
+ uiSortable = $.extend({}, ui, { item: inst.element });
1623
+
1624
+ $.each(inst.sortables, function() {
1625
+ if(this.instance.isOver) {
1626
+
1627
+ this.instance.isOver = 0;
1628
+
1629
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
1630
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
1631
+
1632
+ //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
1633
+ if(this.shouldRevert) this.instance.options.revert = true;
1634
+
1635
+ //Trigger the stop of the sortable
1636
+ this.instance._mouseStop(event);
1637
+
1638
+ this.instance.options.helper = this.instance.options._helper;
1639
+
1640
+ //If the helper has been the original item, restore properties in the sortable
1641
+ if(inst.options.helper == 'original')
1642
+ this.instance.currentItem.css({ top: 'auto', left: 'auto' });
1643
+
1644
+ } else {
1645
+ this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
1646
+ this.instance._trigger("deactivate", event, uiSortable);
1647
+ }
1648
+
1649
+ });
1650
+
1651
+ },
1652
+ drag: function(event, ui) {
1653
+
1654
+ var inst = $(this).data("draggable"), self = this;
1655
+
1656
+ var checkPos = function(o) {
1657
+ var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
1658
+ var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
1659
+ var itemHeight = o.height, itemWidth = o.width;
1660
+ var itemTop = o.top, itemLeft = o.left;
1661
+
1662
+ return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
1663
+ };
1664
+
1665
+ $.each(inst.sortables, function(i) {
1666
+
1667
+ //Copy over some variables to allow calling the sortable's native _intersectsWith
1668
+ this.instance.positionAbs = inst.positionAbs;
1669
+ this.instance.helperProportions = inst.helperProportions;
1670
+ this.instance.offset.click = inst.offset.click;
1671
+
1672
+ if(this.instance._intersectsWith(this.instance.containerCache)) {
1673
+
1674
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
1675
+ if(!this.instance.isOver) {
1676
+
1677
+ this.instance.isOver = 1;
1678
+ //Now we fake the start of dragging for the sortable instance,
1679
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
1680
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
1681
+ this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
1682
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
1683
+ this.instance.options.helper = function() { return ui.helper[0]; };
1684
+
1685
+ event.target = this.instance.currentItem[0];
1686
+ this.instance._mouseCapture(event, true);
1687
+ this.instance._mouseStart(event, true, true);
1688
+
1689
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
1690
+ this.instance.offset.click.top = inst.offset.click.top;
1691
+ this.instance.offset.click.left = inst.offset.click.left;
1692
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
1693
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
1694
+
1695
+ inst._trigger("toSortable", event);
1696
+ inst.dropped = this.instance.element; //draggable revert needs that
1697
+ //hack so receive/update callbacks work (mostly)
1698
+ inst.currentItem = inst.element;
1699
+ this.instance.fromOutside = inst;
1700
+
1701
+ }
1702
+
1703
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
1704
+ if(this.instance.currentItem) this.instance._mouseDrag(event);
1705
+
1706
+ } else {
1707
+
1708
+ //If it doesn't intersect with the sortable, and it intersected before,
1709
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
1710
+ if(this.instance.isOver) {
1711
+
1712
+ this.instance.isOver = 0;
1713
+ this.instance.cancelHelperRemoval = true;
1714
+
1715
+ //Prevent reverting on this forced stop
1716
+ this.instance.options.revert = false;
1717
+
1718
+ // The out event needs to be triggered independently
1719
+ this.instance._trigger('out', event, this.instance._uiHash(this.instance));
1720
+
1721
+ this.instance._mouseStop(event, true);
1722
+ this.instance.options.helper = this.instance.options._helper;
1723
+
1724
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
1725
+ this.instance.currentItem.remove();
1726
+ if(this.instance.placeholder) this.instance.placeholder.remove();
1727
+
1728
+ inst._trigger("fromSortable", event);
1729
+ inst.dropped = false; //draggable revert needs that
1730
+ }
1731
+
1732
+ };
1733
+
1734
+ });
1735
+
1736
+ }
1737
+ });
1738
+
1739
+ $.ui.plugin.add("draggable", "cursor", {
1740
+ start: function(event, ui) {
1741
+ var t = $('body'), o = $(this).data('draggable').options;
1742
+ if (t.css("cursor")) o._cursor = t.css("cursor");
1743
+ t.css("cursor", o.cursor);
1744
+ },
1745
+ stop: function(event, ui) {
1746
+ var o = $(this).data('draggable').options;
1747
+ if (o._cursor) $('body').css("cursor", o._cursor);
1748
+ }
1749
+ });
1750
+
1751
+ $.ui.plugin.add("draggable", "opacity", {
1752
+ start: function(event, ui) {
1753
+ var t = $(ui.helper), o = $(this).data('draggable').options;
1754
+ if(t.css("opacity")) o._opacity = t.css("opacity");
1755
+ t.css('opacity', o.opacity);
1756
+ },
1757
+ stop: function(event, ui) {
1758
+ var o = $(this).data('draggable').options;
1759
+ if(o._opacity) $(ui.helper).css('opacity', o._opacity);
1760
+ }
1761
+ });
1762
+
1763
+ $.ui.plugin.add("draggable", "scroll", {
1764
+ start: function(event, ui) {
1765
+ var i = $(this).data("draggable");
1766
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
1767
+ },
1768
+ drag: function(event, ui) {
1769
+
1770
+ var i = $(this).data("draggable"), o = i.options, scrolled = false;
1771
+
1772
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
1773
+
1774
+ if(!o.axis || o.axis != 'x') {
1775
+ if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
1776
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
1777
+ else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
1778
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
1779
+ }
1780
+
1781
+ if(!o.axis || o.axis != 'y') {
1782
+ if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
1783
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
1784
+ else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
1785
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
1786
+ }
1787
+
1788
+ } else {
1789
+
1790
+ if(!o.axis || o.axis != 'x') {
1791
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
1792
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
1793
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
1794
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
1795
+ }
1796
+
1797
+ if(!o.axis || o.axis != 'y') {
1798
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
1799
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
1800
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
1801
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
1802
+ }
1803
+
1804
+ }
1805
+
1806
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
1807
+ $.ui.ddmanager.prepareOffsets(i, event);
1808
+
1809
+ }
1810
+ });
1811
+
1812
+ $.ui.plugin.add("draggable", "snap", {
1813
+ start: function(event, ui) {
1814
+
1815
+ var i = $(this).data("draggable"), o = i.options;
1816
+ i.snapElements = [];
1817
+
1818
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
1819
+ var $t = $(this); var $o = $t.offset();
1820
+ if(this != i.element[0]) i.snapElements.push({
1821
+ item: this,
1822
+ width: $t.outerWidth(), height: $t.outerHeight(),
1823
+ top: $o.top, left: $o.left
1824
+ });
1825
+ });
1826
+
1827
+ },
1828
+ drag: function(event, ui) {
1829
+
1830
+ var inst = $(this).data("draggable"), o = inst.options;
1831
+ var d = o.snapTolerance;
1832
+
1833
+ var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
1834
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
1835
+
1836
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
1837
+
1838
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
1839
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
1840
+
1841
+ //Yes, I know, this is insane ;)
1842
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
1843
+ if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
1844
+ inst.snapElements[i].snapping = false;
1845
+ continue;
1846
+ }
1847
+
1848
+ if(o.snapMode != 'inner') {
1849
+ var ts = Math.abs(t - y2) <= d;
1850
+ var bs = Math.abs(b - y1) <= d;
1851
+ var ls = Math.abs(l - x2) <= d;
1852
+ var rs = Math.abs(r - x1) <= d;
1853
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1854
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
1855
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
1856
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
1857
+ }
1858
+
1859
+ var first = (ts || bs || ls || rs);
1860
+
1861
+ if(o.snapMode != 'outer') {
1862
+ var ts = Math.abs(t - y1) <= d;
1863
+ var bs = Math.abs(b - y2) <= d;
1864
+ var ls = Math.abs(l - x1) <= d;
1865
+ var rs = Math.abs(r - x2) <= d;
1866
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
1867
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1868
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
1869
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
1870
+ }
1871
+
1872
+ if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
1873
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
1874
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
1875
+
1876
+ };
1877
+
1878
+ }
1879
+ });
1880
+
1881
+ $.ui.plugin.add("draggable", "stack", {
1882
+ start: function(event, ui) {
1883
+
1884
+ var o = $(this).data("draggable").options;
1885
+
1886
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
1887
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
1888
+ });
1889
+ if (!group.length) { return; }
1890
+
1891
+ var min = parseInt(group[0].style.zIndex) || 0;
1892
+ $(group).each(function(i) {
1893
+ this.style.zIndex = min + i;
1894
+ });
1895
+
1896
+ this[0].style.zIndex = min + group.length;
1897
+
1898
+ }
1899
+ });
1900
+
1901
+ $.ui.plugin.add("draggable", "zIndex", {
1902
+ start: function(event, ui) {
1903
+ var t = $(ui.helper), o = $(this).data("draggable").options;
1904
+ if(t.css("zIndex")) o._zIndex = t.css("zIndex");
1905
+ t.css('zIndex', o.zIndex);
1906
+ },
1907
+ stop: function(event, ui) {
1908
+ var o = $(this).data("draggable").options;
1909
+ if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
1910
+ }
1911
+ });
1912
+
1913
+ })(jQuery);
1914
+ /*!
1915
+ * jQuery UI Droppable 1.8.24
1916
+ *
1917
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
1918
+ * Dual licensed under the MIT or GPL Version 2 licenses.
1919
+ * http://jquery.org/license
1920
+ *
1921
+ * http://docs.jquery.com/UI/Droppables
1922
+ *
1923
+ * Depends:
1924
+ * jquery.ui.core.js
1925
+ * jquery.ui.widget.js
1926
+ * jquery.ui.mouse.js
1927
+ * jquery.ui.draggable.js
1928
+ */
1929
+ (function( $, undefined ) {
1930
+
1931
+ $.widget("ui.droppable", {
1932
+ widgetEventPrefix: "drop",
1933
+ options: {
1934
+ accept: '*',
1935
+ activeClass: false,
1936
+ addClasses: true,
1937
+ greedy: false,
1938
+ hoverClass: false,
1939
+ scope: 'default',
1940
+ tolerance: 'intersect'
1941
+ },
1942
+ _create: function() {
1943
+
1944
+ var o = this.options, accept = o.accept;
1945
+ this.isover = 0; this.isout = 1;
1946
+
1947
+ this.accept = $.isFunction(accept) ? accept : function(d) {
1948
+ return d.is(accept);
1949
+ };
1950
+
1951
+ //Store the droppable's proportions
1952
+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
1953
+
1954
+ // Add the reference and positions to the manager
1955
+ $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
1956
+ $.ui.ddmanager.droppables[o.scope].push(this);
1957
+
1958
+ (o.addClasses && this.element.addClass("ui-droppable"));
1959
+
1960
+ },
1961
+
1962
+ destroy: function() {
1963
+ var drop = $.ui.ddmanager.droppables[this.options.scope];
1964
+ for ( var i = 0; i < drop.length; i++ )
1965
+ if ( drop[i] == this )
1966
+ drop.splice(i, 1);
1967
+
1968
+ this.element
1969
+ .removeClass("ui-droppable ui-droppable-disabled")
1970
+ .removeData("droppable")
1971
+ .unbind(".droppable");
1972
+
1973
+ return this;
1974
+ },
1975
+
1976
+ _setOption: function(key, value) {
1977
+
1978
+ if(key == 'accept') {
1979
+ this.accept = $.isFunction(value) ? value : function(d) {
1980
+ return d.is(value);
1981
+ };
1982
+ }
1983
+ $.Widget.prototype._setOption.apply(this, arguments);
1984
+ },
1985
+
1986
+ _activate: function(event) {
1987
+ var draggable = $.ui.ddmanager.current;
1988
+ if(this.options.activeClass) this.element.addClass(this.options.activeClass);
1989
+ (draggable && this._trigger('activate', event, this.ui(draggable)));
1990
+ },
1991
+
1992
+ _deactivate: function(event) {
1993
+ var draggable = $.ui.ddmanager.current;
1994
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
1995
+ (draggable && this._trigger('deactivate', event, this.ui(draggable)));
1996
+ },
1997
+
1998
+ _over: function(event) {
1999
+
2000
+ var draggable = $.ui.ddmanager.current;
2001
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
2002
+
2003
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
2004
+ if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
2005
+ this._trigger('over', event, this.ui(draggable));
2006
+ }
2007
+
2008
+ },
2009
+
2010
+ _out: function(event) {
2011
+
2012
+ var draggable = $.ui.ddmanager.current;
2013
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
2014
+
2015
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
2016
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
2017
+ this._trigger('out', event, this.ui(draggable));
2018
+ }
2019
+
2020
+ },
2021
+
2022
+ _drop: function(event,custom) {
2023
+
2024
+ var draggable = custom || $.ui.ddmanager.current;
2025
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
2026
+
2027
+ var childrenIntersection = false;
2028
+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
2029
+ var inst = $.data(this, 'droppable');
2030
+ if(
2031
+ inst.options.greedy
2032
+ && !inst.options.disabled
2033
+ && inst.options.scope == draggable.options.scope
2034
+ && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
2035
+ && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
2036
+ ) { childrenIntersection = true; return false; }
2037
+ });
2038
+ if(childrenIntersection) return false;
2039
+
2040
+ if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
2041
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
2042
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
2043
+ this._trigger('drop', event, this.ui(draggable));
2044
+ return this.element;
2045
+ }
2046
+
2047
+ return false;
2048
+
2049
+ },
2050
+
2051
+ ui: function(c) {
2052
+ return {
2053
+ draggable: (c.currentItem || c.element),
2054
+ helper: c.helper,
2055
+ position: c.position,
2056
+ offset: c.positionAbs
2057
+ };
2058
+ }
2059
+
2060
+ });
2061
+
2062
+ $.extend($.ui.droppable, {
2063
+ version: "1.8.24"
2064
+ });
2065
+
2066
+ $.ui.intersect = function(draggable, droppable, toleranceMode) {
2067
+
2068
+ if (!droppable.offset) return false;
2069
+
2070
+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
2071
+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
2072
+ var l = droppable.offset.left, r = l + droppable.proportions.width,
2073
+ t = droppable.offset.top, b = t + droppable.proportions.height;
2074
+
2075
+ switch (toleranceMode) {
2076
+ case 'fit':
2077
+ return (l <= x1 && x2 <= r
2078
+ && t <= y1 && y2 <= b);
2079
+ break;
2080
+ case 'intersect':
2081
+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
2082
+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
2083
+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
2084
+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
2085
+ break;
2086
+ case 'pointer':
2087
+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
2088
+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
2089
+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
2090
+ return isOver;
2091
+ break;
2092
+ case 'touch':
2093
+ return (
2094
+ (y1 >= t && y1 <= b) || // Top edge touching
2095
+ (y2 >= t && y2 <= b) || // Bottom edge touching
2096
+ (y1 < t && y2 > b) // Surrounded vertically
2097
+ ) && (
2098
+ (x1 >= l && x1 <= r) || // Left edge touching
2099
+ (x2 >= l && x2 <= r) || // Right edge touching
2100
+ (x1 < l && x2 > r) // Surrounded horizontally
2101
+ );
2102
+ break;
2103
+ default:
2104
+ return false;
2105
+ break;
2106
+ }
2107
+
2108
+ };
2109
+
2110
+ /*
2111
+ This manager tracks offsets of draggables and droppables
2112
+ */
2113
+ $.ui.ddmanager = {
2114
+ current: null,
2115
+ droppables: { 'default': [] },
2116
+ prepareOffsets: function(t, event) {
2117
+
2118
+ var m = $.ui.ddmanager.droppables[t.options.scope] || [];
2119
+ var type = event ? event.type : null; // workaround for #2317
2120
+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
2121
+
2122
+ droppablesLoop: for (var i = 0; i < m.length; i++) {
2123
+
2124
+ if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
2125
+ for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
2126
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
2127
+
2128
+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
2129
+
2130
+ m[i].offset = m[i].element.offset();
2131
+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
2132
+
2133
+ }
2134
+
2135
+ },
2136
+ drop: function(draggable, event) {
2137
+
2138
+ var dropped = false;
2139
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
2140
+
2141
+ if(!this.options) return;
2142
+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
2143
+ dropped = this._drop.call(this, event) || dropped;
2144
+
2145
+ if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
2146
+ this.isout = 1; this.isover = 0;
2147
+ this._deactivate.call(this, event);
2148
+ }
2149
+
2150
+ });
2151
+ return dropped;
2152
+
2153
+ },
2154
+ dragStart: function( draggable, event ) {
2155
+ //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
2156
+ draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() {
2157
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
2158
+ });
2159
+ },
2160
+ drag: function(draggable, event) {
2161
+
2162
+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
2163
+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
2164
+
2165
+ //Run through all droppables and check their positions based on specific tolerance options
2166
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
2167
+
2168
+ if(this.options.disabled || this.greedyChild || !this.visible) return;
2169
+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
2170
+
2171
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
2172
+ if(!c) return;
2173
+
2174
+ var parentInstance;
2175
+ if (this.options.greedy) {
2176
+ // find droppable parents with same scope
2177
+ var scope = this.options.scope;
2178
+ var parent = this.element.parents(':data(droppable)').filter(function () {
2179
+ return $.data(this, 'droppable').options.scope === scope;
2180
+ });
2181
+
2182
+ if (parent.length) {
2183
+ parentInstance = $.data(parent[0], 'droppable');
2184
+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
2185
+ }
2186
+ }
2187
+
2188
+ // we just moved into a greedy child
2189
+ if (parentInstance && c == 'isover') {
2190
+ parentInstance['isover'] = 0;
2191
+ parentInstance['isout'] = 1;
2192
+ parentInstance._out.call(parentInstance, event);
2193
+ }
2194
+
2195
+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
2196
+ this[c == "isover" ? "_over" : "_out"].call(this, event);
2197
+
2198
+ // we just moved out of a greedy child
2199
+ if (parentInstance && c == 'isout') {
2200
+ parentInstance['isout'] = 0;
2201
+ parentInstance['isover'] = 1;
2202
+ parentInstance._over.call(parentInstance, event);
2203
+ }
2204
+ });
2205
+
2206
+ },
2207
+ dragStop: function( draggable, event ) {
2208
+ draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" );
2209
+ //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
2210
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
2211
+ }
2212
+ };
2213
+
2214
+ })(jQuery);
2215
+ /*!
2216
+ * jQuery UI Resizable 1.8.24
2217
+ *
2218
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
2219
+ * Dual licensed under the MIT or GPL Version 2 licenses.
2220
+ * http://jquery.org/license
2221
+ *
2222
+ * http://docs.jquery.com/UI/Resizables
2223
+ *
2224
+ * Depends:
2225
+ * jquery.ui.core.js
2226
+ * jquery.ui.mouse.js
2227
+ * jquery.ui.widget.js
2228
+ */
2229
+ (function( $, undefined ) {
2230
+
2231
+ $.widget("ui.resizable", $.ui.mouse, {
2232
+ widgetEventPrefix: "resize",
2233
+ options: {
2234
+ alsoResize: false,
2235
+ animate: false,
2236
+ animateDuration: "slow",
2237
+ animateEasing: "swing",
2238
+ aspectRatio: false,
2239
+ autoHide: false,
2240
+ containment: false,
2241
+ ghost: false,
2242
+ grid: false,
2243
+ handles: "e,s,se",
2244
+ helper: false,
2245
+ maxHeight: null,
2246
+ maxWidth: null,
2247
+ minHeight: 10,
2248
+ minWidth: 10,
2249
+ zIndex: 1000
2250
+ },
2251
+ _create: function() {
2252
+
2253
+ var self = this, o = this.options;
2254
+ this.element.addClass("ui-resizable");
2255
+
2256
+ $.extend(this, {
2257
+ _aspectRatio: !!(o.aspectRatio),
2258
+ aspectRatio: o.aspectRatio,
2259
+ originalElement: this.element,
2260
+ _proportionallyResizeElements: [],
2261
+ _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
2262
+ });
2263
+
2264
+ //Wrap the element if it cannot hold child nodes
2265
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
2266
+
2267
+ //Create a wrapper element and set the wrapper to the new current internal element
2268
+ this.element.wrap(
2269
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
2270
+ position: this.element.css('position'),
2271
+ width: this.element.outerWidth(),
2272
+ height: this.element.outerHeight(),
2273
+ top: this.element.css('top'),
2274
+ left: this.element.css('left')
2275
+ })
2276
+ );
2277
+
2278
+ //Overwrite the original this.element
2279
+ this.element = this.element.parent().data(
2280
+ "resizable", this.element.data('resizable')
2281
+ );
2282
+
2283
+ this.elementIsWrapper = true;
2284
+
2285
+ //Move margins to the wrapper
2286
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
2287
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
2288
+
2289
+ //Prevent Safari textarea resize
2290
+ this.originalResizeStyle = this.originalElement.css('resize');
2291
+ this.originalElement.css('resize', 'none');
2292
+
2293
+ //Push the actual element to our proportionallyResize internal array
2294
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
2295
+
2296
+ // avoid IE jump (hard set the margin)
2297
+ this.originalElement.css({ margin: this.originalElement.css('margin') });
2298
+
2299
+ // fix handlers offset
2300
+ this._proportionallyResize();
2301
+
2302
+ }
2303
+
2304
+ this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
2305
+ if(this.handles.constructor == String) {
2306
+
2307
+ if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
2308
+ var n = this.handles.split(","); this.handles = {};
2309
+
2310
+ for(var i = 0; i < n.length; i++) {
2311
+
2312
+ var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
2313
+ var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
2314
+
2315
+ // Apply zIndex to all handles - see #7960
2316
+ axis.css({ zIndex: o.zIndex });
2317
+
2318
+ //TODO : What's going on here?
2319
+ if ('se' == handle) {
2320
+ axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
2321
+ };
2322
+
2323
+ //Insert into internal handles object and append to element
2324
+ this.handles[handle] = '.ui-resizable-'+handle;
2325
+ this.element.append(axis);
2326
+ }
2327
+
2328
+ }
2329
+
2330
+ this._renderAxis = function(target) {
2331
+
2332
+ target = target || this.element;
2333
+
2334
+ for(var i in this.handles) {
2335
+
2336
+ if(this.handles[i].constructor == String)
2337
+ this.handles[i] = $(this.handles[i], this.element).show();
2338
+
2339
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
2340
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
2341
+
2342
+ var axis = $(this.handles[i], this.element), padWrapper = 0;
2343
+
2344
+ //Checking the correct pad and border
2345
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
2346
+
2347
+ //The padding type i have to apply...
2348
+ var padPos = [ 'padding',
2349
+ /ne|nw|n/.test(i) ? 'Top' :
2350
+ /se|sw|s/.test(i) ? 'Bottom' :
2351
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
2352
+
2353
+ target.css(padPos, padWrapper);
2354
+
2355
+ this._proportionallyResize();
2356
+
2357
+ }
2358
+
2359
+ //TODO: What's that good for? There's not anything to be executed left
2360
+ if(!$(this.handles[i]).length)
2361
+ continue;
2362
+
2363
+ }
2364
+ };
2365
+
2366
+ //TODO: make renderAxis a prototype function
2367
+ this._renderAxis(this.element);
2368
+
2369
+ this._handles = $('.ui-resizable-handle', this.element)
2370
+ .disableSelection();
2371
+
2372
+ //Matching axis name
2373
+ this._handles.mouseover(function() {
2374
+ if (!self.resizing) {
2375
+ if (this.className)
2376
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
2377
+ //Axis, default = se
2378
+ self.axis = axis && axis[1] ? axis[1] : 'se';
2379
+ }
2380
+ });
2381
+
2382
+ //If we want to auto hide the elements
2383
+ if (o.autoHide) {
2384
+ this._handles.hide();
2385
+ $(this.element)
2386
+ .addClass("ui-resizable-autohide")
2387
+ .hover(function() {
2388
+ if (o.disabled) return;
2389
+ $(this).removeClass("ui-resizable-autohide");
2390
+ self._handles.show();
2391
+ },
2392
+ function(){
2393
+ if (o.disabled) return;
2394
+ if (!self.resizing) {
2395
+ $(this).addClass("ui-resizable-autohide");
2396
+ self._handles.hide();
2397
+ }
2398
+ });
2399
+ }
2400
+
2401
+ //Initialize the mouse interaction
2402
+ this._mouseInit();
2403
+
2404
+ },
2405
+
2406
+ destroy: function() {
2407
+
2408
+ this._mouseDestroy();
2409
+
2410
+ var _destroy = function(exp) {
2411
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
2412
+ .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
2413
+ };
2414
+
2415
+ //TODO: Unwrap at same DOM position
2416
+ if (this.elementIsWrapper) {
2417
+ _destroy(this.element);
2418
+ var wrapper = this.element;
2419
+ wrapper.after(
2420
+ this.originalElement.css({
2421
+ position: wrapper.css('position'),
2422
+ width: wrapper.outerWidth(),
2423
+ height: wrapper.outerHeight(),
2424
+ top: wrapper.css('top'),
2425
+ left: wrapper.css('left')
2426
+ })
2427
+ ).remove();
2428
+ }
2429
+
2430
+ this.originalElement.css('resize', this.originalResizeStyle);
2431
+ _destroy(this.originalElement);
2432
+
2433
+ return this;
2434
+ },
2435
+
2436
+ _mouseCapture: function(event) {
2437
+ var handle = false;
2438
+ for (var i in this.handles) {
2439
+ if ($(this.handles[i])[0] == event.target) {
2440
+ handle = true;
2441
+ }
2442
+ }
2443
+
2444
+ return !this.options.disabled && handle;
2445
+ },
2446
+
2447
+ _mouseStart: function(event) {
2448
+
2449
+ var o = this.options, iniPos = this.element.position(), el = this.element;
2450
+
2451
+ this.resizing = true;
2452
+ this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
2453
+
2454
+ // bugfix for http://dev.jquery.com/ticket/1749
2455
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
2456
+ el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
2457
+ }
2458
+
2459
+ this._renderProxy();
2460
+
2461
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
2462
+
2463
+ if (o.containment) {
2464
+ curleft += $(o.containment).scrollLeft() || 0;
2465
+ curtop += $(o.containment).scrollTop() || 0;
2466
+ }
2467
+
2468
+ //Store needed variables
2469
+ this.offset = this.helper.offset();
2470
+ this.position = { left: curleft, top: curtop };
2471
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
2472
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
2473
+ this.originalPosition = { left: curleft, top: curtop };
2474
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
2475
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
2476
+
2477
+ //Aspect Ratio
2478
+ this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
2479
+
2480
+ var cursor = $('.ui-resizable-' + this.axis).css('cursor');
2481
+ $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
2482
+
2483
+ el.addClass("ui-resizable-resizing");
2484
+ this._propagate("start", event);
2485
+ return true;
2486
+ },
2487
+
2488
+ _mouseDrag: function(event) {
2489
+
2490
+ //Increase performance, avoid regex
2491
+ var el = this.helper, o = this.options, props = {},
2492
+ self = this, smp = this.originalMousePosition, a = this.axis;
2493
+
2494
+ var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
2495
+ var trigger = this._change[a];
2496
+ if (!trigger) return false;
2497
+
2498
+ // Calculate the attrs that will be change
2499
+ var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
2500
+
2501
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
2502
+ this._updateVirtualBoundaries(event.shiftKey);
2503
+ if (this._aspectRatio || event.shiftKey)
2504
+ data = this._updateRatio(data, event);
2505
+
2506
+ data = this._respectSize(data, event);
2507
+
2508
+ // plugins callbacks need to be called first
2509
+ this._propagate("resize", event);
2510
+
2511
+ el.css({
2512
+ top: this.position.top + "px", left: this.position.left + "px",
2513
+ width: this.size.width + "px", height: this.size.height + "px"
2514
+ });
2515
+
2516
+ if (!this._helper && this._proportionallyResizeElements.length)
2517
+ this._proportionallyResize();
2518
+
2519
+ this._updateCache(data);
2520
+
2521
+ // calling the user callback at the end
2522
+ this._trigger('resize', event, this.ui());
2523
+
2524
+ return false;
2525
+ },
2526
+
2527
+ _mouseStop: function(event) {
2528
+
2529
+ this.resizing = false;
2530
+ var o = this.options, self = this;
2531
+
2532
+ if(this._helper) {
2533
+ var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
2534
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
2535
+ soffsetw = ista ? 0 : self.sizeDiff.width;
2536
+
2537
+ var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
2538
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
2539
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
2540
+
2541
+ if (!o.animate)
2542
+ this.element.css($.extend(s, { top: top, left: left }));
2543
+
2544
+ self.helper.height(self.size.height);
2545
+ self.helper.width(self.size.width);
2546
+
2547
+ if (this._helper && !o.animate) this._proportionallyResize();
2548
+ }
2549
+
2550
+ $('body').css('cursor', 'auto');
2551
+
2552
+ this.element.removeClass("ui-resizable-resizing");
2553
+
2554
+ this._propagate("stop", event);
2555
+
2556
+ if (this._helper) this.helper.remove();
2557
+ return false;
2558
+
2559
+ },
2560
+
2561
+ _updateVirtualBoundaries: function(forceAspectRatio) {
2562
+ var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
2563
+
2564
+ b = {
2565
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
2566
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
2567
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
2568
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
2569
+ };
2570
+
2571
+ if(this._aspectRatio || forceAspectRatio) {
2572
+ // We want to create an enclosing box whose aspect ration is the requested one
2573
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
2574
+ pMinWidth = b.minHeight * this.aspectRatio;
2575
+ pMinHeight = b.minWidth / this.aspectRatio;
2576
+ pMaxWidth = b.maxHeight * this.aspectRatio;
2577
+ pMaxHeight = b.maxWidth / this.aspectRatio;
2578
+
2579
+ if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
2580
+ if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
2581
+ if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
2582
+ if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
2583
+ }
2584
+ this._vBoundaries = b;
2585
+ },
2586
+
2587
+ _updateCache: function(data) {
2588
+ var o = this.options;
2589
+ this.offset = this.helper.offset();
2590
+ if (isNumber(data.left)) this.position.left = data.left;
2591
+ if (isNumber(data.top)) this.position.top = data.top;
2592
+ if (isNumber(data.height)) this.size.height = data.height;
2593
+ if (isNumber(data.width)) this.size.width = data.width;
2594
+ },
2595
+
2596
+ _updateRatio: function(data, event) {
2597
+
2598
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
2599
+
2600
+ if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
2601
+ else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
2602
+
2603
+ if (a == 'sw') {
2604
+ data.left = cpos.left + (csize.width - data.width);
2605
+ data.top = null;
2606
+ }
2607
+ if (a == 'nw') {
2608
+ data.top = cpos.top + (csize.height - data.height);
2609
+ data.left = cpos.left + (csize.width - data.width);
2610
+ }
2611
+
2612
+ return data;
2613
+ },
2614
+
2615
+ _respectSize: function(data, event) {
2616
+
2617
+ var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
2618
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
2619
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
2620
+
2621
+ if (isminw) data.width = o.minWidth;
2622
+ if (isminh) data.height = o.minHeight;
2623
+ if (ismaxw) data.width = o.maxWidth;
2624
+ if (ismaxh) data.height = o.maxHeight;
2625
+
2626
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
2627
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
2628
+
2629
+ if (isminw && cw) data.left = dw - o.minWidth;
2630
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
2631
+ if (isminh && ch) data.top = dh - o.minHeight;
2632
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
2633
+
2634
+ // fixing jump error on top/left - bug #2330
2635
+ var isNotwh = !data.width && !data.height;
2636
+ if (isNotwh && !data.left && data.top) data.top = null;
2637
+ else if (isNotwh && !data.top && data.left) data.left = null;
2638
+
2639
+ return data;
2640
+ },
2641
+
2642
+ _proportionallyResize: function() {
2643
+
2644
+ var o = this.options;
2645
+ if (!this._proportionallyResizeElements.length) return;
2646
+ var element = this.helper || this.element;
2647
+
2648
+ for (var i=0; i < this._proportionallyResizeElements.length; i++) {
2649
+
2650
+ var prel = this._proportionallyResizeElements[i];
2651
+
2652
+ if (!this.borderDif) {
2653
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
2654
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
2655
+
2656
+ this.borderDif = $.map(b, function(v, i) {
2657
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
2658
+ return border + padding;
2659
+ });
2660
+ }
2661
+
2662
+ if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
2663
+ continue;
2664
+
2665
+ prel.css({
2666
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
2667
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
2668
+ });
2669
+
2670
+ };
2671
+
2672
+ },
2673
+
2674
+ _renderProxy: function() {
2675
+
2676
+ var el = this.element, o = this.options;
2677
+ this.elementOffset = el.offset();
2678
+
2679
+ if(this._helper) {
2680
+
2681
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
2682
+
2683
+ // fix ie6 offset TODO: This seems broken
2684
+ var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
2685
+ pxyoffset = ( ie6 ? 2 : -1 );
2686
+
2687
+ this.helper.addClass(this._helper).css({
2688
+ width: this.element.outerWidth() + pxyoffset,
2689
+ height: this.element.outerHeight() + pxyoffset,
2690
+ position: 'absolute',
2691
+ left: this.elementOffset.left - ie6offset +'px',
2692
+ top: this.elementOffset.top - ie6offset +'px',
2693
+ zIndex: ++o.zIndex //TODO: Don't modify option
2694
+ });
2695
+
2696
+ this.helper
2697
+ .appendTo("body")
2698
+ .disableSelection();
2699
+
2700
+ } else {
2701
+ this.helper = this.element;
2702
+ }
2703
+
2704
+ },
2705
+
2706
+ _change: {
2707
+ e: function(event, dx, dy) {
2708
+ return { width: this.originalSize.width + dx };
2709
+ },
2710
+ w: function(event, dx, dy) {
2711
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2712
+ return { left: sp.left + dx, width: cs.width - dx };
2713
+ },
2714
+ n: function(event, dx, dy) {
2715
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2716
+ return { top: sp.top + dy, height: cs.height - dy };
2717
+ },
2718
+ s: function(event, dx, dy) {
2719
+ return { height: this.originalSize.height + dy };
2720
+ },
2721
+ se: function(event, dx, dy) {
2722
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2723
+ },
2724
+ sw: function(event, dx, dy) {
2725
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2726
+ },
2727
+ ne: function(event, dx, dy) {
2728
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2729
+ },
2730
+ nw: function(event, dx, dy) {
2731
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2732
+ }
2733
+ },
2734
+
2735
+ _propagate: function(n, event) {
2736
+ $.ui.plugin.call(this, n, [event, this.ui()]);
2737
+ (n != "resize" && this._trigger(n, event, this.ui()));
2738
+ },
2739
+
2740
+ plugins: {},
2741
+
2742
+ ui: function() {
2743
+ return {
2744
+ originalElement: this.originalElement,
2745
+ element: this.element,
2746
+ helper: this.helper,
2747
+ position: this.position,
2748
+ size: this.size,
2749
+ originalSize: this.originalSize,
2750
+ originalPosition: this.originalPosition
2751
+ };
2752
+ }
2753
+
2754
+ });
2755
+
2756
+ $.extend($.ui.resizable, {
2757
+ version: "1.8.24"
2758
+ });
2759
+
2760
+ /*
2761
+ * Resizable Extensions
2762
+ */
2763
+
2764
+ $.ui.plugin.add("resizable", "alsoResize", {
2765
+
2766
+ start: function (event, ui) {
2767
+ var self = $(this).data("resizable"), o = self.options;
2768
+
2769
+ var _store = function (exp) {
2770
+ $(exp).each(function() {
2771
+ var el = $(this);
2772
+ el.data("resizable-alsoresize", {
2773
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
2774
+ left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
2775
+ });
2776
+ });
2777
+ };
2778
+
2779
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
2780
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
2781
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
2782
+ }else{
2783
+ _store(o.alsoResize);
2784
+ }
2785
+ },
2786
+
2787
+ resize: function (event, ui) {
2788
+ var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
2789
+
2790
+ var delta = {
2791
+ height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
2792
+ top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
2793
+ },
2794
+
2795
+ _alsoResize = function (exp, c) {
2796
+ $(exp).each(function() {
2797
+ var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
2798
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
2799
+
2800
+ $.each(css, function (i, prop) {
2801
+ var sum = (start[prop]||0) + (delta[prop]||0);
2802
+ if (sum && sum >= 0)
2803
+ style[prop] = sum || null;
2804
+ });
2805
+
2806
+ el.css(style);
2807
+ });
2808
+ };
2809
+
2810
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
2811
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
2812
+ }else{
2813
+ _alsoResize(o.alsoResize);
2814
+ }
2815
+ },
2816
+
2817
+ stop: function (event, ui) {
2818
+ $(this).removeData("resizable-alsoresize");
2819
+ }
2820
+ });
2821
+
2822
+ $.ui.plugin.add("resizable", "animate", {
2823
+
2824
+ stop: function(event, ui) {
2825
+ var self = $(this).data("resizable"), o = self.options;
2826
+
2827
+ var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
2828
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
2829
+ soffsetw = ista ? 0 : self.sizeDiff.width;
2830
+
2831
+ var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
2832
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
2833
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
2834
+
2835
+ self.element.animate(
2836
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
2837
+ duration: o.animateDuration,
2838
+ easing: o.animateEasing,
2839
+ step: function() {
2840
+
2841
+ var data = {
2842
+ width: parseInt(self.element.css('width'), 10),
2843
+ height: parseInt(self.element.css('height'), 10),
2844
+ top: parseInt(self.element.css('top'), 10),
2845
+ left: parseInt(self.element.css('left'), 10)
2846
+ };
2847
+
2848
+ if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
2849
+
2850
+ // propagating resize, and updating values for each animation step
2851
+ self._updateCache(data);
2852
+ self._propagate("resize", event);
2853
+
2854
+ }
2855
+ }
2856
+ );
2857
+ }
2858
+
2859
+ });
2860
+
2861
+ $.ui.plugin.add("resizable", "containment", {
2862
+
2863
+ start: function(event, ui) {
2864
+ var self = $(this).data("resizable"), o = self.options, el = self.element;
2865
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
2866
+ if (!ce) return;
2867
+
2868
+ self.containerElement = $(ce);
2869
+
2870
+ if (/document/.test(oc) || oc == document) {
2871
+ self.containerOffset = { left: 0, top: 0 };
2872
+ self.containerPosition = { left: 0, top: 0 };
2873
+
2874
+ self.parentData = {
2875
+ element: $(document), left: 0, top: 0,
2876
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
2877
+ };
2878
+ }
2879
+
2880
+ // i'm a node, so compute top, left, right, bottom
2881
+ else {
2882
+ var element = $(ce), p = [];
2883
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
2884
+
2885
+ self.containerOffset = element.offset();
2886
+ self.containerPosition = element.position();
2887
+ self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
2888
+
2889
+ var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
2890
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
2891
+
2892
+ self.parentData = {
2893
+ element: ce, left: co.left, top: co.top, width: width, height: height
2894
+ };
2895
+ }
2896
+ },
2897
+
2898
+ resize: function(event, ui) {
2899
+ var self = $(this).data("resizable"), o = self.options,
2900
+ ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
2901
+ pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
2902
+
2903
+ if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
2904
+
2905
+ if (cp.left < (self._helper ? co.left : 0)) {
2906
+ self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
2907
+ if (pRatio) self.size.height = self.size.width / self.aspectRatio;
2908
+ self.position.left = o.helper ? co.left : 0;
2909
+ }
2910
+
2911
+ if (cp.top < (self._helper ? co.top : 0)) {
2912
+ self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
2913
+ if (pRatio) self.size.width = self.size.height * self.aspectRatio;
2914
+ self.position.top = self._helper ? co.top : 0;
2915
+ }
2916
+
2917
+ self.offset.left = self.parentData.left+self.position.left;
2918
+ self.offset.top = self.parentData.top+self.position.top;
2919
+
2920
+ var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
2921
+ hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
2922
+
2923
+ var isParent = self.containerElement.get(0) == self.element.parent().get(0),
2924
+ isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
2925
+
2926
+ if(isParent && isOffsetRelative) woset -= self.parentData.left;
2927
+
2928
+ if (woset + self.size.width >= self.parentData.width) {
2929
+ self.size.width = self.parentData.width - woset;
2930
+ if (pRatio) self.size.height = self.size.width / self.aspectRatio;
2931
+ }
2932
+
2933
+ if (hoset + self.size.height >= self.parentData.height) {
2934
+ self.size.height = self.parentData.height - hoset;
2935
+ if (pRatio) self.size.width = self.size.height * self.aspectRatio;
2936
+ }
2937
+ },
2938
+
2939
+ stop: function(event, ui){
2940
+ var self = $(this).data("resizable"), o = self.options, cp = self.position,
2941
+ co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
2942
+
2943
+ var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
2944
+
2945
+ if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
2946
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2947
+
2948
+ if (self._helper && !o.animate && (/static/).test(ce.css('position')))
2949
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2950
+
2951
+ }
2952
+ });
2953
+
2954
+ $.ui.plugin.add("resizable", "ghost", {
2955
+
2956
+ start: function(event, ui) {
2957
+
2958
+ var self = $(this).data("resizable"), o = self.options, cs = self.size;
2959
+
2960
+ self.ghost = self.originalElement.clone();
2961
+ self.ghost
2962
+ .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
2963
+ .addClass('ui-resizable-ghost')
2964
+ .addClass(typeof o.ghost == 'string' ? o.ghost : '');
2965
+
2966
+ self.ghost.appendTo(self.helper);
2967
+
2968
+ },
2969
+
2970
+ resize: function(event, ui){
2971
+ var self = $(this).data("resizable"), o = self.options;
2972
+ if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
2973
+ },
2974
+
2975
+ stop: function(event, ui){
2976
+ var self = $(this).data("resizable"), o = self.options;
2977
+ if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
2978
+ }
2979
+
2980
+ });
2981
+
2982
+ $.ui.plugin.add("resizable", "grid", {
2983
+
2984
+ resize: function(event, ui) {
2985
+ var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
2986
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
2987
+ var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
2988
+
2989
+ if (/^(se|s|e)$/.test(a)) {
2990
+ self.size.width = os.width + ox;
2991
+ self.size.height = os.height + oy;
2992
+ }
2993
+ else if (/^(ne)$/.test(a)) {
2994
+ self.size.width = os.width + ox;
2995
+ self.size.height = os.height + oy;
2996
+ self.position.top = op.top - oy;
2997
+ }
2998
+ else if (/^(sw)$/.test(a)) {
2999
+ self.size.width = os.width + ox;
3000
+ self.size.height = os.height + oy;
3001
+ self.position.left = op.left - ox;
3002
+ }
3003
+ else {
3004
+ self.size.width = os.width + ox;
3005
+ self.size.height = os.height + oy;
3006
+ self.position.top = op.top - oy;
3007
+ self.position.left = op.left - ox;
3008
+ }
3009
+ }
3010
+
3011
+ });
3012
+
3013
+ var num = function(v) {
3014
+ return parseInt(v, 10) || 0;
3015
+ };
3016
+
3017
+ var isNumber = function(value) {
3018
+ return !isNaN(parseInt(value, 10));
3019
+ };
3020
+
3021
+ })(jQuery);
3022
+ /*!
3023
+ * jQuery UI Selectable 1.8.24
3024
+ *
3025
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
3026
+ * Dual licensed under the MIT or GPL Version 2 licenses.
3027
+ * http://jquery.org/license
3028
+ *
3029
+ * http://docs.jquery.com/UI/Selectables
3030
+ *
3031
+ * Depends:
3032
+ * jquery.ui.core.js
3033
+ * jquery.ui.mouse.js
3034
+ * jquery.ui.widget.js
3035
+ */
3036
+ (function( $, undefined ) {
3037
+
3038
+ $.widget("ui.selectable", $.ui.mouse, {
3039
+ options: {
3040
+ appendTo: 'body',
3041
+ autoRefresh: true,
3042
+ distance: 0,
3043
+ filter: '*',
3044
+ tolerance: 'touch'
3045
+ },
3046
+ _create: function() {
3047
+ var self = this;
3048
+
3049
+ this.element.addClass("ui-selectable");
3050
+
3051
+ this.dragged = false;
3052
+
3053
+ // cache selectee children based on filter
3054
+ var selectees;
3055
+ this.refresh = function() {
3056
+ selectees = $(self.options.filter, self.element[0]);
3057
+ selectees.addClass("ui-selectee");
3058
+ selectees.each(function() {
3059
+ var $this = $(this);
3060
+ var pos = $this.offset();
3061
+ $.data(this, "selectable-item", {
3062
+ element: this,
3063
+ $element: $this,
3064
+ left: pos.left,
3065
+ top: pos.top,
3066
+ right: pos.left + $this.outerWidth(),
3067
+ bottom: pos.top + $this.outerHeight(),
3068
+ startselected: false,
3069
+ selected: $this.hasClass('ui-selected'),
3070
+ selecting: $this.hasClass('ui-selecting'),
3071
+ unselecting: $this.hasClass('ui-unselecting')
3072
+ });
3073
+ });
3074
+ };
3075
+ this.refresh();
3076
+
3077
+ this.selectees = selectees.addClass("ui-selectee");
3078
+
3079
+ this._mouseInit();
3080
+
3081
+ this.helper = $("<div class='ui-selectable-helper'></div>");
3082
+ },
3083
+
3084
+ destroy: function() {
3085
+ this.selectees
3086
+ .removeClass("ui-selectee")
3087
+ .removeData("selectable-item");
3088
+ this.element
3089
+ .removeClass("ui-selectable ui-selectable-disabled")
3090
+ .removeData("selectable")
3091
+ .unbind(".selectable");
3092
+ this._mouseDestroy();
3093
+
3094
+ return this;
3095
+ },
3096
+
3097
+ _mouseStart: function(event) {
3098
+ var self = this;
3099
+
3100
+ this.opos = [event.pageX, event.pageY];
3101
+
3102
+ if (this.options.disabled)
3103
+ return;
3104
+
3105
+ var options = this.options;
3106
+
3107
+ this.selectees = $(options.filter, this.element[0]);
3108
+
3109
+ this._trigger("start", event);
3110
+
3111
+ $(options.appendTo).append(this.helper);
3112
+ // position helper (lasso)
3113
+ this.helper.css({
3114
+ "left": event.clientX,
3115
+ "top": event.clientY,
3116
+ "width": 0,
3117
+ "height": 0
3118
+ });
3119
+
3120
+ if (options.autoRefresh) {
3121
+ this.refresh();
3122
+ }
3123
+
3124
+ this.selectees.filter('.ui-selected').each(function() {
3125
+ var selectee = $.data(this, "selectable-item");
3126
+ selectee.startselected = true;
3127
+ if (!event.metaKey && !event.ctrlKey) {
3128
+ selectee.$element.removeClass('ui-selected');
3129
+ selectee.selected = false;
3130
+ selectee.$element.addClass('ui-unselecting');
3131
+ selectee.unselecting = true;
3132
+ // selectable UNSELECTING callback
3133
+ self._trigger("unselecting", event, {
3134
+ unselecting: selectee.element
3135
+ });
3136
+ }
3137
+ });
3138
+
3139
+ $(event.target).parents().andSelf().each(function() {
3140
+ var selectee = $.data(this, "selectable-item");
3141
+ if (selectee) {
3142
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
3143
+ selectee.$element
3144
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
3145
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
3146
+ selectee.unselecting = !doSelect;
3147
+ selectee.selecting = doSelect;
3148
+ selectee.selected = doSelect;
3149
+ // selectable (UN)SELECTING callback
3150
+ if (doSelect) {
3151
+ self._trigger("selecting", event, {
3152
+ selecting: selectee.element
3153
+ });
3154
+ } else {
3155
+ self._trigger("unselecting", event, {
3156
+ unselecting: selectee.element
3157
+ });
3158
+ }
3159
+ return false;
3160
+ }
3161
+ });
3162
+
3163
+ },
3164
+
3165
+ _mouseDrag: function(event) {
3166
+ var self = this;
3167
+ this.dragged = true;
3168
+
3169
+ if (this.options.disabled)
3170
+ return;
3171
+
3172
+ var options = this.options;
3173
+
3174
+ var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
3175
+ if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
3176
+ if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
3177
+ this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
3178
+
3179
+ this.selectees.each(function() {
3180
+ var selectee = $.data(this, "selectable-item");
3181
+ //prevent helper from being selected if appendTo: selectable
3182
+ if (!selectee || selectee.element == self.element[0])
3183
+ return;
3184
+ var hit = false;
3185
+ if (options.tolerance == 'touch') {
3186
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
3187
+ } else if (options.tolerance == 'fit') {
3188
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
3189
+ }
3190
+
3191
+ if (hit) {
3192
+ // SELECT
3193
+ if (selectee.selected) {
3194
+ selectee.$element.removeClass('ui-selected');
3195
+ selectee.selected = false;
3196
+ }
3197
+ if (selectee.unselecting) {
3198
+ selectee.$element.removeClass('ui-unselecting');
3199
+ selectee.unselecting = false;
3200
+ }
3201
+ if (!selectee.selecting) {
3202
+ selectee.$element.addClass('ui-selecting');
3203
+ selectee.selecting = true;
3204
+ // selectable SELECTING callback
3205
+ self._trigger("selecting", event, {
3206
+ selecting: selectee.element
3207
+ });
3208
+ }
3209
+ } else {
3210
+ // UNSELECT
3211
+ if (selectee.selecting) {
3212
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
3213
+ selectee.$element.removeClass('ui-selecting');
3214
+ selectee.selecting = false;
3215
+ selectee.$element.addClass('ui-selected');
3216
+ selectee.selected = true;
3217
+ } else {
3218
+ selectee.$element.removeClass('ui-selecting');
3219
+ selectee.selecting = false;
3220
+ if (selectee.startselected) {
3221
+ selectee.$element.addClass('ui-unselecting');
3222
+ selectee.unselecting = true;
3223
+ }
3224
+ // selectable UNSELECTING callback
3225
+ self._trigger("unselecting", event, {
3226
+ unselecting: selectee.element
3227
+ });
3228
+ }
3229
+ }
3230
+ if (selectee.selected) {
3231
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
3232
+ selectee.$element.removeClass('ui-selected');
3233
+ selectee.selected = false;
3234
+
3235
+ selectee.$element.addClass('ui-unselecting');
3236
+ selectee.unselecting = true;
3237
+ // selectable UNSELECTING callback
3238
+ self._trigger("unselecting", event, {
3239
+ unselecting: selectee.element
3240
+ });
3241
+ }
3242
+ }
3243
+ }
3244
+ });
3245
+
3246
+ return false;
3247
+ },
3248
+
3249
+ _mouseStop: function(event) {
3250
+ var self = this;
3251
+
3252
+ this.dragged = false;
3253
+
3254
+ var options = this.options;
3255
+
3256
+ $('.ui-unselecting', this.element[0]).each(function() {
3257
+ var selectee = $.data(this, "selectable-item");
3258
+ selectee.$element.removeClass('ui-unselecting');
3259
+ selectee.unselecting = false;
3260
+ selectee.startselected = false;
3261
+ self._trigger("unselected", event, {
3262
+ unselected: selectee.element
3263
+ });
3264
+ });
3265
+ $('.ui-selecting', this.element[0]).each(function() {
3266
+ var selectee = $.data(this, "selectable-item");
3267
+ selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
3268
+ selectee.selecting = false;
3269
+ selectee.selected = true;
3270
+ selectee.startselected = true;
3271
+ self._trigger("selected", event, {
3272
+ selected: selectee.element
3273
+ });
3274
+ });
3275
+ this._trigger("stop", event);
3276
+
3277
+ this.helper.remove();
3278
+
3279
+ return false;
3280
+ }
3281
+
3282
+ });
3283
+
3284
+ $.extend($.ui.selectable, {
3285
+ version: "1.8.24"
3286
+ });
3287
+
3288
+ })(jQuery);
3289
+ /*!
3290
+ * jQuery UI Sortable 1.8.24
3291
+ *
3292
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
3293
+ * Dual licensed under the MIT or GPL Version 2 licenses.
3294
+ * http://jquery.org/license
3295
+ *
3296
+ * http://docs.jquery.com/UI/Sortables
3297
+ *
3298
+ * Depends:
3299
+ * jquery.ui.core.js
3300
+ * jquery.ui.mouse.js
3301
+ * jquery.ui.widget.js
3302
+ */
3303
+ (function( $, undefined ) {
3304
+
3305
+ $.widget("ui.sortable", $.ui.mouse, {
3306
+ widgetEventPrefix: "sort",
3307
+ ready: false,
3308
+ options: {
3309
+ appendTo: "parent",
3310
+ axis: false,
3311
+ connectWith: false,
3312
+ containment: false,
3313
+ cursor: 'auto',
3314
+ cursorAt: false,
3315
+ dropOnEmpty: true,
3316
+ forcePlaceholderSize: false,
3317
+ forceHelperSize: false,
3318
+ grid: false,
3319
+ handle: false,
3320
+ helper: "original",
3321
+ items: '> *',
3322
+ opacity: false,
3323
+ placeholder: false,
3324
+ revert: false,
3325
+ scroll: true,
3326
+ scrollSensitivity: 20,
3327
+ scrollSpeed: 20,
3328
+ scope: "default",
3329
+ tolerance: "intersect",
3330
+ zIndex: 1000
3331
+ },
3332
+ _create: function() {
3333
+
3334
+ var o = this.options;
3335
+ this.containerCache = {};
3336
+ this.element.addClass("ui-sortable");
3337
+
3338
+ //Get the items
3339
+ this.refresh();
3340
+
3341
+ //Let's determine if the items are being displayed horizontally
3342
+ this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
3343
+
3344
+ //Let's determine the parent's offset
3345
+ this.offset = this.element.offset();
3346
+
3347
+ //Initialize mouse events for interaction
3348
+ this._mouseInit();
3349
+
3350
+ //We're ready to go
3351
+ this.ready = true
3352
+
3353
+ },
3354
+
3355
+ destroy: function() {
3356
+ $.Widget.prototype.destroy.call( this );
3357
+ this.element
3358
+ .removeClass("ui-sortable ui-sortable-disabled");
3359
+ this._mouseDestroy();
3360
+
3361
+ for ( var i = this.items.length - 1; i >= 0; i-- )
3362
+ this.items[i].item.removeData(this.widgetName + "-item");
3363
+
3364
+ return this;
3365
+ },
3366
+
3367
+ _setOption: function(key, value){
3368
+ if ( key === "disabled" ) {
3369
+ this.options[ key ] = value;
3370
+
3371
+ this.widget()
3372
+ [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
3373
+ } else {
3374
+ // Don't call widget base _setOption for disable as it adds ui-state-disabled class
3375
+ $.Widget.prototype._setOption.apply(this, arguments);
3376
+ }
3377
+ },
3378
+
3379
+ _mouseCapture: function(event, overrideHandle) {
3380
+ var that = this;
3381
+
3382
+ if (this.reverting) {
3383
+ return false;
3384
+ }
3385
+
3386
+ if(this.options.disabled || this.options.type == 'static') return false;
3387
+
3388
+ //We have to refresh the items data once first
3389
+ this._refreshItems(event);
3390
+
3391
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
3392
+ var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
3393
+ if($.data(this, that.widgetName + '-item') == self) {
3394
+ currentItem = $(this);
3395
+ return false;
3396
+ }
3397
+ });
3398
+ if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);
3399
+
3400
+ if(!currentItem) return false;
3401
+ if(this.options.handle && !overrideHandle) {
3402
+ var validHandle = false;
3403
+
3404
+ $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
3405
+ if(!validHandle) return false;
3406
+ }
3407
+
3408
+ this.currentItem = currentItem;
3409
+ this._removeCurrentsFromItems();
3410
+ return true;
3411
+
3412
+ },
3413
+
3414
+ _mouseStart: function(event, overrideHandle, noActivation) {
3415
+
3416
+ var o = this.options, self = this;
3417
+ this.currentContainer = this;
3418
+
3419
+ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
3420
+ this.refreshPositions();
3421
+
3422
+ //Create and append the visible helper
3423
+ this.helper = this._createHelper(event);
3424
+
3425
+ //Cache the helper size
3426
+ this._cacheHelperProportions();
3427
+
3428
+ /*
3429
+ * - Position generation -
3430
+ * This block generates everything position related - it's the core of draggables.
3431
+ */
3432
+
3433
+ //Cache the margins of the original element
3434
+ this._cacheMargins();
3435
+
3436
+ //Get the next scrolling parent
3437
+ this.scrollParent = this.helper.scrollParent();
3438
+
3439
+ //The element's absolute position on the page minus margins
3440
+ this.offset = this.currentItem.offset();
3441
+ this.offset = {
3442
+ top: this.offset.top - this.margins.top,
3443
+ left: this.offset.left - this.margins.left
3444
+ };
3445
+
3446
+ $.extend(this.offset, {
3447
+ click: { //Where the click happened, relative to the element
3448
+ left: event.pageX - this.offset.left,
3449
+ top: event.pageY - this.offset.top
3450
+ },
3451
+ parent: this._getParentOffset(),
3452
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
3453
+ });
3454
+
3455
+ // Only after we got the offset, we can change the helper's position to absolute
3456
+ // TODO: Still need to figure out a way to make relative sorting possible
3457
+ this.helper.css("position", "absolute");
3458
+ this.cssPosition = this.helper.css("position");
3459
+
3460
+ //Generate the original position
3461
+ this.originalPosition = this._generatePosition(event);
3462
+ this.originalPageX = event.pageX;
3463
+ this.originalPageY = event.pageY;
3464
+
3465
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
3466
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
3467
+
3468
+ //Cache the former DOM position
3469
+ this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
3470
+
3471
+ //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
3472
+ if(this.helper[0] != this.currentItem[0]) {
3473
+ this.currentItem.hide();
3474
+ }
3475
+
3476
+ //Create the placeholder
3477
+ this._createPlaceholder();
3478
+
3479
+ //Set a containment if given in the options
3480
+ if(o.containment)
3481
+ this._setContainment();
3482
+
3483
+ if(o.cursor) { // cursor option
3484
+ if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
3485
+ $('body').css("cursor", o.cursor);
3486
+ }
3487
+
3488
+ if(o.opacity) { // opacity option
3489
+ if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
3490
+ this.helper.css("opacity", o.opacity);
3491
+ }
3492
+
3493
+ if(o.zIndex) { // zIndex option
3494
+ if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
3495
+ this.helper.css("zIndex", o.zIndex);
3496
+ }
3497
+
3498
+ //Prepare scrolling
3499
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
3500
+ this.overflowOffset = this.scrollParent.offset();
3501
+
3502
+ //Call callbacks
3503
+ this._trigger("start", event, this._uiHash());
3504
+
3505
+ //Recache the helper size
3506
+ if(!this._preserveHelperProportions)
3507
+ this._cacheHelperProportions();
3508
+
3509
+
3510
+ //Post 'activate' events to possible containers
3511
+ if(!noActivation) {
3512
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
3513
+ }
3514
+
3515
+ //Prepare possible droppables
3516
+ if($.ui.ddmanager)
3517
+ $.ui.ddmanager.current = this;
3518
+
3519
+ if ($.ui.ddmanager && !o.dropBehaviour)
3520
+ $.ui.ddmanager.prepareOffsets(this, event);
3521
+
3522
+ this.dragging = true;
3523
+
3524
+ this.helper.addClass("ui-sortable-helper");
3525
+ this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
3526
+ return true;
3527
+
3528
+ },
3529
+
3530
+ _mouseDrag: function(event) {
3531
+
3532
+ //Compute the helpers position
3533
+ this.position = this._generatePosition(event);
3534
+ this.positionAbs = this._convertPositionTo("absolute");
3535
+
3536
+ if (!this.lastPositionAbs) {
3537
+ this.lastPositionAbs = this.positionAbs;
3538
+ }
3539
+
3540
+ //Do scrolling
3541
+ if(this.options.scroll) {
3542
+ var o = this.options, scrolled = false;
3543
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
3544
+
3545
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
3546
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
3547
+ else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
3548
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
3549
+
3550
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
3551
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
3552
+ else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
3553
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
3554
+
3555
+ } else {
3556
+
3557
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
3558
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
3559
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
3560
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
3561
+
3562
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
3563
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
3564
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
3565
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
3566
+
3567
+ }
3568
+
3569
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
3570
+ $.ui.ddmanager.prepareOffsets(this, event);
3571
+ }
3572
+
3573
+ //Regenerate the absolute position used for position checks
3574
+ this.positionAbs = this._convertPositionTo("absolute");
3575
+
3576
+ //Set the helper position
3577
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
3578
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
3579
+
3580
+ //Rearrange
3581
+ for (var i = this.items.length - 1; i >= 0; i--) {
3582
+
3583
+ //Cache variables and intersection, continue if no intersection
3584
+ var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
3585
+ if (!intersection) continue;
3586
+
3587
+ // Only put the placeholder inside the current Container, skip all
3588
+ // items form other containers. This works because when moving
3589
+ // an item from one container to another the
3590
+ // currentContainer is switched before the placeholder is moved.
3591
+ //
3592
+ // Without this moving items in "sub-sortables" can cause the placeholder to jitter
3593
+ // beetween the outer and inner container.
3594
+ if (item.instance !== this.currentContainer) continue;
3595
+
3596
+ if (itemElement != this.currentItem[0] //cannot intersect with itself
3597
+ && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
3598
+ && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
3599
+ && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
3600
+ //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
3601
+ ) {
3602
+
3603
+ this.direction = intersection == 1 ? "down" : "up";
3604
+
3605
+ if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
3606
+ this._rearrange(event, item);
3607
+ } else {
3608
+ break;
3609
+ }
3610
+
3611
+ this._trigger("change", event, this._uiHash());
3612
+ break;
3613
+ }
3614
+ }
3615
+
3616
+ //Post events to containers
3617
+ this._contactContainers(event);
3618
+
3619
+ //Interconnect with droppables
3620
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
3621
+
3622
+ //Call callbacks
3623
+ this._trigger('sort', event, this._uiHash());
3624
+
3625
+ this.lastPositionAbs = this.positionAbs;
3626
+ return false;
3627
+
3628
+ },
3629
+
3630
+ _mouseStop: function(event, noPropagation) {
3631
+
3632
+ if(!event) return;
3633
+
3634
+ //If we are using droppables, inform the manager about the drop
3635
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
3636
+ $.ui.ddmanager.drop(this, event);
3637
+
3638
+ if(this.options.revert) {
3639
+ var self = this;
3640
+ var cur = self.placeholder.offset();
3641
+
3642
+ self.reverting = true;
3643
+
3644
+ $(this.helper).animate({
3645
+ left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
3646
+ top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
3647
+ }, parseInt(this.options.revert, 10) || 500, function() {
3648
+ self._clear(event);
3649
+ });
3650
+ } else {
3651
+ this._clear(event, noPropagation);
3652
+ }
3653
+
3654
+ return false;
3655
+
3656
+ },
3657
+
3658
+ cancel: function() {
3659
+
3660
+ var self = this;
3661
+
3662
+ if(this.dragging) {
3663
+
3664
+ this._mouseUp({ target: null });
3665
+
3666
+ if(this.options.helper == "original")
3667
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
3668
+ else
3669
+ this.currentItem.show();
3670
+
3671
+ //Post deactivating events to containers
3672
+ for (var i = this.containers.length - 1; i >= 0; i--){
3673
+ this.containers[i]._trigger("deactivate", null, self._uiHash(this));
3674
+ if(this.containers[i].containerCache.over) {
3675
+ this.containers[i]._trigger("out", null, self._uiHash(this));
3676
+ this.containers[i].containerCache.over = 0;
3677
+ }
3678
+ }
3679
+
3680
+ }
3681
+
3682
+ if (this.placeholder) {
3683
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
3684
+ if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
3685
+ if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
3686
+
3687
+ $.extend(this, {
3688
+ helper: null,
3689
+ dragging: false,
3690
+ reverting: false,
3691
+ _noFinalSort: null
3692
+ });
3693
+
3694
+ if(this.domPosition.prev) {
3695
+ $(this.domPosition.prev).after(this.currentItem);
3696
+ } else {
3697
+ $(this.domPosition.parent).prepend(this.currentItem);
3698
+ }
3699
+ }
3700
+
3701
+ return this;
3702
+
3703
+ },
3704
+
3705
+ serialize: function(o) {
3706
+
3707
+ var items = this._getItemsAsjQuery(o && o.connected);
3708
+ var str = []; o = o || {};
3709
+
3710
+ $(items).each(function() {
3711
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
3712
+ if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
3713
+ });
3714
+
3715
+ if(!str.length && o.key) {
3716
+ str.push(o.key + '=');
3717
+ }
3718
+
3719
+ return str.join('&');
3720
+
3721
+ },
3722
+
3723
+ toArray: function(o) {
3724
+
3725
+ var items = this._getItemsAsjQuery(o && o.connected);
3726
+ var ret = []; o = o || {};
3727
+
3728
+ items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
3729
+ return ret;
3730
+
3731
+ },
3732
+
3733
+ /* Be careful with the following core functions */
3734
+ _intersectsWith: function(item) {
3735
+
3736
+ var x1 = this.positionAbs.left,
3737
+ x2 = x1 + this.helperProportions.width,
3738
+ y1 = this.positionAbs.top,
3739
+ y2 = y1 + this.helperProportions.height;
3740
+
3741
+ var l = item.left,
3742
+ r = l + item.width,
3743
+ t = item.top,
3744
+ b = t + item.height;
3745
+
3746
+ var dyClick = this.offset.click.top,
3747
+ dxClick = this.offset.click.left;
3748
+
3749
+ var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
3750
+
3751
+ if( this.options.tolerance == "pointer"
3752
+ || this.options.forcePointerForContainers
3753
+ || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
3754
+ ) {
3755
+ return isOverElement;
3756
+ } else {
3757
+
3758
+ return (l < x1 + (this.helperProportions.width / 2) // Right Half
3759
+ && x2 - (this.helperProportions.width / 2) < r // Left Half
3760
+ && t < y1 + (this.helperProportions.height / 2) // Bottom Half
3761
+ && y2 - (this.helperProportions.height / 2) < b ); // Top Half
3762
+
3763
+ }
3764
+ },
3765
+
3766
+ _intersectsWithPointer: function(item) {
3767
+
3768
+ var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
3769
+ isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
3770
+ isOverElement = isOverElementHeight && isOverElementWidth,
3771
+ verticalDirection = this._getDragVerticalDirection(),
3772
+ horizontalDirection = this._getDragHorizontalDirection();
3773
+
3774
+ if (!isOverElement)
3775
+ return false;
3776
+
3777
+ return this.floating ?
3778
+ ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
3779
+ : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
3780
+
3781
+ },
3782
+
3783
+ _intersectsWithSides: function(item) {
3784
+
3785
+ var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
3786
+ isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
3787
+ verticalDirection = this._getDragVerticalDirection(),
3788
+ horizontalDirection = this._getDragHorizontalDirection();
3789
+
3790
+ if (this.floating && horizontalDirection) {
3791
+ return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
3792
+ } else {
3793
+ return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
3794
+ }
3795
+
3796
+ },
3797
+
3798
+ _getDragVerticalDirection: function() {
3799
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
3800
+ return delta != 0 && (delta > 0 ? "down" : "up");
3801
+ },
3802
+
3803
+ _getDragHorizontalDirection: function() {
3804
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
3805
+ return delta != 0 && (delta > 0 ? "right" : "left");
3806
+ },
3807
+
3808
+ refresh: function(event) {
3809
+ this._refreshItems(event);
3810
+ this.refreshPositions();
3811
+ return this;
3812
+ },
3813
+
3814
+ _connectWith: function() {
3815
+ var options = this.options;
3816
+ return options.connectWith.constructor == String
3817
+ ? [options.connectWith]
3818
+ : options.connectWith;
3819
+ },
3820
+
3821
+ _getItemsAsjQuery: function(connected) {
3822
+
3823
+ var self = this;
3824
+ var items = [];
3825
+ var queries = [];
3826
+ var connectWith = this._connectWith();
3827
+
3828
+ if(connectWith && connected) {
3829
+ for (var i = connectWith.length - 1; i >= 0; i--){
3830
+ var cur = $(connectWith[i]);
3831
+ for (var j = cur.length - 1; j >= 0; j--){
3832
+ var inst = $.data(cur[j], this.widgetName);
3833
+ if(inst && inst != this && !inst.options.disabled) {
3834
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
3835
+ }
3836
+ };
3837
+ };
3838
+ }
3839
+
3840
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
3841
+
3842
+ for (var i = queries.length - 1; i >= 0; i--){
3843
+ queries[i][0].each(function() {
3844
+ items.push(this);
3845
+ });
3846
+ };
3847
+
3848
+ return $(items);
3849
+
3850
+ },
3851
+
3852
+ _removeCurrentsFromItems: function() {
3853
+
3854
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
3855
+
3856
+ for (var i=0; i < this.items.length; i++) {
3857
+
3858
+ for (var j=0; j < list.length; j++) {
3859
+ if(list[j] == this.items[i].item[0])
3860
+ this.items.splice(i,1);
3861
+ };
3862
+
3863
+ };
3864
+
3865
+ },
3866
+
3867
+ _refreshItems: function(event) {
3868
+
3869
+ this.items = [];
3870
+ this.containers = [this];
3871
+ var items = this.items;
3872
+ var self = this;
3873
+ var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
3874
+ var connectWith = this._connectWith();
3875
+
3876
+ if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
3877
+ for (var i = connectWith.length - 1; i >= 0; i--){
3878
+ var cur = $(connectWith[i]);
3879
+ for (var j = cur.length - 1; j >= 0; j--){
3880
+ var inst = $.data(cur[j], this.widgetName);
3881
+ if(inst && inst != this && !inst.options.disabled) {
3882
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
3883
+ this.containers.push(inst);
3884
+ }
3885
+ };
3886
+ };
3887
+ }
3888
+
3889
+ for (var i = queries.length - 1; i >= 0; i--) {
3890
+ var targetData = queries[i][1];
3891
+ var _queries = queries[i][0];
3892
+
3893
+ for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
3894
+ var item = $(_queries[j]);
3895
+
3896
+ item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
3897
+
3898
+ items.push({
3899
+ item: item,
3900
+ instance: targetData,
3901
+ width: 0, height: 0,
3902
+ left: 0, top: 0
3903
+ });
3904
+ };
3905
+ };
3906
+
3907
+ },
3908
+
3909
+ refreshPositions: function(fast) {
3910
+
3911
+ //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
3912
+ if(this.offsetParent && this.helper) {
3913
+ this.offset.parent = this._getParentOffset();
3914
+ }
3915
+
3916
+ for (var i = this.items.length - 1; i >= 0; i--){
3917
+ var item = this.items[i];
3918
+
3919
+ //We ignore calculating positions of all connected containers when we're not over them
3920
+ if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
3921
+ continue;
3922
+
3923
+ var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
3924
+
3925
+ if (!fast) {
3926
+ item.width = t.outerWidth();
3927
+ item.height = t.outerHeight();
3928
+ }
3929
+
3930
+ var p = t.offset();
3931
+ item.left = p.left;
3932
+ item.top = p.top;
3933
+ };
3934
+
3935
+ if(this.options.custom && this.options.custom.refreshContainers) {
3936
+ this.options.custom.refreshContainers.call(this);
3937
+ } else {
3938
+ for (var i = this.containers.length - 1; i >= 0; i--){
3939
+ var p = this.containers[i].element.offset();
3940
+ this.containers[i].containerCache.left = p.left;
3941
+ this.containers[i].containerCache.top = p.top;
3942
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
3943
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
3944
+ };
3945
+ }
3946
+
3947
+ return this;
3948
+ },
3949
+
3950
+ _createPlaceholder: function(that) {
3951
+
3952
+ var self = that || this, o = self.options;
3953
+
3954
+ if(!o.placeholder || o.placeholder.constructor == String) {
3955
+ var className = o.placeholder;
3956
+ o.placeholder = {
3957
+ element: function() {
3958
+
3959
+ var el = $(document.createElement(self.currentItem[0].nodeName))
3960
+ .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
3961
+ .removeClass("ui-sortable-helper")[0];
3962
+
3963
+ if(!className)
3964
+ el.style.visibility = "hidden";
3965
+
3966
+ return el;
3967
+ },
3968
+ update: function(container, p) {
3969
+
3970
+ // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
3971
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
3972
+ if(className && !o.forcePlaceholderSize) return;
3973
+
3974
+ //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
3975
+ if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
3976
+ if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
3977
+ }
3978
+ };
3979
+ }
3980
+
3981
+ //Create the placeholder
3982
+ self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
3983
+
3984
+ //Append it after the actual current item
3985
+ self.currentItem.after(self.placeholder);
3986
+
3987
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
3988
+ o.placeholder.update(self, self.placeholder);
3989
+
3990
+ },
3991
+
3992
+ _contactContainers: function(event) {
3993
+
3994
+ // get innermost container that intersects with item
3995
+ var innermostContainer = null, innermostIndex = null;
3996
+
3997
+
3998
+ for (var i = this.containers.length - 1; i >= 0; i--){
3999
+
4000
+ // never consider a container that's located within the item itself
4001
+ if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
4002
+ continue;
4003
+
4004
+ if(this._intersectsWith(this.containers[i].containerCache)) {
4005
+
4006
+ // if we've already found a container and it's more "inner" than this, then continue
4007
+ if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
4008
+ continue;
4009
+
4010
+ innermostContainer = this.containers[i];
4011
+ innermostIndex = i;
4012
+
4013
+ } else {
4014
+ // container doesn't intersect. trigger "out" event if necessary
4015
+ if(this.containers[i].containerCache.over) {
4016
+ this.containers[i]._trigger("out", event, this._uiHash(this));
4017
+ this.containers[i].containerCache.over = 0;
4018
+ }
4019
+ }
4020
+
4021
+ }
4022
+
4023
+ // if no intersecting containers found, return
4024
+ if(!innermostContainer) return;
4025
+
4026
+ // move the item into the container if it's not there already
4027
+ if(this.containers.length === 1) {
4028
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
4029
+ this.containers[innermostIndex].containerCache.over = 1;
4030
+ } else if(this.currentContainer != this.containers[innermostIndex]) {
4031
+
4032
+ //When entering a new container, we will find the item with the least distance and append our item near it
4033
+ var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
4034
+ for (var j = this.items.length - 1; j >= 0; j--) {
4035
+ if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
4036
+ var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
4037
+ if(Math.abs(cur - base) < dist) {
4038
+ dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
4039
+ this.direction = (cur - base > 0) ? 'down' : 'up';
4040
+ }
4041
+ }
4042
+
4043
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
4044
+ return;
4045
+
4046
+ this.currentContainer = this.containers[innermostIndex];
4047
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
4048
+ this._trigger("change", event, this._uiHash());
4049
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
4050
+
4051
+ //Update the placeholder
4052
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
4053
+
4054
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
4055
+ this.containers[innermostIndex].containerCache.over = 1;
4056
+ }
4057
+
4058
+
4059
+ },
4060
+
4061
+ _createHelper: function(event) {
4062
+
4063
+ var o = this.options;
4064
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
4065
+
4066
+ if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
4067
+ $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
4068
+
4069
+ if(helper[0] == this.currentItem[0])
4070
+ this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
4071
+
4072
+ if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
4073
+ if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
4074
+
4075
+ return helper;
4076
+
4077
+ },
4078
+
4079
+ _adjustOffsetFromHelper: function(obj) {
4080
+ if (typeof obj == 'string') {
4081
+ obj = obj.split(' ');
4082
+ }
4083
+ if ($.isArray(obj)) {
4084
+ obj = {left: +obj[0], top: +obj[1] || 0};
4085
+ }
4086
+ if ('left' in obj) {
4087
+ this.offset.click.left = obj.left + this.margins.left;
4088
+ }
4089
+ if ('right' in obj) {
4090
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
4091
+ }
4092
+ if ('top' in obj) {
4093
+ this.offset.click.top = obj.top + this.margins.top;
4094
+ }
4095
+ if ('bottom' in obj) {
4096
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
4097
+ }
4098
+ },
4099
+
4100
+ _getParentOffset: function() {
4101
+
4102
+
4103
+ //Get the offsetParent and cache its position
4104
+ this.offsetParent = this.helper.offsetParent();
4105
+ var po = this.offsetParent.offset();
4106
+
4107
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
4108
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
4109
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
4110
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
4111
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
4112
+ po.left += this.scrollParent.scrollLeft();
4113
+ po.top += this.scrollParent.scrollTop();
4114
+ }
4115
+
4116
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
4117
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
4118
+ po = { top: 0, left: 0 };
4119
+
4120
+ return {
4121
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
4122
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
4123
+ };
4124
+
4125
+ },
4126
+
4127
+ _getRelativeOffset: function() {
4128
+
4129
+ if(this.cssPosition == "relative") {
4130
+ var p = this.currentItem.position();
4131
+ return {
4132
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
4133
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
4134
+ };
4135
+ } else {
4136
+ return { top: 0, left: 0 };
4137
+ }
4138
+
4139
+ },
4140
+
4141
+ _cacheMargins: function() {
4142
+ this.margins = {
4143
+ left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
4144
+ top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
4145
+ };
4146
+ },
4147
+
4148
+ _cacheHelperProportions: function() {
4149
+ this.helperProportions = {
4150
+ width: this.helper.outerWidth(),
4151
+ height: this.helper.outerHeight()
4152
+ };
4153
+ },
4154
+
4155
+ _setContainment: function() {
4156
+
4157
+ var o = this.options;
4158
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
4159
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
4160
+ 0 - this.offset.relative.left - this.offset.parent.left,
4161
+ 0 - this.offset.relative.top - this.offset.parent.top,
4162
+ $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
4163
+ ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
4164
+ ];
4165
+
4166
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
4167
+ var ce = $(o.containment)[0];
4168
+ var co = $(o.containment).offset();
4169
+ var over = ($(ce).css("overflow") != 'hidden');
4170
+
4171
+ this.containment = [
4172
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
4173
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
4174
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
4175
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
4176
+ ];
4177
+ }
4178
+
4179
+ },
4180
+
4181
+ _convertPositionTo: function(d, pos) {
4182
+
4183
+ if(!pos) pos = this.position;
4184
+ var mod = d == "absolute" ? 1 : -1;
4185
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
4186
+
4187
+ return {
4188
+ top: (
4189
+ pos.top // The absolute mouse position
4190
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
4191
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
4192
+ - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
4193
+ ),
4194
+ left: (
4195
+ pos.left // The absolute mouse position
4196
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
4197
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
4198
+ - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
4199
+ )
4200
+ };
4201
+
4202
+ },
4203
+
4204
+ _generatePosition: function(event) {
4205
+
4206
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
4207
+
4208
+ // This is another very weird special case that only happens for relative elements:
4209
+ // 1. If the css position is relative
4210
+ // 2. and the scroll parent is the document or similar to the offset parent
4211
+ // we have to refresh the relative offset during the scroll so there are no jumps
4212
+ if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
4213
+ this.offset.relative = this._getRelativeOffset();
4214
+ }
4215
+
4216
+ var pageX = event.pageX;
4217
+ var pageY = event.pageY;
4218
+
4219
+ /*
4220
+ * - Position constraining -
4221
+ * Constrain the position to a mix of grid, containment.
4222
+ */
4223
+
4224
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
4225
+
4226
+ if(this.containment) {
4227
+ if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
4228
+ if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
4229
+ if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
4230
+ if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
4231
+ }
4232
+
4233
+ if(o.grid) {
4234
+ var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
4235
+ pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
4236
+
4237
+ var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
4238
+ pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
4239
+ }
4240
+
4241
+ }
4242
+
4243
+ return {
4244
+ top: (
4245
+ pageY // The absolute mouse position
4246
+ - this.offset.click.top // Click offset (relative to the element)
4247
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
4248
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
4249
+ + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
4250
+ ),
4251
+ left: (
4252
+ pageX // The absolute mouse position
4253
+ - this.offset.click.left // Click offset (relative to the element)
4254
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
4255
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
4256
+ + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
4257
+ )
4258
+ };
4259
+
4260
+ },
4261
+
4262
+ _rearrange: function(event, i, a, hardRefresh) {
4263
+
4264
+ a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
4265
+
4266
+ //Various things done here to improve the performance:
4267
+ // 1. we create a setTimeout, that calls refreshPositions
4268
+ // 2. on the instance, we have a counter variable, that get's higher after every append
4269
+ // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
4270
+ // 4. this lets only the last addition to the timeout stack through
4271
+ this.counter = this.counter ? ++this.counter : 1;
4272
+ var self = this, counter = this.counter;
4273
+
4274
+ window.setTimeout(function() {
4275
+ if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
4276
+ },0);
4277
+
4278
+ },
4279
+
4280
+ _clear: function(event, noPropagation) {
4281
+
4282
+ this.reverting = false;
4283
+ // We delay all events that have to be triggered to after the point where the placeholder has been removed and
4284
+ // everything else normalized again
4285
+ var delayedTriggers = [], self = this;
4286
+
4287
+ // We first have to update the dom position of the actual currentItem
4288
+ // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
4289
+ if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
4290
+ this._noFinalSort = null;
4291
+
4292
+ if(this.helper[0] == this.currentItem[0]) {
4293
+ for(var i in this._storedCSS) {
4294
+ if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
4295
+ }
4296
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
4297
+ } else {
4298
+ this.currentItem.show();
4299
+ }
4300
+
4301
+ if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
4302
+ if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
4303
+
4304
+ // Check if the items Container has Changed and trigger appropriate
4305
+ // events.
4306
+ if (this !== this.currentContainer) {
4307
+ if(!noPropagation) {
4308
+ delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
4309
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
4310
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
4311
+ }
4312
+ }
4313
+
4314
+ //Post events to containers
4315
+ for (var i = this.containers.length - 1; i >= 0; i--){
4316
+ if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
4317
+ if(this.containers[i].containerCache.over) {
4318
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
4319
+ this.containers[i].containerCache.over = 0;
4320
+ }
4321
+ }
4322
+
4323
+ //Do what was originally in plugins
4324
+ if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
4325
+ if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
4326
+ if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
4327
+
4328
+ this.dragging = false;
4329
+ if(this.cancelHelperRemoval) {
4330
+ if(!noPropagation) {
4331
+ this._trigger("beforeStop", event, this._uiHash());
4332
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
4333
+ this._trigger("stop", event, this._uiHash());
4334
+ }
4335
+
4336
+ this.fromOutside = false;
4337
+ return false;
4338
+ }
4339
+
4340
+ if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
4341
+
4342
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
4343
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
4344
+
4345
+ if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
4346
+
4347
+ if(!noPropagation) {
4348
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
4349
+ this._trigger("stop", event, this._uiHash());
4350
+ }
4351
+
4352
+ this.fromOutside = false;
4353
+ return true;
4354
+
4355
+ },
4356
+
4357
+ _trigger: function() {
4358
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
4359
+ this.cancel();
4360
+ }
4361
+ },
4362
+
4363
+ _uiHash: function(inst) {
4364
+ var self = inst || this;
4365
+ return {
4366
+ helper: self.helper,
4367
+ placeholder: self.placeholder || $([]),
4368
+ position: self.position,
4369
+ originalPosition: self.originalPosition,
4370
+ offset: self.positionAbs,
4371
+ item: self.currentItem,
4372
+ sender: inst ? inst.element : null
4373
+ };
4374
+ }
4375
+
4376
+ });
4377
+
4378
+ $.extend($.ui.sortable, {
4379
+ version: "1.8.24"
4380
+ });
4381
+
4382
+ })(jQuery);
4383
+ /*!
4384
+ * jQuery UI Accordion 1.8.24
4385
+ *
4386
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
4387
+ * Dual licensed under the MIT or GPL Version 2 licenses.
4388
+ * http://jquery.org/license
4389
+ *
4390
+ * http://docs.jquery.com/UI/Accordion
4391
+ *
4392
+ * Depends:
4393
+ * jquery.ui.core.js
4394
+ * jquery.ui.widget.js
4395
+ */
4396
+ (function( $, undefined ) {
4397
+
4398
+ $.widget( "ui.accordion", {
4399
+ options: {
4400
+ active: 0,
4401
+ animated: "slide",
4402
+ autoHeight: true,
4403
+ clearStyle: false,
4404
+ collapsible: false,
4405
+ event: "click",
4406
+ fillSpace: false,
4407
+ header: "> li > :first-child,> :not(li):even",
4408
+ icons: {
4409
+ header: "ui-icon-triangle-1-e",
4410
+ headerSelected: "ui-icon-triangle-1-s"
4411
+ },
4412
+ navigation: false,
4413
+ navigationFilter: function() {
4414
+ return this.href.toLowerCase() === location.href.toLowerCase();
4415
+ }
4416
+ },
4417
+
4418
+ _create: function() {
4419
+ var self = this,
4420
+ options = self.options;
4421
+
4422
+ self.running = 0;
4423
+
4424
+ self.element
4425
+ .addClass( "ui-accordion ui-widget ui-helper-reset" )
4426
+ // in lack of child-selectors in CSS
4427
+ // we need to mark top-LIs in a UL-accordion for some IE-fix
4428
+ .children( "li" )
4429
+ .addClass( "ui-accordion-li-fix" );
4430
+
4431
+ self.headers = self.element.find( options.header )
4432
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
4433
+ .bind( "mouseenter.accordion", function() {
4434
+ if ( options.disabled ) {
4435
+ return;
4436
+ }
4437
+ $( this ).addClass( "ui-state-hover" );
4438
+ })
4439
+ .bind( "mouseleave.accordion", function() {
4440
+ if ( options.disabled ) {
4441
+ return;
4442
+ }
4443
+ $( this ).removeClass( "ui-state-hover" );
4444
+ })
4445
+ .bind( "focus.accordion", function() {
4446
+ if ( options.disabled ) {
4447
+ return;
4448
+ }
4449
+ $( this ).addClass( "ui-state-focus" );
4450
+ })
4451
+ .bind( "blur.accordion", function() {
4452
+ if ( options.disabled ) {
4453
+ return;
4454
+ }
4455
+ $( this ).removeClass( "ui-state-focus" );
4456
+ });
4457
+
4458
+ self.headers.next()
4459
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
4460
+
4461
+ if ( options.navigation ) {
4462
+ var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
4463
+ if ( current.length ) {
4464
+ var header = current.closest( ".ui-accordion-header" );
4465
+ if ( header.length ) {
4466
+ // anchor within header
4467
+ self.active = header;
4468
+ } else {
4469
+ // anchor within content
4470
+ self.active = current.closest( ".ui-accordion-content" ).prev();
4471
+ }
4472
+ }
4473
+ }
4474
+
4475
+ self.active = self._findActive( self.active || options.active )
4476
+ .addClass( "ui-state-default ui-state-active" )
4477
+ .toggleClass( "ui-corner-all" )
4478
+ .toggleClass( "ui-corner-top" );
4479
+ self.active.next().addClass( "ui-accordion-content-active" );
4480
+
4481
+ self._createIcons();
4482
+ self.resize();
4483
+
4484
+ // ARIA
4485
+ self.element.attr( "role", "tablist" );
4486
+
4487
+ self.headers
4488
+ .attr( "role", "tab" )
4489
+ .bind( "keydown.accordion", function( event ) {
4490
+ return self._keydown( event );
4491
+ })
4492
+ .next()
4493
+ .attr( "role", "tabpanel" );
4494
+
4495
+ self.headers
4496
+ .not( self.active || "" )
4497
+ .attr({
4498
+ "aria-expanded": "false",
4499
+ "aria-selected": "false",
4500
+ tabIndex: -1
4501
+ })
4502
+ .next()
4503
+ .hide();
4504
+
4505
+ // make sure at least one header is in the tab order
4506
+ if ( !self.active.length ) {
4507
+ self.headers.eq( 0 ).attr( "tabIndex", 0 );
4508
+ } else {
4509
+ self.active
4510
+ .attr({
4511
+ "aria-expanded": "true",
4512
+ "aria-selected": "true",
4513
+ tabIndex: 0
4514
+ });
4515
+ }
4516
+
4517
+ // only need links in tab order for Safari
4518
+ if ( !$.browser.safari ) {
4519
+ self.headers.find( "a" ).attr( "tabIndex", -1 );
4520
+ }
4521
+
4522
+ if ( options.event ) {
4523
+ self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
4524
+ self._clickHandler.call( self, event, this );
4525
+ event.preventDefault();
4526
+ });
4527
+ }
4528
+ },
4529
+
4530
+ _createIcons: function() {
4531
+ var options = this.options;
4532
+ if ( options.icons ) {
4533
+ $( "<span></span>" )
4534
+ .addClass( "ui-icon " + options.icons.header )
4535
+ .prependTo( this.headers );
4536
+ this.active.children( ".ui-icon" )
4537
+ .toggleClass(options.icons.header)
4538
+ .toggleClass(options.icons.headerSelected);
4539
+ this.element.addClass( "ui-accordion-icons" );
4540
+ }
4541
+ },
4542
+
4543
+ _destroyIcons: function() {
4544
+ this.headers.children( ".ui-icon" ).remove();
4545
+ this.element.removeClass( "ui-accordion-icons" );
4546
+ },
4547
+
4548
+ destroy: function() {
4549
+ var options = this.options;
4550
+
4551
+ this.element
4552
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
4553
+ .removeAttr( "role" );
4554
+
4555
+ this.headers
4556
+ .unbind( ".accordion" )
4557
+ .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
4558
+ .removeAttr( "role" )
4559
+ .removeAttr( "aria-expanded" )
4560
+ .removeAttr( "aria-selected" )
4561
+ .removeAttr( "tabIndex" );
4562
+
4563
+ this.headers.find( "a" ).removeAttr( "tabIndex" );
4564
+ this._destroyIcons();
4565
+ var contents = this.headers.next()
4566
+ .css( "display", "" )
4567
+ .removeAttr( "role" )
4568
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
4569
+ if ( options.autoHeight || options.fillHeight ) {
4570
+ contents.css( "height", "" );
4571
+ }
4572
+
4573
+ return $.Widget.prototype.destroy.call( this );
4574
+ },
4575
+
4576
+ _setOption: function( key, value ) {
4577
+ $.Widget.prototype._setOption.apply( this, arguments );
4578
+
4579
+ if ( key == "active" ) {
4580
+ this.activate( value );
4581
+ }
4582
+ if ( key == "icons" ) {
4583
+ this._destroyIcons();
4584
+ if ( value ) {
4585
+ this._createIcons();
4586
+ }
4587
+ }
4588
+ // #5332 - opacity doesn't cascade to positioned elements in IE
4589
+ // so we need to add the disabled class to the headers and panels
4590
+ if ( key == "disabled" ) {
4591
+ this.headers.add(this.headers.next())
4592
+ [ value ? "addClass" : "removeClass" ](
4593
+ "ui-accordion-disabled ui-state-disabled" );
4594
+ }
4595
+ },
4596
+
4597
+ _keydown: function( event ) {
4598
+ if ( this.options.disabled || event.altKey || event.ctrlKey ) {
4599
+ return;
4600
+ }
4601
+
4602
+ var keyCode = $.ui.keyCode,
4603
+ length = this.headers.length,
4604
+ currentIndex = this.headers.index( event.target ),
4605
+ toFocus = false;
4606
+
4607
+ switch ( event.keyCode ) {
4608
+ case keyCode.RIGHT:
4609
+ case keyCode.DOWN:
4610
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
4611
+ break;
4612
+ case keyCode.LEFT:
4613
+ case keyCode.UP:
4614
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
4615
+ break;
4616
+ case keyCode.SPACE:
4617
+ case keyCode.ENTER:
4618
+ this._clickHandler( { target: event.target }, event.target );
4619
+ event.preventDefault();
4620
+ }
4621
+
4622
+ if ( toFocus ) {
4623
+ $( event.target ).attr( "tabIndex", -1 );
4624
+ $( toFocus ).attr( "tabIndex", 0 );
4625
+ toFocus.focus();
4626
+ return false;
4627
+ }
4628
+
4629
+ return true;
4630
+ },
4631
+
4632
+ resize: function() {
4633
+ var options = this.options,
4634
+ maxHeight;
4635
+
4636
+ if ( options.fillSpace ) {
4637
+ if ( $.browser.msie ) {
4638
+ var defOverflow = this.element.parent().css( "overflow" );
4639
+ this.element.parent().css( "overflow", "hidden");
4640
+ }
4641
+ maxHeight = this.element.parent().height();
4642
+ if ($.browser.msie) {
4643
+ this.element.parent().css( "overflow", defOverflow );
4644
+ }
4645
+
4646
+ this.headers.each(function() {
4647
+ maxHeight -= $( this ).outerHeight( true );
4648
+ });
4649
+
4650
+ this.headers.next()
4651
+ .each(function() {
4652
+ $( this ).height( Math.max( 0, maxHeight -
4653
+ $( this ).innerHeight() + $( this ).height() ) );
4654
+ })
4655
+ .css( "overflow", "auto" );
4656
+ } else if ( options.autoHeight ) {
4657
+ maxHeight = 0;
4658
+ this.headers.next()
4659
+ .each(function() {
4660
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
4661
+ })
4662
+ .height( maxHeight );
4663
+ }
4664
+
4665
+ return this;
4666
+ },
4667
+
4668
+ activate: function( index ) {
4669
+ // TODO this gets called on init, changing the option without an explicit call for that
4670
+ this.options.active = index;
4671
+ // call clickHandler with custom event
4672
+ var active = this._findActive( index )[ 0 ];
4673
+ this._clickHandler( { target: active }, active );
4674
+
4675
+ return this;
4676
+ },
4677
+
4678
+ _findActive: function( selector ) {
4679
+ return selector
4680
+ ? typeof selector === "number"
4681
+ ? this.headers.filter( ":eq(" + selector + ")" )
4682
+ : this.headers.not( this.headers.not( selector ) )
4683
+ : selector === false
4684
+ ? $( [] )
4685
+ : this.headers.filter( ":eq(0)" );
4686
+ },
4687
+
4688
+ // TODO isn't event.target enough? why the separate target argument?
4689
+ _clickHandler: function( event, target ) {
4690
+ var options = this.options;
4691
+ if ( options.disabled ) {
4692
+ return;
4693
+ }
4694
+
4695
+ // called only when using activate(false) to close all parts programmatically
4696
+ if ( !event.target ) {
4697
+ if ( !options.collapsible ) {
4698
+ return;
4699
+ }
4700
+ this.active
4701
+ .removeClass( "ui-state-active ui-corner-top" )
4702
+ .addClass( "ui-state-default ui-corner-all" )
4703
+ .children( ".ui-icon" )
4704
+ .removeClass( options.icons.headerSelected )
4705
+ .addClass( options.icons.header );
4706
+ this.active.next().addClass( "ui-accordion-content-active" );
4707
+ var toHide = this.active.next(),
4708
+ data = {
4709
+ options: options,
4710
+ newHeader: $( [] ),
4711
+ oldHeader: options.active,
4712
+ newContent: $( [] ),
4713
+ oldContent: toHide
4714
+ },
4715
+ toShow = ( this.active = $( [] ) );
4716
+ this._toggle( toShow, toHide, data );
4717
+ return;
4718
+ }
4719
+
4720
+ // get the click target
4721
+ var clicked = $( event.currentTarget || target ),
4722
+ clickedIsActive = clicked[0] === this.active[0];
4723
+
4724
+ // TODO the option is changed, is that correct?
4725
+ // TODO if it is correct, shouldn't that happen after determining that the click is valid?
4726
+ options.active = options.collapsible && clickedIsActive ?
4727
+ false :
4728
+ this.headers.index( clicked );
4729
+
4730
+ // if animations are still active, or the active header is the target, ignore click
4731
+ if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
4732
+ return;
4733
+ }
4734
+
4735
+ // find elements to show and hide
4736
+ var active = this.active,
4737
+ toShow = clicked.next(),
4738
+ toHide = this.active.next(),
4739
+ data = {
4740
+ options: options,
4741
+ newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
4742
+ oldHeader: this.active,
4743
+ newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
4744
+ oldContent: toHide
4745
+ },
4746
+ down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
4747
+
4748
+ // when the call to ._toggle() comes after the class changes
4749
+ // it causes a very odd bug in IE 8 (see #6720)
4750
+ this.active = clickedIsActive ? $([]) : clicked;
4751
+ this._toggle( toShow, toHide, data, clickedIsActive, down );
4752
+
4753
+ // switch classes
4754
+ active
4755
+ .removeClass( "ui-state-active ui-corner-top" )
4756
+ .addClass( "ui-state-default ui-corner-all" )
4757
+ .children( ".ui-icon" )
4758
+ .removeClass( options.icons.headerSelected )
4759
+ .addClass( options.icons.header );
4760
+ if ( !clickedIsActive ) {
4761
+ clicked
4762
+ .removeClass( "ui-state-default ui-corner-all" )
4763
+ .addClass( "ui-state-active ui-corner-top" )
4764
+ .children( ".ui-icon" )
4765
+ .removeClass( options.icons.header )
4766
+ .addClass( options.icons.headerSelected );
4767
+ clicked
4768
+ .next()
4769
+ .addClass( "ui-accordion-content-active" );
4770
+ }
4771
+
4772
+ return;
4773
+ },
4774
+
4775
+ _toggle: function( toShow, toHide, data, clickedIsActive, down ) {
4776
+ var self = this,
4777
+ options = self.options;
4778
+
4779
+ self.toShow = toShow;
4780
+ self.toHide = toHide;
4781
+ self.data = data;
4782
+
4783
+ var complete = function() {
4784
+ if ( !self ) {
4785
+ return;
4786
+ }
4787
+ return self._completed.apply( self, arguments );
4788
+ };
4789
+
4790
+ // trigger changestart event
4791
+ self._trigger( "changestart", null, self.data );
4792
+
4793
+ // count elements to animate
4794
+ self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
4795
+
4796
+ if ( options.animated ) {
4797
+ var animOptions = {};
4798
+
4799
+ if ( options.collapsible && clickedIsActive ) {
4800
+ animOptions = {
4801
+ toShow: $( [] ),
4802
+ toHide: toHide,
4803
+ complete: complete,
4804
+ down: down,
4805
+ autoHeight: options.autoHeight || options.fillSpace
4806
+ };
4807
+ } else {
4808
+ animOptions = {
4809
+ toShow: toShow,
4810
+ toHide: toHide,
4811
+ complete: complete,
4812
+ down: down,
4813
+ autoHeight: options.autoHeight || options.fillSpace
4814
+ };
4815
+ }
4816
+
4817
+ if ( !options.proxied ) {
4818
+ options.proxied = options.animated;
4819
+ }
4820
+
4821
+ if ( !options.proxiedDuration ) {
4822
+ options.proxiedDuration = options.duration;
4823
+ }
4824
+
4825
+ options.animated = $.isFunction( options.proxied ) ?
4826
+ options.proxied( animOptions ) :
4827
+ options.proxied;
4828
+
4829
+ options.duration = $.isFunction( options.proxiedDuration ) ?
4830
+ options.proxiedDuration( animOptions ) :
4831
+ options.proxiedDuration;
4832
+
4833
+ var animations = $.ui.accordion.animations,
4834
+ duration = options.duration,
4835
+ easing = options.animated;
4836
+
4837
+ if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
4838
+ easing = "slide";
4839
+ }
4840
+ if ( !animations[ easing ] ) {
4841
+ animations[ easing ] = function( options ) {
4842
+ this.slide( options, {
4843
+ easing: easing,
4844
+ duration: duration || 700
4845
+ });
4846
+ };
4847
+ }
4848
+
4849
+ animations[ easing ]( animOptions );
4850
+ } else {
4851
+ if ( options.collapsible && clickedIsActive ) {
4852
+ toShow.toggle();
4853
+ } else {
4854
+ toHide.hide();
4855
+ toShow.show();
4856
+ }
4857
+
4858
+ complete( true );
4859
+ }
4860
+
4861
+ // TODO assert that the blur and focus triggers are really necessary, remove otherwise
4862
+ toHide.prev()
4863
+ .attr({
4864
+ "aria-expanded": "false",
4865
+ "aria-selected": "false",
4866
+ tabIndex: -1
4867
+ })
4868
+ .blur();
4869
+ toShow.prev()
4870
+ .attr({
4871
+ "aria-expanded": "true",
4872
+ "aria-selected": "true",
4873
+ tabIndex: 0
4874
+ })
4875
+ .focus();
4876
+ },
4877
+
4878
+ _completed: function( cancel ) {
4879
+ this.running = cancel ? 0 : --this.running;
4880
+ if ( this.running ) {
4881
+ return;
4882
+ }
4883
+
4884
+ if ( this.options.clearStyle ) {
4885
+ this.toShow.add( this.toHide ).css({
4886
+ height: "",
4887
+ overflow: ""
4888
+ });
4889
+ }
4890
+
4891
+ // other classes are removed before the animation; this one needs to stay until completed
4892
+ this.toHide.removeClass( "ui-accordion-content-active" );
4893
+ // Work around for rendering bug in IE (#5421)
4894
+ if ( this.toHide.length ) {
4895
+ this.toHide.parent()[0].className = this.toHide.parent()[0].className;
4896
+ }
4897
+
4898
+ this._trigger( "change", null, this.data );
4899
+ }
4900
+ });
4901
+
4902
+ $.extend( $.ui.accordion, {
4903
+ version: "1.8.24",
4904
+ animations: {
4905
+ slide: function( options, additions ) {
4906
+ options = $.extend({
4907
+ easing: "swing",
4908
+ duration: 300
4909
+ }, options, additions );
4910
+ if ( !options.toHide.size() ) {
4911
+ options.toShow.animate({
4912
+ height: "show",
4913
+ paddingTop: "show",
4914
+ paddingBottom: "show"
4915
+ }, options );
4916
+ return;
4917
+ }
4918
+ if ( !options.toShow.size() ) {
4919
+ options.toHide.animate({
4920
+ height: "hide",
4921
+ paddingTop: "hide",
4922
+ paddingBottom: "hide"
4923
+ }, options );
4924
+ return;
4925
+ }
4926
+ var overflow = options.toShow.css( "overflow" ),
4927
+ percentDone = 0,
4928
+ showProps = {},
4929
+ hideProps = {},
4930
+ fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
4931
+ originalWidth;
4932
+ // fix width before calculating height of hidden element
4933
+ var s = options.toShow;
4934
+ originalWidth = s[0].style.width;
4935
+ s.width( s.parent().width()
4936
+ - parseFloat( s.css( "paddingLeft" ) )
4937
+ - parseFloat( s.css( "paddingRight" ) )
4938
+ - ( parseFloat( s.css( "borderLeftWidth" ) ) || 0 )
4939
+ - ( parseFloat( s.css( "borderRightWidth" ) ) || 0 ) );
4940
+
4941
+ $.each( fxAttrs, function( i, prop ) {
4942
+ hideProps[ prop ] = "hide";
4943
+
4944
+ var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
4945
+ showProps[ prop ] = {
4946
+ value: parts[ 1 ],
4947
+ unit: parts[ 2 ] || "px"
4948
+ };
4949
+ });
4950
+ options.toShow.css({ height: 0, overflow: "hidden" }).show();
4951
+ options.toHide
4952
+ .filter( ":hidden" )
4953
+ .each( options.complete )
4954
+ .end()
4955
+ .filter( ":visible" )
4956
+ .animate( hideProps, {
4957
+ step: function( now, settings ) {
4958
+ // only calculate the percent when animating height
4959
+ // IE gets very inconsistent results when animating elements
4960
+ // with small values, which is common for padding
4961
+ if ( settings.prop == "height" ) {
4962
+ percentDone = ( settings.end - settings.start === 0 ) ? 0 :
4963
+ ( settings.now - settings.start ) / ( settings.end - settings.start );
4964
+ }
4965
+
4966
+ options.toShow[ 0 ].style[ settings.prop ] =
4967
+ ( percentDone * showProps[ settings.prop ].value )
4968
+ + showProps[ settings.prop ].unit;
4969
+ },
4970
+ duration: options.duration,
4971
+ easing: options.easing,
4972
+ complete: function() {
4973
+ if ( !options.autoHeight ) {
4974
+ options.toShow.css( "height", "" );
4975
+ }
4976
+ options.toShow.css({
4977
+ width: originalWidth,
4978
+ overflow: overflow
4979
+ });
4980
+ options.complete();
4981
+ }
4982
+ });
4983
+ },
4984
+ bounceslide: function( options ) {
4985
+ this.slide( options, {
4986
+ easing: options.down ? "easeOutBounce" : "swing",
4987
+ duration: options.down ? 1000 : 200
4988
+ });
4989
+ }
4990
+ }
4991
+ });
4992
+
4993
+ })( jQuery );
4994
+ /*!
4995
+ * jQuery UI Autocomplete 1.8.24
4996
+ *
4997
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
4998
+ * Dual licensed under the MIT or GPL Version 2 licenses.
4999
+ * http://jquery.org/license
5000
+ *
5001
+ * http://docs.jquery.com/UI/Autocomplete
5002
+ *
5003
+ * Depends:
5004
+ * jquery.ui.core.js
5005
+ * jquery.ui.widget.js
5006
+ * jquery.ui.position.js
5007
+ */
5008
+ (function( $, undefined ) {
5009
+
5010
+ // used to prevent race conditions with remote data sources
5011
+ var requestIndex = 0;
5012
+
5013
+ $.widget( "ui.autocomplete", {
5014
+ options: {
5015
+ appendTo: "body",
5016
+ autoFocus: false,
5017
+ delay: 300,
5018
+ minLength: 1,
5019
+ position: {
5020
+ my: "left top",
5021
+ at: "left bottom",
5022
+ collision: "none"
5023
+ },
5024
+ source: null
5025
+ },
5026
+
5027
+ pending: 0,
5028
+
5029
+ _create: function() {
5030
+ var self = this,
5031
+ doc = this.element[ 0 ].ownerDocument,
5032
+ suppressKeyPress;
5033
+ this.isMultiLine = this.element.is( "textarea" );
5034
+
5035
+ this.element
5036
+ .addClass( "ui-autocomplete-input" )
5037
+ .attr( "autocomplete", "off" )
5038
+ // TODO verify these actually work as intended
5039
+ .attr({
5040
+ role: "textbox",
5041
+ "aria-autocomplete": "list",
5042
+ "aria-haspopup": "true"
5043
+ })
5044
+ .bind( "keydown.autocomplete", function( event ) {
5045
+ if ( self.options.disabled || self.element.propAttr( "readOnly" ) ) {
5046
+ return;
5047
+ }
5048
+
5049
+ suppressKeyPress = false;
5050
+ var keyCode = $.ui.keyCode;
5051
+ switch( event.keyCode ) {
5052
+ case keyCode.PAGE_UP:
5053
+ self._move( "previousPage", event );
5054
+ break;
5055
+ case keyCode.PAGE_DOWN:
5056
+ self._move( "nextPage", event );
5057
+ break;
5058
+ case keyCode.UP:
5059
+ self._keyEvent( "previous", event );
5060
+ break;
5061
+ case keyCode.DOWN:
5062
+ self._keyEvent( "next", event );
5063
+ break;
5064
+ case keyCode.ENTER:
5065
+ case keyCode.NUMPAD_ENTER:
5066
+ // when menu is open and has focus
5067
+ if ( self.menu.active ) {
5068
+ // #6055 - Opera still allows the keypress to occur
5069
+ // which causes forms to submit
5070
+ suppressKeyPress = true;
5071
+ event.preventDefault();
5072
+ }
5073
+ //passthrough - ENTER and TAB both select the current element
5074
+ case keyCode.TAB:
5075
+ if ( !self.menu.active ) {
5076
+ return;
5077
+ }
5078
+ self.menu.select( event );
5079
+ break;
5080
+ case keyCode.ESCAPE:
5081
+ self.element.val( self.term );
5082
+ self.close( event );
5083
+ break;
5084
+ default:
5085
+ // keypress is triggered before the input value is changed
5086
+ clearTimeout( self.searching );
5087
+ self.searching = setTimeout(function() {
5088
+ // only search if the value has changed
5089
+ if ( self.term != self.element.val() ) {
5090
+ self.selectedItem = null;
5091
+ self.search( null, event );
5092
+ }
5093
+ }, self.options.delay );
5094
+ break;
5095
+ }
5096
+ })
5097
+ .bind( "keypress.autocomplete", function( event ) {
5098
+ if ( suppressKeyPress ) {
5099
+ suppressKeyPress = false;
5100
+ event.preventDefault();
5101
+ }
5102
+ })
5103
+ .bind( "focus.autocomplete", function() {
5104
+ if ( self.options.disabled ) {
5105
+ return;
5106
+ }
5107
+
5108
+ self.selectedItem = null;
5109
+ self.previous = self.element.val();
5110
+ })
5111
+ .bind( "blur.autocomplete", function( event ) {
5112
+ if ( self.options.disabled ) {
5113
+ return;
5114
+ }
5115
+
5116
+ clearTimeout( self.searching );
5117
+ // clicks on the menu (or a button to trigger a search) will cause a blur event
5118
+ self.closing = setTimeout(function() {
5119
+ self.close( event );
5120
+ self._change( event );
5121
+ }, 150 );
5122
+ });
5123
+ this._initSource();
5124
+ this.menu = $( "<ul></ul>" )
5125
+ .addClass( "ui-autocomplete" )
5126
+ .appendTo( $( this.options.appendTo || "body", doc )[0] )
5127
+ // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
5128
+ .mousedown(function( event ) {
5129
+ // clicking on the scrollbar causes focus to shift to the body
5130
+ // but we can't detect a mouseup or a click immediately afterward
5131
+ // so we have to track the next mousedown and close the menu if
5132
+ // the user clicks somewhere outside of the autocomplete
5133
+ var menuElement = self.menu.element[ 0 ];
5134
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
5135
+ setTimeout(function() {
5136
+ $( document ).one( 'mousedown', function( event ) {
5137
+ if ( event.target !== self.element[ 0 ] &&
5138
+ event.target !== menuElement &&
5139
+ !$.ui.contains( menuElement, event.target ) ) {
5140
+ self.close();
5141
+ }
5142
+ });
5143
+ }, 1 );
5144
+ }
5145
+
5146
+ // use another timeout to make sure the blur-event-handler on the input was already triggered
5147
+ setTimeout(function() {
5148
+ clearTimeout( self.closing );
5149
+ }, 13);
5150
+ })
5151
+ .menu({
5152
+ focus: function( event, ui ) {
5153
+ var item = ui.item.data( "item.autocomplete" );
5154
+ if ( false !== self._trigger( "focus", event, { item: item } ) ) {
5155
+ // use value to match what will end up in the input, if it was a key event
5156
+ if ( /^key/.test(event.originalEvent.type) ) {
5157
+ self.element.val( item.value );
5158
+ }
5159
+ }
5160
+ },
5161
+ selected: function( event, ui ) {
5162
+ var item = ui.item.data( "item.autocomplete" ),
5163
+ previous = self.previous;
5164
+
5165
+ // only trigger when focus was lost (click on menu)
5166
+ if ( self.element[0] !== doc.activeElement ) {
5167
+ self.element.focus();
5168
+ self.previous = previous;
5169
+ // #6109 - IE triggers two focus events and the second
5170
+ // is asynchronous, so we need to reset the previous
5171
+ // term synchronously and asynchronously :-(
5172
+ setTimeout(function() {
5173
+ self.previous = previous;
5174
+ self.selectedItem = item;
5175
+ }, 1);
5176
+ }
5177
+
5178
+ if ( false !== self._trigger( "select", event, { item: item } ) ) {
5179
+ self.element.val( item.value );
5180
+ }
5181
+ // reset the term after the select event
5182
+ // this allows custom select handling to work properly
5183
+ self.term = self.element.val();
5184
+
5185
+ self.close( event );
5186
+ self.selectedItem = item;
5187
+ },
5188
+ blur: function( event, ui ) {
5189
+ // don't set the value of the text field if it's already correct
5190
+ // this prevents moving the cursor unnecessarily
5191
+ if ( self.menu.element.is(":visible") &&
5192
+ ( self.element.val() !== self.term ) ) {
5193
+ self.element.val( self.term );
5194
+ }
5195
+ }
5196
+ })
5197
+ .zIndex( this.element.zIndex() + 1 )
5198
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
5199
+ .css({ top: 0, left: 0 })
5200
+ .hide()
5201
+ .data( "menu" );
5202
+ if ( $.fn.bgiframe ) {
5203
+ this.menu.element.bgiframe();
5204
+ }
5205
+ // turning off autocomplete prevents the browser from remembering the
5206
+ // value when navigating through history, so we re-enable autocomplete
5207
+ // if the page is unloaded before the widget is destroyed. #7790
5208
+ self.beforeunloadHandler = function() {
5209
+ self.element.removeAttr( "autocomplete" );
5210
+ };
5211
+ $( window ).bind( "beforeunload", self.beforeunloadHandler );
5212
+ },
5213
+
5214
+ destroy: function() {
5215
+ this.element
5216
+ .removeClass( "ui-autocomplete-input" )
5217
+ .removeAttr( "autocomplete" )
5218
+ .removeAttr( "role" )
5219
+ .removeAttr( "aria-autocomplete" )
5220
+ .removeAttr( "aria-haspopup" );
5221
+ this.menu.element.remove();
5222
+ $( window ).unbind( "beforeunload", this.beforeunloadHandler );
5223
+ $.Widget.prototype.destroy.call( this );
5224
+ },
5225
+
5226
+ _setOption: function( key, value ) {
5227
+ $.Widget.prototype._setOption.apply( this, arguments );
5228
+ if ( key === "source" ) {
5229
+ this._initSource();
5230
+ }
5231
+ if ( key === "appendTo" ) {
5232
+ this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
5233
+ }
5234
+ if ( key === "disabled" && value && this.xhr ) {
5235
+ this.xhr.abort();
5236
+ }
5237
+ },
5238
+
5239
+ _initSource: function() {
5240
+ var self = this,
5241
+ array,
5242
+ url;
5243
+ if ( $.isArray(this.options.source) ) {
5244
+ array = this.options.source;
5245
+ this.source = function( request, response ) {
5246
+ response( $.ui.autocomplete.filter(array, request.term) );
5247
+ };
5248
+ } else if ( typeof this.options.source === "string" ) {
5249
+ url = this.options.source;
5250
+ this.source = function( request, response ) {
5251
+ if ( self.xhr ) {
5252
+ self.xhr.abort();
5253
+ }
5254
+ self.xhr = $.ajax({
5255
+ url: url,
5256
+ data: request,
5257
+ dataType: "json",
5258
+ success: function( data, status ) {
5259
+ response( data );
5260
+ },
5261
+ error: function() {
5262
+ response( [] );
5263
+ }
5264
+ });
5265
+ };
5266
+ } else {
5267
+ this.source = this.options.source;
5268
+ }
5269
+ },
5270
+
5271
+ search: function( value, event ) {
5272
+ value = value != null ? value : this.element.val();
5273
+
5274
+ // always save the actual value, not the one passed as an argument
5275
+ this.term = this.element.val();
5276
+
5277
+ if ( value.length < this.options.minLength ) {
5278
+ return this.close( event );
5279
+ }
5280
+
5281
+ clearTimeout( this.closing );
5282
+ if ( this._trigger( "search", event ) === false ) {
5283
+ return;
5284
+ }
5285
+
5286
+ return this._search( value );
5287
+ },
5288
+
5289
+ _search: function( value ) {
5290
+ this.pending++;
5291
+ this.element.addClass( "ui-autocomplete-loading" );
5292
+
5293
+ this.source( { term: value }, this._response() );
5294
+ },
5295
+
5296
+ _response: function() {
5297
+ var that = this,
5298
+ index = ++requestIndex;
5299
+
5300
+ return function( content ) {
5301
+ if ( index === requestIndex ) {
5302
+ that.__response( content );
5303
+ }
5304
+
5305
+ that.pending--;
5306
+ if ( !that.pending ) {
5307
+ that.element.removeClass( "ui-autocomplete-loading" );
5308
+ }
5309
+ };
5310
+ },
5311
+
5312
+ __response: function( content ) {
5313
+ if ( !this.options.disabled && content && content.length ) {
5314
+ content = this._normalize( content );
5315
+ this._suggest( content );
5316
+ this._trigger( "open" );
5317
+ } else {
5318
+ this.close();
5319
+ }
5320
+ },
5321
+
5322
+ close: function( event ) {
5323
+ clearTimeout( this.closing );
5324
+ if ( this.menu.element.is(":visible") ) {
5325
+ this.menu.element.hide();
5326
+ this.menu.deactivate();
5327
+ this._trigger( "close", event );
5328
+ }
5329
+ },
5330
+
5331
+ _change: function( event ) {
5332
+ if ( this.previous !== this.element.val() ) {
5333
+ this._trigger( "change", event, { item: this.selectedItem } );
5334
+ }
5335
+ },
5336
+
5337
+ _normalize: function( items ) {
5338
+ // assume all items have the right format when the first item is complete
5339
+ if ( items.length && items[0].label && items[0].value ) {
5340
+ return items;
5341
+ }
5342
+ return $.map( items, function(item) {
5343
+ if ( typeof item === "string" ) {
5344
+ return {
5345
+ label: item,
5346
+ value: item
5347
+ };
5348
+ }
5349
+ return $.extend({
5350
+ label: item.label || item.value,
5351
+ value: item.value || item.label
5352
+ }, item );
5353
+ });
5354
+ },
5355
+
5356
+ _suggest: function( items ) {
5357
+ var ul = this.menu.element
5358
+ .empty()
5359
+ .zIndex( this.element.zIndex() + 1 );
5360
+ this._renderMenu( ul, items );
5361
+ // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
5362
+ this.menu.deactivate();
5363
+ this.menu.refresh();
5364
+
5365
+ // size and position menu
5366
+ ul.show();
5367
+ this._resizeMenu();
5368
+ ul.position( $.extend({
5369
+ of: this.element
5370
+ }, this.options.position ));
5371
+
5372
+ if ( this.options.autoFocus ) {
5373
+ this.menu.next( new $.Event("mouseover") );
5374
+ }
5375
+ },
5376
+
5377
+ _resizeMenu: function() {
5378
+ var ul = this.menu.element;
5379
+ ul.outerWidth( Math.max(
5380
+ // Firefox wraps long text (possibly a rounding bug)
5381
+ // so we add 1px to avoid the wrapping (#7513)
5382
+ ul.width( "" ).outerWidth() + 1,
5383
+ this.element.outerWidth()
5384
+ ) );
5385
+ },
5386
+
5387
+ _renderMenu: function( ul, items ) {
5388
+ var self = this;
5389
+ $.each( items, function( index, item ) {
5390
+ self._renderItem( ul, item );
5391
+ });
5392
+ },
5393
+
5394
+ _renderItem: function( ul, item) {
5395
+ return $( "<li></li>" )
5396
+ .data( "item.autocomplete", item )
5397
+ .append( $( "<a></a>" ).text( item.label ) )
5398
+ .appendTo( ul );
5399
+ },
5400
+
5401
+ _move: function( direction, event ) {
5402
+ if ( !this.menu.element.is(":visible") ) {
5403
+ this.search( null, event );
5404
+ return;
5405
+ }
5406
+ if ( this.menu.first() && /^previous/.test(direction) ||
5407
+ this.menu.last() && /^next/.test(direction) ) {
5408
+ this.element.val( this.term );
5409
+ this.menu.deactivate();
5410
+ return;
5411
+ }
5412
+ this.menu[ direction ]( event );
5413
+ },
5414
+
5415
+ widget: function() {
5416
+ return this.menu.element;
5417
+ },
5418
+ _keyEvent: function( keyEvent, event ) {
5419
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
5420
+ this._move( keyEvent, event );
5421
+
5422
+ // prevents moving cursor to beginning/end of the text field in some browsers
5423
+ event.preventDefault();
5424
+ }
5425
+ }
5426
+ });
5427
+
5428
+ $.extend( $.ui.autocomplete, {
5429
+ escapeRegex: function( value ) {
5430
+ return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
5431
+ },
5432
+ filter: function(array, term) {
5433
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
5434
+ return $.grep( array, function(value) {
5435
+ return matcher.test( value.label || value.value || value );
5436
+ });
5437
+ }
5438
+ });
5439
+
5440
+ }( jQuery ));
5441
+
5442
+ /*
5443
+ * jQuery UI Menu (not officially released)
5444
+ *
5445
+ * This widget isn't yet finished and the API is subject to change. We plan to finish
5446
+ * it for the next release. You're welcome to give it a try anyway and give us feedback,
5447
+ * as long as you're okay with migrating your code later on. We can help with that, too.
5448
+ *
5449
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5450
+ * Dual licensed under the MIT or GPL Version 2 licenses.
5451
+ * http://jquery.org/license
5452
+ *
5453
+ * http://docs.jquery.com/UI/Menu
5454
+ *
5455
+ * Depends:
5456
+ * jquery.ui.core.js
5457
+ * jquery.ui.widget.js
5458
+ */
5459
+ (function($) {
5460
+
5461
+ $.widget("ui.menu", {
5462
+ _create: function() {
5463
+ var self = this;
5464
+ this.element
5465
+ .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
5466
+ .attr({
5467
+ role: "listbox",
5468
+ "aria-activedescendant": "ui-active-menuitem"
5469
+ })
5470
+ .click(function( event ) {
5471
+ if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
5472
+ return;
5473
+ }
5474
+ // temporary
5475
+ event.preventDefault();
5476
+ self.select( event );
5477
+ });
5478
+ this.refresh();
5479
+ },
5480
+
5481
+ refresh: function() {
5482
+ var self = this;
5483
+
5484
+ // don't refresh list items that are already adapted
5485
+ var items = this.element.children("li:not(.ui-menu-item):has(a)")
5486
+ .addClass("ui-menu-item")
5487
+ .attr("role", "menuitem");
5488
+
5489
+ items.children("a")
5490
+ .addClass("ui-corner-all")
5491
+ .attr("tabindex", -1)
5492
+ // mouseenter doesn't work with event delegation
5493
+ .mouseenter(function( event ) {
5494
+ self.activate( event, $(this).parent() );
5495
+ })
5496
+ .mouseleave(function() {
5497
+ self.deactivate();
5498
+ });
5499
+ },
5500
+
5501
+ activate: function( event, item ) {
5502
+ this.deactivate();
5503
+ if (this.hasScroll()) {
5504
+ var offset = item.offset().top - this.element.offset().top,
5505
+ scroll = this.element.scrollTop(),
5506
+ elementHeight = this.element.height();
5507
+ if (offset < 0) {
5508
+ this.element.scrollTop( scroll + offset);
5509
+ } else if (offset >= elementHeight) {
5510
+ this.element.scrollTop( scroll + offset - elementHeight + item.height());
5511
+ }
5512
+ }
5513
+ this.active = item.eq(0)
5514
+ .children("a")
5515
+ .addClass("ui-state-hover")
5516
+ .attr("id", "ui-active-menuitem")
5517
+ .end();
5518
+ this._trigger("focus", event, { item: item });
5519
+ },
5520
+
5521
+ deactivate: function() {
5522
+ if (!this.active) { return; }
5523
+
5524
+ this.active.children("a")
5525
+ .removeClass("ui-state-hover")
5526
+ .removeAttr("id");
5527
+ this._trigger("blur");
5528
+ this.active = null;
5529
+ },
5530
+
5531
+ next: function(event) {
5532
+ this.move("next", ".ui-menu-item:first", event);
5533
+ },
5534
+
5535
+ previous: function(event) {
5536
+ this.move("prev", ".ui-menu-item:last", event);
5537
+ },
5538
+
5539
+ first: function() {
5540
+ return this.active && !this.active.prevAll(".ui-menu-item").length;
5541
+ },
5542
+
5543
+ last: function() {
5544
+ return this.active && !this.active.nextAll(".ui-menu-item").length;
5545
+ },
5546
+
5547
+ move: function(direction, edge, event) {
5548
+ if (!this.active) {
5549
+ this.activate(event, this.element.children(edge));
5550
+ return;
5551
+ }
5552
+ var next = this.active[direction + "All"](".ui-menu-item").eq(0);
5553
+ if (next.length) {
5554
+ this.activate(event, next);
5555
+ } else {
5556
+ this.activate(event, this.element.children(edge));
5557
+ }
5558
+ },
5559
+
5560
+ // TODO merge with previousPage
5561
+ nextPage: function(event) {
5562
+ if (this.hasScroll()) {
5563
+ // TODO merge with no-scroll-else
5564
+ if (!this.active || this.last()) {
5565
+ this.activate(event, this.element.children(".ui-menu-item:first"));
5566
+ return;
5567
+ }
5568
+ var base = this.active.offset().top,
5569
+ height = this.element.height(),
5570
+ result = this.element.children(".ui-menu-item").filter(function() {
5571
+ var close = $(this).offset().top - base - height + $(this).height();
5572
+ // TODO improve approximation
5573
+ return close < 10 && close > -10;
5574
+ });
5575
+
5576
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
5577
+ if (!result.length) {
5578
+ result = this.element.children(".ui-menu-item:last");
5579
+ }
5580
+ this.activate(event, result);
5581
+ } else {
5582
+ this.activate(event, this.element.children(".ui-menu-item")
5583
+ .filter(!this.active || this.last() ? ":first" : ":last"));
5584
+ }
5585
+ },
5586
+
5587
+ // TODO merge with nextPage
5588
+ previousPage: function(event) {
5589
+ if (this.hasScroll()) {
5590
+ // TODO merge with no-scroll-else
5591
+ if (!this.active || this.first()) {
5592
+ this.activate(event, this.element.children(".ui-menu-item:last"));
5593
+ return;
5594
+ }
5595
+
5596
+ var base = this.active.offset().top,
5597
+ height = this.element.height(),
5598
+ result = this.element.children(".ui-menu-item").filter(function() {
5599
+ var close = $(this).offset().top - base + height - $(this).height();
5600
+ // TODO improve approximation
5601
+ return close < 10 && close > -10;
5602
+ });
5603
+
5604
+ // TODO try to catch this earlier when scrollTop indicates the last page anyway
5605
+ if (!result.length) {
5606
+ result = this.element.children(".ui-menu-item:first");
5607
+ }
5608
+ this.activate(event, result);
5609
+ } else {
5610
+ this.activate(event, this.element.children(".ui-menu-item")
5611
+ .filter(!this.active || this.first() ? ":last" : ":first"));
5612
+ }
5613
+ },
5614
+
5615
+ hasScroll: function() {
5616
+ return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight");
5617
+ },
5618
+
5619
+ select: function( event ) {
5620
+ this._trigger("selected", event, { item: this.active });
5621
+ }
5622
+ });
5623
+
5624
+ }(jQuery));
5625
+ /*!
5626
+ * jQuery UI Button 1.8.24
5627
+ *
5628
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5629
+ * Dual licensed under the MIT or GPL Version 2 licenses.
5630
+ * http://jquery.org/license
5631
+ *
5632
+ * http://docs.jquery.com/UI/Button
5633
+ *
5634
+ * Depends:
5635
+ * jquery.ui.core.js
5636
+ * jquery.ui.widget.js
5637
+ */
5638
+ (function( $, undefined ) {
5639
+
5640
+ var lastActive, startXPos, startYPos, clickDragged,
5641
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
5642
+ stateClasses = "ui-state-hover ui-state-active ",
5643
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
5644
+ formResetHandler = function() {
5645
+ var buttons = $( this ).find( ":ui-button" );
5646
+ setTimeout(function() {
5647
+ buttons.button( "refresh" );
5648
+ }, 1 );
5649
+ },
5650
+ radioGroup = function( radio ) {
5651
+ var name = radio.name,
5652
+ form = radio.form,
5653
+ radios = $( [] );
5654
+ if ( name ) {
5655
+ if ( form ) {
5656
+ radios = $( form ).find( "[name='" + name + "']" );
5657
+ } else {
5658
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
5659
+ .filter(function() {
5660
+ return !this.form;
5661
+ });
5662
+ }
5663
+ }
5664
+ return radios;
5665
+ };
5666
+
5667
+ $.widget( "ui.button", {
5668
+ options: {
5669
+ disabled: null,
5670
+ text: true,
5671
+ label: null,
5672
+ icons: {
5673
+ primary: null,
5674
+ secondary: null
5675
+ }
5676
+ },
5677
+ _create: function() {
5678
+ this.element.closest( "form" )
5679
+ .unbind( "reset.button" )
5680
+ .bind( "reset.button", formResetHandler );
5681
+
5682
+ if ( typeof this.options.disabled !== "boolean" ) {
5683
+ this.options.disabled = !!this.element.propAttr( "disabled" );
5684
+ } else {
5685
+ this.element.propAttr( "disabled", this.options.disabled );
5686
+ }
5687
+
5688
+ this._determineButtonType();
5689
+ this.hasTitle = !!this.buttonElement.attr( "title" );
5690
+
5691
+ var self = this,
5692
+ options = this.options,
5693
+ toggleButton = this.type === "checkbox" || this.type === "radio",
5694
+ hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
5695
+ focusClass = "ui-state-focus";
5696
+
5697
+ if ( options.label === null ) {
5698
+ options.label = this.buttonElement.html();
5699
+ }
5700
+
5701
+ this.buttonElement
5702
+ .addClass( baseClasses )
5703
+ .attr( "role", "button" )
5704
+ .bind( "mouseenter.button", function() {
5705
+ if ( options.disabled ) {
5706
+ return;
5707
+ }
5708
+ $( this ).addClass( "ui-state-hover" );
5709
+ if ( this === lastActive ) {
5710
+ $( this ).addClass( "ui-state-active" );
5711
+ }
5712
+ })
5713
+ .bind( "mouseleave.button", function() {
5714
+ if ( options.disabled ) {
5715
+ return;
5716
+ }
5717
+ $( this ).removeClass( hoverClass );
5718
+ })
5719
+ .bind( "click.button", function( event ) {
5720
+ if ( options.disabled ) {
5721
+ event.preventDefault();
5722
+ event.stopImmediatePropagation();
5723
+ }
5724
+ });
5725
+
5726
+ this.element
5727
+ .bind( "focus.button", function() {
5728
+ // no need to check disabled, focus won't be triggered anyway
5729
+ self.buttonElement.addClass( focusClass );
5730
+ })
5731
+ .bind( "blur.button", function() {
5732
+ self.buttonElement.removeClass( focusClass );
5733
+ });
5734
+
5735
+ if ( toggleButton ) {
5736
+ this.element.bind( "change.button", function() {
5737
+ if ( clickDragged ) {
5738
+ return;
5739
+ }
5740
+ self.refresh();
5741
+ });
5742
+ // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
5743
+ // prevents issue where button state changes but checkbox/radio checked state
5744
+ // does not in Firefox (see ticket #6970)
5745
+ this.buttonElement
5746
+ .bind( "mousedown.button", function( event ) {
5747
+ if ( options.disabled ) {
5748
+ return;
5749
+ }
5750
+ clickDragged = false;
5751
+ startXPos = event.pageX;
5752
+ startYPos = event.pageY;
5753
+ })
5754
+ .bind( "mouseup.button", function( event ) {
5755
+ if ( options.disabled ) {
5756
+ return;
5757
+ }
5758
+ if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
5759
+ clickDragged = true;
5760
+ }
5761
+ });
5762
+ }
5763
+
5764
+ if ( this.type === "checkbox" ) {
5765
+ this.buttonElement.bind( "click.button", function() {
5766
+ if ( options.disabled || clickDragged ) {
5767
+ return false;
5768
+ }
5769
+ $( this ).toggleClass( "ui-state-active" );
5770
+ self.buttonElement.attr( "aria-pressed", self.element[0].checked );
5771
+ });
5772
+ } else if ( this.type === "radio" ) {
5773
+ this.buttonElement.bind( "click.button", function() {
5774
+ if ( options.disabled || clickDragged ) {
5775
+ return false;
5776
+ }
5777
+ $( this ).addClass( "ui-state-active" );
5778
+ self.buttonElement.attr( "aria-pressed", "true" );
5779
+
5780
+ var radio = self.element[ 0 ];
5781
+ radioGroup( radio )
5782
+ .not( radio )
5783
+ .map(function() {
5784
+ return $( this ).button( "widget" )[ 0 ];
5785
+ })
5786
+ .removeClass( "ui-state-active" )
5787
+ .attr( "aria-pressed", "false" );
5788
+ });
5789
+ } else {
5790
+ this.buttonElement
5791
+ .bind( "mousedown.button", function() {
5792
+ if ( options.disabled ) {
5793
+ return false;
5794
+ }
5795
+ $( this ).addClass( "ui-state-active" );
5796
+ lastActive = this;
5797
+ $( document ).one( "mouseup", function() {
5798
+ lastActive = null;
5799
+ });
5800
+ })
5801
+ .bind( "mouseup.button", function() {
5802
+ if ( options.disabled ) {
5803
+ return false;
5804
+ }
5805
+ $( this ).removeClass( "ui-state-active" );
5806
+ })
5807
+ .bind( "keydown.button", function(event) {
5808
+ if ( options.disabled ) {
5809
+ return false;
5810
+ }
5811
+ if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
5812
+ $( this ).addClass( "ui-state-active" );
5813
+ }
5814
+ })
5815
+ .bind( "keyup.button", function() {
5816
+ $( this ).removeClass( "ui-state-active" );
5817
+ });
5818
+
5819
+ if ( this.buttonElement.is("a") ) {
5820
+ this.buttonElement.keyup(function(event) {
5821
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
5822
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
5823
+ $( this ).click();
5824
+ }
5825
+ });
5826
+ }
5827
+ }
5828
+
5829
+ // TODO: pull out $.Widget's handling for the disabled option into
5830
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
5831
+ // be overridden by individual plugins
5832
+ this._setOption( "disabled", options.disabled );
5833
+ this._resetButton();
5834
+ },
5835
+
5836
+ _determineButtonType: function() {
5837
+
5838
+ if ( this.element.is(":checkbox") ) {
5839
+ this.type = "checkbox";
5840
+ } else if ( this.element.is(":radio") ) {
5841
+ this.type = "radio";
5842
+ } else if ( this.element.is("input") ) {
5843
+ this.type = "input";
5844
+ } else {
5845
+ this.type = "button";
5846
+ }
5847
+
5848
+ if ( this.type === "checkbox" || this.type === "radio" ) {
5849
+ // we don't search against the document in case the element
5850
+ // is disconnected from the DOM
5851
+ var ancestor = this.element.parents().filter(":last"),
5852
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
5853
+ this.buttonElement = ancestor.find( labelSelector );
5854
+ if ( !this.buttonElement.length ) {
5855
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
5856
+ this.buttonElement = ancestor.filter( labelSelector );
5857
+ if ( !this.buttonElement.length ) {
5858
+ this.buttonElement = ancestor.find( labelSelector );
5859
+ }
5860
+ }
5861
+ this.element.addClass( "ui-helper-hidden-accessible" );
5862
+
5863
+ var checked = this.element.is( ":checked" );
5864
+ if ( checked ) {
5865
+ this.buttonElement.addClass( "ui-state-active" );
5866
+ }
5867
+ this.buttonElement.attr( "aria-pressed", checked );
5868
+ } else {
5869
+ this.buttonElement = this.element;
5870
+ }
5871
+ },
5872
+
5873
+ widget: function() {
5874
+ return this.buttonElement;
5875
+ },
5876
+
5877
+ destroy: function() {
5878
+ this.element
5879
+ .removeClass( "ui-helper-hidden-accessible" );
5880
+ this.buttonElement
5881
+ .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
5882
+ .removeAttr( "role" )
5883
+ .removeAttr( "aria-pressed" )
5884
+ .html( this.buttonElement.find(".ui-button-text").html() );
5885
+
5886
+ if ( !this.hasTitle ) {
5887
+ this.buttonElement.removeAttr( "title" );
5888
+ }
5889
+
5890
+ $.Widget.prototype.destroy.call( this );
5891
+ },
5892
+
5893
+ _setOption: function( key, value ) {
5894
+ $.Widget.prototype._setOption.apply( this, arguments );
5895
+ if ( key === "disabled" ) {
5896
+ if ( value ) {
5897
+ this.element.propAttr( "disabled", true );
5898
+ } else {
5899
+ this.element.propAttr( "disabled", false );
5900
+ }
5901
+ return;
5902
+ }
5903
+ this._resetButton();
5904
+ },
5905
+
5906
+ refresh: function() {
5907
+ var isDisabled = this.element.is( ":disabled" );
5908
+ if ( isDisabled !== this.options.disabled ) {
5909
+ this._setOption( "disabled", isDisabled );
5910
+ }
5911
+ if ( this.type === "radio" ) {
5912
+ radioGroup( this.element[0] ).each(function() {
5913
+ if ( $( this ).is( ":checked" ) ) {
5914
+ $( this ).button( "widget" )
5915
+ .addClass( "ui-state-active" )
5916
+ .attr( "aria-pressed", "true" );
5917
+ } else {
5918
+ $( this ).button( "widget" )
5919
+ .removeClass( "ui-state-active" )
5920
+ .attr( "aria-pressed", "false" );
5921
+ }
5922
+ });
5923
+ } else if ( this.type === "checkbox" ) {
5924
+ if ( this.element.is( ":checked" ) ) {
5925
+ this.buttonElement
5926
+ .addClass( "ui-state-active" )
5927
+ .attr( "aria-pressed", "true" );
5928
+ } else {
5929
+ this.buttonElement
5930
+ .removeClass( "ui-state-active" )
5931
+ .attr( "aria-pressed", "false" );
5932
+ }
5933
+ }
5934
+ },
5935
+
5936
+ _resetButton: function() {
5937
+ if ( this.type === "input" ) {
5938
+ if ( this.options.label ) {
5939
+ this.element.val( this.options.label );
5940
+ }
5941
+ return;
5942
+ }
5943
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
5944
+ buttonText = $( "<span></span>", this.element[0].ownerDocument )
5945
+ .addClass( "ui-button-text" )
5946
+ .html( this.options.label )
5947
+ .appendTo( buttonElement.empty() )
5948
+ .text(),
5949
+ icons = this.options.icons,
5950
+ multipleIcons = icons.primary && icons.secondary,
5951
+ buttonClasses = [];
5952
+
5953
+ if ( icons.primary || icons.secondary ) {
5954
+ if ( this.options.text ) {
5955
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
5956
+ }
5957
+
5958
+ if ( icons.primary ) {
5959
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
5960
+ }
5961
+
5962
+ if ( icons.secondary ) {
5963
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
5964
+ }
5965
+
5966
+ if ( !this.options.text ) {
5967
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
5968
+
5969
+ if ( !this.hasTitle ) {
5970
+ buttonElement.attr( "title", buttonText );
5971
+ }
5972
+ }
5973
+ } else {
5974
+ buttonClasses.push( "ui-button-text-only" );
5975
+ }
5976
+ buttonElement.addClass( buttonClasses.join( " " ) );
5977
+ }
5978
+ });
5979
+
5980
+ $.widget( "ui.buttonset", {
5981
+ options: {
5982
+ items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
5983
+ },
5984
+
5985
+ _create: function() {
5986
+ this.element.addClass( "ui-buttonset" );
5987
+ },
5988
+
5989
+ _init: function() {
5990
+ this.refresh();
5991
+ },
5992
+
5993
+ _setOption: function( key, value ) {
5994
+ if ( key === "disabled" ) {
5995
+ this.buttons.button( "option", key, value );
5996
+ }
5997
+
5998
+ $.Widget.prototype._setOption.apply( this, arguments );
5999
+ },
6000
+
6001
+ refresh: function() {
6002
+ var rtl = this.element.css( "direction" ) === "rtl";
6003
+
6004
+ this.buttons = this.element.find( this.options.items )
6005
+ .filter( ":ui-button" )
6006
+ .button( "refresh" )
6007
+ .end()
6008
+ .not( ":ui-button" )
6009
+ .button()
6010
+ .end()
6011
+ .map(function() {
6012
+ return $( this ).button( "widget" )[ 0 ];
6013
+ })
6014
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
6015
+ .filter( ":first" )
6016
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
6017
+ .end()
6018
+ .filter( ":last" )
6019
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
6020
+ .end()
6021
+ .end();
6022
+ },
6023
+
6024
+ destroy: function() {
6025
+ this.element.removeClass( "ui-buttonset" );
6026
+ this.buttons
6027
+ .map(function() {
6028
+ return $( this ).button( "widget" )[ 0 ];
6029
+ })
6030
+ .removeClass( "ui-corner-left ui-corner-right" )
6031
+ .end()
6032
+ .button( "destroy" );
6033
+
6034
+ $.Widget.prototype.destroy.call( this );
6035
+ }
6036
+ });
6037
+
6038
+ }( jQuery ) );
6039
+ /*!
6040
+ * jQuery UI Dialog 1.8.24
6041
+ *
6042
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
6043
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6044
+ * http://jquery.org/license
6045
+ *
6046
+ * http://docs.jquery.com/UI/Dialog
6047
+ *
6048
+ * Depends:
6049
+ * jquery.ui.core.js
6050
+ * jquery.ui.widget.js
6051
+ * jquery.ui.button.js
6052
+ * jquery.ui.draggable.js
6053
+ * jquery.ui.mouse.js
6054
+ * jquery.ui.position.js
6055
+ * jquery.ui.resizable.js
6056
+ */
6057
+ (function( $, undefined ) {
6058
+
6059
+ var uiDialogClasses =
6060
+ 'ui-dialog ' +
6061
+ 'ui-widget ' +
6062
+ 'ui-widget-content ' +
6063
+ 'ui-corner-all ',
6064
+ sizeRelatedOptions = {
6065
+ buttons: true,
6066
+ height: true,
6067
+ maxHeight: true,
6068
+ maxWidth: true,
6069
+ minHeight: true,
6070
+ minWidth: true,
6071
+ width: true
6072
+ },
6073
+ resizableRelatedOptions = {
6074
+ maxHeight: true,
6075
+ maxWidth: true,
6076
+ minHeight: true,
6077
+ minWidth: true
6078
+ };
6079
+
6080
+ $.widget("ui.dialog", {
6081
+ options: {
6082
+ autoOpen: true,
6083
+ buttons: {},
6084
+ closeOnEscape: true,
6085
+ closeText: 'close',
6086
+ dialogClass: '',
6087
+ draggable: true,
6088
+ hide: null,
6089
+ height: 'auto',
6090
+ maxHeight: false,
6091
+ maxWidth: false,
6092
+ minHeight: 150,
6093
+ minWidth: 150,
6094
+ modal: false,
6095
+ position: {
6096
+ my: 'center',
6097
+ at: 'center',
6098
+ collision: 'fit',
6099
+ // ensure that the titlebar is never outside the document
6100
+ using: function(pos) {
6101
+ var topOffset = $(this).css(pos).offset().top;
6102
+ if (topOffset < 0) {
6103
+ $(this).css('top', pos.top - topOffset);
6104
+ }
6105
+ }
6106
+ },
6107
+ resizable: true,
6108
+ show: null,
6109
+ stack: true,
6110
+ title: '',
6111
+ width: 300,
6112
+ zIndex: 1000
6113
+ },
6114
+
6115
+ _create: function() {
6116
+ this.originalTitle = this.element.attr('title');
6117
+ // #5742 - .attr() might return a DOMElement
6118
+ if ( typeof this.originalTitle !== "string" ) {
6119
+ this.originalTitle = "";
6120
+ }
6121
+
6122
+ this.options.title = this.options.title || this.originalTitle;
6123
+ var self = this,
6124
+ options = self.options,
6125
+
6126
+ title = options.title || '&#160;',
6127
+ titleId = $.ui.dialog.getTitleId(self.element),
6128
+
6129
+ uiDialog = (self.uiDialog = $('<div></div>'))
6130
+ .appendTo(document.body)
6131
+ .hide()
6132
+ .addClass(uiDialogClasses + options.dialogClass)
6133
+ .css({
6134
+ zIndex: options.zIndex
6135
+ })
6136
+ // setting tabIndex makes the div focusable
6137
+ // setting outline to 0 prevents a border on focus in Mozilla
6138
+ .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
6139
+ if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
6140
+ event.keyCode === $.ui.keyCode.ESCAPE) {
6141
+
6142
+ self.close(event);
6143
+ event.preventDefault();
6144
+ }
6145
+ })
6146
+ .attr({
6147
+ role: 'dialog',
6148
+ 'aria-labelledby': titleId
6149
+ })
6150
+ .mousedown(function(event) {
6151
+ self.moveToTop(false, event);
6152
+ }),
6153
+
6154
+ uiDialogContent = self.element
6155
+ .show()
6156
+ .removeAttr('title')
6157
+ .addClass(
6158
+ 'ui-dialog-content ' +
6159
+ 'ui-widget-content')
6160
+ .appendTo(uiDialog),
6161
+
6162
+ uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
6163
+ .addClass(
6164
+ 'ui-dialog-titlebar ' +
6165
+ 'ui-widget-header ' +
6166
+ 'ui-corner-all ' +
6167
+ 'ui-helper-clearfix'
6168
+ )
6169
+ .prependTo(uiDialog),
6170
+
6171
+ uiDialogTitlebarClose = $('<a href="#"></a>')
6172
+ .addClass(
6173
+ 'ui-dialog-titlebar-close ' +
6174
+ 'ui-corner-all'
6175
+ )
6176
+ .attr('role', 'button')
6177
+ .hover(
6178
+ function() {
6179
+ uiDialogTitlebarClose.addClass('ui-state-hover');
6180
+ },
6181
+ function() {
6182
+ uiDialogTitlebarClose.removeClass('ui-state-hover');
6183
+ }
6184
+ )
6185
+ .focus(function() {
6186
+ uiDialogTitlebarClose.addClass('ui-state-focus');
6187
+ })
6188
+ .blur(function() {
6189
+ uiDialogTitlebarClose.removeClass('ui-state-focus');
6190
+ })
6191
+ .click(function(event) {
6192
+ self.close(event);
6193
+ return false;
6194
+ })
6195
+ .appendTo(uiDialogTitlebar),
6196
+
6197
+ uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
6198
+ .addClass(
6199
+ 'ui-icon ' +
6200
+ 'ui-icon-closethick'
6201
+ )
6202
+ .text(options.closeText)
6203
+ .appendTo(uiDialogTitlebarClose),
6204
+
6205
+ uiDialogTitle = $('<span></span>')
6206
+ .addClass('ui-dialog-title')
6207
+ .attr('id', titleId)
6208
+ .html(title)
6209
+ .prependTo(uiDialogTitlebar);
6210
+
6211
+ //handling of deprecated beforeclose (vs beforeClose) option
6212
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
6213
+ //TODO: remove in 1.9pre
6214
+ if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
6215
+ options.beforeClose = options.beforeclose;
6216
+ }
6217
+
6218
+ uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
6219
+
6220
+ if (options.draggable && $.fn.draggable) {
6221
+ self._makeDraggable();
6222
+ }
6223
+ if (options.resizable && $.fn.resizable) {
6224
+ self._makeResizable();
6225
+ }
6226
+
6227
+ self._createButtons(options.buttons);
6228
+ self._isOpen = false;
6229
+
6230
+ if ($.fn.bgiframe) {
6231
+ uiDialog.bgiframe();
6232
+ }
6233
+ },
6234
+
6235
+ _init: function() {
6236
+ if ( this.options.autoOpen ) {
6237
+ this.open();
6238
+ }
6239
+ },
6240
+
6241
+ destroy: function() {
6242
+ var self = this;
6243
+
6244
+ if (self.overlay) {
6245
+ self.overlay.destroy();
6246
+ }
6247
+ self.uiDialog.hide();
6248
+ self.element
6249
+ .unbind('.dialog')
6250
+ .removeData('dialog')
6251
+ .removeClass('ui-dialog-content ui-widget-content')
6252
+ .hide().appendTo('body');
6253
+ self.uiDialog.remove();
6254
+
6255
+ if (self.originalTitle) {
6256
+ self.element.attr('title', self.originalTitle);
6257
+ }
6258
+
6259
+ return self;
6260
+ },
6261
+
6262
+ widget: function() {
6263
+ return this.uiDialog;
6264
+ },
6265
+
6266
+ close: function(event) {
6267
+ var self = this,
6268
+ maxZ, thisZ;
6269
+
6270
+ if (false === self._trigger('beforeClose', event)) {
6271
+ return;
6272
+ }
6273
+
6274
+ if (self.overlay) {
6275
+ self.overlay.destroy();
6276
+ }
6277
+ self.uiDialog.unbind('keypress.ui-dialog');
6278
+
6279
+ self._isOpen = false;
6280
+
6281
+ if (self.options.hide) {
6282
+ self.uiDialog.hide(self.options.hide, function() {
6283
+ self._trigger('close', event);
6284
+ });
6285
+ } else {
6286
+ self.uiDialog.hide();
6287
+ self._trigger('close', event);
6288
+ }
6289
+
6290
+ $.ui.dialog.overlay.resize();
6291
+
6292
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
6293
+ if (self.options.modal) {
6294
+ maxZ = 0;
6295
+ $('.ui-dialog').each(function() {
6296
+ if (this !== self.uiDialog[0]) {
6297
+ thisZ = $(this).css('z-index');
6298
+ if(!isNaN(thisZ)) {
6299
+ maxZ = Math.max(maxZ, thisZ);
6300
+ }
6301
+ }
6302
+ });
6303
+ $.ui.dialog.maxZ = maxZ;
6304
+ }
6305
+
6306
+ return self;
6307
+ },
6308
+
6309
+ isOpen: function() {
6310
+ return this._isOpen;
6311
+ },
6312
+
6313
+ // the force parameter allows us to move modal dialogs to their correct
6314
+ // position on open
6315
+ moveToTop: function(force, event) {
6316
+ var self = this,
6317
+ options = self.options,
6318
+ saveScroll;
6319
+
6320
+ if ((options.modal && !force) ||
6321
+ (!options.stack && !options.modal)) {
6322
+ return self._trigger('focus', event);
6323
+ }
6324
+
6325
+ if (options.zIndex > $.ui.dialog.maxZ) {
6326
+ $.ui.dialog.maxZ = options.zIndex;
6327
+ }
6328
+ if (self.overlay) {
6329
+ $.ui.dialog.maxZ += 1;
6330
+ self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
6331
+ }
6332
+
6333
+ //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
6334
+ // http://ui.jquery.com/bugs/ticket/3193
6335
+ saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() };
6336
+ $.ui.dialog.maxZ += 1;
6337
+ self.uiDialog.css('z-index', $.ui.dialog.maxZ);
6338
+ self.element.attr(saveScroll);
6339
+ self._trigger('focus', event);
6340
+
6341
+ return self;
6342
+ },
6343
+
6344
+ open: function() {
6345
+ if (this._isOpen) { return; }
6346
+
6347
+ var self = this,
6348
+ options = self.options,
6349
+ uiDialog = self.uiDialog;
6350
+
6351
+ self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
6352
+ self._size();
6353
+ self._position(options.position);
6354
+ uiDialog.show(options.show);
6355
+ self.moveToTop(true);
6356
+
6357
+ // prevent tabbing out of modal dialogs
6358
+ if ( options.modal ) {
6359
+ uiDialog.bind( "keydown.ui-dialog", function( event ) {
6360
+ if ( event.keyCode !== $.ui.keyCode.TAB ) {
6361
+ return;
6362
+ }
6363
+
6364
+ var tabbables = $(':tabbable', this),
6365
+ first = tabbables.filter(':first'),
6366
+ last = tabbables.filter(':last');
6367
+
6368
+ if (event.target === last[0] && !event.shiftKey) {
6369
+ first.focus(1);
6370
+ return false;
6371
+ } else if (event.target === first[0] && event.shiftKey) {
6372
+ last.focus(1);
6373
+ return false;
6374
+ }
6375
+ });
6376
+ }
6377
+
6378
+ // set focus to the first tabbable element in the content area or the first button
6379
+ // if there are no tabbable elements, set focus on the dialog itself
6380
+ $(self.element.find(':tabbable').get().concat(
6381
+ uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
6382
+ uiDialog.get()))).eq(0).focus();
6383
+
6384
+ self._isOpen = true;
6385
+ self._trigger('open');
6386
+
6387
+ return self;
6388
+ },
6389
+
6390
+ _createButtons: function(buttons) {
6391
+ var self = this,
6392
+ hasButtons = false,
6393
+ uiDialogButtonPane = $('<div></div>')
6394
+ .addClass(
6395
+ 'ui-dialog-buttonpane ' +
6396
+ 'ui-widget-content ' +
6397
+ 'ui-helper-clearfix'
6398
+ ),
6399
+ uiButtonSet = $( "<div></div>" )
6400
+ .addClass( "ui-dialog-buttonset" )
6401
+ .appendTo( uiDialogButtonPane );
6402
+
6403
+ // if we already have a button pane, remove it
6404
+ self.uiDialog.find('.ui-dialog-buttonpane').remove();
6405
+
6406
+ if (typeof buttons === 'object' && buttons !== null) {
6407
+ $.each(buttons, function() {
6408
+ return !(hasButtons = true);
6409
+ });
6410
+ }
6411
+ if (hasButtons) {
6412
+ $.each(buttons, function(name, props) {
6413
+ props = $.isFunction( props ) ?
6414
+ { click: props, text: name } :
6415
+ props;
6416
+ var button = $('<button type="button"></button>')
6417
+ .click(function() {
6418
+ props.click.apply(self.element[0], arguments);
6419
+ })
6420
+ .appendTo(uiButtonSet);
6421
+ // can't use .attr( props, true ) with jQuery 1.3.2.
6422
+ $.each( props, function( key, value ) {
6423
+ if ( key === "click" ) {
6424
+ return;
6425
+ }
6426
+ if ( key in button ) {
6427
+ button[ key ]( value );
6428
+ } else {
6429
+ button.attr( key, value );
6430
+ }
6431
+ });
6432
+ if ($.fn.button) {
6433
+ button.button();
6434
+ }
6435
+ });
6436
+ uiDialogButtonPane.appendTo(self.uiDialog);
6437
+ }
6438
+ },
6439
+
6440
+ _makeDraggable: function() {
6441
+ var self = this,
6442
+ options = self.options,
6443
+ doc = $(document),
6444
+ heightBeforeDrag;
6445
+
6446
+ function filteredUi(ui) {
6447
+ return {
6448
+ position: ui.position,
6449
+ offset: ui.offset
6450
+ };
6451
+ }
6452
+
6453
+ self.uiDialog.draggable({
6454
+ cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
6455
+ handle: '.ui-dialog-titlebar',
6456
+ containment: 'document',
6457
+ start: function(event, ui) {
6458
+ heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
6459
+ $(this).height($(this).height()).addClass("ui-dialog-dragging");
6460
+ self._trigger('dragStart', event, filteredUi(ui));
6461
+ },
6462
+ drag: function(event, ui) {
6463
+ self._trigger('drag', event, filteredUi(ui));
6464
+ },
6465
+ stop: function(event, ui) {
6466
+ options.position = [ui.position.left - doc.scrollLeft(),
6467
+ ui.position.top - doc.scrollTop()];
6468
+ $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
6469
+ self._trigger('dragStop', event, filteredUi(ui));
6470
+ $.ui.dialog.overlay.resize();
6471
+ }
6472
+ });
6473
+ },
6474
+
6475
+ _makeResizable: function(handles) {
6476
+ handles = (handles === undefined ? this.options.resizable : handles);
6477
+ var self = this,
6478
+ options = self.options,
6479
+ // .ui-resizable has position: relative defined in the stylesheet
6480
+ // but dialogs have to use absolute or fixed positioning
6481
+ position = self.uiDialog.css('position'),
6482
+ resizeHandles = (typeof handles === 'string' ?
6483
+ handles :
6484
+ 'n,e,s,w,se,sw,ne,nw'
6485
+ );
6486
+
6487
+ function filteredUi(ui) {
6488
+ return {
6489
+ originalPosition: ui.originalPosition,
6490
+ originalSize: ui.originalSize,
6491
+ position: ui.position,
6492
+ size: ui.size
6493
+ };
6494
+ }
6495
+
6496
+ self.uiDialog.resizable({
6497
+ cancel: '.ui-dialog-content',
6498
+ containment: 'document',
6499
+ alsoResize: self.element,
6500
+ maxWidth: options.maxWidth,
6501
+ maxHeight: options.maxHeight,
6502
+ minWidth: options.minWidth,
6503
+ minHeight: self._minHeight(),
6504
+ handles: resizeHandles,
6505
+ start: function(event, ui) {
6506
+ $(this).addClass("ui-dialog-resizing");
6507
+ self._trigger('resizeStart', event, filteredUi(ui));
6508
+ },
6509
+ resize: function(event, ui) {
6510
+ self._trigger('resize', event, filteredUi(ui));
6511
+ },
6512
+ stop: function(event, ui) {
6513
+ $(this).removeClass("ui-dialog-resizing");
6514
+ options.height = $(this).height();
6515
+ options.width = $(this).width();
6516
+ self._trigger('resizeStop', event, filteredUi(ui));
6517
+ $.ui.dialog.overlay.resize();
6518
+ }
6519
+ })
6520
+ .css('position', position)
6521
+ .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
6522
+ },
6523
+
6524
+ _minHeight: function() {
6525
+ var options = this.options;
6526
+
6527
+ if (options.height === 'auto') {
6528
+ return options.minHeight;
6529
+ } else {
6530
+ return Math.min(options.minHeight, options.height);
6531
+ }
6532
+ },
6533
+
6534
+ _position: function(position) {
6535
+ var myAt = [],
6536
+ offset = [0, 0],
6537
+ isVisible;
6538
+
6539
+ if (position) {
6540
+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
6541
+ // if (typeof position == 'string' || $.isArray(position)) {
6542
+ // myAt = $.isArray(position) ? position : position.split(' ');
6543
+
6544
+ if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
6545
+ myAt = position.split ? position.split(' ') : [position[0], position[1]];
6546
+ if (myAt.length === 1) {
6547
+ myAt[1] = myAt[0];
6548
+ }
6549
+
6550
+ $.each(['left', 'top'], function(i, offsetPosition) {
6551
+ if (+myAt[i] === myAt[i]) {
6552
+ offset[i] = myAt[i];
6553
+ myAt[i] = offsetPosition;
6554
+ }
6555
+ });
6556
+
6557
+ position = {
6558
+ my: myAt.join(" "),
6559
+ at: myAt.join(" "),
6560
+ offset: offset.join(" ")
6561
+ };
6562
+ }
6563
+
6564
+ position = $.extend({}, $.ui.dialog.prototype.options.position, position);
6565
+ } else {
6566
+ position = $.ui.dialog.prototype.options.position;
6567
+ }
6568
+
6569
+ // need to show the dialog to get the actual offset in the position plugin
6570
+ isVisible = this.uiDialog.is(':visible');
6571
+ if (!isVisible) {
6572
+ this.uiDialog.show();
6573
+ }
6574
+ this.uiDialog
6575
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
6576
+ .css({ top: 0, left: 0 })
6577
+ .position($.extend({ of: window }, position));
6578
+ if (!isVisible) {
6579
+ this.uiDialog.hide();
6580
+ }
6581
+ },
6582
+
6583
+ _setOptions: function( options ) {
6584
+ var self = this,
6585
+ resizableOptions = {},
6586
+ resize = false;
6587
+
6588
+ $.each( options, function( key, value ) {
6589
+ self._setOption( key, value );
6590
+
6591
+ if ( key in sizeRelatedOptions ) {
6592
+ resize = true;
6593
+ }
6594
+ if ( key in resizableRelatedOptions ) {
6595
+ resizableOptions[ key ] = value;
6596
+ }
6597
+ });
6598
+
6599
+ if ( resize ) {
6600
+ this._size();
6601
+ }
6602
+ if ( this.uiDialog.is( ":data(resizable)" ) ) {
6603
+ this.uiDialog.resizable( "option", resizableOptions );
6604
+ }
6605
+ },
6606
+
6607
+ _setOption: function(key, value){
6608
+ var self = this,
6609
+ uiDialog = self.uiDialog;
6610
+
6611
+ switch (key) {
6612
+ //handling of deprecated beforeclose (vs beforeClose) option
6613
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
6614
+ //TODO: remove in 1.9pre
6615
+ case "beforeclose":
6616
+ key = "beforeClose";
6617
+ break;
6618
+ case "buttons":
6619
+ self._createButtons(value);
6620
+ break;
6621
+ case "closeText":
6622
+ // ensure that we always pass a string
6623
+ self.uiDialogTitlebarCloseText.text("" + value);
6624
+ break;
6625
+ case "dialogClass":
6626
+ uiDialog
6627
+ .removeClass(self.options.dialogClass)
6628
+ .addClass(uiDialogClasses + value);
6629
+ break;
6630
+ case "disabled":
6631
+ if (value) {
6632
+ uiDialog.addClass('ui-dialog-disabled');
6633
+ } else {
6634
+ uiDialog.removeClass('ui-dialog-disabled');
6635
+ }
6636
+ break;
6637
+ case "draggable":
6638
+ var isDraggable = uiDialog.is( ":data(draggable)" );
6639
+ if ( isDraggable && !value ) {
6640
+ uiDialog.draggable( "destroy" );
6641
+ }
6642
+
6643
+ if ( !isDraggable && value ) {
6644
+ self._makeDraggable();
6645
+ }
6646
+ break;
6647
+ case "position":
6648
+ self._position(value);
6649
+ break;
6650
+ case "resizable":
6651
+ // currently resizable, becoming non-resizable
6652
+ var isResizable = uiDialog.is( ":data(resizable)" );
6653
+ if (isResizable && !value) {
6654
+ uiDialog.resizable('destroy');
6655
+ }
6656
+
6657
+ // currently resizable, changing handles
6658
+ if (isResizable && typeof value === 'string') {
6659
+ uiDialog.resizable('option', 'handles', value);
6660
+ }
6661
+
6662
+ // currently non-resizable, becoming resizable
6663
+ if (!isResizable && value !== false) {
6664
+ self._makeResizable(value);
6665
+ }
6666
+ break;
6667
+ case "title":
6668
+ // convert whatever was passed in o a string, for html() to not throw up
6669
+ $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
6670
+ break;
6671
+ }
6672
+
6673
+ $.Widget.prototype._setOption.apply(self, arguments);
6674
+ },
6675
+
6676
+ _size: function() {
6677
+ /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
6678
+ * divs will both have width and height set, so we need to reset them
6679
+ */
6680
+ var options = this.options,
6681
+ nonContentHeight,
6682
+ minContentHeight,
6683
+ isVisible = this.uiDialog.is( ":visible" );
6684
+
6685
+ // reset content sizing
6686
+ this.element.show().css({
6687
+ width: 'auto',
6688
+ minHeight: 0,
6689
+ height: 0
6690
+ });
6691
+
6692
+ if (options.minWidth > options.width) {
6693
+ options.width = options.minWidth;
6694
+ }
6695
+
6696
+ // reset wrapper sizing
6697
+ // determine the height of all the non-content elements
6698
+ nonContentHeight = this.uiDialog.css({
6699
+ height: 'auto',
6700
+ width: options.width
6701
+ })
6702
+ .height();
6703
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
6704
+
6705
+ if ( options.height === "auto" ) {
6706
+ // only needed for IE6 support
6707
+ if ( $.support.minHeight ) {
6708
+ this.element.css({
6709
+ minHeight: minContentHeight,
6710
+ height: "auto"
6711
+ });
6712
+ } else {
6713
+ this.uiDialog.show();
6714
+ var autoHeight = this.element.css( "height", "auto" ).height();
6715
+ if ( !isVisible ) {
6716
+ this.uiDialog.hide();
6717
+ }
6718
+ this.element.height( Math.max( autoHeight, minContentHeight ) );
6719
+ }
6720
+ } else {
6721
+ this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
6722
+ }
6723
+
6724
+ if (this.uiDialog.is(':data(resizable)')) {
6725
+ this.uiDialog.resizable('option', 'minHeight', this._minHeight());
6726
+ }
6727
+ }
6728
+ });
6729
+
6730
+ $.extend($.ui.dialog, {
6731
+ version: "1.8.24",
6732
+
6733
+ uuid: 0,
6734
+ maxZ: 0,
6735
+
6736
+ getTitleId: function($el) {
6737
+ var id = $el.attr('id');
6738
+ if (!id) {
6739
+ this.uuid += 1;
6740
+ id = this.uuid;
6741
+ }
6742
+ return 'ui-dialog-title-' + id;
6743
+ },
6744
+
6745
+ overlay: function(dialog) {
6746
+ this.$el = $.ui.dialog.overlay.create(dialog);
6747
+ }
6748
+ });
6749
+
6750
+ $.extend($.ui.dialog.overlay, {
6751
+ instances: [],
6752
+ // reuse old instances due to IE memory leak with alpha transparency (see #5185)
6753
+ oldInstances: [],
6754
+ maxZ: 0,
6755
+ events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
6756
+ function(event) { return event + '.dialog-overlay'; }).join(' '),
6757
+ create: function(dialog) {
6758
+ if (this.instances.length === 0) {
6759
+ // prevent use of anchors and inputs
6760
+ // we use a setTimeout in case the overlay is created from an
6761
+ // event that we're going to be cancelling (see #2804)
6762
+ setTimeout(function() {
6763
+ // handle $(el).dialog().dialog('close') (see #4065)
6764
+ if ($.ui.dialog.overlay.instances.length) {
6765
+ $(document).bind($.ui.dialog.overlay.events, function(event) {
6766
+ // stop events if the z-index of the target is < the z-index of the overlay
6767
+ // we cannot return true when we don't want to cancel the event (#3523)
6768
+ if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
6769
+ return false;
6770
+ }
6771
+ });
6772
+ }
6773
+ }, 1);
6774
+
6775
+ // allow closing by pressing the escape key
6776
+ $(document).bind('keydown.dialog-overlay', function(event) {
6777
+ if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
6778
+ event.keyCode === $.ui.keyCode.ESCAPE) {
6779
+
6780
+ dialog.close(event);
6781
+ event.preventDefault();
6782
+ }
6783
+ });
6784
+
6785
+ // handle window resize
6786
+ $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
6787
+ }
6788
+
6789
+ var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
6790
+ .appendTo(document.body)
6791
+ .css({
6792
+ width: this.width(),
6793
+ height: this.height()
6794
+ });
6795
+
6796
+ if ($.fn.bgiframe) {
6797
+ $el.bgiframe();
6798
+ }
6799
+
6800
+ this.instances.push($el);
6801
+ return $el;
6802
+ },
6803
+
6804
+ destroy: function($el) {
6805
+ var indexOf = $.inArray($el, this.instances);
6806
+ if (indexOf != -1){
6807
+ this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
6808
+ }
6809
+
6810
+ if (this.instances.length === 0) {
6811
+ $([document, window]).unbind('.dialog-overlay');
6812
+ }
6813
+
6814
+ $el.remove();
6815
+
6816
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
6817
+ var maxZ = 0;
6818
+ $.each(this.instances, function() {
6819
+ maxZ = Math.max(maxZ, this.css('z-index'));
6820
+ });
6821
+ this.maxZ = maxZ;
6822
+ },
6823
+
6824
+ height: function() {
6825
+ var scrollHeight,
6826
+ offsetHeight;
6827
+ // handle IE 6
6828
+ if ($.browser.msie && $.browser.version < 7) {
6829
+ scrollHeight = Math.max(
6830
+ document.documentElement.scrollHeight,
6831
+ document.body.scrollHeight
6832
+ );
6833
+ offsetHeight = Math.max(
6834
+ document.documentElement.offsetHeight,
6835
+ document.body.offsetHeight
6836
+ );
6837
+
6838
+ if (scrollHeight < offsetHeight) {
6839
+ return $(window).height() + 'px';
6840
+ } else {
6841
+ return scrollHeight + 'px';
6842
+ }
6843
+ // handle "good" browsers
6844
+ } else {
6845
+ return $(document).height() + 'px';
6846
+ }
6847
+ },
6848
+
6849
+ width: function() {
6850
+ var scrollWidth,
6851
+ offsetWidth;
6852
+ // handle IE
6853
+ if ( $.browser.msie ) {
6854
+ scrollWidth = Math.max(
6855
+ document.documentElement.scrollWidth,
6856
+ document.body.scrollWidth
6857
+ );
6858
+ offsetWidth = Math.max(
6859
+ document.documentElement.offsetWidth,
6860
+ document.body.offsetWidth
6861
+ );
6862
+
6863
+ if (scrollWidth < offsetWidth) {
6864
+ return $(window).width() + 'px';
6865
+ } else {
6866
+ return scrollWidth + 'px';
6867
+ }
6868
+ // handle "good" browsers
6869
+ } else {
6870
+ return $(document).width() + 'px';
6871
+ }
6872
+ },
6873
+
6874
+ resize: function() {
6875
+ /* If the dialog is draggable and the user drags it past the
6876
+ * right edge of the window, the document becomes wider so we
6877
+ * need to stretch the overlay. If the user then drags the
6878
+ * dialog back to the left, the document will become narrower,
6879
+ * so we need to shrink the overlay to the appropriate size.
6880
+ * This is handled by shrinking the overlay before setting it
6881
+ * to the full document size.
6882
+ */
6883
+ var $overlays = $([]);
6884
+ $.each($.ui.dialog.overlay.instances, function() {
6885
+ $overlays = $overlays.add(this);
6886
+ });
6887
+
6888
+ $overlays.css({
6889
+ width: 0,
6890
+ height: 0
6891
+ }).css({
6892
+ width: $.ui.dialog.overlay.width(),
6893
+ height: $.ui.dialog.overlay.height()
6894
+ });
6895
+ }
6896
+ });
6897
+
6898
+ $.extend($.ui.dialog.overlay.prototype, {
6899
+ destroy: function() {
6900
+ $.ui.dialog.overlay.destroy(this.$el);
6901
+ }
6902
+ });
6903
+
6904
+ }(jQuery));
6905
+ /*!
6906
+ * jQuery UI Slider 1.8.24
6907
+ *
6908
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
6909
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6910
+ * http://jquery.org/license
6911
+ *
6912
+ * http://docs.jquery.com/UI/Slider
6913
+ *
6914
+ * Depends:
6915
+ * jquery.ui.core.js
6916
+ * jquery.ui.mouse.js
6917
+ * jquery.ui.widget.js
6918
+ */
6919
+ (function( $, undefined ) {
6920
+
6921
+ // number of pages in a slider
6922
+ // (how many times can you page up/down to go through the whole range)
6923
+ var numPages = 5;
6924
+
6925
+ $.widget( "ui.slider", $.ui.mouse, {
6926
+
6927
+ widgetEventPrefix: "slide",
6928
+
6929
+ options: {
6930
+ animate: false,
6931
+ distance: 0,
6932
+ max: 100,
6933
+ min: 0,
6934
+ orientation: "horizontal",
6935
+ range: false,
6936
+ step: 1,
6937
+ value: 0,
6938
+ values: null
6939
+ },
6940
+
6941
+ _create: function() {
6942
+ var self = this,
6943
+ o = this.options,
6944
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
6945
+ handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
6946
+ handleCount = ( o.values && o.values.length ) || 1,
6947
+ handles = [];
6948
+
6949
+ this._keySliding = false;
6950
+ this._mouseSliding = false;
6951
+ this._animateOff = true;
6952
+ this._handleIndex = null;
6953
+ this._detectOrientation();
6954
+ this._mouseInit();
6955
+
6956
+ this.element
6957
+ .addClass( "ui-slider" +
6958
+ " ui-slider-" + this.orientation +
6959
+ " ui-widget" +
6960
+ " ui-widget-content" +
6961
+ " ui-corner-all" +
6962
+ ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
6963
+
6964
+ this.range = $([]);
6965
+
6966
+ if ( o.range ) {
6967
+ if ( o.range === true ) {
6968
+ if ( !o.values ) {
6969
+ o.values = [ this._valueMin(), this._valueMin() ];
6970
+ }
6971
+ if ( o.values.length && o.values.length !== 2 ) {
6972
+ o.values = [ o.values[0], o.values[0] ];
6973
+ }
6974
+ }
6975
+
6976
+ this.range = $( "<div></div>" )
6977
+ .appendTo( this.element )
6978
+ .addClass( "ui-slider-range" +
6979
+ // note: this isn't the most fittingly semantic framework class for this element,
6980
+ // but worked best visually with a variety of themes
6981
+ " ui-widget-header" +
6982
+ ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
6983
+ }
6984
+
6985
+ for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
6986
+ handles.push( handle );
6987
+ }
6988
+
6989
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) );
6990
+
6991
+ this.handle = this.handles.eq( 0 );
6992
+
6993
+ this.handles.add( this.range ).filter( "a" )
6994
+ .click(function( event ) {
6995
+ event.preventDefault();
6996
+ })
6997
+ .hover(function() {
6998
+ if ( !o.disabled ) {
6999
+ $( this ).addClass( "ui-state-hover" );
7000
+ }
7001
+ }, function() {
7002
+ $( this ).removeClass( "ui-state-hover" );
7003
+ })
7004
+ .focus(function() {
7005
+ if ( !o.disabled ) {
7006
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
7007
+ $( this ).addClass( "ui-state-focus" );
7008
+ } else {
7009
+ $( this ).blur();
7010
+ }
7011
+ })
7012
+ .blur(function() {
7013
+ $( this ).removeClass( "ui-state-focus" );
7014
+ });
7015
+
7016
+ this.handles.each(function( i ) {
7017
+ $( this ).data( "index.ui-slider-handle", i );
7018
+ });
7019
+
7020
+ this.handles
7021
+ .keydown(function( event ) {
7022
+ var index = $( this ).data( "index.ui-slider-handle" ),
7023
+ allowed,
7024
+ curVal,
7025
+ newVal,
7026
+ step;
7027
+
7028
+ if ( self.options.disabled ) {
7029
+ return;
7030
+ }
7031
+
7032
+ switch ( event.keyCode ) {
7033
+ case $.ui.keyCode.HOME:
7034
+ case $.ui.keyCode.END:
7035
+ case $.ui.keyCode.PAGE_UP:
7036
+ case $.ui.keyCode.PAGE_DOWN:
7037
+ case $.ui.keyCode.UP:
7038
+ case $.ui.keyCode.RIGHT:
7039
+ case $.ui.keyCode.DOWN:
7040
+ case $.ui.keyCode.LEFT:
7041
+ event.preventDefault();
7042
+ if ( !self._keySliding ) {
7043
+ self._keySliding = true;
7044
+ $( this ).addClass( "ui-state-active" );
7045
+ allowed = self._start( event, index );
7046
+ if ( allowed === false ) {
7047
+ return;
7048
+ }
7049
+ }
7050
+ break;
7051
+ }
7052
+
7053
+ step = self.options.step;
7054
+ if ( self.options.values && self.options.values.length ) {
7055
+ curVal = newVal = self.values( index );
7056
+ } else {
7057
+ curVal = newVal = self.value();
7058
+ }
7059
+
7060
+ switch ( event.keyCode ) {
7061
+ case $.ui.keyCode.HOME:
7062
+ newVal = self._valueMin();
7063
+ break;
7064
+ case $.ui.keyCode.END:
7065
+ newVal = self._valueMax();
7066
+ break;
7067
+ case $.ui.keyCode.PAGE_UP:
7068
+ newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
7069
+ break;
7070
+ case $.ui.keyCode.PAGE_DOWN:
7071
+ newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
7072
+ break;
7073
+ case $.ui.keyCode.UP:
7074
+ case $.ui.keyCode.RIGHT:
7075
+ if ( curVal === self._valueMax() ) {
7076
+ return;
7077
+ }
7078
+ newVal = self._trimAlignValue( curVal + step );
7079
+ break;
7080
+ case $.ui.keyCode.DOWN:
7081
+ case $.ui.keyCode.LEFT:
7082
+ if ( curVal === self._valueMin() ) {
7083
+ return;
7084
+ }
7085
+ newVal = self._trimAlignValue( curVal - step );
7086
+ break;
7087
+ }
7088
+
7089
+ self._slide( event, index, newVal );
7090
+ })
7091
+ .keyup(function( event ) {
7092
+ var index = $( this ).data( "index.ui-slider-handle" );
7093
+
7094
+ if ( self._keySliding ) {
7095
+ self._keySliding = false;
7096
+ self._stop( event, index );
7097
+ self._change( event, index );
7098
+ $( this ).removeClass( "ui-state-active" );
7099
+ }
7100
+
7101
+ });
7102
+
7103
+ this._refreshValue();
7104
+
7105
+ this._animateOff = false;
7106
+ },
7107
+
7108
+ destroy: function() {
7109
+ this.handles.remove();
7110
+ this.range.remove();
7111
+
7112
+ this.element
7113
+ .removeClass( "ui-slider" +
7114
+ " ui-slider-horizontal" +
7115
+ " ui-slider-vertical" +
7116
+ " ui-slider-disabled" +
7117
+ " ui-widget" +
7118
+ " ui-widget-content" +
7119
+ " ui-corner-all" )
7120
+ .removeData( "slider" )
7121
+ .unbind( ".slider" );
7122
+
7123
+ this._mouseDestroy();
7124
+
7125
+ return this;
7126
+ },
7127
+
7128
+ _mouseCapture: function( event ) {
7129
+ var o = this.options,
7130
+ position,
7131
+ normValue,
7132
+ distance,
7133
+ closestHandle,
7134
+ self,
7135
+ index,
7136
+ allowed,
7137
+ offset,
7138
+ mouseOverHandle;
7139
+
7140
+ if ( o.disabled ) {
7141
+ return false;
7142
+ }
7143
+
7144
+ this.elementSize = {
7145
+ width: this.element.outerWidth(),
7146
+ height: this.element.outerHeight()
7147
+ };
7148
+ this.elementOffset = this.element.offset();
7149
+
7150
+ position = { x: event.pageX, y: event.pageY };
7151
+ normValue = this._normValueFromMouse( position );
7152
+ distance = this._valueMax() - this._valueMin() + 1;
7153
+ self = this;
7154
+ this.handles.each(function( i ) {
7155
+ var thisDistance = Math.abs( normValue - self.values(i) );
7156
+ if ( distance > thisDistance ) {
7157
+ distance = thisDistance;
7158
+ closestHandle = $( this );
7159
+ index = i;
7160
+ }
7161
+ });
7162
+
7163
+ // workaround for bug #3736 (if both handles of a range are at 0,
7164
+ // the first is always used as the one with least distance,
7165
+ // and moving it is obviously prevented by preventing negative ranges)
7166
+ if( o.range === true && this.values(1) === o.min ) {
7167
+ index += 1;
7168
+ closestHandle = $( this.handles[index] );
7169
+ }
7170
+
7171
+ allowed = this._start( event, index );
7172
+ if ( allowed === false ) {
7173
+ return false;
7174
+ }
7175
+ this._mouseSliding = true;
7176
+
7177
+ self._handleIndex = index;
7178
+
7179
+ closestHandle
7180
+ .addClass( "ui-state-active" )
7181
+ .focus();
7182
+
7183
+ offset = closestHandle.offset();
7184
+ mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
7185
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
7186
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
7187
+ top: event.pageY - offset.top -
7188
+ ( closestHandle.height() / 2 ) -
7189
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
7190
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
7191
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
7192
+ };
7193
+
7194
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
7195
+ this._slide( event, index, normValue );
7196
+ }
7197
+ this._animateOff = true;
7198
+ return true;
7199
+ },
7200
+
7201
+ _mouseStart: function( event ) {
7202
+ return true;
7203
+ },
7204
+
7205
+ _mouseDrag: function( event ) {
7206
+ var position = { x: event.pageX, y: event.pageY },
7207
+ normValue = this._normValueFromMouse( position );
7208
+
7209
+ this._slide( event, this._handleIndex, normValue );
7210
+
7211
+ return false;
7212
+ },
7213
+
7214
+ _mouseStop: function( event ) {
7215
+ this.handles.removeClass( "ui-state-active" );
7216
+ this._mouseSliding = false;
7217
+
7218
+ this._stop( event, this._handleIndex );
7219
+ this._change( event, this._handleIndex );
7220
+
7221
+ this._handleIndex = null;
7222
+ this._clickOffset = null;
7223
+ this._animateOff = false;
7224
+
7225
+ return false;
7226
+ },
7227
+
7228
+ _detectOrientation: function() {
7229
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
7230
+ },
7231
+
7232
+ _normValueFromMouse: function( position ) {
7233
+ var pixelTotal,
7234
+ pixelMouse,
7235
+ percentMouse,
7236
+ valueTotal,
7237
+ valueMouse;
7238
+
7239
+ if ( this.orientation === "horizontal" ) {
7240
+ pixelTotal = this.elementSize.width;
7241
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
7242
+ } else {
7243
+ pixelTotal = this.elementSize.height;
7244
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
7245
+ }
7246
+
7247
+ percentMouse = ( pixelMouse / pixelTotal );
7248
+ if ( percentMouse > 1 ) {
7249
+ percentMouse = 1;
7250
+ }
7251
+ if ( percentMouse < 0 ) {
7252
+ percentMouse = 0;
7253
+ }
7254
+ if ( this.orientation === "vertical" ) {
7255
+ percentMouse = 1 - percentMouse;
7256
+ }
7257
+
7258
+ valueTotal = this._valueMax() - this._valueMin();
7259
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
7260
+
7261
+ return this._trimAlignValue( valueMouse );
7262
+ },
7263
+
7264
+ _start: function( event, index ) {
7265
+ var uiHash = {
7266
+ handle: this.handles[ index ],
7267
+ value: this.value()
7268
+ };
7269
+ if ( this.options.values && this.options.values.length ) {
7270
+ uiHash.value = this.values( index );
7271
+ uiHash.values = this.values();
7272
+ }
7273
+ return this._trigger( "start", event, uiHash );
7274
+ },
7275
+
7276
+ _slide: function( event, index, newVal ) {
7277
+ var otherVal,
7278
+ newValues,
7279
+ allowed;
7280
+
7281
+ if ( this.options.values && this.options.values.length ) {
7282
+ otherVal = this.values( index ? 0 : 1 );
7283
+
7284
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
7285
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
7286
+ ) {
7287
+ newVal = otherVal;
7288
+ }
7289
+
7290
+ if ( newVal !== this.values( index ) ) {
7291
+ newValues = this.values();
7292
+ newValues[ index ] = newVal;
7293
+ // A slide can be canceled by returning false from the slide callback
7294
+ allowed = this._trigger( "slide", event, {
7295
+ handle: this.handles[ index ],
7296
+ value: newVal,
7297
+ values: newValues
7298
+ } );
7299
+ otherVal = this.values( index ? 0 : 1 );
7300
+ if ( allowed !== false ) {
7301
+ this.values( index, newVal, true );
7302
+ }
7303
+ }
7304
+ } else {
7305
+ if ( newVal !== this.value() ) {
7306
+ // A slide can be canceled by returning false from the slide callback
7307
+ allowed = this._trigger( "slide", event, {
7308
+ handle: this.handles[ index ],
7309
+ value: newVal
7310
+ } );
7311
+ if ( allowed !== false ) {
7312
+ this.value( newVal );
7313
+ }
7314
+ }
7315
+ }
7316
+ },
7317
+
7318
+ _stop: function( event, index ) {
7319
+ var uiHash = {
7320
+ handle: this.handles[ index ],
7321
+ value: this.value()
7322
+ };
7323
+ if ( this.options.values && this.options.values.length ) {
7324
+ uiHash.value = this.values( index );
7325
+ uiHash.values = this.values();
7326
+ }
7327
+
7328
+ this._trigger( "stop", event, uiHash );
7329
+ },
7330
+
7331
+ _change: function( event, index ) {
7332
+ if ( !this._keySliding && !this._mouseSliding ) {
7333
+ var uiHash = {
7334
+ handle: this.handles[ index ],
7335
+ value: this.value()
7336
+ };
7337
+ if ( this.options.values && this.options.values.length ) {
7338
+ uiHash.value = this.values( index );
7339
+ uiHash.values = this.values();
7340
+ }
7341
+
7342
+ this._trigger( "change", event, uiHash );
7343
+ }
7344
+ },
7345
+
7346
+ value: function( newValue ) {
7347
+ if ( arguments.length ) {
7348
+ this.options.value = this._trimAlignValue( newValue );
7349
+ this._refreshValue();
7350
+ this._change( null, 0 );
7351
+ return;
7352
+ }
7353
+
7354
+ return this._value();
7355
+ },
7356
+
7357
+ values: function( index, newValue ) {
7358
+ var vals,
7359
+ newValues,
7360
+ i;
7361
+
7362
+ if ( arguments.length > 1 ) {
7363
+ this.options.values[ index ] = this._trimAlignValue( newValue );
7364
+ this._refreshValue();
7365
+ this._change( null, index );
7366
+ return;
7367
+ }
7368
+
7369
+ if ( arguments.length ) {
7370
+ if ( $.isArray( arguments[ 0 ] ) ) {
7371
+ vals = this.options.values;
7372
+ newValues = arguments[ 0 ];
7373
+ for ( i = 0; i < vals.length; i += 1 ) {
7374
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
7375
+ this._change( null, i );
7376
+ }
7377
+ this._refreshValue();
7378
+ } else {
7379
+ if ( this.options.values && this.options.values.length ) {
7380
+ return this._values( index );
7381
+ } else {
7382
+ return this.value();
7383
+ }
7384
+ }
7385
+ } else {
7386
+ return this._values();
7387
+ }
7388
+ },
7389
+
7390
+ _setOption: function( key, value ) {
7391
+ var i,
7392
+ valsLength = 0;
7393
+
7394
+ if ( $.isArray( this.options.values ) ) {
7395
+ valsLength = this.options.values.length;
7396
+ }
7397
+
7398
+ $.Widget.prototype._setOption.apply( this, arguments );
7399
+
7400
+ switch ( key ) {
7401
+ case "disabled":
7402
+ if ( value ) {
7403
+ this.handles.filter( ".ui-state-focus" ).blur();
7404
+ this.handles.removeClass( "ui-state-hover" );
7405
+ this.handles.propAttr( "disabled", true );
7406
+ this.element.addClass( "ui-disabled" );
7407
+ } else {
7408
+ this.handles.propAttr( "disabled", false );
7409
+ this.element.removeClass( "ui-disabled" );
7410
+ }
7411
+ break;
7412
+ case "orientation":
7413
+ this._detectOrientation();
7414
+ this.element
7415
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
7416
+ .addClass( "ui-slider-" + this.orientation );
7417
+ this._refreshValue();
7418
+ break;
7419
+ case "value":
7420
+ this._animateOff = true;
7421
+ this._refreshValue();
7422
+ this._change( null, 0 );
7423
+ this._animateOff = false;
7424
+ break;
7425
+ case "values":
7426
+ this._animateOff = true;
7427
+ this._refreshValue();
7428
+ for ( i = 0; i < valsLength; i += 1 ) {
7429
+ this._change( null, i );
7430
+ }
7431
+ this._animateOff = false;
7432
+ break;
7433
+ }
7434
+ },
7435
+
7436
+ //internal value getter
7437
+ // _value() returns value trimmed by min and max, aligned by step
7438
+ _value: function() {
7439
+ var val = this.options.value;
7440
+ val = this._trimAlignValue( val );
7441
+
7442
+ return val;
7443
+ },
7444
+
7445
+ //internal values getter
7446
+ // _values() returns array of values trimmed by min and max, aligned by step
7447
+ // _values( index ) returns single value trimmed by min and max, aligned by step
7448
+ _values: function( index ) {
7449
+ var val,
7450
+ vals,
7451
+ i;
7452
+
7453
+ if ( arguments.length ) {
7454
+ val = this.options.values[ index ];
7455
+ val = this._trimAlignValue( val );
7456
+
7457
+ return val;
7458
+ } else {
7459
+ // .slice() creates a copy of the array
7460
+ // this copy gets trimmed by min and max and then returned
7461
+ vals = this.options.values.slice();
7462
+ for ( i = 0; i < vals.length; i+= 1) {
7463
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
7464
+ }
7465
+
7466
+ return vals;
7467
+ }
7468
+ },
7469
+
7470
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
7471
+ _trimAlignValue: function( val ) {
7472
+ if ( val <= this._valueMin() ) {
7473
+ return this._valueMin();
7474
+ }
7475
+ if ( val >= this._valueMax() ) {
7476
+ return this._valueMax();
7477
+ }
7478
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
7479
+ valModStep = (val - this._valueMin()) % step,
7480
+ alignValue = val - valModStep;
7481
+
7482
+ if ( Math.abs(valModStep) * 2 >= step ) {
7483
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
7484
+ }
7485
+
7486
+ // Since JavaScript has problems with large floats, round
7487
+ // the final value to 5 digits after the decimal point (see #4124)
7488
+ return parseFloat( alignValue.toFixed(5) );
7489
+ },
7490
+
7491
+ _valueMin: function() {
7492
+ return this.options.min;
7493
+ },
7494
+
7495
+ _valueMax: function() {
7496
+ return this.options.max;
7497
+ },
7498
+
7499
+ _refreshValue: function() {
7500
+ var oRange = this.options.range,
7501
+ o = this.options,
7502
+ self = this,
7503
+ animate = ( !this._animateOff ) ? o.animate : false,
7504
+ valPercent,
7505
+ _set = {},
7506
+ lastValPercent,
7507
+ value,
7508
+ valueMin,
7509
+ valueMax;
7510
+
7511
+ if ( this.options.values && this.options.values.length ) {
7512
+ this.handles.each(function( i, j ) {
7513
+ valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
7514
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
7515
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
7516
+ if ( self.options.range === true ) {
7517
+ if ( self.orientation === "horizontal" ) {
7518
+ if ( i === 0 ) {
7519
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
7520
+ }
7521
+ if ( i === 1 ) {
7522
+ self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
7523
+ }
7524
+ } else {
7525
+ if ( i === 0 ) {
7526
+ self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
7527
+ }
7528
+ if ( i === 1 ) {
7529
+ self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
7530
+ }
7531
+ }
7532
+ }
7533
+ lastValPercent = valPercent;
7534
+ });
7535
+ } else {
7536
+ value = this.value();
7537
+ valueMin = this._valueMin();
7538
+ valueMax = this._valueMax();
7539
+ valPercent = ( valueMax !== valueMin ) ?
7540
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
7541
+ 0;
7542
+ _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
7543
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
7544
+
7545
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
7546
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
7547
+ }
7548
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
7549
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
7550
+ }
7551
+ if ( oRange === "min" && this.orientation === "vertical" ) {
7552
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
7553
+ }
7554
+ if ( oRange === "max" && this.orientation === "vertical" ) {
7555
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
7556
+ }
7557
+ }
7558
+ }
7559
+
7560
+ });
7561
+
7562
+ $.extend( $.ui.slider, {
7563
+ version: "1.8.24"
7564
+ });
7565
+
7566
+ }(jQuery));
7567
+ /*!
7568
+ * jQuery UI Tabs 1.8.24
7569
+ *
7570
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
7571
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7572
+ * http://jquery.org/license
7573
+ *
7574
+ * http://docs.jquery.com/UI/Tabs
7575
+ *
7576
+ * Depends:
7577
+ * jquery.ui.core.js
7578
+ * jquery.ui.widget.js
7579
+ */
7580
+ (function( $, undefined ) {
7581
+
7582
+ var tabId = 0,
7583
+ listId = 0;
7584
+
7585
+ function getNextTabId() {
7586
+ return ++tabId;
7587
+ }
7588
+
7589
+ function getNextListId() {
7590
+ return ++listId;
7591
+ }
7592
+
7593
+ $.widget( "ui.tabs", {
7594
+ options: {
7595
+ add: null,
7596
+ ajaxOptions: null,
7597
+ cache: false,
7598
+ cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
7599
+ collapsible: false,
7600
+ disable: null,
7601
+ disabled: [],
7602
+ enable: null,
7603
+ event: "click",
7604
+ fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
7605
+ idPrefix: "ui-tabs-",
7606
+ load: null,
7607
+ panelTemplate: "<div></div>",
7608
+ remove: null,
7609
+ select: null,
7610
+ show: null,
7611
+ spinner: "<em>Loading&#8230;</em>",
7612
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
7613
+ },
7614
+
7615
+ _create: function() {
7616
+ this._tabify( true );
7617
+ },
7618
+
7619
+ _setOption: function( key, value ) {
7620
+ if ( key == "selected" ) {
7621
+ if (this.options.collapsible && value == this.options.selected ) {
7622
+ return;
7623
+ }
7624
+ this.select( value );
7625
+ } else {
7626
+ this.options[ key ] = value;
7627
+ this._tabify();
7628
+ }
7629
+ },
7630
+
7631
+ _tabId: function( a ) {
7632
+ return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
7633
+ this.options.idPrefix + getNextTabId();
7634
+ },
7635
+
7636
+ _sanitizeSelector: function( hash ) {
7637
+ // we need this because an id may contain a ":"
7638
+ return hash.replace( /:/g, "\\:" );
7639
+ },
7640
+
7641
+ _cookie: function() {
7642
+ var cookie = this.cookie ||
7643
+ ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
7644
+ return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
7645
+ },
7646
+
7647
+ _ui: function( tab, panel ) {
7648
+ return {
7649
+ tab: tab,
7650
+ panel: panel,
7651
+ index: this.anchors.index( tab )
7652
+ };
7653
+ },
7654
+
7655
+ _cleanup: function() {
7656
+ // restore all former loading tabs labels
7657
+ this.lis.filter( ".ui-state-processing" )
7658
+ .removeClass( "ui-state-processing" )
7659
+ .find( "span:data(label.tabs)" )
7660
+ .each(function() {
7661
+ var el = $( this );
7662
+ el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
7663
+ });
7664
+ },
7665
+
7666
+ _tabify: function( init ) {
7667
+ var self = this,
7668
+ o = this.options,
7669
+ fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
7670
+
7671
+ this.list = this.element.find( "ol,ul" ).eq( 0 );
7672
+ this.lis = $( " > li:has(a[href])", this.list );
7673
+ this.anchors = this.lis.map(function() {
7674
+ return $( "a", this )[ 0 ];
7675
+ });
7676
+ this.panels = $( [] );
7677
+
7678
+ this.anchors.each(function( i, a ) {
7679
+ var href = $( a ).attr( "href" );
7680
+ // For dynamically created HTML that contains a hash as href IE < 8 expands
7681
+ // such href to the full page url with hash and then misinterprets tab as ajax.
7682
+ // Same consideration applies for an added tab with a fragment identifier
7683
+ // since a[href=#fragment-identifier] does unexpectedly not match.
7684
+ // Thus normalize href attribute...
7685
+ var hrefBase = href.split( "#" )[ 0 ],
7686
+ baseEl;
7687
+ if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
7688
+ ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
7689
+ href = a.hash;
7690
+ a.href = href;
7691
+ }
7692
+
7693
+ // inline tab
7694
+ if ( fragmentId.test( href ) ) {
7695
+ self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
7696
+ // remote tab
7697
+ // prevent loading the page itself if href is just "#"
7698
+ } else if ( href && href !== "#" ) {
7699
+ // required for restore on destroy
7700
+ $.data( a, "href.tabs", href );
7701
+
7702
+ // TODO until #3808 is fixed strip fragment identifier from url
7703
+ // (IE fails to load from such url)
7704
+ $.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
7705
+
7706
+ var id = self._tabId( a );
7707
+ a.href = "#" + id;
7708
+ var $panel = self.element.find( "#" + id );
7709
+ if ( !$panel.length ) {
7710
+ $panel = $( o.panelTemplate )
7711
+ .attr( "id", id )
7712
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
7713
+ .insertAfter( self.panels[ i - 1 ] || self.list );
7714
+ $panel.data( "destroy.tabs", true );
7715
+ }
7716
+ self.panels = self.panels.add( $panel );
7717
+ // invalid tab href
7718
+ } else {
7719
+ o.disabled.push( i );
7720
+ }
7721
+ });
7722
+
7723
+ // initialization from scratch
7724
+ if ( init ) {
7725
+ // attach necessary classes for styling
7726
+ this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
7727
+ this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
7728
+ this.lis.addClass( "ui-state-default ui-corner-top" );
7729
+ this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
7730
+
7731
+ // Selected tab
7732
+ // use "selected" option or try to retrieve:
7733
+ // 1. from fragment identifier in url
7734
+ // 2. from cookie
7735
+ // 3. from selected class attribute on <li>
7736
+ if ( o.selected === undefined ) {
7737
+ if ( location.hash ) {
7738
+ this.anchors.each(function( i, a ) {
7739
+ if ( a.hash == location.hash ) {
7740
+ o.selected = i;
7741
+ return false;
7742
+ }
7743
+ });
7744
+ }
7745
+ if ( typeof o.selected !== "number" && o.cookie ) {
7746
+ o.selected = parseInt( self._cookie(), 10 );
7747
+ }
7748
+ if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
7749
+ o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
7750
+ }
7751
+ o.selected = o.selected || ( this.lis.length ? 0 : -1 );
7752
+ } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
7753
+ o.selected = -1;
7754
+ }
7755
+
7756
+ // sanity check - default to first tab...
7757
+ o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
7758
+ ? o.selected
7759
+ : 0;
7760
+
7761
+ // Take disabling tabs via class attribute from HTML
7762
+ // into account and update option properly.
7763
+ // A selected tab cannot become disabled.
7764
+ o.disabled = $.unique( o.disabled.concat(
7765
+ $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
7766
+ return self.lis.index( n );
7767
+ })
7768
+ ) ).sort();
7769
+
7770
+ if ( $.inArray( o.selected, o.disabled ) != -1 ) {
7771
+ o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
7772
+ }
7773
+
7774
+ // highlight selected tab
7775
+ this.panels.addClass( "ui-tabs-hide" );
7776
+ this.lis.removeClass( "ui-tabs-selected ui-state-active" );
7777
+ // check for length avoids error when initializing empty list
7778
+ if ( o.selected >= 0 && this.anchors.length ) {
7779
+ self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
7780
+ this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
7781
+
7782
+ // seems to be expected behavior that the show callback is fired
7783
+ self.element.queue( "tabs", function() {
7784
+ self._trigger( "show", null,
7785
+ self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );
7786
+ });
7787
+
7788
+ this.load( o.selected );
7789
+ }
7790
+
7791
+ // clean up to avoid memory leaks in certain versions of IE 6
7792
+ // TODO: namespace this event
7793
+ $( window ).bind( "unload", function() {
7794
+ self.lis.add( self.anchors ).unbind( ".tabs" );
7795
+ self.lis = self.anchors = self.panels = null;
7796
+ });
7797
+ // update selected after add/remove
7798
+ } else {
7799
+ o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
7800
+ }
7801
+
7802
+ // update collapsible
7803
+ // TODO: use .toggleClass()
7804
+ this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
7805
+
7806
+ // set or update cookie after init and add/remove respectively
7807
+ if ( o.cookie ) {
7808
+ this._cookie( o.selected, o.cookie );
7809
+ }
7810
+
7811
+ // disable tabs
7812
+ for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
7813
+ $( li )[ $.inArray( i, o.disabled ) != -1 &&
7814
+ // TODO: use .toggleClass()
7815
+ !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
7816
+ }
7817
+
7818
+ // reset cache if switching from cached to not cached
7819
+ if ( o.cache === false ) {
7820
+ this.anchors.removeData( "cache.tabs" );
7821
+ }
7822
+
7823
+ // remove all handlers before, tabify may run on existing tabs after add or option change
7824
+ this.lis.add( this.anchors ).unbind( ".tabs" );
7825
+
7826
+ if ( o.event !== "mouseover" ) {
7827
+ var addState = function( state, el ) {
7828
+ if ( el.is( ":not(.ui-state-disabled)" ) ) {
7829
+ el.addClass( "ui-state-" + state );
7830
+ }
7831
+ };
7832
+ var removeState = function( state, el ) {
7833
+ el.removeClass( "ui-state-" + state );
7834
+ };
7835
+ this.lis.bind( "mouseover.tabs" , function() {
7836
+ addState( "hover", $( this ) );
7837
+ });
7838
+ this.lis.bind( "mouseout.tabs", function() {
7839
+ removeState( "hover", $( this ) );
7840
+ });
7841
+ this.anchors.bind( "focus.tabs", function() {
7842
+ addState( "focus", $( this ).closest( "li" ) );
7843
+ });
7844
+ this.anchors.bind( "blur.tabs", function() {
7845
+ removeState( "focus", $( this ).closest( "li" ) );
7846
+ });
7847
+ }
7848
+
7849
+ // set up animations
7850
+ var hideFx, showFx;
7851
+ if ( o.fx ) {
7852
+ if ( $.isArray( o.fx ) ) {
7853
+ hideFx = o.fx[ 0 ];
7854
+ showFx = o.fx[ 1 ];
7855
+ } else {
7856
+ hideFx = showFx = o.fx;
7857
+ }
7858
+ }
7859
+
7860
+ // Reset certain styles left over from animation
7861
+ // and prevent IE's ClearType bug...
7862
+ function resetStyle( $el, fx ) {
7863
+ $el.css( "display", "" );
7864
+ if ( !$.support.opacity && fx.opacity ) {
7865
+ $el[ 0 ].style.removeAttribute( "filter" );
7866
+ }
7867
+ }
7868
+
7869
+ // Show a tab...
7870
+ var showTab = showFx
7871
+ ? function( clicked, $show ) {
7872
+ $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
7873
+ $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
7874
+ .animate( showFx, showFx.duration || "normal", function() {
7875
+ resetStyle( $show, showFx );
7876
+ self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
7877
+ });
7878
+ }
7879
+ : function( clicked, $show ) {
7880
+ $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
7881
+ $show.removeClass( "ui-tabs-hide" );
7882
+ self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
7883
+ };
7884
+
7885
+ // Hide a tab, $show is optional...
7886
+ var hideTab = hideFx
7887
+ ? function( clicked, $hide ) {
7888
+ $hide.animate( hideFx, hideFx.duration || "normal", function() {
7889
+ self.lis.removeClass( "ui-tabs-selected ui-state-active" );
7890
+ $hide.addClass( "ui-tabs-hide" );
7891
+ resetStyle( $hide, hideFx );
7892
+ self.element.dequeue( "tabs" );
7893
+ });
7894
+ }
7895
+ : function( clicked, $hide, $show ) {
7896
+ self.lis.removeClass( "ui-tabs-selected ui-state-active" );
7897
+ $hide.addClass( "ui-tabs-hide" );
7898
+ self.element.dequeue( "tabs" );
7899
+ };
7900
+
7901
+ // attach tab event handler, unbind to avoid duplicates from former tabifying...
7902
+ this.anchors.bind( o.event + ".tabs", function() {
7903
+ var el = this,
7904
+ $li = $(el).closest( "li" ),
7905
+ $hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
7906
+ $show = self.element.find( self._sanitizeSelector( el.hash ) );
7907
+
7908
+ // If tab is already selected and not collapsible or tab disabled or
7909
+ // or is already loading or click callback returns false stop here.
7910
+ // Check if click handler returns false last so that it is not executed
7911
+ // for a disabled or loading tab!
7912
+ if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
7913
+ $li.hasClass( "ui-state-disabled" ) ||
7914
+ $li.hasClass( "ui-state-processing" ) ||
7915
+ self.panels.filter( ":animated" ).length ||
7916
+ self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
7917
+ this.blur();
7918
+ return false;
7919
+ }
7920
+
7921
+ o.selected = self.anchors.index( this );
7922
+
7923
+ self.abort();
7924
+
7925
+ // if tab may be closed
7926
+ if ( o.collapsible ) {
7927
+ if ( $li.hasClass( "ui-tabs-selected" ) ) {
7928
+ o.selected = -1;
7929
+
7930
+ if ( o.cookie ) {
7931
+ self._cookie( o.selected, o.cookie );
7932
+ }
7933
+
7934
+ self.element.queue( "tabs", function() {
7935
+ hideTab( el, $hide );
7936
+ }).dequeue( "tabs" );
7937
+
7938
+ this.blur();
7939
+ return false;
7940
+ } else if ( !$hide.length ) {
7941
+ if ( o.cookie ) {
7942
+ self._cookie( o.selected, o.cookie );
7943
+ }
7944
+
7945
+ self.element.queue( "tabs", function() {
7946
+ showTab( el, $show );
7947
+ });
7948
+
7949
+ // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
7950
+ self.load( self.anchors.index( this ) );
7951
+
7952
+ this.blur();
7953
+ return false;
7954
+ }
7955
+ }
7956
+
7957
+ if ( o.cookie ) {
7958
+ self._cookie( o.selected, o.cookie );
7959
+ }
7960
+
7961
+ // show new tab
7962
+ if ( $show.length ) {
7963
+ if ( $hide.length ) {
7964
+ self.element.queue( "tabs", function() {
7965
+ hideTab( el, $hide );
7966
+ });
7967
+ }
7968
+ self.element.queue( "tabs", function() {
7969
+ showTab( el, $show );
7970
+ });
7971
+
7972
+ self.load( self.anchors.index( this ) );
7973
+ } else {
7974
+ throw "jQuery UI Tabs: Mismatching fragment identifier.";
7975
+ }
7976
+
7977
+ // Prevent IE from keeping other link focussed when using the back button
7978
+ // and remove dotted border from clicked link. This is controlled via CSS
7979
+ // in modern browsers; blur() removes focus from address bar in Firefox
7980
+ // which can become a usability and annoying problem with tabs('rotate').
7981
+ if ( $.browser.msie ) {
7982
+ this.blur();
7983
+ }
7984
+ });
7985
+
7986
+ // disable click in any case
7987
+ this.anchors.bind( "click.tabs", function(){
7988
+ return false;
7989
+ });
7990
+ },
7991
+
7992
+ _getIndex: function( index ) {
7993
+ // meta-function to give users option to provide a href string instead of a numerical index.
7994
+ // also sanitizes numerical indexes to valid values.
7995
+ if ( typeof index == "string" ) {
7996
+ index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
7997
+ }
7998
+
7999
+ return index;
8000
+ },
8001
+
8002
+ destroy: function() {
8003
+ var o = this.options;
8004
+
8005
+ this.abort();
8006
+
8007
+ this.element
8008
+ .unbind( ".tabs" )
8009
+ .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
8010
+ .removeData( "tabs" );
8011
+
8012
+ this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
8013
+
8014
+ this.anchors.each(function() {
8015
+ var href = $.data( this, "href.tabs" );
8016
+ if ( href ) {
8017
+ this.href = href;
8018
+ }
8019
+ var $this = $( this ).unbind( ".tabs" );
8020
+ $.each( [ "href", "load", "cache" ], function( i, prefix ) {
8021
+ $this.removeData( prefix + ".tabs" );
8022
+ });
8023
+ });
8024
+
8025
+ this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
8026
+ if ( $.data( this, "destroy.tabs" ) ) {
8027
+ $( this ).remove();
8028
+ } else {
8029
+ $( this ).removeClass([
8030
+ "ui-state-default",
8031
+ "ui-corner-top",
8032
+ "ui-tabs-selected",
8033
+ "ui-state-active",
8034
+ "ui-state-hover",
8035
+ "ui-state-focus",
8036
+ "ui-state-disabled",
8037
+ "ui-tabs-panel",
8038
+ "ui-widget-content",
8039
+ "ui-corner-bottom",
8040
+ "ui-tabs-hide"
8041
+ ].join( " " ) );
8042
+ }
8043
+ });
8044
+
8045
+ if ( o.cookie ) {
8046
+ this._cookie( null, o.cookie );
8047
+ }
8048
+
8049
+ return this;
8050
+ },
8051
+
8052
+ add: function( url, label, index ) {
8053
+ if ( index === undefined ) {
8054
+ index = this.anchors.length;
8055
+ }
8056
+
8057
+ var self = this,
8058
+ o = this.options,
8059
+ $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
8060
+ id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
8061
+
8062
+ $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
8063
+
8064
+ // try to find an existing element before creating a new one
8065
+ var $panel = self.element.find( "#" + id );
8066
+ if ( !$panel.length ) {
8067
+ $panel = $( o.panelTemplate )
8068
+ .attr( "id", id )
8069
+ .data( "destroy.tabs", true );
8070
+ }
8071
+ $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
8072
+
8073
+ if ( index >= this.lis.length ) {
8074
+ $li.appendTo( this.list );
8075
+ $panel.appendTo( this.list[ 0 ].parentNode );
8076
+ } else {
8077
+ $li.insertBefore( this.lis[ index ] );
8078
+ $panel.insertBefore( this.panels[ index ] );
8079
+ }
8080
+
8081
+ o.disabled = $.map( o.disabled, function( n, i ) {
8082
+ return n >= index ? ++n : n;
8083
+ });
8084
+
8085
+ this._tabify();
8086
+
8087
+ if ( this.anchors.length == 1 ) {
8088
+ o.selected = 0;
8089
+ $li.addClass( "ui-tabs-selected ui-state-active" );
8090
+ $panel.removeClass( "ui-tabs-hide" );
8091
+ this.element.queue( "tabs", function() {
8092
+ self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
8093
+ });
8094
+
8095
+ this.load( 0 );
8096
+ }
8097
+
8098
+ this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
8099
+ return this;
8100
+ },
8101
+
8102
+ remove: function( index ) {
8103
+ index = this._getIndex( index );
8104
+ var o = this.options,
8105
+ $li = this.lis.eq( index ).remove(),
8106
+ $panel = this.panels.eq( index ).remove();
8107
+
8108
+ // If selected tab was removed focus tab to the right or
8109
+ // in case the last tab was removed the tab to the left.
8110
+ if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
8111
+ this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
8112
+ }
8113
+
8114
+ o.disabled = $.map(
8115
+ $.grep( o.disabled, function(n, i) {
8116
+ return n != index;
8117
+ }),
8118
+ function( n, i ) {
8119
+ return n >= index ? --n : n;
8120
+ });
8121
+
8122
+ this._tabify();
8123
+
8124
+ this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
8125
+ return this;
8126
+ },
8127
+
8128
+ enable: function( index ) {
8129
+ index = this._getIndex( index );
8130
+ var o = this.options;
8131
+ if ( $.inArray( index, o.disabled ) == -1 ) {
8132
+ return;
8133
+ }
8134
+
8135
+ this.lis.eq( index ).removeClass( "ui-state-disabled" );
8136
+ o.disabled = $.grep( o.disabled, function( n, i ) {
8137
+ return n != index;
8138
+ });
8139
+
8140
+ this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
8141
+ return this;
8142
+ },
8143
+
8144
+ disable: function( index ) {
8145
+ index = this._getIndex( index );
8146
+ var self = this, o = this.options;
8147
+ // cannot disable already selected tab
8148
+ if ( index != o.selected ) {
8149
+ this.lis.eq( index ).addClass( "ui-state-disabled" );
8150
+
8151
+ o.disabled.push( index );
8152
+ o.disabled.sort();
8153
+
8154
+ this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
8155
+ }
8156
+
8157
+ return this;
8158
+ },
8159
+
8160
+ select: function( index ) {
8161
+ index = this._getIndex( index );
8162
+ if ( index == -1 ) {
8163
+ if ( this.options.collapsible && this.options.selected != -1 ) {
8164
+ index = this.options.selected;
8165
+ } else {
8166
+ return this;
8167
+ }
8168
+ }
8169
+ this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
8170
+ return this;
8171
+ },
8172
+
8173
+ load: function( index ) {
8174
+ index = this._getIndex( index );
8175
+ var self = this,
8176
+ o = this.options,
8177
+ a = this.anchors.eq( index )[ 0 ],
8178
+ url = $.data( a, "load.tabs" );
8179
+
8180
+ this.abort();
8181
+
8182
+ // not remote or from cache
8183
+ if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
8184
+ this.element.dequeue( "tabs" );
8185
+ return;
8186
+ }
8187
+
8188
+ // load remote from here on
8189
+ this.lis.eq( index ).addClass( "ui-state-processing" );
8190
+
8191
+ if ( o.spinner ) {
8192
+ var span = $( "span", a );
8193
+ span.data( "label.tabs", span.html() ).html( o.spinner );
8194
+ }
8195
+
8196
+ this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
8197
+ url: url,
8198
+ success: function( r, s ) {
8199
+ self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
8200
+
8201
+ // take care of tab labels
8202
+ self._cleanup();
8203
+
8204
+ if ( o.cache ) {
8205
+ $.data( a, "cache.tabs", true );
8206
+ }
8207
+
8208
+ self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
8209
+ try {
8210
+ o.ajaxOptions.success( r, s );
8211
+ }
8212
+ catch ( e ) {}
8213
+ },
8214
+ error: function( xhr, s, e ) {
8215
+ // take care of tab labels
8216
+ self._cleanup();
8217
+
8218
+ self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
8219
+ try {
8220
+ // Passing index avoid a race condition when this method is
8221
+ // called after the user has selected another tab.
8222
+ // Pass the anchor that initiated this request allows
8223
+ // loadError to manipulate the tab content panel via $(a.hash)
8224
+ o.ajaxOptions.error( xhr, s, index, a );
8225
+ }
8226
+ catch ( e ) {}
8227
+ }
8228
+ } ) );
8229
+
8230
+ // last, so that load event is fired before show...
8231
+ self.element.dequeue( "tabs" );
8232
+
8233
+ return this;
8234
+ },
8235
+
8236
+ abort: function() {
8237
+ // stop possibly running animations
8238
+ this.element.queue( [] );
8239
+ this.panels.stop( false, true );
8240
+
8241
+ // "tabs" queue must not contain more than two elements,
8242
+ // which are the callbacks for the latest clicked tab...
8243
+ this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
8244
+
8245
+ // terminate pending requests from other tabs
8246
+ if ( this.xhr ) {
8247
+ this.xhr.abort();
8248
+ delete this.xhr;
8249
+ }
8250
+
8251
+ // take care of tab labels
8252
+ this._cleanup();
8253
+ return this;
8254
+ },
8255
+
8256
+ url: function( index, url ) {
8257
+ this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
8258
+ return this;
8259
+ },
8260
+
8261
+ length: function() {
8262
+ return this.anchors.length;
8263
+ }
8264
+ });
8265
+
8266
+ $.extend( $.ui.tabs, {
8267
+ version: "1.8.24"
8268
+ });
8269
+
8270
+ /*
8271
+ * Tabs Extensions
8272
+ */
8273
+
8274
+ /*
8275
+ * Rotate
8276
+ */
8277
+ $.extend( $.ui.tabs.prototype, {
8278
+ rotation: null,
8279
+ rotate: function( ms, continuing ) {
8280
+ var self = this,
8281
+ o = this.options;
8282
+
8283
+ var rotate = self._rotate || ( self._rotate = function( e ) {
8284
+ clearTimeout( self.rotation );
8285
+ self.rotation = setTimeout(function() {
8286
+ var t = o.selected;
8287
+ self.select( ++t < self.anchors.length ? t : 0 );
8288
+ }, ms );
8289
+
8290
+ if ( e ) {
8291
+ e.stopPropagation();
8292
+ }
8293
+ });
8294
+
8295
+ var stop = self._unrotate || ( self._unrotate = !continuing
8296
+ ? function(e) {
8297
+ if (e.clientX) { // in case of a true click
8298
+ self.rotate(null);
8299
+ }
8300
+ }
8301
+ : function( e ) {
8302
+ rotate();
8303
+ });
8304
+
8305
+ // start rotation
8306
+ if ( ms ) {
8307
+ this.element.bind( "tabsshow", rotate );
8308
+ this.anchors.bind( o.event + ".tabs", stop );
8309
+ rotate();
8310
+ // stop rotation
8311
+ } else {
8312
+ clearTimeout( self.rotation );
8313
+ this.element.unbind( "tabsshow", rotate );
8314
+ this.anchors.unbind( o.event + ".tabs", stop );
8315
+ delete this._rotate;
8316
+ delete this._unrotate;
8317
+ }
8318
+
8319
+ return this;
8320
+ }
8321
+ });
8322
+
8323
+ })( jQuery );
8324
+ /*!
8325
+ * jQuery UI Datepicker 1.8.24
8326
+ *
8327
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
8328
+ * Dual licensed under the MIT or GPL Version 2 licenses.
8329
+ * http://jquery.org/license
8330
+ *
8331
+ * http://docs.jquery.com/UI/Datepicker
8332
+ *
8333
+ * Depends:
8334
+ * jquery.ui.core.js
8335
+ */
8336
+ (function( $, undefined ) {
8337
+
8338
+ $.extend($.ui, { datepicker: { version: "1.8.24" } });
8339
+
8340
+ var PROP_NAME = 'datepicker';
8341
+ var dpuuid = new Date().getTime();
8342
+ var instActive;
8343
+
8344
+ /* Date picker manager.
8345
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
8346
+ Settings for (groups of) date pickers are maintained in an instance object,
8347
+ allowing multiple different settings on the same page. */
8348
+
8349
+ function Datepicker() {
8350
+ this.debug = false; // Change this to true to start debugging
8351
+ this._curInst = null; // The current instance in use
8352
+ this._keyEvent = false; // If the last event was a key event
8353
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
8354
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
8355
+ this._inDialog = false; // True if showing within a "dialog", false if not
8356
+ this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
8357
+ this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
8358
+ this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
8359
+ this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
8360
+ this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
8361
+ this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
8362
+ this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
8363
+ this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
8364
+ this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
8365
+ this.regional = []; // Available regional settings, indexed by language code
8366
+ this.regional[''] = { // Default regional settings
8367
+ closeText: 'Done', // Display text for close link
8368
+ prevText: 'Prev', // Display text for previous month link
8369
+ nextText: 'Next', // Display text for next month link
8370
+ currentText: 'Today', // Display text for current month link
8371
+ monthNames: ['January','February','March','April','May','June',
8372
+ 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
8373
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
8374
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
8375
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
8376
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
8377
+ weekHeader: 'Wk', // Column header for week of the year
8378
+ dateFormat: 'mm/dd/yy', // See format options on parseDate
8379
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
8380
+ isRTL: false, // True if right-to-left language, false if left-to-right
8381
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
8382
+ yearSuffix: '' // Additional text to append to the year in the month headers
8383
+ };
8384
+ this._defaults = { // Global defaults for all the date picker instances
8385
+ showOn: 'focus', // 'focus' for popup on focus,
8386
+ // 'button' for trigger button, or 'both' for either
8387
+ showAnim: 'fadeIn', // Name of jQuery animation for popup
8388
+ showOptions: {}, // Options for enhanced animations
8389
+ defaultDate: null, // Used when field is blank: actual date,
8390
+ // +/-number for offset from today, null for today
8391
+ appendText: '', // Display text following the input box, e.g. showing the format
8392
+ buttonText: '...', // Text for trigger button
8393
+ buttonImage: '', // URL for trigger button image
8394
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
8395
+ hideIfNoPrevNext: false, // True to hide next/previous month links
8396
+ // if not applicable, false to just disable them
8397
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
8398
+ gotoCurrent: false, // True if today link goes back to current selection instead
8399
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
8400
+ changeYear: false, // True if year can be selected directly, false if only prev/next
8401
+ yearRange: 'c-10:c+10', // Range of years to display in drop-down,
8402
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
8403
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
8404
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
8405
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
8406
+ showWeek: false, // True to show week of the year, false to not show it
8407
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
8408
+ // takes a Date and returns the number of the week for it
8409
+ shortYearCutoff: '+10', // Short year values < this are in the current century,
8410
+ // > this are in the previous century,
8411
+ // string value starting with '+' for current year + value
8412
+ minDate: null, // The earliest selectable date, or null for no limit
8413
+ maxDate: null, // The latest selectable date, or null for no limit
8414
+ duration: 'fast', // Duration of display/closure
8415
+ beforeShowDay: null, // Function that takes a date and returns an array with
8416
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
8417
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
8418
+ beforeShow: null, // Function that takes an input field and
8419
+ // returns a set of custom settings for the date picker
8420
+ onSelect: null, // Define a callback function when a date is selected
8421
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
8422
+ onClose: null, // Define a callback function when the datepicker is closed
8423
+ numberOfMonths: 1, // Number of months to show at a time
8424
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
8425
+ stepMonths: 1, // Number of months to step back/forward
8426
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
8427
+ altField: '', // Selector for an alternate field to store selected dates into
8428
+ altFormat: '', // The date format to use for the alternate field
8429
+ constrainInput: true, // The input is constrained by the current date format
8430
+ showButtonPanel: false, // True to show button panel, false to not show it
8431
+ autoSize: false, // True to size the input for the date format, false to leave as is
8432
+ disabled: false // The initial disabled state
8433
+ };
8434
+ $.extend(this._defaults, this.regional['']);
8435
+ this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
8436
+ }
8437
+
8438
+ $.extend(Datepicker.prototype, {
8439
+ /* Class name added to elements to indicate already configured with a date picker. */
8440
+ markerClassName: 'hasDatepicker',
8441
+
8442
+ //Keep track of the maximum number of rows displayed (see #7043)
8443
+ maxRows: 4,
8444
+
8445
+ /* Debug logging (if enabled). */
8446
+ log: function () {
8447
+ if (this.debug)
8448
+ console.log.apply('', arguments);
8449
+ },
8450
+
8451
+ // TODO rename to "widget" when switching to widget factory
8452
+ _widgetDatepicker: function() {
8453
+ return this.dpDiv;
8454
+ },
8455
+
8456
+ /* Override the default settings for all instances of the date picker.
8457
+ @param settings object - the new settings to use as defaults (anonymous object)
8458
+ @return the manager object */
8459
+ setDefaults: function(settings) {
8460
+ extendRemove(this._defaults, settings || {});
8461
+ return this;
8462
+ },
8463
+
8464
+ /* Attach the date picker to a jQuery selection.
8465
+ @param target element - the target input field or division or span
8466
+ @param settings object - the new settings to use for this date picker instance (anonymous) */
8467
+ _attachDatepicker: function(target, settings) {
8468
+ // check for settings on the control itself - in namespace 'date:'
8469
+ var inlineSettings = null;
8470
+ for (var attrName in this._defaults) {
8471
+ var attrValue = target.getAttribute('date:' + attrName);
8472
+ if (attrValue) {
8473
+ inlineSettings = inlineSettings || {};
8474
+ try {
8475
+ inlineSettings[attrName] = eval(attrValue);
8476
+ } catch (err) {
8477
+ inlineSettings[attrName] = attrValue;
8478
+ }
8479
+ }
8480
+ }
8481
+ var nodeName = target.nodeName.toLowerCase();
8482
+ var inline = (nodeName == 'div' || nodeName == 'span');
8483
+ if (!target.id) {
8484
+ this.uuid += 1;
8485
+ target.id = 'dp' + this.uuid;
8486
+ }
8487
+ var inst = this._newInst($(target), inline);
8488
+ inst.settings = $.extend({}, settings || {}, inlineSettings || {});
8489
+ if (nodeName == 'input') {
8490
+ this._connectDatepicker(target, inst);
8491
+ } else if (inline) {
8492
+ this._inlineDatepicker(target, inst);
8493
+ }
8494
+ },
8495
+
8496
+ /* Create a new instance object. */
8497
+ _newInst: function(target, inline) {
8498
+ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
8499
+ return {id: id, input: target, // associated target
8500
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
8501
+ drawMonth: 0, drawYear: 0, // month being drawn
8502
+ inline: inline, // is datepicker inline or not
8503
+ dpDiv: (!inline ? this.dpDiv : // presentation div
8504
+ bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))};
8505
+ },
8506
+
8507
+ /* Attach the date picker to an input field. */
8508
+ _connectDatepicker: function(target, inst) {
8509
+ var input = $(target);
8510
+ inst.append = $([]);
8511
+ inst.trigger = $([]);
8512
+ if (input.hasClass(this.markerClassName))
8513
+ return;
8514
+ this._attachments(input, inst);
8515
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
8516
+ keypress(this._doKeyPress).keyup(this._doKeyUp).
8517
+ bind("setData.datepicker", function(event, key, value) {
8518
+ inst.settings[key] = value;
8519
+ }).bind("getData.datepicker", function(event, key) {
8520
+ return this._get(inst, key);
8521
+ });
8522
+ this._autoSize(inst);
8523
+ $.data(target, PROP_NAME, inst);
8524
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
8525
+ if( inst.settings.disabled ) {
8526
+ this._disableDatepicker( target );
8527
+ }
8528
+ },
8529
+
8530
+ /* Make attachments based on settings. */
8531
+ _attachments: function(input, inst) {
8532
+ var appendText = this._get(inst, 'appendText');
8533
+ var isRTL = this._get(inst, 'isRTL');
8534
+ if (inst.append)
8535
+ inst.append.remove();
8536
+ if (appendText) {
8537
+ inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
8538
+ input[isRTL ? 'before' : 'after'](inst.append);
8539
+ }
8540
+ input.unbind('focus', this._showDatepicker);
8541
+ if (inst.trigger)
8542
+ inst.trigger.remove();
8543
+ var showOn = this._get(inst, 'showOn');
8544
+ if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
8545
+ input.focus(this._showDatepicker);
8546
+ if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
8547
+ var buttonText = this._get(inst, 'buttonText');
8548
+ var buttonImage = this._get(inst, 'buttonImage');
8549
+ inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
8550
+ $('<img/>').addClass(this._triggerClass).
8551
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
8552
+ $('<button type="button"></button>').addClass(this._triggerClass).
8553
+ html(buttonImage == '' ? buttonText : $('<img/>').attr(
8554
+ { src:buttonImage, alt:buttonText, title:buttonText })));
8555
+ input[isRTL ? 'before' : 'after'](inst.trigger);
8556
+ inst.trigger.click(function() {
8557
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
8558
+ $.datepicker._hideDatepicker();
8559
+ else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
8560
+ $.datepicker._hideDatepicker();
8561
+ $.datepicker._showDatepicker(input[0]);
8562
+ } else
8563
+ $.datepicker._showDatepicker(input[0]);
8564
+ return false;
8565
+ });
8566
+ }
8567
+ },
8568
+
8569
+ /* Apply the maximum length for the date format. */
8570
+ _autoSize: function(inst) {
8571
+ if (this._get(inst, 'autoSize') && !inst.inline) {
8572
+ var date = new Date(2009, 12 - 1, 20); // Ensure double digits
8573
+ var dateFormat = this._get(inst, 'dateFormat');
8574
+ if (dateFormat.match(/[DM]/)) {
8575
+ var findMax = function(names) {
8576
+ var max = 0;
8577
+ var maxI = 0;
8578
+ for (var i = 0; i < names.length; i++) {
8579
+ if (names[i].length > max) {
8580
+ max = names[i].length;
8581
+ maxI = i;
8582
+ }
8583
+ }
8584
+ return maxI;
8585
+ };
8586
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
8587
+ 'monthNames' : 'monthNamesShort'))));
8588
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
8589
+ 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
8590
+ }
8591
+ inst.input.attr('size', this._formatDate(inst, date).length);
8592
+ }
8593
+ },
8594
+
8595
+ /* Attach an inline date picker to a div. */
8596
+ _inlineDatepicker: function(target, inst) {
8597
+ var divSpan = $(target);
8598
+ if (divSpan.hasClass(this.markerClassName))
8599
+ return;
8600
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv).
8601
+ bind("setData.datepicker", function(event, key, value){
8602
+ inst.settings[key] = value;
8603
+ }).bind("getData.datepicker", function(event, key){
8604
+ return this._get(inst, key);
8605
+ });
8606
+ $.data(target, PROP_NAME, inst);
8607
+ this._setDate(inst, this._getDefaultDate(inst), true);
8608
+ this._updateDatepicker(inst);
8609
+ this._updateAlternate(inst);
8610
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
8611
+ if( inst.settings.disabled ) {
8612
+ this._disableDatepicker( target );
8613
+ }
8614
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
8615
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
8616
+ inst.dpDiv.css( "display", "block" );
8617
+ },
8618
+
8619
+ /* Pop-up the date picker in a "dialog" box.
8620
+ @param input element - ignored
8621
+ @param date string or Date - the initial date to display
8622
+ @param onSelect function - the function to call when a date is selected
8623
+ @param settings object - update the dialog date picker instance's settings (anonymous object)
8624
+ @param pos int[2] - coordinates for the dialog's position within the screen or
8625
+ event - with x/y coordinates or
8626
+ leave empty for default (screen centre)
8627
+ @return the manager object */
8628
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
8629
+ var inst = this._dialogInst; // internal instance
8630
+ if (!inst) {
8631
+ this.uuid += 1;
8632
+ var id = 'dp' + this.uuid;
8633
+ this._dialogInput = $('<input type="text" id="' + id +
8634
+ '" style="position: absolute; top: -100px; width: 0px;"/>');
8635
+ this._dialogInput.keydown(this._doKeyDown);
8636
+ $('body').append(this._dialogInput);
8637
+ inst = this._dialogInst = this._newInst(this._dialogInput, false);
8638
+ inst.settings = {};
8639
+ $.data(this._dialogInput[0], PROP_NAME, inst);
8640
+ }
8641
+ extendRemove(inst.settings, settings || {});
8642
+ date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
8643
+ this._dialogInput.val(date);
8644
+
8645
+ this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
8646
+ if (!this._pos) {
8647
+ var browserWidth = document.documentElement.clientWidth;
8648
+ var browserHeight = document.documentElement.clientHeight;
8649
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
8650
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
8651
+ this._pos = // should use actual width/height below
8652
+ [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
8653
+ }
8654
+
8655
+ // move input on screen for focus, but hidden behind dialog
8656
+ this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
8657
+ inst.settings.onSelect = onSelect;
8658
+ this._inDialog = true;
8659
+ this.dpDiv.addClass(this._dialogClass);
8660
+ this._showDatepicker(this._dialogInput[0]);
8661
+ if ($.blockUI)
8662
+ $.blockUI(this.dpDiv);
8663
+ $.data(this._dialogInput[0], PROP_NAME, inst);
8664
+ return this;
8665
+ },
8666
+
8667
+ /* Detach a datepicker from its control.
8668
+ @param target element - the target input field or division or span */
8669
+ _destroyDatepicker: function(target) {
8670
+ var $target = $(target);
8671
+ var inst = $.data(target, PROP_NAME);
8672
+ if (!$target.hasClass(this.markerClassName)) {
8673
+ return;
8674
+ }
8675
+ var nodeName = target.nodeName.toLowerCase();
8676
+ $.removeData(target, PROP_NAME);
8677
+ if (nodeName == 'input') {
8678
+ inst.append.remove();
8679
+ inst.trigger.remove();
8680
+ $target.removeClass(this.markerClassName).
8681
+ unbind('focus', this._showDatepicker).
8682
+ unbind('keydown', this._doKeyDown).
8683
+ unbind('keypress', this._doKeyPress).
8684
+ unbind('keyup', this._doKeyUp);
8685
+ } else if (nodeName == 'div' || nodeName == 'span')
8686
+ $target.removeClass(this.markerClassName).empty();
8687
+ },
8688
+
8689
+ /* Enable the date picker to a jQuery selection.
8690
+ @param target element - the target input field or division or span */
8691
+ _enableDatepicker: function(target) {
8692
+ var $target = $(target);
8693
+ var inst = $.data(target, PROP_NAME);
8694
+ if (!$target.hasClass(this.markerClassName)) {
8695
+ return;
8696
+ }
8697
+ var nodeName = target.nodeName.toLowerCase();
8698
+ if (nodeName == 'input') {
8699
+ target.disabled = false;
8700
+ inst.trigger.filter('button').
8701
+ each(function() { this.disabled = false; }).end().
8702
+ filter('img').css({opacity: '1.0', cursor: ''});
8703
+ }
8704
+ else if (nodeName == 'div' || nodeName == 'span') {
8705
+ var inline = $target.children('.' + this._inlineClass);
8706
+ inline.children().removeClass('ui-state-disabled');
8707
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
8708
+ removeAttr("disabled");
8709
+ }
8710
+ this._disabledInputs = $.map(this._disabledInputs,
8711
+ function(value) { return (value == target ? null : value); }); // delete entry
8712
+ },
8713
+
8714
+ /* Disable the date picker to a jQuery selection.
8715
+ @param target element - the target input field or division or span */
8716
+ _disableDatepicker: function(target) {
8717
+ var $target = $(target);
8718
+ var inst = $.data(target, PROP_NAME);
8719
+ if (!$target.hasClass(this.markerClassName)) {
8720
+ return;
8721
+ }
8722
+ var nodeName = target.nodeName.toLowerCase();
8723
+ if (nodeName == 'input') {
8724
+ target.disabled = true;
8725
+ inst.trigger.filter('button').
8726
+ each(function() { this.disabled = true; }).end().
8727
+ filter('img').css({opacity: '0.5', cursor: 'default'});
8728
+ }
8729
+ else if (nodeName == 'div' || nodeName == 'span') {
8730
+ var inline = $target.children('.' + this._inlineClass);
8731
+ inline.children().addClass('ui-state-disabled');
8732
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
8733
+ attr("disabled", "disabled");
8734
+ }
8735
+ this._disabledInputs = $.map(this._disabledInputs,
8736
+ function(value) { return (value == target ? null : value); }); // delete entry
8737
+ this._disabledInputs[this._disabledInputs.length] = target;
8738
+ },
8739
+
8740
+ /* Is the first field in a jQuery collection disabled as a datepicker?
8741
+ @param target element - the target input field or division or span
8742
+ @return boolean - true if disabled, false if enabled */
8743
+ _isDisabledDatepicker: function(target) {
8744
+ if (!target) {
8745
+ return false;
8746
+ }
8747
+ for (var i = 0; i < this._disabledInputs.length; i++) {
8748
+ if (this._disabledInputs[i] == target)
8749
+ return true;
8750
+ }
8751
+ return false;
8752
+ },
8753
+
8754
+ /* Retrieve the instance data for the target control.
8755
+ @param target element - the target input field or division or span
8756
+ @return object - the associated instance data
8757
+ @throws error if a jQuery problem getting data */
8758
+ _getInst: function(target) {
8759
+ try {
8760
+ return $.data(target, PROP_NAME);
8761
+ }
8762
+ catch (err) {
8763
+ throw 'Missing instance data for this datepicker';
8764
+ }
8765
+ },
8766
+
8767
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
8768
+ @param target element - the target input field or division or span
8769
+ @param name object - the new settings to update or
8770
+ string - the name of the setting to change or retrieve,
8771
+ when retrieving also 'all' for all instance settings or
8772
+ 'defaults' for all global defaults
8773
+ @param value any - the new value for the setting
8774
+ (omit if above is an object or to retrieve a value) */
8775
+ _optionDatepicker: function(target, name, value) {
8776
+ var inst = this._getInst(target);
8777
+ if (arguments.length == 2 && typeof name == 'string') {
8778
+ return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
8779
+ (inst ? (name == 'all' ? $.extend({}, inst.settings) :
8780
+ this._get(inst, name)) : null));
8781
+ }
8782
+ var settings = name || {};
8783
+ if (typeof name == 'string') {
8784
+ settings = {};
8785
+ settings[name] = value;
8786
+ }
8787
+ if (inst) {
8788
+ if (this._curInst == inst) {
8789
+ this._hideDatepicker();
8790
+ }
8791
+ var date = this._getDateDatepicker(target, true);
8792
+ var minDate = this._getMinMaxDate(inst, 'min');
8793
+ var maxDate = this._getMinMaxDate(inst, 'max');
8794
+ extendRemove(inst.settings, settings);
8795
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
8796
+ if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
8797
+ inst.settings.minDate = this._formatDate(inst, minDate);
8798
+ if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
8799
+ inst.settings.maxDate = this._formatDate(inst, maxDate);
8800
+ this._attachments($(target), inst);
8801
+ this._autoSize(inst);
8802
+ this._setDate(inst, date);
8803
+ this._updateAlternate(inst);
8804
+ this._updateDatepicker(inst);
8805
+ }
8806
+ },
8807
+
8808
+ // change method deprecated
8809
+ _changeDatepicker: function(target, name, value) {
8810
+ this._optionDatepicker(target, name, value);
8811
+ },
8812
+
8813
+ /* Redraw the date picker attached to an input field or division.
8814
+ @param target element - the target input field or division or span */
8815
+ _refreshDatepicker: function(target) {
8816
+ var inst = this._getInst(target);
8817
+ if (inst) {
8818
+ this._updateDatepicker(inst);
8819
+ }
8820
+ },
8821
+
8822
+ /* Set the dates for a jQuery selection.
8823
+ @param target element - the target input field or division or span
8824
+ @param date Date - the new date */
8825
+ _setDateDatepicker: function(target, date) {
8826
+ var inst = this._getInst(target);
8827
+ if (inst) {
8828
+ this._setDate(inst, date);
8829
+ this._updateDatepicker(inst);
8830
+ this._updateAlternate(inst);
8831
+ }
8832
+ },
8833
+
8834
+ /* Get the date(s) for the first entry in a jQuery selection.
8835
+ @param target element - the target input field or division or span
8836
+ @param noDefault boolean - true if no default date is to be used
8837
+ @return Date - the current date */
8838
+ _getDateDatepicker: function(target, noDefault) {
8839
+ var inst = this._getInst(target);
8840
+ if (inst && !inst.inline)
8841
+ this._setDateFromField(inst, noDefault);
8842
+ return (inst ? this._getDate(inst) : null);
8843
+ },
8844
+
8845
+ /* Handle keystrokes. */
8846
+ _doKeyDown: function(event) {
8847
+ var inst = $.datepicker._getInst(event.target);
8848
+ var handled = true;
8849
+ var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
8850
+ inst._keyEvent = true;
8851
+ if ($.datepicker._datepickerShowing)
8852
+ switch (event.keyCode) {
8853
+ case 9: $.datepicker._hideDatepicker();
8854
+ handled = false;
8855
+ break; // hide on tab out
8856
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
8857
+ $.datepicker._currentClass + ')', inst.dpDiv);
8858
+ if (sel[0])
8859
+ $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
8860
+ var onSelect = $.datepicker._get(inst, 'onSelect');
8861
+ if (onSelect) {
8862
+ var dateStr = $.datepicker._formatDate(inst);
8863
+
8864
+ // trigger custom callback
8865
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
8866
+ }
8867
+ else
8868
+ $.datepicker._hideDatepicker();
8869
+ return false; // don't submit the form
8870
+ break; // select the value on enter
8871
+ case 27: $.datepicker._hideDatepicker();
8872
+ break; // hide on escape
8873
+ case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8874
+ -$.datepicker._get(inst, 'stepBigMonths') :
8875
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
8876
+ break; // previous month/year on page up/+ ctrl
8877
+ case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8878
+ +$.datepicker._get(inst, 'stepBigMonths') :
8879
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
8880
+ break; // next month/year on page down/+ ctrl
8881
+ case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
8882
+ handled = event.ctrlKey || event.metaKey;
8883
+ break; // clear on ctrl or command +end
8884
+ case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
8885
+ handled = event.ctrlKey || event.metaKey;
8886
+ break; // current on ctrl or command +home
8887
+ case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
8888
+ handled = event.ctrlKey || event.metaKey;
8889
+ // -1 day on ctrl or command +left
8890
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8891
+ -$.datepicker._get(inst, 'stepBigMonths') :
8892
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
8893
+ // next month/year on alt +left on Mac
8894
+ break;
8895
+ case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
8896
+ handled = event.ctrlKey || event.metaKey;
8897
+ break; // -1 week on ctrl or command +up
8898
+ case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
8899
+ handled = event.ctrlKey || event.metaKey;
8900
+ // +1 day on ctrl or command +right
8901
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
8902
+ +$.datepicker._get(inst, 'stepBigMonths') :
8903
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
8904
+ // next month/year on alt +right
8905
+ break;
8906
+ case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
8907
+ handled = event.ctrlKey || event.metaKey;
8908
+ break; // +1 week on ctrl or command +down
8909
+ default: handled = false;
8910
+ }
8911
+ else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
8912
+ $.datepicker._showDatepicker(this);
8913
+ else {
8914
+ handled = false;
8915
+ }
8916
+ if (handled) {
8917
+ event.preventDefault();
8918
+ event.stopPropagation();
8919
+ }
8920
+ },
8921
+
8922
+ /* Filter entered characters - based on date format. */
8923
+ _doKeyPress: function(event) {
8924
+ var inst = $.datepicker._getInst(event.target);
8925
+ if ($.datepicker._get(inst, 'constrainInput')) {
8926
+ var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
8927
+ var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
8928
+ return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
8929
+ }
8930
+ },
8931
+
8932
+ /* Synchronise manual entry and field/alternate field. */
8933
+ _doKeyUp: function(event) {
8934
+ var inst = $.datepicker._getInst(event.target);
8935
+ if (inst.input.val() != inst.lastVal) {
8936
+ try {
8937
+ var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
8938
+ (inst.input ? inst.input.val() : null),
8939
+ $.datepicker._getFormatConfig(inst));
8940
+ if (date) { // only if valid
8941
+ $.datepicker._setDateFromField(inst);
8942
+ $.datepicker._updateAlternate(inst);
8943
+ $.datepicker._updateDatepicker(inst);
8944
+ }
8945
+ }
8946
+ catch (err) {
8947
+ $.datepicker.log(err);
8948
+ }
8949
+ }
8950
+ return true;
8951
+ },
8952
+
8953
+ /* Pop-up the date picker for a given input field.
8954
+ If false returned from beforeShow event handler do not show.
8955
+ @param input element - the input field attached to the date picker or
8956
+ event - if triggered by focus */
8957
+ _showDatepicker: function(input) {
8958
+ input = input.target || input;
8959
+ if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
8960
+ input = $('input', input.parentNode)[0];
8961
+ if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
8962
+ return;
8963
+ var inst = $.datepicker._getInst(input);
8964
+ if ($.datepicker._curInst && $.datepicker._curInst != inst) {
8965
+ $.datepicker._curInst.dpDiv.stop(true, true);
8966
+ if ( inst && $.datepicker._datepickerShowing ) {
8967
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
8968
+ }
8969
+ }
8970
+ var beforeShow = $.datepicker._get(inst, 'beforeShow');
8971
+ var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
8972
+ if(beforeShowSettings === false){
8973
+ //false
8974
+ return;
8975
+ }
8976
+ extendRemove(inst.settings, beforeShowSettings);
8977
+ inst.lastVal = null;
8978
+ $.datepicker._lastInput = input;
8979
+ $.datepicker._setDateFromField(inst);
8980
+ if ($.datepicker._inDialog) // hide cursor
8981
+ input.value = '';
8982
+ if (!$.datepicker._pos) { // position below input
8983
+ $.datepicker._pos = $.datepicker._findPos(input);
8984
+ $.datepicker._pos[1] += input.offsetHeight; // add the height
8985
+ }
8986
+ var isFixed = false;
8987
+ $(input).parents().each(function() {
8988
+ isFixed |= $(this).css('position') == 'fixed';
8989
+ return !isFixed;
8990
+ });
8991
+ if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
8992
+ $.datepicker._pos[0] -= document.documentElement.scrollLeft;
8993
+ $.datepicker._pos[1] -= document.documentElement.scrollTop;
8994
+ }
8995
+ var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
8996
+ $.datepicker._pos = null;
8997
+ //to avoid flashes on Firefox
8998
+ inst.dpDiv.empty();
8999
+ // determine sizing offscreen
9000
+ inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
9001
+ $.datepicker._updateDatepicker(inst);
9002
+ // fix width for dynamic number of date pickers
9003
+ // and adjust position before showing
9004
+ offset = $.datepicker._checkOffset(inst, offset, isFixed);
9005
+ inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
9006
+ 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
9007
+ left: offset.left + 'px', top: offset.top + 'px'});
9008
+ if (!inst.inline) {
9009
+ var showAnim = $.datepicker._get(inst, 'showAnim');
9010
+ var duration = $.datepicker._get(inst, 'duration');
9011
+ var postProcess = function() {
9012
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
9013
+ if( !! cover.length ){
9014
+ var borders = $.datepicker._getBorders(inst.dpDiv);
9015
+ cover.css({left: -borders[0], top: -borders[1],
9016
+ width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
9017
+ }
9018
+ };
9019
+ inst.dpDiv.zIndex($(input).zIndex()+1);
9020
+ $.datepicker._datepickerShowing = true;
9021
+ if ($.effects && $.effects[showAnim])
9022
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
9023
+ else
9024
+ inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
9025
+ if (!showAnim || !duration)
9026
+ postProcess();
9027
+ if (inst.input.is(':visible') && !inst.input.is(':disabled'))
9028
+ inst.input.focus();
9029
+ $.datepicker._curInst = inst;
9030
+ }
9031
+ },
9032
+
9033
+ /* Generate the date picker content. */
9034
+ _updateDatepicker: function(inst) {
9035
+ var self = this;
9036
+ self.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
9037
+ var borders = $.datepicker._getBorders(inst.dpDiv);
9038
+ instActive = inst; // for delegate hover events
9039
+ inst.dpDiv.empty().append(this._generateHTML(inst));
9040
+ this._attachHandlers(inst);
9041
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
9042
+ if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
9043
+ cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
9044
+ }
9045
+ inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
9046
+ var numMonths = this._getNumberOfMonths(inst);
9047
+ var cols = numMonths[1];
9048
+ var width = 17;
9049
+ inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
9050
+ if (cols > 1)
9051
+ inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
9052
+ inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
9053
+ 'Class']('ui-datepicker-multi');
9054
+ inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
9055
+ 'Class']('ui-datepicker-rtl');
9056
+ if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
9057
+ // #6694 - don't focus the input if it's already focused
9058
+ // this breaks the change event in IE
9059
+ inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
9060
+ inst.input.focus();
9061
+ // deffered render of the years select (to avoid flashes on Firefox)
9062
+ if( inst.yearshtml ){
9063
+ var origyearshtml = inst.yearshtml;
9064
+ setTimeout(function(){
9065
+ //assure that inst.yearshtml didn't change.
9066
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
9067
+ inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
9068
+ }
9069
+ origyearshtml = inst.yearshtml = null;
9070
+ }, 0);
9071
+ }
9072
+ },
9073
+
9074
+ /* Retrieve the size of left and top borders for an element.
9075
+ @param elem (jQuery object) the element of interest
9076
+ @return (number[2]) the left and top borders */
9077
+ _getBorders: function(elem) {
9078
+ var convert = function(value) {
9079
+ return {thin: 1, medium: 2, thick: 3}[value] || value;
9080
+ };
9081
+ return [parseFloat(convert(elem.css('border-left-width'))),
9082
+ parseFloat(convert(elem.css('border-top-width')))];
9083
+ },
9084
+
9085
+ /* Check positioning to remain on screen. */
9086
+ _checkOffset: function(inst, offset, isFixed) {
9087
+ var dpWidth = inst.dpDiv.outerWidth();
9088
+ var dpHeight = inst.dpDiv.outerHeight();
9089
+ var inputWidth = inst.input ? inst.input.outerWidth() : 0;
9090
+ var inputHeight = inst.input ? inst.input.outerHeight() : 0;
9091
+ var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft());
9092
+ var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
9093
+
9094
+ offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
9095
+ offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
9096
+ offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
9097
+
9098
+ // now check if datepicker is showing outside window viewport - move to a better place if so.
9099
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
9100
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
9101
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
9102
+ Math.abs(dpHeight + inputHeight) : 0);
9103
+
9104
+ return offset;
9105
+ },
9106
+
9107
+ /* Find an object's position on the screen. */
9108
+ _findPos: function(obj) {
9109
+ var inst = this._getInst(obj);
9110
+ var isRTL = this._get(inst, 'isRTL');
9111
+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
9112
+ obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
9113
+ }
9114
+ var position = $(obj).offset();
9115
+ return [position.left, position.top];
9116
+ },
9117
+
9118
+ /* Hide the date picker from view.
9119
+ @param input element - the input field attached to the date picker */
9120
+ _hideDatepicker: function(input) {
9121
+ var inst = this._curInst;
9122
+ if (!inst || (input && inst != $.data(input, PROP_NAME)))
9123
+ return;
9124
+ if (this._datepickerShowing) {
9125
+ var showAnim = this._get(inst, 'showAnim');
9126
+ var duration = this._get(inst, 'duration');
9127
+ var postProcess = function() {
9128
+ $.datepicker._tidyDialog(inst);
9129
+ };
9130
+ if ($.effects && $.effects[showAnim])
9131
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
9132
+ else
9133
+ inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
9134
+ (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
9135
+ if (!showAnim)
9136
+ postProcess();
9137
+ this._datepickerShowing = false;
9138
+ var onClose = this._get(inst, 'onClose');
9139
+ if (onClose)
9140
+ onClose.apply((inst.input ? inst.input[0] : null),
9141
+ [(inst.input ? inst.input.val() : ''), inst]);
9142
+ this._lastInput = null;
9143
+ if (this._inDialog) {
9144
+ this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
9145
+ if ($.blockUI) {
9146
+ $.unblockUI();
9147
+ $('body').append(this.dpDiv);
9148
+ }
9149
+ }
9150
+ this._inDialog = false;
9151
+ }
9152
+ },
9153
+
9154
+ /* Tidy up after a dialog display. */
9155
+ _tidyDialog: function(inst) {
9156
+ inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
9157
+ },
9158
+
9159
+ /* Close date picker if clicked elsewhere. */
9160
+ _checkExternalClick: function(event) {
9161
+ if (!$.datepicker._curInst)
9162
+ return;
9163
+
9164
+ var $target = $(event.target),
9165
+ inst = $.datepicker._getInst($target[0]);
9166
+
9167
+ if ( ( ( $target[0].id != $.datepicker._mainDivId &&
9168
+ $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
9169
+ !$target.hasClass($.datepicker.markerClassName) &&
9170
+ !$target.closest("." + $.datepicker._triggerClass).length &&
9171
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
9172
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
9173
+ $.datepicker._hideDatepicker();
9174
+ },
9175
+
9176
+ /* Adjust one of the date sub-fields. */
9177
+ _adjustDate: function(id, offset, period) {
9178
+ var target = $(id);
9179
+ var inst = this._getInst(target[0]);
9180
+ if (this._isDisabledDatepicker(target[0])) {
9181
+ return;
9182
+ }
9183
+ this._adjustInstDate(inst, offset +
9184
+ (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
9185
+ period);
9186
+ this._updateDatepicker(inst);
9187
+ },
9188
+
9189
+ /* Action for current link. */
9190
+ _gotoToday: function(id) {
9191
+ var target = $(id);
9192
+ var inst = this._getInst(target[0]);
9193
+ if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
9194
+ inst.selectedDay = inst.currentDay;
9195
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
9196
+ inst.drawYear = inst.selectedYear = inst.currentYear;
9197
+ }
9198
+ else {
9199
+ var date = new Date();
9200
+ inst.selectedDay = date.getDate();
9201
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
9202
+ inst.drawYear = inst.selectedYear = date.getFullYear();
9203
+ }
9204
+ this._notifyChange(inst);
9205
+ this._adjustDate(target);
9206
+ },
9207
+
9208
+ /* Action for selecting a new month/year. */
9209
+ _selectMonthYear: function(id, select, period) {
9210
+ var target = $(id);
9211
+ var inst = this._getInst(target[0]);
9212
+ inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
9213
+ inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
9214
+ parseInt(select.options[select.selectedIndex].value,10);
9215
+ this._notifyChange(inst);
9216
+ this._adjustDate(target);
9217
+ },
9218
+
9219
+ /* Action for selecting a day. */
9220
+ _selectDay: function(id, month, year, td) {
9221
+ var target = $(id);
9222
+ if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
9223
+ return;
9224
+ }
9225
+ var inst = this._getInst(target[0]);
9226
+ inst.selectedDay = inst.currentDay = $('a', td).html();
9227
+ inst.selectedMonth = inst.currentMonth = month;
9228
+ inst.selectedYear = inst.currentYear = year;
9229
+ this._selectDate(id, this._formatDate(inst,
9230
+ inst.currentDay, inst.currentMonth, inst.currentYear));
9231
+ },
9232
+
9233
+ /* Erase the input field and hide the date picker. */
9234
+ _clearDate: function(id) {
9235
+ var target = $(id);
9236
+ var inst = this._getInst(target[0]);
9237
+ this._selectDate(target, '');
9238
+ },
9239
+
9240
+ /* Update the input field with the selected date. */
9241
+ _selectDate: function(id, dateStr) {
9242
+ var target = $(id);
9243
+ var inst = this._getInst(target[0]);
9244
+ dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
9245
+ if (inst.input)
9246
+ inst.input.val(dateStr);
9247
+ this._updateAlternate(inst);
9248
+ var onSelect = this._get(inst, 'onSelect');
9249
+ if (onSelect)
9250
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
9251
+ else if (inst.input)
9252
+ inst.input.trigger('change'); // fire the change event
9253
+ if (inst.inline)
9254
+ this._updateDatepicker(inst);
9255
+ else {
9256
+ this._hideDatepicker();
9257
+ this._lastInput = inst.input[0];
9258
+ if (typeof(inst.input[0]) != 'object')
9259
+ inst.input.focus(); // restore focus
9260
+ this._lastInput = null;
9261
+ }
9262
+ },
9263
+
9264
+ /* Update any alternate field to synchronise with the main field. */
9265
+ _updateAlternate: function(inst) {
9266
+ var altField = this._get(inst, 'altField');
9267
+ if (altField) { // update alternate field too
9268
+ var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
9269
+ var date = this._getDate(inst);
9270
+ var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
9271
+ $(altField).each(function() { $(this).val(dateStr); });
9272
+ }
9273
+ },
9274
+
9275
+ /* Set as beforeShowDay function to prevent selection of weekends.
9276
+ @param date Date - the date to customise
9277
+ @return [boolean, string] - is this date selectable?, what is its CSS class? */
9278
+ noWeekends: function(date) {
9279
+ var day = date.getDay();
9280
+ return [(day > 0 && day < 6), ''];
9281
+ },
9282
+
9283
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
9284
+ @param date Date - the date to get the week for
9285
+ @return number - the number of the week within the year that contains this date */
9286
+ iso8601Week: function(date) {
9287
+ var checkDate = new Date(date.getTime());
9288
+ // Find Thursday of this week starting on Monday
9289
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
9290
+ var time = checkDate.getTime();
9291
+ checkDate.setMonth(0); // Compare with Jan 1
9292
+ checkDate.setDate(1);
9293
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
9294
+ },
9295
+
9296
+ /* Parse a string value into a date object.
9297
+ See formatDate below for the possible formats.
9298
+
9299
+ @param format string - the expected format of the date
9300
+ @param value string - the date in the above format
9301
+ @param settings Object - attributes include:
9302
+ shortYearCutoff number - the cutoff year for determining the century (optional)
9303
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
9304
+ dayNames string[7] - names of the days from Sunday (optional)
9305
+ monthNamesShort string[12] - abbreviated names of the months (optional)
9306
+ monthNames string[12] - names of the months (optional)
9307
+ @return Date - the extracted date value or null if value is blank */
9308
+ parseDate: function (format, value, settings) {
9309
+ if (format == null || value == null)
9310
+ throw 'Invalid arguments';
9311
+ value = (typeof value == 'object' ? value.toString() : value + '');
9312
+ if (value == '')
9313
+ return null;
9314
+ var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
9315
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
9316
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
9317
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
9318
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
9319
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
9320
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
9321
+ var year = -1;
9322
+ var month = -1;
9323
+ var day = -1;
9324
+ var doy = -1;
9325
+ var literal = false;
9326
+ // Check whether a format character is doubled
9327
+ var lookAhead = function(match) {
9328
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
9329
+ if (matches)
9330
+ iFormat++;
9331
+ return matches;
9332
+ };
9333
+ // Extract a number from the string value
9334
+ var getNumber = function(match) {
9335
+ var isDoubled = lookAhead(match);
9336
+ var size = (match == '@' ? 14 : (match == '!' ? 20 :
9337
+ (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
9338
+ var digits = new RegExp('^\\d{1,' + size + '}');
9339
+ var num = value.substring(iValue).match(digits);
9340
+ if (!num)
9341
+ throw 'Missing number at position ' + iValue;
9342
+ iValue += num[0].length;
9343
+ return parseInt(num[0], 10);
9344
+ };
9345
+ // Extract a name from the string value and convert to an index
9346
+ var getName = function(match, shortNames, longNames) {
9347
+ var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
9348
+ return [ [k, v] ];
9349
+ }).sort(function (a, b) {
9350
+ return -(a[1].length - b[1].length);
9351
+ });
9352
+ var index = -1;
9353
+ $.each(names, function (i, pair) {
9354
+ var name = pair[1];
9355
+ if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
9356
+ index = pair[0];
9357
+ iValue += name.length;
9358
+ return false;
9359
+ }
9360
+ });
9361
+ if (index != -1)
9362
+ return index + 1;
9363
+ else
9364
+ throw 'Unknown name at position ' + iValue;
9365
+ };
9366
+ // Confirm that a literal character matches the string value
9367
+ var checkLiteral = function() {
9368
+ if (value.charAt(iValue) != format.charAt(iFormat))
9369
+ throw 'Unexpected literal at position ' + iValue;
9370
+ iValue++;
9371
+ };
9372
+ var iValue = 0;
9373
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
9374
+ if (literal)
9375
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
9376
+ literal = false;
9377
+ else
9378
+ checkLiteral();
9379
+ else
9380
+ switch (format.charAt(iFormat)) {
9381
+ case 'd':
9382
+ day = getNumber('d');
9383
+ break;
9384
+ case 'D':
9385
+ getName('D', dayNamesShort, dayNames);
9386
+ break;
9387
+ case 'o':
9388
+ doy = getNumber('o');
9389
+ break;
9390
+ case 'm':
9391
+ month = getNumber('m');
9392
+ break;
9393
+ case 'M':
9394
+ month = getName('M', monthNamesShort, monthNames);
9395
+ break;
9396
+ case 'y':
9397
+ year = getNumber('y');
9398
+ break;
9399
+ case '@':
9400
+ var date = new Date(getNumber('@'));
9401
+ year = date.getFullYear();
9402
+ month = date.getMonth() + 1;
9403
+ day = date.getDate();
9404
+ break;
9405
+ case '!':
9406
+ var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
9407
+ year = date.getFullYear();
9408
+ month = date.getMonth() + 1;
9409
+ day = date.getDate();
9410
+ break;
9411
+ case "'":
9412
+ if (lookAhead("'"))
9413
+ checkLiteral();
9414
+ else
9415
+ literal = true;
9416
+ break;
9417
+ default:
9418
+ checkLiteral();
9419
+ }
9420
+ }
9421
+ if (iValue < value.length){
9422
+ throw "Extra/unparsed characters found in date: " + value.substring(iValue);
9423
+ }
9424
+ if (year == -1)
9425
+ year = new Date().getFullYear();
9426
+ else if (year < 100)
9427
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
9428
+ (year <= shortYearCutoff ? 0 : -100);
9429
+ if (doy > -1) {
9430
+ month = 1;
9431
+ day = doy;
9432
+ do {
9433
+ var dim = this._getDaysInMonth(year, month - 1);
9434
+ if (day <= dim)
9435
+ break;
9436
+ month++;
9437
+ day -= dim;
9438
+ } while (true);
9439
+ }
9440
+ var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
9441
+ if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
9442
+ throw 'Invalid date'; // E.g. 31/02/00
9443
+ return date;
9444
+ },
9445
+
9446
+ /* Standard date formats. */
9447
+ ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
9448
+ COOKIE: 'D, dd M yy',
9449
+ ISO_8601: 'yy-mm-dd',
9450
+ RFC_822: 'D, d M y',
9451
+ RFC_850: 'DD, dd-M-y',
9452
+ RFC_1036: 'D, d M y',
9453
+ RFC_1123: 'D, d M yy',
9454
+ RFC_2822: 'D, d M yy',
9455
+ RSS: 'D, d M y', // RFC 822
9456
+ TICKS: '!',
9457
+ TIMESTAMP: '@',
9458
+ W3C: 'yy-mm-dd', // ISO 8601
9459
+
9460
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
9461
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
9462
+
9463
+ /* Format a date object into a string value.
9464
+ The format can be combinations of the following:
9465
+ d - day of month (no leading zero)
9466
+ dd - day of month (two digit)
9467
+ o - day of year (no leading zeros)
9468
+ oo - day of year (three digit)
9469
+ D - day name short
9470
+ DD - day name long
9471
+ m - month of year (no leading zero)
9472
+ mm - month of year (two digit)
9473
+ M - month name short
9474
+ MM - month name long
9475
+ y - year (two digit)
9476
+ yy - year (four digit)
9477
+ @ - Unix timestamp (ms since 01/01/1970)
9478
+ ! - Windows ticks (100ns since 01/01/0001)
9479
+ '...' - literal text
9480
+ '' - single quote
9481
+
9482
+ @param format string - the desired format of the date
9483
+ @param date Date - the date value to format
9484
+ @param settings Object - attributes include:
9485
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
9486
+ dayNames string[7] - names of the days from Sunday (optional)
9487
+ monthNamesShort string[12] - abbreviated names of the months (optional)
9488
+ monthNames string[12] - names of the months (optional)
9489
+ @return string - the date in the above format */
9490
+ formatDate: function (format, date, settings) {
9491
+ if (!date)
9492
+ return '';
9493
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
9494
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
9495
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
9496
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
9497
+ // Check whether a format character is doubled
9498
+ var lookAhead = function(match) {
9499
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
9500
+ if (matches)
9501
+ iFormat++;
9502
+ return matches;
9503
+ };
9504
+ // Format a number, with leading zero if necessary
9505
+ var formatNumber = function(match, value, len) {
9506
+ var num = '' + value;
9507
+ if (lookAhead(match))
9508
+ while (num.length < len)
9509
+ num = '0' + num;
9510
+ return num;
9511
+ };
9512
+ // Format a name, short or long as requested
9513
+ var formatName = function(match, value, shortNames, longNames) {
9514
+ return (lookAhead(match) ? longNames[value] : shortNames[value]);
9515
+ };
9516
+ var output = '';
9517
+ var literal = false;
9518
+ if (date)
9519
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
9520
+ if (literal)
9521
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
9522
+ literal = false;
9523
+ else
9524
+ output += format.charAt(iFormat);
9525
+ else
9526
+ switch (format.charAt(iFormat)) {
9527
+ case 'd':
9528
+ output += formatNumber('d', date.getDate(), 2);
9529
+ break;
9530
+ case 'D':
9531
+ output += formatName('D', date.getDay(), dayNamesShort, dayNames);
9532
+ break;
9533
+ case 'o':
9534
+ output += formatNumber('o',
9535
+ Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
9536
+ break;
9537
+ case 'm':
9538
+ output += formatNumber('m', date.getMonth() + 1, 2);
9539
+ break;
9540
+ case 'M':
9541
+ output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
9542
+ break;
9543
+ case 'y':
9544
+ output += (lookAhead('y') ? date.getFullYear() :
9545
+ (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
9546
+ break;
9547
+ case '@':
9548
+ output += date.getTime();
9549
+ break;
9550
+ case '!':
9551
+ output += date.getTime() * 10000 + this._ticksTo1970;
9552
+ break;
9553
+ case "'":
9554
+ if (lookAhead("'"))
9555
+ output += "'";
9556
+ else
9557
+ literal = true;
9558
+ break;
9559
+ default:
9560
+ output += format.charAt(iFormat);
9561
+ }
9562
+ }
9563
+ return output;
9564
+ },
9565
+
9566
+ /* Extract all possible characters from the date format. */
9567
+ _possibleChars: function (format) {
9568
+ var chars = '';
9569
+ var literal = false;
9570
+ // Check whether a format character is doubled
9571
+ var lookAhead = function(match) {
9572
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
9573
+ if (matches)
9574
+ iFormat++;
9575
+ return matches;
9576
+ };
9577
+ for (var iFormat = 0; iFormat < format.length; iFormat++)
9578
+ if (literal)
9579
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
9580
+ literal = false;
9581
+ else
9582
+ chars += format.charAt(iFormat);
9583
+ else
9584
+ switch (format.charAt(iFormat)) {
9585
+ case 'd': case 'm': case 'y': case '@':
9586
+ chars += '0123456789';
9587
+ break;
9588
+ case 'D': case 'M':
9589
+ return null; // Accept anything
9590
+ case "'":
9591
+ if (lookAhead("'"))
9592
+ chars += "'";
9593
+ else
9594
+ literal = true;
9595
+ break;
9596
+ default:
9597
+ chars += format.charAt(iFormat);
9598
+ }
9599
+ return chars;
9600
+ },
9601
+
9602
+ /* Get a setting value, defaulting if necessary. */
9603
+ _get: function(inst, name) {
9604
+ return inst.settings[name] !== undefined ?
9605
+ inst.settings[name] : this._defaults[name];
9606
+ },
9607
+
9608
+ /* Parse existing date and initialise date picker. */
9609
+ _setDateFromField: function(inst, noDefault) {
9610
+ if (inst.input.val() == inst.lastVal) {
9611
+ return;
9612
+ }
9613
+ var dateFormat = this._get(inst, 'dateFormat');
9614
+ var dates = inst.lastVal = inst.input ? inst.input.val() : null;
9615
+ var date, defaultDate;
9616
+ date = defaultDate = this._getDefaultDate(inst);
9617
+ var settings = this._getFormatConfig(inst);
9618
+ try {
9619
+ date = this.parseDate(dateFormat, dates, settings) || defaultDate;
9620
+ } catch (event) {
9621
+ this.log(event);
9622
+ dates = (noDefault ? '' : dates);
9623
+ }
9624
+ inst.selectedDay = date.getDate();
9625
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
9626
+ inst.drawYear = inst.selectedYear = date.getFullYear();
9627
+ inst.currentDay = (dates ? date.getDate() : 0);
9628
+ inst.currentMonth = (dates ? date.getMonth() : 0);
9629
+ inst.currentYear = (dates ? date.getFullYear() : 0);
9630
+ this._adjustInstDate(inst);
9631
+ },
9632
+
9633
+ /* Retrieve the default date shown on opening. */
9634
+ _getDefaultDate: function(inst) {
9635
+ return this._restrictMinMax(inst,
9636
+ this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
9637
+ },
9638
+
9639
+ /* A date may be specified as an exact value or a relative one. */
9640
+ _determineDate: function(inst, date, defaultDate) {
9641
+ var offsetNumeric = function(offset) {
9642
+ var date = new Date();
9643
+ date.setDate(date.getDate() + offset);
9644
+ return date;
9645
+ };
9646
+ var offsetString = function(offset) {
9647
+ try {
9648
+ return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
9649
+ offset, $.datepicker._getFormatConfig(inst));
9650
+ }
9651
+ catch (e) {
9652
+ // Ignore
9653
+ }
9654
+ var date = (offset.toLowerCase().match(/^c/) ?
9655
+ $.datepicker._getDate(inst) : null) || new Date();
9656
+ var year = date.getFullYear();
9657
+ var month = date.getMonth();
9658
+ var day = date.getDate();
9659
+ var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
9660
+ var matches = pattern.exec(offset);
9661
+ while (matches) {
9662
+ switch (matches[2] || 'd') {
9663
+ case 'd' : case 'D' :
9664
+ day += parseInt(matches[1],10); break;
9665
+ case 'w' : case 'W' :
9666
+ day += parseInt(matches[1],10) * 7; break;
9667
+ case 'm' : case 'M' :
9668
+ month += parseInt(matches[1],10);
9669
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
9670
+ break;
9671
+ case 'y': case 'Y' :
9672
+ year += parseInt(matches[1],10);
9673
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
9674
+ break;
9675
+ }
9676
+ matches = pattern.exec(offset);
9677
+ }
9678
+ return new Date(year, month, day);
9679
+ };
9680
+ var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
9681
+ (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
9682
+ newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
9683
+ if (newDate) {
9684
+ newDate.setHours(0);
9685
+ newDate.setMinutes(0);
9686
+ newDate.setSeconds(0);
9687
+ newDate.setMilliseconds(0);
9688
+ }
9689
+ return this._daylightSavingAdjust(newDate);
9690
+ },
9691
+
9692
+ /* Handle switch to/from daylight saving.
9693
+ Hours may be non-zero on daylight saving cut-over:
9694
+ > 12 when midnight changeover, but then cannot generate
9695
+ midnight datetime, so jump to 1AM, otherwise reset.
9696
+ @param date (Date) the date to check
9697
+ @return (Date) the corrected date */
9698
+ _daylightSavingAdjust: function(date) {
9699
+ if (!date) return null;
9700
+ date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
9701
+ return date;
9702
+ },
9703
+
9704
+ /* Set the date(s) directly. */
9705
+ _setDate: function(inst, date, noChange) {
9706
+ var clear = !date;
9707
+ var origMonth = inst.selectedMonth;
9708
+ var origYear = inst.selectedYear;
9709
+ var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
9710
+ inst.selectedDay = inst.currentDay = newDate.getDate();
9711
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
9712
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
9713
+ if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
9714
+ this._notifyChange(inst);
9715
+ this._adjustInstDate(inst);
9716
+ if (inst.input) {
9717
+ inst.input.val(clear ? '' : this._formatDate(inst));
9718
+ }
9719
+ },
9720
+
9721
+ /* Retrieve the date(s) directly. */
9722
+ _getDate: function(inst) {
9723
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
9724
+ this._daylightSavingAdjust(new Date(
9725
+ inst.currentYear, inst.currentMonth, inst.currentDay)));
9726
+ return startDate;
9727
+ },
9728
+
9729
+ /* Attach the onxxx handlers. These are declared statically so
9730
+ * they work with static code transformers like Caja.
9731
+ */
9732
+ _attachHandlers: function(inst) {
9733
+ var stepMonths = this._get(inst, 'stepMonths');
9734
+ var id = '#' + inst.id.replace( /\\\\/g, "\\" );
9735
+ inst.dpDiv.find('[data-handler]').map(function () {
9736
+ var handler = {
9737
+ prev: function () {
9738
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M');
9739
+ },
9740
+ next: function () {
9741
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M');
9742
+ },
9743
+ hide: function () {
9744
+ window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker();
9745
+ },
9746
+ today: function () {
9747
+ window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id);
9748
+ },
9749
+ selectDay: function () {
9750
+ window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this);
9751
+ return false;
9752
+ },
9753
+ selectMonth: function () {
9754
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M');
9755
+ return false;
9756
+ },
9757
+ selectYear: function () {
9758
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y');
9759
+ return false;
9760
+ }
9761
+ };
9762
+ $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
9763
+ });
9764
+ },
9765
+
9766
+ /* Generate the HTML for the current state of the date picker. */
9767
+ _generateHTML: function(inst) {
9768
+ var today = new Date();
9769
+ today = this._daylightSavingAdjust(
9770
+ new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
9771
+ var isRTL = this._get(inst, 'isRTL');
9772
+ var showButtonPanel = this._get(inst, 'showButtonPanel');
9773
+ var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
9774
+ var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
9775
+ var numMonths = this._getNumberOfMonths(inst);
9776
+ var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
9777
+ var stepMonths = this._get(inst, 'stepMonths');
9778
+ var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
9779
+ var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
9780
+ new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
9781
+ var minDate = this._getMinMaxDate(inst, 'min');
9782
+ var maxDate = this._getMinMaxDate(inst, 'max');
9783
+ var drawMonth = inst.drawMonth - showCurrentAtPos;
9784
+ var drawYear = inst.drawYear;
9785
+ if (drawMonth < 0) {
9786
+ drawMonth += 12;
9787
+ drawYear--;
9788
+ }
9789
+ if (maxDate) {
9790
+ var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
9791
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
9792
+ maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
9793
+ while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
9794
+ drawMonth--;
9795
+ if (drawMonth < 0) {
9796
+ drawMonth = 11;
9797
+ drawYear--;
9798
+ }
9799
+ }
9800
+ }
9801
+ inst.drawMonth = drawMonth;
9802
+ inst.drawYear = drawYear;
9803
+ var prevText = this._get(inst, 'prevText');
9804
+ prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
9805
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
9806
+ this._getFormatConfig(inst)));
9807
+ var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
9808
+ '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' +
9809
+ ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
9810
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
9811
+ var nextText = this._get(inst, 'nextText');
9812
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
9813
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
9814
+ this._getFormatConfig(inst)));
9815
+ var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
9816
+ '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' +
9817
+ ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
9818
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
9819
+ var currentText = this._get(inst, 'currentText');
9820
+ var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
9821
+ currentText = (!navigationAsDateFormat ? currentText :
9822
+ this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
9823
+ var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' +
9824
+ this._get(inst, 'closeText') + '</button>' : '');
9825
+ var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
9826
+ (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
9827
+ '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
9828
+ var firstDay = parseInt(this._get(inst, 'firstDay'),10);
9829
+ firstDay = (isNaN(firstDay) ? 0 : firstDay);
9830
+ var showWeek = this._get(inst, 'showWeek');
9831
+ var dayNames = this._get(inst, 'dayNames');
9832
+ var dayNamesShort = this._get(inst, 'dayNamesShort');
9833
+ var dayNamesMin = this._get(inst, 'dayNamesMin');
9834
+ var monthNames = this._get(inst, 'monthNames');
9835
+ var monthNamesShort = this._get(inst, 'monthNamesShort');
9836
+ var beforeShowDay = this._get(inst, 'beforeShowDay');
9837
+ var showOtherMonths = this._get(inst, 'showOtherMonths');
9838
+ var selectOtherMonths = this._get(inst, 'selectOtherMonths');
9839
+ var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
9840
+ var defaultDate = this._getDefaultDate(inst);
9841
+ var html = '';
9842
+ for (var row = 0; row < numMonths[0]; row++) {
9843
+ var group = '';
9844
+ this.maxRows = 4;
9845
+ for (var col = 0; col < numMonths[1]; col++) {
9846
+ var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
9847
+ var cornerClass = ' ui-corner-all';
9848
+ var calender = '';
9849
+ if (isMultiMonth) {
9850
+ calender += '<div class="ui-datepicker-group';
9851
+ if (numMonths[1] > 1)
9852
+ switch (col) {
9853
+ case 0: calender += ' ui-datepicker-group-first';
9854
+ cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
9855
+ case numMonths[1]-1: calender += ' ui-datepicker-group-last';
9856
+ cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
9857
+ default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
9858
+ }
9859
+ calender += '">';
9860
+ }
9861
+ calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
9862
+ (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
9863
+ (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
9864
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
9865
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
9866
+ '</div><table class="ui-datepicker-calendar"><thead>' +
9867
+ '<tr>';
9868
+ var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
9869
+ for (var dow = 0; dow < 7; dow++) { // days of the week
9870
+ var day = (dow + firstDay) % 7;
9871
+ thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
9872
+ '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
9873
+ }
9874
+ calender += thead + '</tr></thead><tbody>';
9875
+ var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
9876
+ if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
9877
+ inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
9878
+ var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
9879
+ var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
9880
+ var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
9881
+ this.maxRows = numRows;
9882
+ var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
9883
+ for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
9884
+ calender += '<tr>';
9885
+ var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
9886
+ this._get(inst, 'calculateWeek')(printDate) + '</td>');
9887
+ for (var dow = 0; dow < 7; dow++) { // create date picker days
9888
+ var daySettings = (beforeShowDay ?
9889
+ beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
9890
+ var otherMonth = (printDate.getMonth() != drawMonth);
9891
+ var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
9892
+ (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
9893
+ tbody += '<td class="' +
9894
+ ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
9895
+ (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
9896
+ ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
9897
+ (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
9898
+ // or defaultDate is current printedDate and defaultDate is selectedDate
9899
+ ' ' + this._dayOverClass : '') + // highlight selected day
9900
+ (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
9901
+ (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
9902
+ (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
9903
+ (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
9904
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
9905
+ (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions
9906
+ (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
9907
+ (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
9908
+ (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
9909
+ (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
9910
+ (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
9911
+ '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
9912
+ printDate.setDate(printDate.getDate() + 1);
9913
+ printDate = this._daylightSavingAdjust(printDate);
9914
+ }
9915
+ calender += tbody + '</tr>';
9916
+ }
9917
+ drawMonth++;
9918
+ if (drawMonth > 11) {
9919
+ drawMonth = 0;
9920
+ drawYear++;
9921
+ }
9922
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
9923
+ ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
9924
+ group += calender;
9925
+ }
9926
+ html += group;
9927
+ }
9928
+ html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
9929
+ '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
9930
+ inst._keyEvent = false;
9931
+ return html;
9932
+ },
9933
+
9934
+ /* Generate the month and year header. */
9935
+ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
9936
+ secondary, monthNames, monthNamesShort) {
9937
+ var changeMonth = this._get(inst, 'changeMonth');
9938
+ var changeYear = this._get(inst, 'changeYear');
9939
+ var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
9940
+ var html = '<div class="ui-datepicker-title">';
9941
+ var monthHtml = '';
9942
+ // month selection
9943
+ if (secondary || !changeMonth)
9944
+ monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
9945
+ else {
9946
+ var inMinYear = (minDate && minDate.getFullYear() == drawYear);
9947
+ var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
9948
+ monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';
9949
+ for (var month = 0; month < 12; month++) {
9950
+ if ((!inMinYear || month >= minDate.getMonth()) &&
9951
+ (!inMaxYear || month <= maxDate.getMonth()))
9952
+ monthHtml += '<option value="' + month + '"' +
9953
+ (month == drawMonth ? ' selected="selected"' : '') +
9954
+ '>' + monthNamesShort[month] + '</option>';
9955
+ }
9956
+ monthHtml += '</select>';
9957
+ }
9958
+ if (!showMonthAfterYear)
9959
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
9960
+ // year selection
9961
+ if ( !inst.yearshtml ) {
9962
+ inst.yearshtml = '';
9963
+ if (secondary || !changeYear)
9964
+ html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
9965
+ else {
9966
+ // determine range of years to display
9967
+ var years = this._get(inst, 'yearRange').split(':');
9968
+ var thisYear = new Date().getFullYear();
9969
+ var determineYear = function(value) {
9970
+ var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
9971
+ (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
9972
+ parseInt(value, 10)));
9973
+ return (isNaN(year) ? thisYear : year);
9974
+ };
9975
+ var year = determineYear(years[0]);
9976
+ var endYear = Math.max(year, determineYear(years[1] || ''));
9977
+ year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
9978
+ endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
9979
+ inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';
9980
+ for (; year <= endYear; year++) {
9981
+ inst.yearshtml += '<option value="' + year + '"' +
9982
+ (year == drawYear ? ' selected="selected"' : '') +
9983
+ '>' + year + '</option>';
9984
+ }
9985
+ inst.yearshtml += '</select>';
9986
+
9987
+ html += inst.yearshtml;
9988
+ inst.yearshtml = null;
9989
+ }
9990
+ }
9991
+ html += this._get(inst, 'yearSuffix');
9992
+ if (showMonthAfterYear)
9993
+ html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
9994
+ html += '</div>'; // Close datepicker_header
9995
+ return html;
9996
+ },
9997
+
9998
+ /* Adjust one of the date sub-fields. */
9999
+ _adjustInstDate: function(inst, offset, period) {
10000
+ var year = inst.drawYear + (period == 'Y' ? offset : 0);
10001
+ var month = inst.drawMonth + (period == 'M' ? offset : 0);
10002
+ var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
10003
+ (period == 'D' ? offset : 0);
10004
+ var date = this._restrictMinMax(inst,
10005
+ this._daylightSavingAdjust(new Date(year, month, day)));
10006
+ inst.selectedDay = date.getDate();
10007
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
10008
+ inst.drawYear = inst.selectedYear = date.getFullYear();
10009
+ if (period == 'M' || period == 'Y')
10010
+ this._notifyChange(inst);
10011
+ },
10012
+
10013
+ /* Ensure a date is within any min/max bounds. */
10014
+ _restrictMinMax: function(inst, date) {
10015
+ var minDate = this._getMinMaxDate(inst, 'min');
10016
+ var maxDate = this._getMinMaxDate(inst, 'max');
10017
+ var newDate = (minDate && date < minDate ? minDate : date);
10018
+ newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
10019
+ return newDate;
10020
+ },
10021
+
10022
+ /* Notify change of month/year. */
10023
+ _notifyChange: function(inst) {
10024
+ var onChange = this._get(inst, 'onChangeMonthYear');
10025
+ if (onChange)
10026
+ onChange.apply((inst.input ? inst.input[0] : null),
10027
+ [inst.selectedYear, inst.selectedMonth + 1, inst]);
10028
+ },
10029
+
10030
+ /* Determine the number of months to show. */
10031
+ _getNumberOfMonths: function(inst) {
10032
+ var numMonths = this._get(inst, 'numberOfMonths');
10033
+ return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
10034
+ },
10035
+
10036
+ /* Determine the current maximum date - ensure no time components are set. */
10037
+ _getMinMaxDate: function(inst, minMax) {
10038
+ return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
10039
+ },
10040
+
10041
+ /* Find the number of days in a given month. */
10042
+ _getDaysInMonth: function(year, month) {
10043
+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
10044
+ },
10045
+
10046
+ /* Find the day of the week of the first of a month. */
10047
+ _getFirstDayOfMonth: function(year, month) {
10048
+ return new Date(year, month, 1).getDay();
10049
+ },
10050
+
10051
+ /* Determines if we should allow a "next/prev" month display change. */
10052
+ _canAdjustMonth: function(inst, offset, curYear, curMonth) {
10053
+ var numMonths = this._getNumberOfMonths(inst);
10054
+ var date = this._daylightSavingAdjust(new Date(curYear,
10055
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
10056
+ if (offset < 0)
10057
+ date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
10058
+ return this._isInRange(inst, date);
10059
+ },
10060
+
10061
+ /* Is the given date in the accepted range? */
10062
+ _isInRange: function(inst, date) {
10063
+ var minDate = this._getMinMaxDate(inst, 'min');
10064
+ var maxDate = this._getMinMaxDate(inst, 'max');
10065
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
10066
+ (!maxDate || date.getTime() <= maxDate.getTime()));
10067
+ },
10068
+
10069
+ /* Provide the configuration settings for formatting/parsing. */
10070
+ _getFormatConfig: function(inst) {
10071
+ var shortYearCutoff = this._get(inst, 'shortYearCutoff');
10072
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
10073
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
10074
+ return {shortYearCutoff: shortYearCutoff,
10075
+ dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
10076
+ monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
10077
+ },
10078
+
10079
+ /* Format the given date for display. */
10080
+ _formatDate: function(inst, day, month, year) {
10081
+ if (!day) {
10082
+ inst.currentDay = inst.selectedDay;
10083
+ inst.currentMonth = inst.selectedMonth;
10084
+ inst.currentYear = inst.selectedYear;
10085
+ }
10086
+ var date = (day ? (typeof day == 'object' ? day :
10087
+ this._daylightSavingAdjust(new Date(year, month, day))) :
10088
+ this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
10089
+ return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
10090
+ }
10091
+ });
10092
+
10093
+ /*
10094
+ * Bind hover events for datepicker elements.
10095
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
10096
+ * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
10097
+ */
10098
+ function bindHover(dpDiv) {
10099
+ var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
10100
+ return dpDiv.bind('mouseout', function(event) {
10101
+ var elem = $( event.target ).closest( selector );
10102
+ if ( !elem.length ) {
10103
+ return;
10104
+ }
10105
+ elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" );
10106
+ })
10107
+ .bind('mouseover', function(event) {
10108
+ var elem = $( event.target ).closest( selector );
10109
+ if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||
10110
+ !elem.length ) {
10111
+ return;
10112
+ }
10113
+ elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
10114
+ elem.addClass('ui-state-hover');
10115
+ if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');
10116
+ if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');
10117
+ });
10118
+ }
10119
+
10120
+ /* jQuery extend now ignores nulls! */
10121
+ function extendRemove(target, props) {
10122
+ $.extend(target, props);
10123
+ for (var name in props)
10124
+ if (props[name] == null || props[name] == undefined)
10125
+ target[name] = props[name];
10126
+ return target;
10127
+ };
10128
+
10129
+ /* Determine whether an object is an array. */
10130
+ function isArray(a) {
10131
+ return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
10132
+ (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
10133
+ };
10134
+
10135
+ /* Invoke the datepicker functionality.
10136
+ @param options string - a command, optionally followed by additional parameters or
10137
+ Object - settings for attaching new datepicker functionality
10138
+ @return jQuery object */
10139
+ $.fn.datepicker = function(options){
10140
+
10141
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
10142
+ if ( !this.length ) {
10143
+ return this;
10144
+ }
10145
+
10146
+ /* Initialise the date picker. */
10147
+ if (!$.datepicker.initialized) {
10148
+ $(document).mousedown($.datepicker._checkExternalClick).
10149
+ find('body').append($.datepicker.dpDiv);
10150
+ $.datepicker.initialized = true;
10151
+ }
10152
+
10153
+ var otherArgs = Array.prototype.slice.call(arguments, 1);
10154
+ if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
10155
+ return $.datepicker['_' + options + 'Datepicker'].
10156
+ apply($.datepicker, [this[0]].concat(otherArgs));
10157
+ if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
10158
+ return $.datepicker['_' + options + 'Datepicker'].
10159
+ apply($.datepicker, [this[0]].concat(otherArgs));
10160
+ return this.each(function() {
10161
+ typeof options == 'string' ?
10162
+ $.datepicker['_' + options + 'Datepicker'].
10163
+ apply($.datepicker, [this].concat(otherArgs)) :
10164
+ $.datepicker._attachDatepicker(this, options);
10165
+ });
10166
+ };
10167
+
10168
+ $.datepicker = new Datepicker(); // singleton instance
10169
+ $.datepicker.initialized = false;
10170
+ $.datepicker.uuid = new Date().getTime();
10171
+ $.datepicker.version = "1.8.24";
10172
+
10173
+ // Workaround for #4055
10174
+ // Add another global to avoid noConflict issues with inline event handlers
10175
+ window['DP_jQuery_' + dpuuid] = $;
10176
+
10177
+ })(jQuery);
10178
+ /*!
10179
+ * jQuery UI Progressbar 1.8.24
10180
+ *
10181
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
10182
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10183
+ * http://jquery.org/license
10184
+ *
10185
+ * http://docs.jquery.com/UI/Progressbar
10186
+ *
10187
+ * Depends:
10188
+ * jquery.ui.core.js
10189
+ * jquery.ui.widget.js
10190
+ */
10191
+ (function( $, undefined ) {
10192
+
10193
+ $.widget( "ui.progressbar", {
10194
+ options: {
10195
+ value: 0,
10196
+ max: 100
10197
+ },
10198
+
10199
+ min: 0,
10200
+
10201
+ _create: function() {
10202
+ this.element
10203
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
10204
+ .attr({
10205
+ role: "progressbar",
10206
+ "aria-valuemin": this.min,
10207
+ "aria-valuemax": this.options.max,
10208
+ "aria-valuenow": this._value()
10209
+ });
10210
+
10211
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
10212
+ .appendTo( this.element );
10213
+
10214
+ this.oldValue = this._value();
10215
+ this._refreshValue();
10216
+ },
10217
+
10218
+ destroy: function() {
10219
+ this.element
10220
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
10221
+ .removeAttr( "role" )
10222
+ .removeAttr( "aria-valuemin" )
10223
+ .removeAttr( "aria-valuemax" )
10224
+ .removeAttr( "aria-valuenow" );
10225
+
10226
+ this.valueDiv.remove();
10227
+
10228
+ $.Widget.prototype.destroy.apply( this, arguments );
10229
+ },
10230
+
10231
+ value: function( newValue ) {
10232
+ if ( newValue === undefined ) {
10233
+ return this._value();
10234
+ }
10235
+
10236
+ this._setOption( "value", newValue );
10237
+ return this;
10238
+ },
10239
+
10240
+ _setOption: function( key, value ) {
10241
+ if ( key === "value" ) {
10242
+ this.options.value = value;
10243
+ this._refreshValue();
10244
+ if ( this._value() === this.options.max ) {
10245
+ this._trigger( "complete" );
10246
+ }
10247
+ }
10248
+
10249
+ $.Widget.prototype._setOption.apply( this, arguments );
10250
+ },
10251
+
10252
+ _value: function() {
10253
+ var val = this.options.value;
10254
+ // normalize invalid value
10255
+ if ( typeof val !== "number" ) {
10256
+ val = 0;
10257
+ }
10258
+ return Math.min( this.options.max, Math.max( this.min, val ) );
10259
+ },
10260
+
10261
+ _percentage: function() {
10262
+ return 100 * this._value() / this.options.max;
10263
+ },
10264
+
10265
+ _refreshValue: function() {
10266
+ var value = this.value();
10267
+ var percentage = this._percentage();
10268
+
10269
+ if ( this.oldValue !== value ) {
10270
+ this.oldValue = value;
10271
+ this._trigger( "change" );
10272
+ }
10273
+
10274
+ this.valueDiv
10275
+ .toggle( value > this.min )
10276
+ .toggleClass( "ui-corner-right", value === this.options.max )
10277
+ .width( percentage.toFixed(0) + "%" );
10278
+ this.element.attr( "aria-valuenow", value );
10279
+ }
10280
+ });
10281
+
10282
+ $.extend( $.ui.progressbar, {
10283
+ version: "1.8.24"
10284
+ });
10285
+
10286
+ })( jQuery );
10287
+ /*!
10288
+ * jQuery UI Effects 1.8.24
10289
+ *
10290
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
10291
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10292
+ * http://jquery.org/license
10293
+ *
10294
+ * http://docs.jquery.com/UI/Effects/
10295
+ */
10296
+ ;jQuery.effects || (function($, undefined) {
10297
+
10298
+ $.effects = {};
10299
+
10300
+
10301
+
10302
+ /******************************************************************************/
10303
+ /****************************** COLOR ANIMATIONS ******************************/
10304
+ /******************************************************************************/
10305
+
10306
+ // override the animation for color styles
10307
+ $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
10308
+ 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
10309
+ function(i, attr) {
10310
+ $.fx.step[attr] = function(fx) {
10311
+ if (!fx.colorInit) {
10312
+ fx.start = getColor(fx.elem, attr);
10313
+ fx.end = getRGB(fx.end);
10314
+ fx.colorInit = true;
10315
+ }
10316
+
10317
+ fx.elem.style[attr] = 'rgb(' +
10318
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
10319
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
10320
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
10321
+ };
10322
+ });
10323
+
10324
+ // Color Conversion functions from highlightFade
10325
+ // By Blair Mitchelmore
10326
+ // http://jquery.offput.ca/highlightFade/
10327
+
10328
+ // Parse strings looking for color tuples [255,255,255]
10329
+ function getRGB(color) {
10330
+ var result;
10331
+
10332
+ // Check if we're already dealing with an array of colors
10333
+ if ( color && color.constructor == Array && color.length == 3 )
10334
+ return color;
10335
+
10336
+ // Look for rgb(num,num,num)
10337
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
10338
+ return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
10339
+
10340
+ // Look for rgb(num%,num%,num%)
10341
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
10342
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
10343
+
10344
+ // Look for #a0b1c2
10345
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
10346
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
10347
+
10348
+ // Look for #fff
10349
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
10350
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
10351
+
10352
+ // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
10353
+ if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
10354
+ return colors['transparent'];
10355
+
10356
+ // Otherwise, we're most likely dealing with a named color
10357
+ return colors[$.trim(color).toLowerCase()];
10358
+ }
10359
+
10360
+ function getColor(elem, attr) {
10361
+ var color;
10362
+
10363
+ do {
10364
+ // jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
10365
+ color = ($.curCSS || $.css)(elem, attr);
10366
+
10367
+ // Keep going until we find an element that has color, or we hit the body
10368
+ if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
10369
+ break;
10370
+
10371
+ attr = "backgroundColor";
10372
+ } while ( elem = elem.parentNode );
10373
+
10374
+ return getRGB(color);
10375
+ };
10376
+
10377
+ // Some named colors to work with
10378
+ // From Interface by Stefan Petre
10379
+ // http://interface.eyecon.ro/
10380
+
10381
+ var colors = {
10382
+ aqua:[0,255,255],
10383
+ azure:[240,255,255],
10384
+ beige:[245,245,220],
10385
+ black:[0,0,0],
10386
+ blue:[0,0,255],
10387
+ brown:[165,42,42],
10388
+ cyan:[0,255,255],
10389
+ darkblue:[0,0,139],
10390
+ darkcyan:[0,139,139],
10391
+ darkgrey:[169,169,169],
10392
+ darkgreen:[0,100,0],
10393
+ darkkhaki:[189,183,107],
10394
+ darkmagenta:[139,0,139],
10395
+ darkolivegreen:[85,107,47],
10396
+ darkorange:[255,140,0],
10397
+ darkorchid:[153,50,204],
10398
+ darkred:[139,0,0],
10399
+ darksalmon:[233,150,122],
10400
+ darkviolet:[148,0,211],
10401
+ fuchsia:[255,0,255],
10402
+ gold:[255,215,0],
10403
+ green:[0,128,0],
10404
+ indigo:[75,0,130],
10405
+ khaki:[240,230,140],
10406
+ lightblue:[173,216,230],
10407
+ lightcyan:[224,255,255],
10408
+ lightgreen:[144,238,144],
10409
+ lightgrey:[211,211,211],
10410
+ lightpink:[255,182,193],
10411
+ lightyellow:[255,255,224],
10412
+ lime:[0,255,0],
10413
+ magenta:[255,0,255],
10414
+ maroon:[128,0,0],
10415
+ navy:[0,0,128],
10416
+ olive:[128,128,0],
10417
+ orange:[255,165,0],
10418
+ pink:[255,192,203],
10419
+ purple:[128,0,128],
10420
+ violet:[128,0,128],
10421
+ red:[255,0,0],
10422
+ silver:[192,192,192],
10423
+ white:[255,255,255],
10424
+ yellow:[255,255,0],
10425
+ transparent: [255,255,255]
10426
+ };
10427
+
10428
+
10429
+
10430
+ /******************************************************************************/
10431
+ /****************************** CLASS ANIMATIONS ******************************/
10432
+ /******************************************************************************/
10433
+
10434
+ var classAnimationActions = ['add', 'remove', 'toggle'],
10435
+ shorthandStyles = {
10436
+ border: 1,
10437
+ borderBottom: 1,
10438
+ borderColor: 1,
10439
+ borderLeft: 1,
10440
+ borderRight: 1,
10441
+ borderTop: 1,
10442
+ borderWidth: 1,
10443
+ margin: 1,
10444
+ padding: 1
10445
+ };
10446
+
10447
+ function getElementStyles() {
10448
+ var style = document.defaultView
10449
+ ? document.defaultView.getComputedStyle(this, null)
10450
+ : this.currentStyle,
10451
+ newStyle = {},
10452
+ key,
10453
+ camelCase;
10454
+
10455
+ // webkit enumerates style porperties
10456
+ if (style && style.length && style[0] && style[style[0]]) {
10457
+ var len = style.length;
10458
+ while (len--) {
10459
+ key = style[len];
10460
+ if (typeof style[key] == 'string') {
10461
+ camelCase = key.replace(/\-(\w)/g, function(all, letter){
10462
+ return letter.toUpperCase();
10463
+ });
10464
+ newStyle[camelCase] = style[key];
10465
+ }
10466
+ }
10467
+ } else {
10468
+ for (key in style) {
10469
+ if (typeof style[key] === 'string') {
10470
+ newStyle[key] = style[key];
10471
+ }
10472
+ }
10473
+ }
10474
+
10475
+ return newStyle;
10476
+ }
10477
+
10478
+ function filterStyles(styles) {
10479
+ var name, value;
10480
+ for (name in styles) {
10481
+ value = styles[name];
10482
+ if (
10483
+ // ignore null and undefined values
10484
+ value == null ||
10485
+ // ignore functions (when does this occur?)
10486
+ $.isFunction(value) ||
10487
+ // shorthand styles that need to be expanded
10488
+ name in shorthandStyles ||
10489
+ // ignore scrollbars (break in IE)
10490
+ (/scrollbar/).test(name) ||
10491
+
10492
+ // only colors or values that can be converted to numbers
10493
+ (!(/color/i).test(name) && isNaN(parseFloat(value)))
10494
+ ) {
10495
+ delete styles[name];
10496
+ }
10497
+ }
10498
+
10499
+ return styles;
10500
+ }
10501
+
10502
+ function styleDifference(oldStyle, newStyle) {
10503
+ var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
10504
+ name;
10505
+
10506
+ for (name in newStyle) {
10507
+ if (oldStyle[name] != newStyle[name]) {
10508
+ diff[name] = newStyle[name];
10509
+ }
10510
+ }
10511
+
10512
+ return diff;
10513
+ }
10514
+
10515
+ $.effects.animateClass = function(value, duration, easing, callback) {
10516
+ if ($.isFunction(easing)) {
10517
+ callback = easing;
10518
+ easing = null;
10519
+ }
10520
+
10521
+ return this.queue(function() {
10522
+ var that = $(this),
10523
+ originalStyleAttr = that.attr('style') || ' ',
10524
+ originalStyle = filterStyles(getElementStyles.call(this)),
10525
+ newStyle,
10526
+ className = that.attr('class') || "";
10527
+
10528
+ $.each(classAnimationActions, function(i, action) {
10529
+ if (value[action]) {
10530
+ that[action + 'Class'](value[action]);
10531
+ }
10532
+ });
10533
+ newStyle = filterStyles(getElementStyles.call(this));
10534
+ that.attr('class', className);
10535
+
10536
+ that.animate(styleDifference(originalStyle, newStyle), {
10537
+ queue: false,
10538
+ duration: duration,
10539
+ easing: easing,
10540
+ complete: function() {
10541
+ $.each(classAnimationActions, function(i, action) {
10542
+ if (value[action]) { that[action + 'Class'](value[action]); }
10543
+ });
10544
+ // work around bug in IE by clearing the cssText before setting it
10545
+ if (typeof that.attr('style') == 'object') {
10546
+ that.attr('style').cssText = '';
10547
+ that.attr('style').cssText = originalStyleAttr;
10548
+ } else {
10549
+ that.attr('style', originalStyleAttr);
10550
+ }
10551
+ if (callback) { callback.apply(this, arguments); }
10552
+ $.dequeue( this );
10553
+ }
10554
+ });
10555
+ });
10556
+ };
10557
+
10558
+ $.fn.extend({
10559
+ _addClass: $.fn.addClass,
10560
+ addClass: function(classNames, speed, easing, callback) {
10561
+ return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
10562
+ },
10563
+
10564
+ _removeClass: $.fn.removeClass,
10565
+ removeClass: function(classNames,speed,easing,callback) {
10566
+ return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
10567
+ },
10568
+
10569
+ _toggleClass: $.fn.toggleClass,
10570
+ toggleClass: function(classNames, force, speed, easing, callback) {
10571
+ if ( typeof force == "boolean" || force === undefined ) {
10572
+ if ( !speed ) {
10573
+ // without speed parameter;
10574
+ return this._toggleClass(classNames, force);
10575
+ } else {
10576
+ return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
10577
+ }
10578
+ } else {
10579
+ // without switch parameter;
10580
+ return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
10581
+ }
10582
+ },
10583
+
10584
+ switchClass: function(remove,add,speed,easing,callback) {
10585
+ return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
10586
+ }
10587
+ });
10588
+
10589
+
10590
+
10591
+ /******************************************************************************/
10592
+ /*********************************** EFFECTS **********************************/
10593
+ /******************************************************************************/
10594
+
10595
+ $.extend($.effects, {
10596
+ version: "1.8.24",
10597
+
10598
+ // Saves a set of properties in a data storage
10599
+ save: function(element, set) {
10600
+ for(var i=0; i < set.length; i++) {
10601
+ if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
10602
+ }
10603
+ },
10604
+
10605
+ // Restores a set of previously saved properties from a data storage
10606
+ restore: function(element, set) {
10607
+ for(var i=0; i < set.length; i++) {
10608
+ if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
10609
+ }
10610
+ },
10611
+
10612
+ setMode: function(el, mode) {
10613
+ if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
10614
+ return mode;
10615
+ },
10616
+
10617
+ getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
10618
+ // this should be a little more flexible in the future to handle a string & hash
10619
+ var y, x;
10620
+ switch (origin[0]) {
10621
+ case 'top': y = 0; break;
10622
+ case 'middle': y = 0.5; break;
10623
+ case 'bottom': y = 1; break;
10624
+ default: y = origin[0] / original.height;
10625
+ };
10626
+ switch (origin[1]) {
10627
+ case 'left': x = 0; break;
10628
+ case 'center': x = 0.5; break;
10629
+ case 'right': x = 1; break;
10630
+ default: x = origin[1] / original.width;
10631
+ };
10632
+ return {x: x, y: y};
10633
+ },
10634
+
10635
+ // Wraps the element around a wrapper that copies position properties
10636
+ createWrapper: function(element) {
10637
+
10638
+ // if the element is already wrapped, return it
10639
+ if (element.parent().is('.ui-effects-wrapper')) {
10640
+ return element.parent();
10641
+ }
10642
+
10643
+ // wrap the element
10644
+ var props = {
10645
+ width: element.outerWidth(true),
10646
+ height: element.outerHeight(true),
10647
+ 'float': element.css('float')
10648
+ },
10649
+ wrapper = $('<div></div>')
10650
+ .addClass('ui-effects-wrapper')
10651
+ .css({
10652
+ fontSize: '100%',
10653
+ background: 'transparent',
10654
+ border: 'none',
10655
+ margin: 0,
10656
+ padding: 0
10657
+ }),
10658
+ active = document.activeElement;
10659
+
10660
+ // support: Firefox
10661
+ // Firefox incorrectly exposes anonymous content
10662
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
10663
+ try {
10664
+ active.id;
10665
+ } catch( e ) {
10666
+ active = document.body;
10667
+ }
10668
+
10669
+ element.wrap( wrapper );
10670
+
10671
+ // Fixes #7595 - Elements lose focus when wrapped.
10672
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
10673
+ $( active ).focus();
10674
+ }
10675
+
10676
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
10677
+
10678
+ // transfer positioning properties to the wrapper
10679
+ if (element.css('position') == 'static') {
10680
+ wrapper.css({ position: 'relative' });
10681
+ element.css({ position: 'relative' });
10682
+ } else {
10683
+ $.extend(props, {
10684
+ position: element.css('position'),
10685
+ zIndex: element.css('z-index')
10686
+ });
10687
+ $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
10688
+ props[pos] = element.css(pos);
10689
+ if (isNaN(parseInt(props[pos], 10))) {
10690
+ props[pos] = 'auto';
10691
+ }
10692
+ });
10693
+ element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });
10694
+ }
10695
+
10696
+ return wrapper.css(props).show();
10697
+ },
10698
+
10699
+ removeWrapper: function(element) {
10700
+ var parent,
10701
+ active = document.activeElement;
10702
+
10703
+ if (element.parent().is('.ui-effects-wrapper')) {
10704
+ parent = element.parent().replaceWith(element);
10705
+ // Fixes #7595 - Elements lose focus when wrapped.
10706
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
10707
+ $( active ).focus();
10708
+ }
10709
+ return parent;
10710
+ }
10711
+
10712
+ return element;
10713
+ },
10714
+
10715
+ setTransition: function(element, list, factor, value) {
10716
+ value = value || {};
10717
+ $.each(list, function(i, x){
10718
+ var unit = element.cssUnit(x);
10719
+ if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
10720
+ });
10721
+ return value;
10722
+ }
10723
+ });
10724
+
10725
+
10726
+ function _normalizeArguments(effect, options, speed, callback) {
10727
+ // shift params for method overloading
10728
+ if (typeof effect == 'object') {
10729
+ callback = options;
10730
+ speed = null;
10731
+ options = effect;
10732
+ effect = options.effect;
10733
+ }
10734
+ if ($.isFunction(options)) {
10735
+ callback = options;
10736
+ speed = null;
10737
+ options = {};
10738
+ }
10739
+ if (typeof options == 'number' || $.fx.speeds[options]) {
10740
+ callback = speed;
10741
+ speed = options;
10742
+ options = {};
10743
+ }
10744
+ if ($.isFunction(speed)) {
10745
+ callback = speed;
10746
+ speed = null;
10747
+ }
10748
+
10749
+ options = options || {};
10750
+
10751
+ speed = speed || options.duration;
10752
+ speed = $.fx.off ? 0 : typeof speed == 'number'
10753
+ ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
10754
+
10755
+ callback = callback || options.complete;
10756
+
10757
+ return [effect, options, speed, callback];
10758
+ }
10759
+
10760
+ function standardSpeed( speed ) {
10761
+ // valid standard speeds
10762
+ if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
10763
+ return true;
10764
+ }
10765
+
10766
+ // invalid strings - treat as "normal" speed
10767
+ if ( typeof speed === "string" && !$.effects[ speed ] ) {
10768
+ return true;
10769
+ }
10770
+
10771
+ return false;
10772
+ }
10773
+
10774
+ $.fn.extend({
10775
+ effect: function(effect, options, speed, callback) {
10776
+ var args = _normalizeArguments.apply(this, arguments),
10777
+ // TODO: make effects take actual parameters instead of a hash
10778
+ args2 = {
10779
+ options: args[1],
10780
+ duration: args[2],
10781
+ callback: args[3]
10782
+ },
10783
+ mode = args2.options.mode,
10784
+ effectMethod = $.effects[effect];
10785
+
10786
+ if ( $.fx.off || !effectMethod ) {
10787
+ // delegate to the original method (e.g., .show()) if possible
10788
+ if ( mode ) {
10789
+ return this[ mode ]( args2.duration, args2.callback );
10790
+ } else {
10791
+ return this.each(function() {
10792
+ if ( args2.callback ) {
10793
+ args2.callback.call( this );
10794
+ }
10795
+ });
10796
+ }
10797
+ }
10798
+
10799
+ return effectMethod.call(this, args2);
10800
+ },
10801
+
10802
+ _show: $.fn.show,
10803
+ show: function(speed) {
10804
+ if ( standardSpeed( speed ) ) {
10805
+ return this._show.apply(this, arguments);
10806
+ } else {
10807
+ var args = _normalizeArguments.apply(this, arguments);
10808
+ args[1].mode = 'show';
10809
+ return this.effect.apply(this, args);
10810
+ }
10811
+ },
10812
+
10813
+ _hide: $.fn.hide,
10814
+ hide: function(speed) {
10815
+ if ( standardSpeed( speed ) ) {
10816
+ return this._hide.apply(this, arguments);
10817
+ } else {
10818
+ var args = _normalizeArguments.apply(this, arguments);
10819
+ args[1].mode = 'hide';
10820
+ return this.effect.apply(this, args);
10821
+ }
10822
+ },
10823
+
10824
+ // jQuery core overloads toggle and creates _toggle
10825
+ __toggle: $.fn.toggle,
10826
+ toggle: function(speed) {
10827
+ if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
10828
+ return this.__toggle.apply(this, arguments);
10829
+ } else {
10830
+ var args = _normalizeArguments.apply(this, arguments);
10831
+ args[1].mode = 'toggle';
10832
+ return this.effect.apply(this, args);
10833
+ }
10834
+ },
10835
+
10836
+ // helper functions
10837
+ cssUnit: function(key) {
10838
+ var style = this.css(key), val = [];
10839
+ $.each( ['em','px','%','pt'], function(i, unit){
10840
+ if(style.indexOf(unit) > 0)
10841
+ val = [parseFloat(style), unit];
10842
+ });
10843
+ return val;
10844
+ }
10845
+ });
10846
+
10847
+
10848
+
10849
+ /******************************************************************************/
10850
+ /*********************************** EASING ***********************************/
10851
+ /******************************************************************************/
10852
+
10853
+ // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
10854
+
10855
+ var baseEasings = {};
10856
+
10857
+ $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
10858
+ baseEasings[ name ] = function( p ) {
10859
+ return Math.pow( p, i + 2 );
10860
+ };
10861
+ });
10862
+
10863
+ $.extend( baseEasings, {
10864
+ Sine: function ( p ) {
10865
+ return 1 - Math.cos( p * Math.PI / 2 );
10866
+ },
10867
+ Circ: function ( p ) {
10868
+ return 1 - Math.sqrt( 1 - p * p );
10869
+ },
10870
+ Elastic: function( p ) {
10871
+ return p === 0 || p === 1 ? p :
10872
+ -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
10873
+ },
10874
+ Back: function( p ) {
10875
+ return p * p * ( 3 * p - 2 );
10876
+ },
10877
+ Bounce: function ( p ) {
10878
+ var pow2,
10879
+ bounce = 4;
10880
+
10881
+ while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
10882
+ return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
10883
+ }
10884
+ });
10885
+
10886
+ $.each( baseEasings, function( name, easeIn ) {
10887
+ $.easing[ "easeIn" + name ] = easeIn;
10888
+ $.easing[ "easeOut" + name ] = function( p ) {
10889
+ return 1 - easeIn( 1 - p );
10890
+ };
10891
+ $.easing[ "easeInOut" + name ] = function( p ) {
10892
+ return p < .5 ?
10893
+ easeIn( p * 2 ) / 2 :
10894
+ easeIn( p * -2 + 2 ) / -2 + 1;
10895
+ };
10896
+ });
10897
+
10898
+ })(jQuery);
10899
+ /*!
10900
+ * jQuery UI Effects Blind 1.8.24
10901
+ *
10902
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
10903
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10904
+ * http://jquery.org/license
10905
+ *
10906
+ * http://docs.jquery.com/UI/Effects/Blind
10907
+ *
10908
+ * Depends:
10909
+ * jquery.effects.core.js
10910
+ */
10911
+ (function( $, undefined ) {
10912
+
10913
+ $.effects.blind = function(o) {
10914
+
10915
+ return this.queue(function() {
10916
+
10917
+ // Create element
10918
+ var el = $(this), props = ['position','top','bottom','left','right'];
10919
+
10920
+ // Set options
10921
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
10922
+ var direction = o.options.direction || 'vertical'; // Default direction
10923
+
10924
+ // Adjust
10925
+ $.effects.save(el, props); el.show(); // Save & Show
10926
+ var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
10927
+ var ref = (direction == 'vertical') ? 'height' : 'width';
10928
+ var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
10929
+ if(mode == 'show') wrapper.css(ref, 0); // Shift
10930
+
10931
+ // Animation
10932
+ var animation = {};
10933
+ animation[ref] = mode == 'show' ? distance : 0;
10934
+
10935
+ // Animate
10936
+ wrapper.animate(animation, o.duration, o.options.easing, function() {
10937
+ if(mode == 'hide') el.hide(); // Hide
10938
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
10939
+ if(o.callback) o.callback.apply(el[0], arguments); // Callback
10940
+ el.dequeue();
10941
+ });
10942
+
10943
+ });
10944
+
10945
+ };
10946
+
10947
+ })(jQuery);
10948
+ /*!
10949
+ * jQuery UI Effects Bounce 1.8.24
10950
+ *
10951
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
10952
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10953
+ * http://jquery.org/license
10954
+ *
10955
+ * http://docs.jquery.com/UI/Effects/Bounce
10956
+ *
10957
+ * Depends:
10958
+ * jquery.effects.core.js
10959
+ */
10960
+ (function( $, undefined ) {
10961
+
10962
+ $.effects.bounce = function(o) {
10963
+
10964
+ return this.queue(function() {
10965
+
10966
+ // Create element
10967
+ var el = $(this), props = ['position','top','bottom','left','right'];
10968
+
10969
+ // Set options
10970
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
10971
+ var direction = o.options.direction || 'up'; // Default direction
10972
+ var distance = o.options.distance || 20; // Default distance
10973
+ var times = o.options.times || 5; // Default # of times
10974
+ var speed = o.duration || 250; // Default speed per bounce
10975
+ if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
10976
+
10977
+ // Adjust
10978
+ $.effects.save(el, props); el.show(); // Save & Show
10979
+ $.effects.createWrapper(el); // Create Wrapper
10980
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
10981
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
10982
+ var distance = o.options.distance || (ref == 'top' ? el.outerHeight(true) / 3 : el.outerWidth(true) / 3);
10983
+ if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
10984
+ if (mode == 'hide') distance = distance / (times * 2);
10985
+ if (mode != 'hide') times--;
10986
+
10987
+ // Animate
10988
+ if (mode == 'show') { // Show Bounce
10989
+ var animation = {opacity: 1};
10990
+ animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
10991
+ el.animate(animation, speed / 2, o.options.easing);
10992
+ distance = distance / 2;
10993
+ times--;
10994
+ };
10995
+ for (var i = 0; i < times; i++) { // Bounces
10996
+ var animation1 = {}, animation2 = {};
10997
+ animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
10998
+ animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
10999
+ el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
11000
+ distance = (mode == 'hide') ? distance * 2 : distance / 2;
11001
+ };
11002
+ if (mode == 'hide') { // Last Bounce
11003
+ var animation = {opacity: 0};
11004
+ animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
11005
+ el.animate(animation, speed / 2, o.options.easing, function(){
11006
+ el.hide(); // Hide
11007
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11008
+ if(o.callback) o.callback.apply(this, arguments); // Callback
11009
+ });
11010
+ } else {
11011
+ var animation1 = {}, animation2 = {};
11012
+ animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
11013
+ animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
11014
+ el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
11015
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11016
+ if(o.callback) o.callback.apply(this, arguments); // Callback
11017
+ });
11018
+ };
11019
+ el.queue('fx', function() { el.dequeue(); });
11020
+ el.dequeue();
11021
+ });
11022
+
11023
+ };
11024
+
11025
+ })(jQuery);
11026
+ /*!
11027
+ * jQuery UI Effects Clip 1.8.24
11028
+ *
11029
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11030
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11031
+ * http://jquery.org/license
11032
+ *
11033
+ * http://docs.jquery.com/UI/Effects/Clip
11034
+ *
11035
+ * Depends:
11036
+ * jquery.effects.core.js
11037
+ */
11038
+ (function( $, undefined ) {
11039
+
11040
+ $.effects.clip = function(o) {
11041
+
11042
+ return this.queue(function() {
11043
+
11044
+ // Create element
11045
+ var el = $(this), props = ['position','top','bottom','left','right','height','width'];
11046
+
11047
+ // Set options
11048
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
11049
+ var direction = o.options.direction || 'vertical'; // Default direction
11050
+
11051
+ // Adjust
11052
+ $.effects.save(el, props); el.show(); // Save & Show
11053
+ var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
11054
+ var animate = el[0].tagName == 'IMG' ? wrapper : el;
11055
+ var ref = {
11056
+ size: (direction == 'vertical') ? 'height' : 'width',
11057
+ position: (direction == 'vertical') ? 'top' : 'left'
11058
+ };
11059
+ var distance = (direction == 'vertical') ? animate.height() : animate.width();
11060
+ if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
11061
+
11062
+ // Animation
11063
+ var animation = {};
11064
+ animation[ref.size] = mode == 'show' ? distance : 0;
11065
+ animation[ref.position] = mode == 'show' ? 0 : distance / 2;
11066
+
11067
+ // Animate
11068
+ animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
11069
+ if(mode == 'hide') el.hide(); // Hide
11070
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11071
+ if(o.callback) o.callback.apply(el[0], arguments); // Callback
11072
+ el.dequeue();
11073
+ }});
11074
+
11075
+ });
11076
+
11077
+ };
11078
+
11079
+ })(jQuery);
11080
+ /*!
11081
+ * jQuery UI Effects Drop 1.8.24
11082
+ *
11083
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11084
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11085
+ * http://jquery.org/license
11086
+ *
11087
+ * http://docs.jquery.com/UI/Effects/Drop
11088
+ *
11089
+ * Depends:
11090
+ * jquery.effects.core.js
11091
+ */
11092
+ (function( $, undefined ) {
11093
+
11094
+ $.effects.drop = function(o) {
11095
+
11096
+ return this.queue(function() {
11097
+
11098
+ // Create element
11099
+ var el = $(this), props = ['position','top','bottom','left','right','opacity'];
11100
+
11101
+ // Set options
11102
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
11103
+ var direction = o.options.direction || 'left'; // Default Direction
11104
+
11105
+ // Adjust
11106
+ $.effects.save(el, props); el.show(); // Save & Show
11107
+ $.effects.createWrapper(el); // Create Wrapper
11108
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
11109
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
11110
+ var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) / 2 : el.outerWidth( true ) / 2);
11111
+ if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
11112
+
11113
+ // Animation
11114
+ var animation = {opacity: mode == 'show' ? 1 : 0};
11115
+ animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
11116
+
11117
+ // Animate
11118
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
11119
+ if(mode == 'hide') el.hide(); // Hide
11120
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11121
+ if(o.callback) o.callback.apply(this, arguments); // Callback
11122
+ el.dequeue();
11123
+ }});
11124
+
11125
+ });
11126
+
11127
+ };
11128
+
11129
+ })(jQuery);
11130
+ /*!
11131
+ * jQuery UI Effects Explode 1.8.24
11132
+ *
11133
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11134
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11135
+ * http://jquery.org/license
11136
+ *
11137
+ * http://docs.jquery.com/UI/Effects/Explode
11138
+ *
11139
+ * Depends:
11140
+ * jquery.effects.core.js
11141
+ */
11142
+ (function( $, undefined ) {
11143
+
11144
+ $.effects.explode = function(o) {
11145
+
11146
+ return this.queue(function() {
11147
+
11148
+ var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
11149
+ var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
11150
+
11151
+ o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
11152
+ var el = $(this).show().css('visibility', 'hidden');
11153
+ var offset = el.offset();
11154
+
11155
+ //Substract the margins - not fixing the problem yet.
11156
+ offset.top -= parseInt(el.css("marginTop"),10) || 0;
11157
+ offset.left -= parseInt(el.css("marginLeft"),10) || 0;
11158
+
11159
+ var width = el.outerWidth(true);
11160
+ var height = el.outerHeight(true);
11161
+
11162
+ for(var i=0;i<rows;i++) { // =
11163
+ for(var j=0;j<cells;j++) { // ||
11164
+ el
11165
+ .clone()
11166
+ .appendTo('body')
11167
+ .wrap('<div></div>')
11168
+ .css({
11169
+ position: 'absolute',
11170
+ visibility: 'visible',
11171
+ left: -j*(width/cells),
11172
+ top: -i*(height/rows)
11173
+ })
11174
+ .parent()
11175
+ .addClass('ui-effects-explode')
11176
+ .css({
11177
+ position: 'absolute',
11178
+ overflow: 'hidden',
11179
+ width: width/cells,
11180
+ height: height/rows,
11181
+ left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
11182
+ top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
11183
+ opacity: o.options.mode == 'show' ? 0 : 1
11184
+ }).animate({
11185
+ left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
11186
+ top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
11187
+ opacity: o.options.mode == 'show' ? 1 : 0
11188
+ }, o.duration || 500);
11189
+ }
11190
+ }
11191
+
11192
+ // Set a timeout, to call the callback approx. when the other animations have finished
11193
+ setTimeout(function() {
11194
+
11195
+ o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
11196
+ if(o.callback) o.callback.apply(el[0]); // Callback
11197
+ el.dequeue();
11198
+
11199
+ $('div.ui-effects-explode').remove();
11200
+
11201
+ }, o.duration || 500);
11202
+
11203
+
11204
+ });
11205
+
11206
+ };
11207
+
11208
+ })(jQuery);
11209
+ /*!
11210
+ * jQuery UI Effects Fade 1.8.24
11211
+ *
11212
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11213
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11214
+ * http://jquery.org/license
11215
+ *
11216
+ * http://docs.jquery.com/UI/Effects/Fade
11217
+ *
11218
+ * Depends:
11219
+ * jquery.effects.core.js
11220
+ */
11221
+ (function( $, undefined ) {
11222
+
11223
+ $.effects.fade = function(o) {
11224
+ return this.queue(function() {
11225
+ var elem = $(this),
11226
+ mode = $.effects.setMode(elem, o.options.mode || 'hide');
11227
+
11228
+ elem.animate({ opacity: mode }, {
11229
+ queue: false,
11230
+ duration: o.duration,
11231
+ easing: o.options.easing,
11232
+ complete: function() {
11233
+ (o.callback && o.callback.apply(this, arguments));
11234
+ elem.dequeue();
11235
+ }
11236
+ });
11237
+ });
11238
+ };
11239
+
11240
+ })(jQuery);
11241
+ /*!
11242
+ * jQuery UI Effects Fold 1.8.24
11243
+ *
11244
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11245
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11246
+ * http://jquery.org/license
11247
+ *
11248
+ * http://docs.jquery.com/UI/Effects/Fold
11249
+ *
11250
+ * Depends:
11251
+ * jquery.effects.core.js
11252
+ */
11253
+ (function( $, undefined ) {
11254
+
11255
+ $.effects.fold = function(o) {
11256
+
11257
+ return this.queue(function() {
11258
+
11259
+ // Create element
11260
+ var el = $(this), props = ['position','top','bottom','left','right'];
11261
+
11262
+ // Set options
11263
+ var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
11264
+ var size = o.options.size || 15; // Default fold size
11265
+ var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
11266
+ var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
11267
+
11268
+ // Adjust
11269
+ $.effects.save(el, props); el.show(); // Save & Show
11270
+ var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
11271
+ var widthFirst = ((mode == 'show') != horizFirst);
11272
+ var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
11273
+ var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
11274
+ var percent = /([0-9]+)%/.exec(size);
11275
+ if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
11276
+ if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
11277
+
11278
+ // Animation
11279
+ var animation1 = {}, animation2 = {};
11280
+ animation1[ref[0]] = mode == 'show' ? distance[0] : size;
11281
+ animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
11282
+
11283
+ // Animate
11284
+ wrapper.animate(animation1, duration, o.options.easing)
11285
+ .animate(animation2, duration, o.options.easing, function() {
11286
+ if(mode == 'hide') el.hide(); // Hide
11287
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11288
+ if(o.callback) o.callback.apply(el[0], arguments); // Callback
11289
+ el.dequeue();
11290
+ });
11291
+
11292
+ });
11293
+
11294
+ };
11295
+
11296
+ })(jQuery);
11297
+ /*!
11298
+ * jQuery UI Effects Highlight 1.8.24
11299
+ *
11300
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11301
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11302
+ * http://jquery.org/license
11303
+ *
11304
+ * http://docs.jquery.com/UI/Effects/Highlight
11305
+ *
11306
+ * Depends:
11307
+ * jquery.effects.core.js
11308
+ */
11309
+ (function( $, undefined ) {
11310
+
11311
+ $.effects.highlight = function(o) {
11312
+ return this.queue(function() {
11313
+ var elem = $(this),
11314
+ props = ['backgroundImage', 'backgroundColor', 'opacity'],
11315
+ mode = $.effects.setMode(elem, o.options.mode || 'show'),
11316
+ animation = {
11317
+ backgroundColor: elem.css('backgroundColor')
11318
+ };
11319
+
11320
+ if (mode == 'hide') {
11321
+ animation.opacity = 0;
11322
+ }
11323
+
11324
+ $.effects.save(elem, props);
11325
+ elem
11326
+ .show()
11327
+ .css({
11328
+ backgroundImage: 'none',
11329
+ backgroundColor: o.options.color || '#ffff99'
11330
+ })
11331
+ .animate(animation, {
11332
+ queue: false,
11333
+ duration: o.duration,
11334
+ easing: o.options.easing,
11335
+ complete: function() {
11336
+ (mode == 'hide' && elem.hide());
11337
+ $.effects.restore(elem, props);
11338
+ (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
11339
+ (o.callback && o.callback.apply(this, arguments));
11340
+ elem.dequeue();
11341
+ }
11342
+ });
11343
+ });
11344
+ };
11345
+
11346
+ })(jQuery);
11347
+ /*!
11348
+ * jQuery UI Effects Pulsate 1.8.24
11349
+ *
11350
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11351
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11352
+ * http://jquery.org/license
11353
+ *
11354
+ * http://docs.jquery.com/UI/Effects/Pulsate
11355
+ *
11356
+ * Depends:
11357
+ * jquery.effects.core.js
11358
+ */
11359
+ (function( $, undefined ) {
11360
+
11361
+ $.effects.pulsate = function(o) {
11362
+ return this.queue(function() {
11363
+ var elem = $(this),
11364
+ mode = $.effects.setMode(elem, o.options.mode || 'show'),
11365
+ times = ((o.options.times || 5) * 2) - 1,
11366
+ duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
11367
+ isVisible = elem.is(':visible'),
11368
+ animateTo = 0;
11369
+
11370
+ if (!isVisible) {
11371
+ elem.css('opacity', 0).show();
11372
+ animateTo = 1;
11373
+ }
11374
+
11375
+ if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
11376
+ times--;
11377
+ }
11378
+
11379
+ for (var i = 0; i < times; i++) {
11380
+ elem.animate({ opacity: animateTo }, duration, o.options.easing);
11381
+ animateTo = (animateTo + 1) % 2;
11382
+ }
11383
+
11384
+ elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
11385
+ if (animateTo == 0) {
11386
+ elem.hide();
11387
+ }
11388
+ (o.callback && o.callback.apply(this, arguments));
11389
+ });
11390
+
11391
+ elem
11392
+ .queue('fx', function() { elem.dequeue(); })
11393
+ .dequeue();
11394
+ });
11395
+ };
11396
+
11397
+ })(jQuery);
11398
+ /*!
11399
+ * jQuery UI Effects Scale 1.8.24
11400
+ *
11401
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11402
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11403
+ * http://jquery.org/license
11404
+ *
11405
+ * http://docs.jquery.com/UI/Effects/Scale
11406
+ *
11407
+ * Depends:
11408
+ * jquery.effects.core.js
11409
+ */
11410
+ (function( $, undefined ) {
11411
+
11412
+ $.effects.puff = function(o) {
11413
+ return this.queue(function() {
11414
+ var elem = $(this),
11415
+ mode = $.effects.setMode(elem, o.options.mode || 'hide'),
11416
+ percent = parseInt(o.options.percent, 10) || 150,
11417
+ factor = percent / 100,
11418
+ original = { height: elem.height(), width: elem.width() };
11419
+
11420
+ $.extend(o.options, {
11421
+ fade: true,
11422
+ mode: mode,
11423
+ percent: mode == 'hide' ? percent : 100,
11424
+ from: mode == 'hide'
11425
+ ? original
11426
+ : {
11427
+ height: original.height * factor,
11428
+ width: original.width * factor
11429
+ }
11430
+ });
11431
+
11432
+ elem.effect('scale', o.options, o.duration, o.callback);
11433
+ elem.dequeue();
11434
+ });
11435
+ };
11436
+
11437
+ $.effects.scale = function(o) {
11438
+
11439
+ return this.queue(function() {
11440
+
11441
+ // Create element
11442
+ var el = $(this);
11443
+
11444
+ // Set options
11445
+ var options = $.extend(true, {}, o.options);
11446
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
11447
+ var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
11448
+ var direction = o.options.direction || 'both'; // Set default axis
11449
+ var origin = o.options.origin; // The origin of the scaling
11450
+ if (mode != 'effect') { // Set default origin and restore for show/hide
11451
+ options.origin = origin || ['middle','center'];
11452
+ options.restore = true;
11453
+ }
11454
+ var original = {height: el.height(), width: el.width()}; // Save original
11455
+ el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
11456
+
11457
+ // Adjust
11458
+ var factor = { // Set scaling factor
11459
+ y: direction != 'horizontal' ? (percent / 100) : 1,
11460
+ x: direction != 'vertical' ? (percent / 100) : 1
11461
+ };
11462
+ el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
11463
+
11464
+ if (o.options.fade) { // Fade option to support puff
11465
+ if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
11466
+ if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
11467
+ };
11468
+
11469
+ // Animation
11470
+ options.from = el.from; options.to = el.to; options.mode = mode;
11471
+
11472
+ // Animate
11473
+ el.effect('size', options, o.duration, o.callback);
11474
+ el.dequeue();
11475
+ });
11476
+
11477
+ };
11478
+
11479
+ $.effects.size = function(o) {
11480
+
11481
+ return this.queue(function() {
11482
+
11483
+ // Create element
11484
+ var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity'];
11485
+ var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore
11486
+ var props2 = ['width','height','overflow']; // Copy for children
11487
+ var cProps = ['fontSize'];
11488
+ var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
11489
+ var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
11490
+
11491
+ // Set options
11492
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
11493
+ var restore = o.options.restore || false; // Default restore
11494
+ var scale = o.options.scale || 'both'; // Default scale mode
11495
+ var origin = o.options.origin; // The origin of the sizing
11496
+ var original = {height: el.height(), width: el.width()}; // Save original
11497
+ el.from = o.options.from || original; // Default from state
11498
+ el.to = o.options.to || original; // Default to state
11499
+ // Adjust
11500
+ if (origin) { // Calculate baseline shifts
11501
+ var baseline = $.effects.getBaseline(origin, original);
11502
+ el.from.top = (original.height - el.from.height) * baseline.y;
11503
+ el.from.left = (original.width - el.from.width) * baseline.x;
11504
+ el.to.top = (original.height - el.to.height) * baseline.y;
11505
+ el.to.left = (original.width - el.to.width) * baseline.x;
11506
+ };
11507
+ var factor = { // Set scaling factor
11508
+ from: {y: el.from.height / original.height, x: el.from.width / original.width},
11509
+ to: {y: el.to.height / original.height, x: el.to.width / original.width}
11510
+ };
11511
+ if (scale == 'box' || scale == 'both') { // Scale the css box
11512
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
11513
+ props = props.concat(vProps);
11514
+ el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
11515
+ el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
11516
+ };
11517
+ if (factor.from.x != factor.to.x) { // Horizontal props scaling
11518
+ props = props.concat(hProps);
11519
+ el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
11520
+ el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
11521
+ };
11522
+ };
11523
+ if (scale == 'content' || scale == 'both') { // Scale the content
11524
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
11525
+ props = props.concat(cProps);
11526
+ el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
11527
+ el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
11528
+ };
11529
+ };
11530
+ $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
11531
+ $.effects.createWrapper(el); // Create Wrapper
11532
+ el.css('overflow','hidden').css(el.from); // Shift
11533
+
11534
+ // Animate
11535
+ if (scale == 'content' || scale == 'both') { // Scale the children
11536
+ vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
11537
+ hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
11538
+ props2 = props.concat(vProps).concat(hProps); // Concat
11539
+ el.find("*[width]").each(function(){
11540
+ var child = $(this);
11541
+ if (restore) $.effects.save(child, props2);
11542
+ var c_original = {height: child.height(), width: child.width()}; // Save original
11543
+ child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
11544
+ child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
11545
+ if (factor.from.y != factor.to.y) { // Vertical props scaling
11546
+ child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
11547
+ child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
11548
+ };
11549
+ if (factor.from.x != factor.to.x) { // Horizontal props scaling
11550
+ child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
11551
+ child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
11552
+ };
11553
+ child.css(child.from); // Shift children
11554
+ child.animate(child.to, o.duration, o.options.easing, function(){
11555
+ if (restore) $.effects.restore(child, props2); // Restore children
11556
+ }); // Animate children
11557
+ });
11558
+ };
11559
+
11560
+ // Animate
11561
+ el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
11562
+ if (el.to.opacity === 0) {
11563
+ el.css('opacity', el.from.opacity);
11564
+ }
11565
+ if(mode == 'hide') el.hide(); // Hide
11566
+ $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
11567
+ if(o.callback) o.callback.apply(this, arguments); // Callback
11568
+ el.dequeue();
11569
+ }});
11570
+
11571
+ });
11572
+
11573
+ };
11574
+
11575
+ })(jQuery);
11576
+ /*!
11577
+ * jQuery UI Effects Shake 1.8.24
11578
+ *
11579
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11580
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11581
+ * http://jquery.org/license
11582
+ *
11583
+ * http://docs.jquery.com/UI/Effects/Shake
11584
+ *
11585
+ * Depends:
11586
+ * jquery.effects.core.js
11587
+ */
11588
+ (function( $, undefined ) {
11589
+
11590
+ $.effects.shake = function(o) {
11591
+
11592
+ return this.queue(function() {
11593
+
11594
+ // Create element
11595
+ var el = $(this), props = ['position','top','bottom','left','right'];
11596
+
11597
+ // Set options
11598
+ var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
11599
+ var direction = o.options.direction || 'left'; // Default direction
11600
+ var distance = o.options.distance || 20; // Default distance
11601
+ var times = o.options.times || 3; // Default # of times
11602
+ var speed = o.duration || o.options.duration || 140; // Default speed per shake
11603
+
11604
+ // Adjust
11605
+ $.effects.save(el, props); el.show(); // Save & Show
11606
+ $.effects.createWrapper(el); // Create Wrapper
11607
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
11608
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
11609
+
11610
+ // Animation
11611
+ var animation = {}, animation1 = {}, animation2 = {};
11612
+ animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
11613
+ animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
11614
+ animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
11615
+
11616
+ // Animate
11617
+ el.animate(animation, speed, o.options.easing);
11618
+ for (var i = 1; i < times; i++) { // Shakes
11619
+ el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
11620
+ };
11621
+ el.animate(animation1, speed, o.options.easing).
11622
+ animate(animation, speed / 2, o.options.easing, function(){ // Last shake
11623
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11624
+ if(o.callback) o.callback.apply(this, arguments); // Callback
11625
+ });
11626
+ el.queue('fx', function() { el.dequeue(); });
11627
+ el.dequeue();
11628
+ });
11629
+
11630
+ };
11631
+
11632
+ })(jQuery);
11633
+ /*!
11634
+ * jQuery UI Effects Slide 1.8.24
11635
+ *
11636
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11637
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11638
+ * http://jquery.org/license
11639
+ *
11640
+ * http://docs.jquery.com/UI/Effects/Slide
11641
+ *
11642
+ * Depends:
11643
+ * jquery.effects.core.js
11644
+ */
11645
+ (function( $, undefined ) {
11646
+
11647
+ $.effects.slide = function(o) {
11648
+
11649
+ return this.queue(function() {
11650
+
11651
+ // Create element
11652
+ var el = $(this), props = ['position','top','bottom','left','right'];
11653
+
11654
+ // Set options
11655
+ var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
11656
+ var direction = o.options.direction || 'left'; // Default Direction
11657
+
11658
+ // Adjust
11659
+ $.effects.save(el, props); el.show(); // Save & Show
11660
+ $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
11661
+ var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
11662
+ var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
11663
+ var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) : el.outerWidth( true ));
11664
+ if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
11665
+
11666
+ // Animation
11667
+ var animation = {};
11668
+ animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
11669
+
11670
+ // Animate
11671
+ el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
11672
+ if(mode == 'hide') el.hide(); // Hide
11673
+ $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
11674
+ if(o.callback) o.callback.apply(this, arguments); // Callback
11675
+ el.dequeue();
11676
+ }});
11677
+
11678
+ });
11679
+
11680
+ };
11681
+
11682
+ })(jQuery);
11683
+ /*!
11684
+ * jQuery UI Effects Transfer 1.8.24
11685
+ *
11686
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11687
+ * Dual licensed under the MIT or GPL Version 2 licenses.
11688
+ * http://jquery.org/license
11689
+ *
11690
+ * http://docs.jquery.com/UI/Effects/Transfer
11691
+ *
11692
+ * Depends:
11693
+ * jquery.effects.core.js
11694
+ */
11695
+ (function( $, undefined ) {
11696
+
11697
+ $.effects.transfer = function(o) {
11698
+ return this.queue(function() {
11699
+ var elem = $(this),
11700
+ target = $(o.options.to),
11701
+ endPosition = target.offset(),
11702
+ animation = {
11703
+ top: endPosition.top,
11704
+ left: endPosition.left,
11705
+ height: target.innerHeight(),
11706
+ width: target.innerWidth()
11707
+ },
11708
+ startPosition = elem.offset(),
11709
+ transfer = $('<div class="ui-effects-transfer"></div>')
11710
+ .appendTo(document.body)
11711
+ .addClass(o.options.className)
11712
+ .css({
11713
+ top: startPosition.top,
11714
+ left: startPosition.left,
11715
+ height: elem.innerHeight(),
11716
+ width: elem.innerWidth(),
11717
+ position: 'absolute'
11718
+ })
11719
+ .animate(animation, o.duration, o.options.easing, function() {
11720
+ transfer.remove();
11721
+ (o.callback && o.callback.apply(elem[0], arguments));
11722
+ elem.dequeue();
11723
+ });
11724
+ });
11725
+ };
11726
+
11727
+ })(jQuery);
js/kd/jquery-ui.js ADDED
@@ -0,0 +1,14742 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.9.0 - 2012-10-05
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
4
+ * Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function( $, undefined ) {
7
+
8
+ var uuid = 0,
9
+ runiqueId = /^ui-id-\d+$/;
10
+
11
+ // prevent duplicate loading
12
+ // this is only a problem because we proxy existing functions
13
+ // and we don't want to double proxy them
14
+ $.ui = $.ui || {};
15
+ if ( $.ui.version ) {
16
+ return;
17
+ }
18
+
19
+ $.extend( $.ui, {
20
+ version: "1.9.0",
21
+
22
+ keyCode: {
23
+ BACKSPACE: 8,
24
+ COMMA: 188,
25
+ DELETE: 46,
26
+ DOWN: 40,
27
+ END: 35,
28
+ ENTER: 13,
29
+ ESCAPE: 27,
30
+ HOME: 36,
31
+ LEFT: 37,
32
+ NUMPAD_ADD: 107,
33
+ NUMPAD_DECIMAL: 110,
34
+ NUMPAD_DIVIDE: 111,
35
+ NUMPAD_ENTER: 108,
36
+ NUMPAD_MULTIPLY: 106,
37
+ NUMPAD_SUBTRACT: 109,
38
+ PAGE_DOWN: 34,
39
+ PAGE_UP: 33,
40
+ PERIOD: 190,
41
+ RIGHT: 39,
42
+ SPACE: 32,
43
+ TAB: 9,
44
+ UP: 38
45
+ }
46
+ });
47
+
48
+ // plugins
49
+ $.fn.extend({
50
+ _focus: $.fn.focus,
51
+ focus: function( delay, fn ) {
52
+ return typeof delay === "number" ?
53
+ this.each(function() {
54
+ var elem = this;
55
+ setTimeout(function() {
56
+ $( elem ).focus();
57
+ if ( fn ) {
58
+ fn.call( elem );
59
+ }
60
+ }, delay );
61
+ }) :
62
+ this._focus.apply( this, arguments );
63
+ },
64
+
65
+ scrollParent: function() {
66
+ var scrollParent;
67
+ if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
68
+ scrollParent = this.parents().filter(function() {
69
+ return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
70
+ }).eq(0);
71
+ } else {
72
+ scrollParent = this.parents().filter(function() {
73
+ return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
74
+ }).eq(0);
75
+ }
76
+
77
+ return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
78
+ },
79
+
80
+ zIndex: function( zIndex ) {
81
+ if ( zIndex !== undefined ) {
82
+ return this.css( "zIndex", zIndex );
83
+ }
84
+
85
+ if ( this.length ) {
86
+ var elem = $( this[ 0 ] ), position, value;
87
+ while ( elem.length && elem[ 0 ] !== document ) {
88
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
89
+ // This makes behavior of this function consistent across browsers
90
+ // WebKit always returns auto if the element is positioned
91
+ position = elem.css( "position" );
92
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
93
+ // IE returns 0 when zIndex is not specified
94
+ // other browsers return a string
95
+ // we ignore the case of nested elements with an explicit value of 0
96
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
97
+ value = parseInt( elem.css( "zIndex" ), 10 );
98
+ if ( !isNaN( value ) && value !== 0 ) {
99
+ return value;
100
+ }
101
+ }
102
+ elem = elem.parent();
103
+ }
104
+ }
105
+
106
+ return 0;
107
+ },
108
+
109
+ uniqueId: function() {
110
+ return this.each(function() {
111
+ if ( !this.id ) {
112
+ this.id = "ui-id-" + (++uuid);
113
+ }
114
+ });
115
+ },
116
+
117
+ removeUniqueId: function() {
118
+ return this.each(function() {
119
+ if ( runiqueId.test( this.id ) ) {
120
+ $( this ).removeAttr( "id" );
121
+ }
122
+ });
123
+ }
124
+ });
125
+
126
+ // support: jQuery <1.8
127
+ if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
128
+ $.each( [ "Width", "Height" ], function( i, name ) {
129
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
130
+ type = name.toLowerCase(),
131
+ orig = {
132
+ innerWidth: $.fn.innerWidth,
133
+ innerHeight: $.fn.innerHeight,
134
+ outerWidth: $.fn.outerWidth,
135
+ outerHeight: $.fn.outerHeight
136
+ };
137
+
138
+ function reduce( elem, size, border, margin ) {
139
+ $.each( side, function() {
140
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
141
+ if ( border ) {
142
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
143
+ }
144
+ if ( margin ) {
145
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
146
+ }
147
+ });
148
+ return size;
149
+ }
150
+
151
+ $.fn[ "inner" + name ] = function( size ) {
152
+ if ( size === undefined ) {
153
+ return orig[ "inner" + name ].call( this );
154
+ }
155
+
156
+ return this.each(function() {
157
+ $( this ).css( type, reduce( this, size ) + "px" );
158
+ });
159
+ };
160
+
161
+ $.fn[ "outer" + name] = function( size, margin ) {
162
+ if ( typeof size !== "number" ) {
163
+ return orig[ "outer" + name ].call( this, size );
164
+ }
165
+
166
+ return this.each(function() {
167
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
168
+ });
169
+ };
170
+ });
171
+ }
172
+
173
+ // selectors
174
+ function focusable( element, isTabIndexNotNaN ) {
175
+ var map, mapName, img,
176
+ nodeName = element.nodeName.toLowerCase();
177
+ if ( "area" === nodeName ) {
178
+ map = element.parentNode;
179
+ mapName = map.name;
180
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
181
+ return false;
182
+ }
183
+ img = $( "img[usemap=#" + mapName + "]" )[0];
184
+ return !!img && visible( img );
185
+ }
186
+ return ( /input|select|textarea|button|object/.test( nodeName ) ?
187
+ !element.disabled :
188
+ "a" === nodeName ?
189
+ element.href || isTabIndexNotNaN :
190
+ isTabIndexNotNaN) &&
191
+ // the element and all of its ancestors must be visible
192
+ visible( element );
193
+ }
194
+
195
+ function visible( element ) {
196
+ return !$( element ).parents().andSelf().filter(function() {
197
+ return $.css( this, "visibility" ) === "hidden" ||
198
+ $.expr.filters.hidden( this );
199
+ }).length;
200
+ }
201
+
202
+ $.extend( $.expr[ ":" ], {
203
+ data: $.expr.createPseudo ?
204
+ $.expr.createPseudo(function( dataName ) {
205
+ return function( elem ) {
206
+ return !!$.data( elem, dataName );
207
+ };
208
+ }) :
209
+ // support: jQuery <1.8
210
+ function( elem, i, match ) {
211
+ return !!$.data( elem, match[ 3 ] );
212
+ },
213
+
214
+ focusable: function( element ) {
215
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
216
+ },
217
+
218
+ tabbable: function( element ) {
219
+ var tabIndex = $.attr( element, "tabindex" ),
220
+ isTabIndexNaN = isNaN( tabIndex );
221
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
222
+ }
223
+ });
224
+
225
+ // support
226
+ $(function() {
227
+ var body = document.body,
228
+ div = body.appendChild( div = document.createElement( "div" ) );
229
+
230
+ // access offsetHeight before setting the style to prevent a layout bug
231
+ // in IE 9 which causes the element to continue to take up space even
232
+ // after it is removed from the DOM (#8026)
233
+ div.offsetHeight;
234
+
235
+ $.extend( div.style, {
236
+ minHeight: "100px",
237
+ height: "auto",
238
+ padding: 0,
239
+ borderWidth: 0
240
+ });
241
+
242
+ $.support.minHeight = div.offsetHeight === 100;
243
+ $.support.selectstart = "onselectstart" in div;
244
+
245
+ // set display to none to avoid a layout bug in IE
246
+ // http://dev.jquery.com/ticket/4014
247
+ body.removeChild( div ).style.display = "none";
248
+ });
249
+
250
+
251
+
252
+
253
+
254
+ // deprecated
255
+
256
+ $.fn.extend({
257
+ disableSelection: function() {
258
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
259
+ ".ui-disableSelection", function( event ) {
260
+ event.preventDefault();
261
+ });
262
+ },
263
+
264
+ enableSelection: function() {
265
+ return this.unbind( ".ui-disableSelection" );
266
+ }
267
+ });
268
+
269
+ $.extend( $.ui, {
270
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
271
+ plugin: {
272
+ add: function( module, option, set ) {
273
+ var i,
274
+ proto = $.ui[ module ].prototype;
275
+ for ( i in set ) {
276
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
277
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
278
+ }
279
+ },
280
+ call: function( instance, name, args ) {
281
+ var i,
282
+ set = instance.plugins[ name ];
283
+ if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
284
+ return;
285
+ }
286
+
287
+ for ( i = 0; i < set.length; i++ ) {
288
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
289
+ set[ i ][ 1 ].apply( instance.element, args );
290
+ }
291
+ }
292
+ }
293
+ },
294
+
295
+ contains: $.contains,
296
+
297
+ // only used by resizable
298
+ hasScroll: function( el, a ) {
299
+
300
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
301
+ if ( $( el ).css( "overflow" ) === "hidden") {
302
+ return false;
303
+ }
304
+
305
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
306
+ has = false;
307
+
308
+ if ( el[ scroll ] > 0 ) {
309
+ return true;
310
+ }
311
+
312
+ // TODO: determine which cases actually cause this to happen
313
+ // if the element doesn't have the scroll set, see if it's possible to
314
+ // set the scroll
315
+ el[ scroll ] = 1;
316
+ has = ( el[ scroll ] > 0 );
317
+ el[ scroll ] = 0;
318
+ return has;
319
+ },
320
+
321
+ // these are odd functions, fix the API or move into individual plugins
322
+ isOverAxis: function( x, reference, size ) {
323
+ //Determines when x coordinate is over "b" element axis
324
+ return ( x > reference ) && ( x < ( reference + size ) );
325
+ },
326
+ isOver: function( y, x, top, left, height, width ) {
327
+ //Determines when x, y coordinates is over "b" element
328
+ return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
329
+ }
330
+ });
331
+
332
+ })( jQuery );
333
+
334
+ (function( $, undefined ) {
335
+
336
+ var uuid = 0,
337
+ slice = Array.prototype.slice,
338
+ _cleanData = $.cleanData;
339
+ $.cleanData = function( elems ) {
340
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
341
+ try {
342
+ $( elem ).triggerHandler( "remove" );
343
+ // http://bugs.jquery.com/ticket/8235
344
+ } catch( e ) {}
345
+ }
346
+ _cleanData( elems );
347
+ };
348
+
349
+ $.widget = function( name, base, prototype ) {
350
+ var fullName, existingConstructor, constructor, basePrototype,
351
+ namespace = name.split( "." )[ 0 ];
352
+
353
+ name = name.split( "." )[ 1 ];
354
+ fullName = namespace + "-" + name;
355
+
356
+ if ( !prototype ) {
357
+ prototype = base;
358
+ base = $.Widget;
359
+ }
360
+
361
+ // create selector for plugin
362
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
363
+ return !!$.data( elem, fullName );
364
+ };
365
+
366
+ $[ namespace ] = $[ namespace ] || {};
367
+ existingConstructor = $[ namespace ][ name ];
368
+ constructor = $[ namespace ][ name ] = function( options, element ) {
369
+ // allow instantiation without "new" keyword
370
+ if ( !this._createWidget ) {
371
+ return new constructor( options, element );
372
+ }
373
+
374
+ // allow instantiation without initializing for simple inheritance
375
+ // must use "new" keyword (the code above always passes args)
376
+ if ( arguments.length ) {
377
+ this._createWidget( options, element );
378
+ }
379
+ };
380
+ // extend with the existing constructor to carry over any static properties
381
+ $.extend( constructor, existingConstructor, {
382
+ version: prototype.version,
383
+ // copy the object used to create the prototype in case we need to
384
+ // redefine the widget later
385
+ _proto: $.extend( {}, prototype ),
386
+ // track widgets that inherit from this widget in case this widget is
387
+ // redefined after a widget inherits from it
388
+ _childConstructors: []
389
+ });
390
+
391
+ basePrototype = new base();
392
+ // we need to make the options hash a property directly on the new instance
393
+ // otherwise we'll modify the options hash on the prototype that we're
394
+ // inheriting from
395
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
396
+ $.each( prototype, function( prop, value ) {
397
+ if ( $.isFunction( value ) ) {
398
+ prototype[ prop ] = (function() {
399
+ var _super = function() {
400
+ return base.prototype[ prop ].apply( this, arguments );
401
+ },
402
+ _superApply = function( args ) {
403
+ return base.prototype[ prop ].apply( this, args );
404
+ };
405
+ return function() {
406
+ var __super = this._super,
407
+ __superApply = this._superApply,
408
+ returnValue;
409
+
410
+ this._super = _super;
411
+ this._superApply = _superApply;
412
+
413
+ returnValue = value.apply( this, arguments );
414
+
415
+ this._super = __super;
416
+ this._superApply = __superApply;
417
+
418
+ return returnValue;
419
+ };
420
+ })();
421
+ }
422
+ });
423
+ constructor.prototype = $.widget.extend( basePrototype, {
424
+ // TODO: remove support for widgetEventPrefix
425
+ // always use the name + a colon as the prefix, e.g., draggable:start
426
+ // don't prefix for widgets that aren't DOM-based
427
+ widgetEventPrefix: name
428
+ }, prototype, {
429
+ constructor: constructor,
430
+ namespace: namespace,
431
+ widgetName: name,
432
+ // TODO remove widgetBaseClass, see #8155
433
+ widgetBaseClass: fullName,
434
+ widgetFullName: fullName
435
+ });
436
+
437
+ // If this widget is being redefined then we need to find all widgets that
438
+ // are inheriting from it and redefine all of them so that they inherit from
439
+ // the new version of this widget. We're essentially trying to replace one
440
+ // level in the prototype chain.
441
+ if ( existingConstructor ) {
442
+ $.each( existingConstructor._childConstructors, function( i, child ) {
443
+ var childPrototype = child.prototype;
444
+
445
+ // redefine the child widget using the same prototype that was
446
+ // originally used, but inherit from the new version of the base
447
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
448
+ });
449
+ // remove the list of existing child constructors from the old constructor
450
+ // so the old child constructors can be garbage collected
451
+ delete existingConstructor._childConstructors;
452
+ } else {
453
+ base._childConstructors.push( constructor );
454
+ }
455
+
456
+ $.widget.bridge( name, constructor );
457
+ };
458
+
459
+ $.widget.extend = function( target ) {
460
+ var input = slice.call( arguments, 1 ),
461
+ inputIndex = 0,
462
+ inputLength = input.length,
463
+ key,
464
+ value;
465
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
466
+ for ( key in input[ inputIndex ] ) {
467
+ value = input[ inputIndex ][ key ];
468
+ if (input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
469
+ target[ key ] = $.isPlainObject( value ) ? $.widget.extend( {}, target[ key ], value ) : value;
470
+ }
471
+ }
472
+ }
473
+ return target;
474
+ };
475
+
476
+ $.widget.bridge = function( name, object ) {
477
+ var fullName = object.prototype.widgetFullName;
478
+ $.fn[ name ] = function( options ) {
479
+ var isMethodCall = typeof options === "string",
480
+ args = slice.call( arguments, 1 ),
481
+ returnValue = this;
482
+
483
+ // allow multiple hashes to be passed on init
484
+ options = !isMethodCall && args.length ?
485
+ $.widget.extend.apply( null, [ options ].concat(args) ) :
486
+ options;
487
+
488
+ if ( isMethodCall ) {
489
+ this.each(function() {
490
+ var methodValue,
491
+ instance = $.data( this, fullName );
492
+ if ( !instance ) {
493
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
494
+ "attempted to call method '" + options + "'" );
495
+ }
496
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
497
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
498
+ }
499
+ methodValue = instance[ options ].apply( instance, args );
500
+ if ( methodValue !== instance && methodValue !== undefined ) {
501
+ returnValue = methodValue && methodValue.jquery ?
502
+ returnValue.pushStack( methodValue.get() ) :
503
+ methodValue;
504
+ return false;
505
+ }
506
+ });
507
+ } else {
508
+ this.each(function() {
509
+ var instance = $.data( this, fullName );
510
+ if ( instance ) {
511
+ instance.option( options || {} )._init();
512
+ } else {
513
+ new object( options, this );
514
+ }
515
+ });
516
+ }
517
+
518
+ return returnValue;
519
+ };
520
+ };
521
+
522
+ $.Widget = function( options, element ) {};
523
+ $.Widget._childConstructors = [];
524
+
525
+ $.Widget.prototype = {
526
+ widgetName: "widget",
527
+ widgetEventPrefix: "",
528
+ defaultElement: "<div>",
529
+ options: {
530
+ disabled: false,
531
+
532
+ // callbacks
533
+ create: null
534
+ },
535
+ _createWidget: function( options, element ) {
536
+ element = $( element || this.defaultElement || this )[ 0 ];
537
+ this.element = $( element );
538
+ this.uuid = uuid++;
539
+ this.eventNamespace = "." + this.widgetName + this.uuid;
540
+ this.options = $.widget.extend( {},
541
+ this.options,
542
+ this._getCreateOptions(),
543
+ options );
544
+
545
+ this.bindings = $();
546
+ this.hoverable = $();
547
+ this.focusable = $();
548
+
549
+ if ( element !== this ) {
550
+ // 1.9 BC for #7810
551
+ // TODO remove dual storage
552
+ $.data( element, this.widgetName, this );
553
+ $.data( element, this.widgetFullName, this );
554
+ this._on({ remove: "destroy" });
555
+ this.document = $( element.style ?
556
+ // element within the document
557
+ element.ownerDocument :
558
+ // element is window or document
559
+ element.document || element );
560
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
561
+ }
562
+
563
+ this._create();
564
+ this._trigger( "create", null, this._getCreateEventData() );
565
+ this._init();
566
+ },
567
+ _getCreateOptions: $.noop,
568
+ _getCreateEventData: $.noop,
569
+ _create: $.noop,
570
+ _init: $.noop,
571
+
572
+ destroy: function() {
573
+ this._destroy();
574
+ // we can probably remove the unbind calls in 2.0
575
+ // all event bindings should go through this._on()
576
+ this.element
577
+ .unbind( this.eventNamespace )
578
+ // 1.9 BC for #7810
579
+ // TODO remove dual storage
580
+ .removeData( this.widgetName )
581
+ .removeData( this.widgetFullName )
582
+ // support: jquery <1.6.3
583
+ // http://bugs.jquery.com/ticket/9413
584
+ .removeData( $.camelCase( this.widgetFullName ) );
585
+ this.widget()
586
+ .unbind( this.eventNamespace )
587
+ .removeAttr( "aria-disabled" )
588
+ .removeClass(
589
+ this.widgetFullName + "-disabled " +
590
+ "ui-state-disabled" );
591
+
592
+ // clean up events and states
593
+ this.bindings.unbind( this.eventNamespace );
594
+ this.hoverable.removeClass( "ui-state-hover" );
595
+ this.focusable.removeClass( "ui-state-focus" );
596
+ },
597
+ _destroy: $.noop,
598
+
599
+ widget: function() {
600
+ return this.element;
601
+ },
602
+
603
+ option: function( key, value ) {
604
+ var options = key,
605
+ parts,
606
+ curOption,
607
+ i;
608
+
609
+ if ( arguments.length === 0 ) {
610
+ // don't return a reference to the internal hash
611
+ return $.widget.extend( {}, this.options );
612
+ }
613
+
614
+ if ( typeof key === "string" ) {
615
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
616
+ options = {};
617
+ parts = key.split( "." );
618
+ key = parts.shift();
619
+ if ( parts.length ) {
620
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
621
+ for ( i = 0; i < parts.length - 1; i++ ) {
622
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
623
+ curOption = curOption[ parts[ i ] ];
624
+ }
625
+ key = parts.pop();
626
+ if ( value === undefined ) {
627
+ return curOption[ key ] === undefined ? null : curOption[ key ];
628
+ }
629
+ curOption[ key ] = value;
630
+ } else {
631
+ if ( value === undefined ) {
632
+ return this.options[ key ] === undefined ? null : this.options[ key ];
633
+ }
634
+ options[ key ] = value;
635
+ }
636
+ }
637
+
638
+ this._setOptions( options );
639
+
640
+ return this;
641
+ },
642
+ _setOptions: function( options ) {
643
+ var key;
644
+
645
+ for ( key in options ) {
646
+ this._setOption( key, options[ key ] );
647
+ }
648
+
649
+ return this;
650
+ },
651
+ _setOption: function( key, value ) {
652
+ this.options[ key ] = value;
653
+
654
+ if ( key === "disabled" ) {
655
+ this.widget()
656
+ .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
657
+ .attr( "aria-disabled", value );
658
+ this.hoverable.removeClass( "ui-state-hover" );
659
+ this.focusable.removeClass( "ui-state-focus" );
660
+ }
661
+
662
+ return this;
663
+ },
664
+
665
+ enable: function() {
666
+ return this._setOption( "disabled", false );
667
+ },
668
+ disable: function() {
669
+ return this._setOption( "disabled", true );
670
+ },
671
+
672
+ _on: function( element, handlers ) {
673
+ // no element argument, shuffle and use this.element
674
+ if ( !handlers ) {
675
+ handlers = element;
676
+ element = this.element;
677
+ } else {
678
+ // accept selectors, DOM elements
679
+ element = $( element );
680
+ this.bindings = this.bindings.add( element );
681
+ }
682
+
683
+ var instance = this;
684
+ $.each( handlers, function( event, handler ) {
685
+ function handlerProxy() {
686
+ // allow widgets to customize the disabled handling
687
+ // - disabled as an array instead of boolean
688
+ // - disabled class as method for disabling individual parts
689
+ if ( instance.options.disabled === true ||
690
+ $( this ).hasClass( "ui-state-disabled" ) ) {
691
+ return;
692
+ }
693
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
694
+ .apply( instance, arguments );
695
+ }
696
+
697
+ // copy the guid so direct unbinding works
698
+ if ( typeof handler !== "string" ) {
699
+ handlerProxy.guid = handler.guid =
700
+ handler.guid || handlerProxy.guid || $.guid++;
701
+ }
702
+
703
+ var match = event.match( /^(\w+)\s*(.*)$/ ),
704
+ eventName = match[1] + instance.eventNamespace,
705
+ selector = match[2];
706
+ if ( selector ) {
707
+ instance.widget().delegate( selector, eventName, handlerProxy );
708
+ } else {
709
+ element.bind( eventName, handlerProxy );
710
+ }
711
+ });
712
+ },
713
+
714
+ _off: function( element, eventName ) {
715
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
716
+ element.unbind( eventName ).undelegate( eventName );
717
+ },
718
+
719
+ _delay: function( handler, delay ) {
720
+ function handlerProxy() {
721
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
722
+ .apply( instance, arguments );
723
+ }
724
+ var instance = this;
725
+ return setTimeout( handlerProxy, delay || 0 );
726
+ },
727
+
728
+ _hoverable: function( element ) {
729
+ this.hoverable = this.hoverable.add( element );
730
+ this._on( element, {
731
+ mouseenter: function( event ) {
732
+ $( event.currentTarget ).addClass( "ui-state-hover" );
733
+ },
734
+ mouseleave: function( event ) {
735
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
736
+ }
737
+ });
738
+ },
739
+
740
+ _focusable: function( element ) {
741
+ this.focusable = this.focusable.add( element );
742
+ this._on( element, {
743
+ focusin: function( event ) {
744
+ $( event.currentTarget ).addClass( "ui-state-focus" );
745
+ },
746
+ focusout: function( event ) {
747
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
748
+ }
749
+ });
750
+ },
751
+
752
+ _trigger: function( type, event, data ) {
753
+ var prop, orig,
754
+ callback = this.options[ type ];
755
+
756
+ data = data || {};
757
+ event = $.Event( event );
758
+ event.type = ( type === this.widgetEventPrefix ?
759
+ type :
760
+ this.widgetEventPrefix + type ).toLowerCase();
761
+ // the original event may come from any element
762
+ // so we need to reset the target on the new event
763
+ event.target = this.element[ 0 ];
764
+
765
+ // copy original event properties over to the new event
766
+ orig = event.originalEvent;
767
+ if ( orig ) {
768
+ for ( prop in orig ) {
769
+ if ( !( prop in event ) ) {
770
+ event[ prop ] = orig[ prop ];
771
+ }
772
+ }
773
+ }
774
+
775
+ this.element.trigger( event, data );
776
+ return !( $.isFunction( callback ) &&
777
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
778
+ event.isDefaultPrevented() );
779
+ }
780
+ };
781
+
782
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
783
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
784
+ if ( typeof options === "string" ) {
785
+ options = { effect: options };
786
+ }
787
+ var hasOptions,
788
+ effectName = !options ?
789
+ method :
790
+ options === true || typeof options === "number" ?
791
+ defaultEffect :
792
+ options.effect || defaultEffect;
793
+ options = options || {};
794
+ if ( typeof options === "number" ) {
795
+ options = { duration: options };
796
+ }
797
+ hasOptions = !$.isEmptyObject( options );
798
+ options.complete = callback;
799
+ if ( options.delay ) {
800
+ element.delay( options.delay );
801
+ }
802
+ if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
803
+ element[ method ]( options );
804
+ } else if ( effectName !== method && element[ effectName ] ) {
805
+ element[ effectName ]( options.duration, options.easing, callback );
806
+ } else {
807
+ element.queue(function( next ) {
808
+ $( this )[ method ]();
809
+ if ( callback ) {
810
+ callback.call( element[ 0 ] );
811
+ }
812
+ next();
813
+ });
814
+ }
815
+ };
816
+ });
817
+
818
+ // DEPRECATED
819
+ if ( $.uiBackCompat !== false ) {
820
+ $.Widget.prototype._getCreateOptions = function() {
821
+ return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
822
+ };
823
+ }
824
+
825
+ })( jQuery );
826
+
827
+ (function( $, undefined ) {
828
+
829
+ var mouseHandled = false;
830
+ $( document ).mouseup( function( e ) {
831
+ mouseHandled = false;
832
+ });
833
+
834
+ $.widget("ui.mouse", {
835
+ version: "1.9.0",
836
+ options: {
837
+ cancel: 'input,textarea,button,select,option',
838
+ distance: 1,
839
+ delay: 0
840
+ },
841
+ _mouseInit: function() {
842
+ var that = this;
843
+
844
+ this.element
845
+ .bind('mousedown.'+this.widgetName, function(event) {
846
+ return that._mouseDown(event);
847
+ })
848
+ .bind('click.'+this.widgetName, function(event) {
849
+ if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
850
+ $.removeData(event.target, that.widgetName + '.preventClickEvent');
851
+ event.stopImmediatePropagation();
852
+ return false;
853
+ }
854
+ });
855
+
856
+ this.started = false;
857
+ },
858
+
859
+ // TODO: make sure destroying one instance of mouse doesn't mess with
860
+ // other instances of mouse
861
+ _mouseDestroy: function() {
862
+ this.element.unbind('.'+this.widgetName);
863
+ if ( this._mouseMoveDelegate ) {
864
+ $(document)
865
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
866
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
867
+ }
868
+ },
869
+
870
+ _mouseDown: function(event) {
871
+ // don't let more than one widget handle mouseStart
872
+ if( mouseHandled ) { return; }
873
+
874
+ // we may have missed mouseup (out of window)
875
+ (this._mouseStarted && this._mouseUp(event));
876
+
877
+ this._mouseDownEvent = event;
878
+
879
+ var that = this,
880
+ btnIsLeft = (event.which === 1),
881
+ // event.target.nodeName works around a bug in IE 8 with
882
+ // disabled inputs (#7620)
883
+ elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
884
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
885
+ return true;
886
+ }
887
+
888
+ this.mouseDelayMet = !this.options.delay;
889
+ if (!this.mouseDelayMet) {
890
+ this._mouseDelayTimer = setTimeout(function() {
891
+ that.mouseDelayMet = true;
892
+ }, this.options.delay);
893
+ }
894
+
895
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
896
+ this._mouseStarted = (this._mouseStart(event) !== false);
897
+ if (!this._mouseStarted) {
898
+ event.preventDefault();
899
+ return true;
900
+ }
901
+ }
902
+
903
+ // Click event may never have fired (Gecko & Opera)
904
+ if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
905
+ $.removeData(event.target, this.widgetName + '.preventClickEvent');
906
+ }
907
+
908
+ // these delegates are required to keep context
909
+ this._mouseMoveDelegate = function(event) {
910
+ return that._mouseMove(event);
911
+ };
912
+ this._mouseUpDelegate = function(event) {
913
+ return that._mouseUp(event);
914
+ };
915
+ $(document)
916
+ .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
917
+ .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
918
+
919
+ event.preventDefault();
920
+
921
+ mouseHandled = true;
922
+ return true;
923
+ },
924
+
925
+ _mouseMove: function(event) {
926
+ // IE mouseup check - mouseup happened when mouse was out of window
927
+ if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
928
+ return this._mouseUp(event);
929
+ }
930
+
931
+ if (this._mouseStarted) {
932
+ this._mouseDrag(event);
933
+ return event.preventDefault();
934
+ }
935
+
936
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
937
+ this._mouseStarted =
938
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
939
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
940
+ }
941
+
942
+ return !this._mouseStarted;
943
+ },
944
+
945
+ _mouseUp: function(event) {
946
+ $(document)
947
+ .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
948
+ .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
949
+
950
+ if (this._mouseStarted) {
951
+ this._mouseStarted = false;
952
+
953
+ if (event.target === this._mouseDownEvent.target) {
954
+ $.data(event.target, this.widgetName + '.preventClickEvent', true);
955
+ }
956
+
957
+ this._mouseStop(event);
958
+ }
959
+
960
+ return false;
961
+ },
962
+
963
+ _mouseDistanceMet: function(event) {
964
+ return (Math.max(
965
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
966
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
967
+ ) >= this.options.distance
968
+ );
969
+ },
970
+
971
+ _mouseDelayMet: function(event) {
972
+ return this.mouseDelayMet;
973
+ },
974
+
975
+ // These are placeholder methods, to be overriden by extending plugin
976
+ _mouseStart: function(event) {},
977
+ _mouseDrag: function(event) {},
978
+ _mouseStop: function(event) {},
979
+ _mouseCapture: function(event) { return true; }
980
+ });
981
+
982
+ })(jQuery);
983
+
984
+ (function( $, undefined ) {
985
+
986
+ $.widget("ui.draggable", $.ui.mouse, {
987
+ version: "1.9.0",
988
+ widgetEventPrefix: "drag",
989
+ options: {
990
+ addClasses: true,
991
+ appendTo: "parent",
992
+ axis: false,
993
+ connectToSortable: false,
994
+ containment: false,
995
+ cursor: "auto",
996
+ cursorAt: false,
997
+ grid: false,
998
+ handle: false,
999
+ helper: "original",
1000
+ iframeFix: false,
1001
+ opacity: false,
1002
+ refreshPositions: false,
1003
+ revert: false,
1004
+ revertDuration: 500,
1005
+ scope: "default",
1006
+ scroll: true,
1007
+ scrollSensitivity: 20,
1008
+ scrollSpeed: 20,
1009
+ snap: false,
1010
+ snapMode: "both",
1011
+ snapTolerance: 20,
1012
+ stack: false,
1013
+ zIndex: false
1014
+ },
1015
+ _create: function() {
1016
+
1017
+ if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
1018
+ this.element[0].style.position = 'relative';
1019
+
1020
+ (this.options.addClasses && this.element.addClass("ui-draggable"));
1021
+ (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
1022
+
1023
+ this._mouseInit();
1024
+
1025
+ },
1026
+
1027
+ _destroy: function() {
1028
+ this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
1029
+ this._mouseDestroy();
1030
+ },
1031
+
1032
+ _mouseCapture: function(event) {
1033
+
1034
+ var o = this.options;
1035
+
1036
+ // among others, prevent a drag on a resizable-handle
1037
+ if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
1038
+ return false;
1039
+
1040
+ //Quit if we're not on a valid handle
1041
+ this.handle = this._getHandle(event);
1042
+ if (!this.handle)
1043
+ return false;
1044
+
1045
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
1046
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
1047
+ .css({
1048
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
1049
+ position: "absolute", opacity: "0.001", zIndex: 1000
1050
+ })
1051
+ .css($(this).offset())
1052
+ .appendTo("body");
1053
+ });
1054
+
1055
+ return true;
1056
+
1057
+ },
1058
+
1059
+ _mouseStart: function(event) {
1060
+
1061
+ var o = this.options;
1062
+
1063
+ //Create and append the visible helper
1064
+ this.helper = this._createHelper(event);
1065
+
1066
+ this.helper.addClass("ui-draggable-dragging");
1067
+
1068
+ //Cache the helper size
1069
+ this._cacheHelperProportions();
1070
+
1071
+ //If ddmanager is used for droppables, set the global draggable
1072
+ if($.ui.ddmanager)
1073
+ $.ui.ddmanager.current = this;
1074
+
1075
+ /*
1076
+ * - Position generation -
1077
+ * This block generates everything position related - it's the core of draggables.
1078
+ */
1079
+
1080
+ //Cache the margins of the original element
1081
+ this._cacheMargins();
1082
+
1083
+ //Store the helper's css position
1084
+ this.cssPosition = this.helper.css("position");
1085
+ this.scrollParent = this.helper.scrollParent();
1086
+
1087
+ //The element's absolute position on the page minus margins
1088
+ this.offset = this.positionAbs = this.element.offset();
1089
+ this.offset = {
1090
+ top: this.offset.top - this.margins.top,
1091
+ left: this.offset.left - this.margins.left
1092
+ };
1093
+
1094
+ $.extend(this.offset, {
1095
+ click: { //Where the click happened, relative to the element
1096
+ left: event.pageX - this.offset.left,
1097
+ top: event.pageY - this.offset.top
1098
+ },
1099
+ parent: this._getParentOffset(),
1100
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
1101
+ });
1102
+
1103
+ //Generate the original position
1104
+ this.originalPosition = this.position = this._generatePosition(event);
1105
+ this.originalPageX = event.pageX;
1106
+ this.originalPageY = event.pageY;
1107
+
1108
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
1109
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
1110
+
1111
+ //Set a containment if given in the options
1112
+ if(o.containment)
1113
+ this._setContainment();
1114
+
1115
+ //Trigger event + callbacks
1116
+ if(this._trigger("start", event) === false) {
1117
+ this._clear();
1118
+ return false;
1119
+ }
1120
+
1121
+ //Recache the helper size
1122
+ this._cacheHelperProportions();
1123
+
1124
+ //Prepare the droppable offsets
1125
+ if ($.ui.ddmanager && !o.dropBehaviour)
1126
+ $.ui.ddmanager.prepareOffsets(this, event);
1127
+
1128
+
1129
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
1130
+
1131
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
1132
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
1133
+
1134
+ return true;
1135
+ },
1136
+
1137
+ _mouseDrag: function(event, noPropagation) {
1138
+
1139
+ //Compute the helpers position
1140
+ this.position = this._generatePosition(event);
1141
+ this.positionAbs = this._convertPositionTo("absolute");
1142
+
1143
+ //Call plugins and callbacks and use the resulting position if something is returned
1144
+ if (!noPropagation) {
1145
+ var ui = this._uiHash();
1146
+ if(this._trigger('drag', event, ui) === false) {
1147
+ this._mouseUp({});
1148
+ return false;
1149
+ }
1150
+ this.position = ui.position;
1151
+ }
1152
+
1153
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
1154
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
1155
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
1156
+
1157
+ return false;
1158
+ },
1159
+
1160
+ _mouseStop: function(event) {
1161
+
1162
+ //If we are using droppables, inform the manager about the drop
1163
+ var dropped = false;
1164
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
1165
+ dropped = $.ui.ddmanager.drop(this, event);
1166
+
1167
+ //if a drop comes from outside (a sortable)
1168
+ if(this.dropped) {
1169
+ dropped = this.dropped;
1170
+ this.dropped = false;
1171
+ }
1172
+
1173
+ //if the original element is no longer in the DOM don't bother to continue (see #8269)
1174
+ var element = this.element[0], elementInDom = false;
1175
+ while ( element && (element = element.parentNode) ) {
1176
+ if (element == document ) {
1177
+ elementInDom = true;
1178
+ }
1179
+ }
1180
+ if ( !elementInDom && this.options.helper === "original" )
1181
+ return false;
1182
+
1183
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
1184
+ var that = this;
1185
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
1186
+ if(that._trigger("stop", event) !== false) {
1187
+ that._clear();
1188
+ }
1189
+ });
1190
+ } else {
1191
+ if(this._trigger("stop", event) !== false) {
1192
+ this._clear();
1193
+ }
1194
+ }
1195
+
1196
+ return false;
1197
+ },
1198
+
1199
+ _mouseUp: function(event) {
1200
+ //Remove frame helpers
1201
+ $("div.ui-draggable-iframeFix").each(function() {
1202
+ this.parentNode.removeChild(this);
1203
+ });
1204
+
1205
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
1206
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
1207
+
1208
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
1209
+ },
1210
+
1211
+ cancel: function() {
1212
+
1213
+ if(this.helper.is(".ui-draggable-dragging")) {
1214
+ this._mouseUp({});
1215
+ } else {
1216
+ this._clear();
1217
+ }
1218
+
1219
+ return this;
1220
+
1221
+ },
1222
+
1223
+ _getHandle: function(event) {
1224
+
1225
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
1226
+ $(this.options.handle, this.element)
1227
+ .find("*")
1228
+ .andSelf()
1229
+ .each(function() {
1230
+ if(this == event.target) handle = true;
1231
+ });
1232
+
1233
+ return handle;
1234
+
1235
+ },
1236
+
1237
+ _createHelper: function(event) {
1238
+
1239
+ var o = this.options;
1240
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
1241
+
1242
+ if(!helper.parents('body').length)
1243
+ helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
1244
+
1245
+ if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
1246
+ helper.css("position", "absolute");
1247
+
1248
+ return helper;
1249
+
1250
+ },
1251
+
1252
+ _adjustOffsetFromHelper: function(obj) {
1253
+ if (typeof obj == 'string') {
1254
+ obj = obj.split(' ');
1255
+ }
1256
+ if ($.isArray(obj)) {
1257
+ obj = {left: +obj[0], top: +obj[1] || 0};
1258
+ }
1259
+ if ('left' in obj) {
1260
+ this.offset.click.left = obj.left + this.margins.left;
1261
+ }
1262
+ if ('right' in obj) {
1263
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
1264
+ }
1265
+ if ('top' in obj) {
1266
+ this.offset.click.top = obj.top + this.margins.top;
1267
+ }
1268
+ if ('bottom' in obj) {
1269
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
1270
+ }
1271
+ },
1272
+
1273
+ _getParentOffset: function() {
1274
+
1275
+ //Get the offsetParent and cache its position
1276
+ this.offsetParent = this.helper.offsetParent();
1277
+ var po = this.offsetParent.offset();
1278
+
1279
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
1280
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
1281
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
1282
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
1283
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
1284
+ po.left += this.scrollParent.scrollLeft();
1285
+ po.top += this.scrollParent.scrollTop();
1286
+ }
1287
+
1288
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
1289
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
1290
+ po = { top: 0, left: 0 };
1291
+
1292
+ return {
1293
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
1294
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
1295
+ };
1296
+
1297
+ },
1298
+
1299
+ _getRelativeOffset: function() {
1300
+
1301
+ if(this.cssPosition == "relative") {
1302
+ var p = this.element.position();
1303
+ return {
1304
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
1305
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
1306
+ };
1307
+ } else {
1308
+ return { top: 0, left: 0 };
1309
+ }
1310
+
1311
+ },
1312
+
1313
+ _cacheMargins: function() {
1314
+ this.margins = {
1315
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
1316
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
1317
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
1318
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
1319
+ };
1320
+ },
1321
+
1322
+ _cacheHelperProportions: function() {
1323
+ this.helperProportions = {
1324
+ width: this.helper.outerWidth(),
1325
+ height: this.helper.outerHeight()
1326
+ };
1327
+ },
1328
+
1329
+ _setContainment: function() {
1330
+
1331
+ var o = this.options;
1332
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
1333
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
1334
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
1335
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
1336
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
1337
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
1338
+ ];
1339
+
1340
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
1341
+ var c = $(o.containment);
1342
+ var ce = c[0]; if(!ce) return;
1343
+ var co = c.offset();
1344
+ var over = ($(ce).css("overflow") != 'hidden');
1345
+
1346
+ this.containment = [
1347
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
1348
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
1349
+ (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
1350
+ (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
1351
+ ];
1352
+ this.relative_container = c;
1353
+
1354
+ } else if(o.containment.constructor == Array) {
1355
+ this.containment = o.containment;
1356
+ }
1357
+
1358
+ },
1359
+
1360
+ _convertPositionTo: function(d, pos) {
1361
+
1362
+ if(!pos) pos = this.position;
1363
+ var mod = d == "absolute" ? 1 : -1;
1364
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
1365
+
1366
+ return {
1367
+ top: (
1368
+ pos.top // The absolute mouse position
1369
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
1370
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
1371
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
1372
+ ),
1373
+ left: (
1374
+ pos.left // The absolute mouse position
1375
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
1376
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
1377
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
1378
+ )
1379
+ };
1380
+
1381
+ },
1382
+
1383
+ _generatePosition: function(event) {
1384
+
1385
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
1386
+ var pageX = event.pageX;
1387
+ var pageY = event.pageY;
1388
+
1389
+ /*
1390
+ * - Position constraining -
1391
+ * Constrain the position to a mix of grid, containment.
1392
+ */
1393
+
1394
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
1395
+ var containment;
1396
+ if(this.containment) {
1397
+ if (this.relative_container){
1398
+ var co = this.relative_container.offset();
1399
+ containment = [ this.containment[0] + co.left,
1400
+ this.containment[1] + co.top,
1401
+ this.containment[2] + co.left,
1402
+ this.containment[3] + co.top ];
1403
+ }
1404
+ else {
1405
+ containment = this.containment;
1406
+ }
1407
+
1408
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
1409
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
1410
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
1411
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
1412
+ }
1413
+
1414
+ if(o.grid) {
1415
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
1416
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
1417
+ pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
1418
+
1419
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
1420
+ pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
1421
+ }
1422
+
1423
+ }
1424
+
1425
+ return {
1426
+ top: (
1427
+ pageY // The absolute mouse position
1428
+ - this.offset.click.top // Click offset (relative to the element)
1429
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
1430
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
1431
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
1432
+ ),
1433
+ left: (
1434
+ pageX // The absolute mouse position
1435
+ - this.offset.click.left // Click offset (relative to the element)
1436
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
1437
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
1438
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
1439
+ )
1440
+ };
1441
+
1442
+ },
1443
+
1444
+ _clear: function() {
1445
+ this.helper.removeClass("ui-draggable-dragging");
1446
+ if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
1447
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
1448
+ this.helper = null;
1449
+ this.cancelHelperRemoval = false;
1450
+ },
1451
+
1452
+ // From now on bulk stuff - mainly helpers
1453
+
1454
+ _trigger: function(type, event, ui) {
1455
+ ui = ui || this._uiHash();
1456
+ $.ui.plugin.call(this, type, [event, ui]);
1457
+ if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
1458
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
1459
+ },
1460
+
1461
+ plugins: {},
1462
+
1463
+ _uiHash: function(event) {
1464
+ return {
1465
+ helper: this.helper,
1466
+ position: this.position,
1467
+ originalPosition: this.originalPosition,
1468
+ offset: this.positionAbs
1469
+ };
1470
+ }
1471
+
1472
+ });
1473
+
1474
+ $.ui.plugin.add("draggable", "connectToSortable", {
1475
+ start: function(event, ui) {
1476
+
1477
+ var inst = $(this).data("draggable"), o = inst.options,
1478
+ uiSortable = $.extend({}, ui, { item: inst.element });
1479
+ inst.sortables = [];
1480
+ $(o.connectToSortable).each(function() {
1481
+ var sortable = $.data(this, 'sortable');
1482
+ if (sortable && !sortable.options.disabled) {
1483
+ inst.sortables.push({
1484
+ instance: sortable,
1485
+ shouldRevert: sortable.options.revert
1486
+ });
1487
+ sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
1488
+ sortable._trigger("activate", event, uiSortable);
1489
+ }
1490
+ });
1491
+
1492
+ },
1493
+ stop: function(event, ui) {
1494
+
1495
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
1496
+ var inst = $(this).data("draggable"),
1497
+ uiSortable = $.extend({}, ui, { item: inst.element });
1498
+
1499
+ $.each(inst.sortables, function() {
1500
+ if(this.instance.isOver) {
1501
+
1502
+ this.instance.isOver = 0;
1503
+
1504
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
1505
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
1506
+
1507
+ //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
1508
+ if(this.shouldRevert) this.instance.options.revert = true;
1509
+
1510
+ //Trigger the stop of the sortable
1511
+ this.instance._mouseStop(event);
1512
+
1513
+ this.instance.options.helper = this.instance.options._helper;
1514
+
1515
+ //If the helper has been the original item, restore properties in the sortable
1516
+ if(inst.options.helper == 'original')
1517
+ this.instance.currentItem.css({ top: 'auto', left: 'auto' });
1518
+
1519
+ } else {
1520
+ this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
1521
+ this.instance._trigger("deactivate", event, uiSortable);
1522
+ }
1523
+
1524
+ });
1525
+
1526
+ },
1527
+ drag: function(event, ui) {
1528
+
1529
+ var inst = $(this).data("draggable"), that = this;
1530
+
1531
+ var checkPos = function(o) {
1532
+ var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
1533
+ var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
1534
+ var itemHeight = o.height, itemWidth = o.width;
1535
+ var itemTop = o.top, itemLeft = o.left;
1536
+
1537
+ return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
1538
+ };
1539
+
1540
+ $.each(inst.sortables, function(i) {
1541
+
1542
+ //Copy over some variables to allow calling the sortable's native _intersectsWith
1543
+ this.instance.positionAbs = inst.positionAbs;
1544
+ this.instance.helperProportions = inst.helperProportions;
1545
+ this.instance.offset.click = inst.offset.click;
1546
+
1547
+ if(this.instance._intersectsWith(this.instance.containerCache)) {
1548
+
1549
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
1550
+ if(!this.instance.isOver) {
1551
+
1552
+ this.instance.isOver = 1;
1553
+ //Now we fake the start of dragging for the sortable instance,
1554
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
1555
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
1556
+ this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
1557
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
1558
+ this.instance.options.helper = function() { return ui.helper[0]; };
1559
+
1560
+ event.target = this.instance.currentItem[0];
1561
+ this.instance._mouseCapture(event, true);
1562
+ this.instance._mouseStart(event, true, true);
1563
+
1564
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
1565
+ this.instance.offset.click.top = inst.offset.click.top;
1566
+ this.instance.offset.click.left = inst.offset.click.left;
1567
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
1568
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
1569
+
1570
+ inst._trigger("toSortable", event);
1571
+ inst.dropped = this.instance.element; //draggable revert needs that
1572
+ //hack so receive/update callbacks work (mostly)
1573
+ inst.currentItem = inst.element;
1574
+ this.instance.fromOutside = inst;
1575
+
1576
+ }
1577
+
1578
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
1579
+ if(this.instance.currentItem) this.instance._mouseDrag(event);
1580
+
1581
+ } else {
1582
+
1583
+ //If it doesn't intersect with the sortable, and it intersected before,
1584
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
1585
+ if(this.instance.isOver) {
1586
+
1587
+ this.instance.isOver = 0;
1588
+ this.instance.cancelHelperRemoval = true;
1589
+
1590
+ //Prevent reverting on this forced stop
1591
+ this.instance.options.revert = false;
1592
+
1593
+ // The out event needs to be triggered independently
1594
+ this.instance._trigger('out', event, this.instance._uiHash(this.instance));
1595
+
1596
+ this.instance._mouseStop(event, true);
1597
+ this.instance.options.helper = this.instance.options._helper;
1598
+
1599
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
1600
+ this.instance.currentItem.remove();
1601
+ if(this.instance.placeholder) this.instance.placeholder.remove();
1602
+
1603
+ inst._trigger("fromSortable", event);
1604
+ inst.dropped = false; //draggable revert needs that
1605
+ }
1606
+
1607
+ };
1608
+
1609
+ });
1610
+
1611
+ }
1612
+ });
1613
+
1614
+ $.ui.plugin.add("draggable", "cursor", {
1615
+ start: function(event, ui) {
1616
+ var t = $('body'), o = $(this).data('draggable').options;
1617
+ if (t.css("cursor")) o._cursor = t.css("cursor");
1618
+ t.css("cursor", o.cursor);
1619
+ },
1620
+ stop: function(event, ui) {
1621
+ var o = $(this).data('draggable').options;
1622
+ if (o._cursor) $('body').css("cursor", o._cursor);
1623
+ }
1624
+ });
1625
+
1626
+ $.ui.plugin.add("draggable", "opacity", {
1627
+ start: function(event, ui) {
1628
+ var t = $(ui.helper), o = $(this).data('draggable').options;
1629
+ if(t.css("opacity")) o._opacity = t.css("opacity");
1630
+ t.css('opacity', o.opacity);
1631
+ },
1632
+ stop: function(event, ui) {
1633
+ var o = $(this).data('draggable').options;
1634
+ if(o._opacity) $(ui.helper).css('opacity', o._opacity);
1635
+ }
1636
+ });
1637
+
1638
+ $.ui.plugin.add("draggable", "scroll", {
1639
+ start: function(event, ui) {
1640
+ var i = $(this).data("draggable");
1641
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
1642
+ },
1643
+ drag: function(event, ui) {
1644
+
1645
+ var i = $(this).data("draggable"), o = i.options, scrolled = false;
1646
+
1647
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
1648
+
1649
+ if(!o.axis || o.axis != 'x') {
1650
+ if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
1651
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
1652
+ else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
1653
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
1654
+ }
1655
+
1656
+ if(!o.axis || o.axis != 'y') {
1657
+ if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
1658
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
1659
+ else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
1660
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
1661
+ }
1662
+
1663
+ } else {
1664
+
1665
+ if(!o.axis || o.axis != 'x') {
1666
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
1667
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
1668
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
1669
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
1670
+ }
1671
+
1672
+ if(!o.axis || o.axis != 'y') {
1673
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
1674
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
1675
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
1676
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
1677
+ }
1678
+
1679
+ }
1680
+
1681
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
1682
+ $.ui.ddmanager.prepareOffsets(i, event);
1683
+
1684
+ }
1685
+ });
1686
+
1687
+ $.ui.plugin.add("draggable", "snap", {
1688
+ start: function(event, ui) {
1689
+
1690
+ var i = $(this).data("draggable"), o = i.options;
1691
+ i.snapElements = [];
1692
+
1693
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
1694
+ var $t = $(this); var $o = $t.offset();
1695
+ if(this != i.element[0]) i.snapElements.push({
1696
+ item: this,
1697
+ width: $t.outerWidth(), height: $t.outerHeight(),
1698
+ top: $o.top, left: $o.left
1699
+ });
1700
+ });
1701
+
1702
+ },
1703
+ drag: function(event, ui) {
1704
+
1705
+ var inst = $(this).data("draggable"), o = inst.options;
1706
+ var d = o.snapTolerance;
1707
+
1708
+ var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
1709
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
1710
+
1711
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
1712
+
1713
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
1714
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
1715
+
1716
+ //Yes, I know, this is insane ;)
1717
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
1718
+ if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
1719
+ inst.snapElements[i].snapping = false;
1720
+ continue;
1721
+ }
1722
+
1723
+ if(o.snapMode != 'inner') {
1724
+ var ts = Math.abs(t - y2) <= d;
1725
+ var bs = Math.abs(b - y1) <= d;
1726
+ var ls = Math.abs(l - x2) <= d;
1727
+ var rs = Math.abs(r - x1) <= d;
1728
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1729
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
1730
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
1731
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
1732
+ }
1733
+
1734
+ var first = (ts || bs || ls || rs);
1735
+
1736
+ if(o.snapMode != 'outer') {
1737
+ var ts = Math.abs(t - y1) <= d;
1738
+ var bs = Math.abs(b - y2) <= d;
1739
+ var ls = Math.abs(l - x1) <= d;
1740
+ var rs = Math.abs(r - x2) <= d;
1741
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
1742
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
1743
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
1744
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
1745
+ }
1746
+
1747
+ if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
1748
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
1749
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
1750
+
1751
+ };
1752
+
1753
+ }
1754
+ });
1755
+
1756
+ $.ui.plugin.add("draggable", "stack", {
1757
+ start: function(event, ui) {
1758
+
1759
+ var o = $(this).data("draggable").options;
1760
+
1761
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
1762
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
1763
+ });
1764
+ if (!group.length) { return; }
1765
+
1766
+ var min = parseInt(group[0].style.zIndex) || 0;
1767
+ $(group).each(function(i) {
1768
+ this.style.zIndex = min + i;
1769
+ });
1770
+
1771
+ this[0].style.zIndex = min + group.length;
1772
+
1773
+ }
1774
+ });
1775
+
1776
+ $.ui.plugin.add("draggable", "zIndex", {
1777
+ start: function(event, ui) {
1778
+ var t = $(ui.helper), o = $(this).data("draggable").options;
1779
+ if(t.css("zIndex")) o._zIndex = t.css("zIndex");
1780
+ t.css('zIndex', o.zIndex);
1781
+ },
1782
+ stop: function(event, ui) {
1783
+ var o = $(this).data("draggable").options;
1784
+ if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
1785
+ }
1786
+ });
1787
+
1788
+ })(jQuery);
1789
+
1790
+ (function( $, undefined ) {
1791
+
1792
+ $.widget("ui.droppable", {
1793
+ version: "1.9.0",
1794
+ widgetEventPrefix: "drop",
1795
+ options: {
1796
+ accept: '*',
1797
+ activeClass: false,
1798
+ addClasses: true,
1799
+ greedy: false,
1800
+ hoverClass: false,
1801
+ scope: 'default',
1802
+ tolerance: 'intersect'
1803
+ },
1804
+ _create: function() {
1805
+
1806
+ var o = this.options, accept = o.accept;
1807
+ this.isover = 0; this.isout = 1;
1808
+
1809
+ this.accept = $.isFunction(accept) ? accept : function(d) {
1810
+ return d.is(accept);
1811
+ };
1812
+
1813
+ //Store the droppable's proportions
1814
+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
1815
+
1816
+ // Add the reference and positions to the manager
1817
+ $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
1818
+ $.ui.ddmanager.droppables[o.scope].push(this);
1819
+
1820
+ (o.addClasses && this.element.addClass("ui-droppable"));
1821
+
1822
+ },
1823
+
1824
+ _destroy: function() {
1825
+ var drop = $.ui.ddmanager.droppables[this.options.scope];
1826
+ for ( var i = 0; i < drop.length; i++ )
1827
+ if ( drop[i] == this )
1828
+ drop.splice(i, 1);
1829
+
1830
+ this.element.removeClass("ui-droppable ui-droppable-disabled");
1831
+ },
1832
+
1833
+ _setOption: function(key, value) {
1834
+
1835
+ if(key == 'accept') {
1836
+ this.accept = $.isFunction(value) ? value : function(d) {
1837
+ return d.is(value);
1838
+ };
1839
+ }
1840
+ $.Widget.prototype._setOption.apply(this, arguments);
1841
+ },
1842
+
1843
+ _activate: function(event) {
1844
+ var draggable = $.ui.ddmanager.current;
1845
+ if(this.options.activeClass) this.element.addClass(this.options.activeClass);
1846
+ (draggable && this._trigger('activate', event, this.ui(draggable)));
1847
+ },
1848
+
1849
+ _deactivate: function(event) {
1850
+ var draggable = $.ui.ddmanager.current;
1851
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
1852
+ (draggable && this._trigger('deactivate', event, this.ui(draggable)));
1853
+ },
1854
+
1855
+ _over: function(event) {
1856
+
1857
+ var draggable = $.ui.ddmanager.current;
1858
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
1859
+
1860
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1861
+ if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
1862
+ this._trigger('over', event, this.ui(draggable));
1863
+ }
1864
+
1865
+ },
1866
+
1867
+ _out: function(event) {
1868
+
1869
+ var draggable = $.ui.ddmanager.current;
1870
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
1871
+
1872
+ if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1873
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
1874
+ this._trigger('out', event, this.ui(draggable));
1875
+ }
1876
+
1877
+ },
1878
+
1879
+ _drop: function(event,custom) {
1880
+
1881
+ var draggable = custom || $.ui.ddmanager.current;
1882
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
1883
+
1884
+ var childrenIntersection = false;
1885
+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
1886
+ var inst = $.data(this, 'droppable');
1887
+ if(
1888
+ inst.options.greedy
1889
+ && !inst.options.disabled
1890
+ && inst.options.scope == draggable.options.scope
1891
+ && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
1892
+ && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
1893
+ ) { childrenIntersection = true; return false; }
1894
+ });
1895
+ if(childrenIntersection) return false;
1896
+
1897
+ if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1898
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
1899
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
1900
+ this._trigger('drop', event, this.ui(draggable));
1901
+ return this.element;
1902
+ }
1903
+
1904
+ return false;
1905
+
1906
+ },
1907
+
1908
+ ui: function(c) {
1909
+ return {
1910
+ draggable: (c.currentItem || c.element),
1911
+ helper: c.helper,
1912
+ position: c.position,
1913
+ offset: c.positionAbs
1914
+ };
1915
+ }
1916
+
1917
+ });
1918
+
1919
+ $.ui.intersect = function(draggable, droppable, toleranceMode) {
1920
+
1921
+ if (!droppable.offset) return false;
1922
+
1923
+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
1924
+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
1925
+ var l = droppable.offset.left, r = l + droppable.proportions.width,
1926
+ t = droppable.offset.top, b = t + droppable.proportions.height;
1927
+
1928
+ switch (toleranceMode) {
1929
+ case 'fit':
1930
+ return (l <= x1 && x2 <= r
1931
+ && t <= y1 && y2 <= b);
1932
+ break;
1933
+ case 'intersect':
1934
+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
1935
+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
1936
+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
1937
+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
1938
+ break;
1939
+ case 'pointer':
1940
+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
1941
+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
1942
+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
1943
+ return isOver;
1944
+ break;
1945
+ case 'touch':
1946
+ return (
1947
+ (y1 >= t && y1 <= b) || // Top edge touching
1948
+ (y2 >= t && y2 <= b) || // Bottom edge touching
1949
+ (y1 < t && y2 > b) // Surrounded vertically
1950
+ ) && (
1951
+ (x1 >= l && x1 <= r) || // Left edge touching
1952
+ (x2 >= l && x2 <= r) || // Right edge touching
1953
+ (x1 < l && x2 > r) // Surrounded horizontally
1954
+ );
1955
+ break;
1956
+ default:
1957
+ return false;
1958
+ break;
1959
+ }
1960
+
1961
+ };
1962
+
1963
+ /*
1964
+ This manager tracks offsets of draggables and droppables
1965
+ */
1966
+ $.ui.ddmanager = {
1967
+ current: null,
1968
+ droppables: { 'default': [] },
1969
+ prepareOffsets: function(t, event) {
1970
+
1971
+ var m = $.ui.ddmanager.droppables[t.options.scope] || [];
1972
+ var type = event ? event.type : null; // workaround for #2317
1973
+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
1974
+
1975
+ droppablesLoop: for (var i = 0; i < m.length; i++) {
1976
+
1977
+ if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
1978
+ for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
1979
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
1980
+
1981
+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
1982
+
1983
+ m[i].offset = m[i].element.offset();
1984
+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
1985
+
1986
+ }
1987
+
1988
+ },
1989
+ drop: function(draggable, event) {
1990
+
1991
+ var dropped = false;
1992
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
1993
+
1994
+ if(!this.options) return;
1995
+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
1996
+ dropped = this._drop.call(this, event) || dropped;
1997
+
1998
+ if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
1999
+ this.isout = 1; this.isover = 0;
2000
+ this._deactivate.call(this, event);
2001
+ }
2002
+
2003
+ });
2004
+ return dropped;
2005
+
2006
+ },
2007
+ dragStart: function( draggable, event ) {
2008
+ //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
2009
+ draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
2010
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
2011
+ });
2012
+ },
2013
+ drag: function(draggable, event) {
2014
+
2015
+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
2016
+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
2017
+
2018
+ //Run through all droppables and check their positions based on specific tolerance options
2019
+ $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
2020
+
2021
+ if(this.options.disabled || this.greedyChild || !this.visible) return;
2022
+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
2023
+
2024
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
2025
+ if(!c) return;
2026
+
2027
+ var parentInstance;
2028
+ if (this.options.greedy) {
2029
+ // find droppable parents with same scope
2030
+ var scope = this.options.scope;
2031
+ var parent = this.element.parents(':data(droppable)').filter(function () {
2032
+ return $.data(this, 'droppable').options.scope === scope;
2033
+ });
2034
+
2035
+ if (parent.length) {
2036
+ parentInstance = $.data(parent[0], 'droppable');
2037
+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
2038
+ }
2039
+ }
2040
+
2041
+ // we just moved into a greedy child
2042
+ if (parentInstance && c == 'isover') {
2043
+ parentInstance['isover'] = 0;
2044
+ parentInstance['isout'] = 1;
2045
+ parentInstance._out.call(parentInstance, event);
2046
+ }
2047
+
2048
+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
2049
+ this[c == "isover" ? "_over" : "_out"].call(this, event);
2050
+
2051
+ // we just moved out of a greedy child
2052
+ if (parentInstance && c == 'isout') {
2053
+ parentInstance['isout'] = 0;
2054
+ parentInstance['isover'] = 1;
2055
+ parentInstance._over.call(parentInstance, event);
2056
+ }
2057
+ });
2058
+
2059
+ },
2060
+ dragStop: function( draggable, event ) {
2061
+ draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
2062
+ //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
2063
+ if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
2064
+ }
2065
+ };
2066
+
2067
+ })(jQuery);
2068
+
2069
+ (function( $, undefined ) {
2070
+
2071
+ $.widget("ui.resizable", $.ui.mouse, {
2072
+ version: "1.9.0",
2073
+ widgetEventPrefix: "resize",
2074
+ options: {
2075
+ alsoResize: false,
2076
+ animate: false,
2077
+ animateDuration: "slow",
2078
+ animateEasing: "swing",
2079
+ aspectRatio: false,
2080
+ autoHide: false,
2081
+ containment: false,
2082
+ ghost: false,
2083
+ grid: false,
2084
+ handles: "e,s,se",
2085
+ helper: false,
2086
+ maxHeight: null,
2087
+ maxWidth: null,
2088
+ minHeight: 10,
2089
+ minWidth: 10,
2090
+ zIndex: 1000
2091
+ },
2092
+ _create: function() {
2093
+
2094
+ var that = this, o = this.options;
2095
+ this.element.addClass("ui-resizable");
2096
+
2097
+ $.extend(this, {
2098
+ _aspectRatio: !!(o.aspectRatio),
2099
+ aspectRatio: o.aspectRatio,
2100
+ originalElement: this.element,
2101
+ _proportionallyResizeElements: [],
2102
+ _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
2103
+ });
2104
+
2105
+ //Wrap the element if it cannot hold child nodes
2106
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
2107
+
2108
+ //Create a wrapper element and set the wrapper to the new current internal element
2109
+ this.element.wrap(
2110
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
2111
+ position: this.element.css('position'),
2112
+ width: this.element.outerWidth(),
2113
+ height: this.element.outerHeight(),
2114
+ top: this.element.css('top'),
2115
+ left: this.element.css('left')
2116
+ })
2117
+ );
2118
+
2119
+ //Overwrite the original this.element
2120
+ this.element = this.element.parent().data(
2121
+ "resizable", this.element.data('resizable')
2122
+ );
2123
+
2124
+ this.elementIsWrapper = true;
2125
+
2126
+ //Move margins to the wrapper
2127
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
2128
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
2129
+
2130
+ //Prevent Safari textarea resize
2131
+ this.originalResizeStyle = this.originalElement.css('resize');
2132
+ this.originalElement.css('resize', 'none');
2133
+
2134
+ //Push the actual element to our proportionallyResize internal array
2135
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
2136
+
2137
+ // avoid IE jump (hard set the margin)
2138
+ this.originalElement.css({ margin: this.originalElement.css('margin') });
2139
+
2140
+ // fix handlers offset
2141
+ this._proportionallyResize();
2142
+
2143
+ }
2144
+
2145
+ this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
2146
+ if(this.handles.constructor == String) {
2147
+
2148
+ if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
2149
+ var n = this.handles.split(","); this.handles = {};
2150
+
2151
+ for(var i = 0; i < n.length; i++) {
2152
+
2153
+ var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
2154
+ var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
2155
+
2156
+ // Apply zIndex to all handles - see #7960
2157
+ axis.css({ zIndex: o.zIndex });
2158
+
2159
+ //TODO : What's going on here?
2160
+ if ('se' == handle) {
2161
+ axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
2162
+ };
2163
+
2164
+ //Insert into internal handles object and append to element
2165
+ this.handles[handle] = '.ui-resizable-'+handle;
2166
+ this.element.append(axis);
2167
+ }
2168
+
2169
+ }
2170
+
2171
+ this._renderAxis = function(target) {
2172
+
2173
+ target = target || this.element;
2174
+
2175
+ for(var i in this.handles) {
2176
+
2177
+ if(this.handles[i].constructor == String)
2178
+ this.handles[i] = $(this.handles[i], this.element).show();
2179
+
2180
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
2181
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
2182
+
2183
+ var axis = $(this.handles[i], this.element), padWrapper = 0;
2184
+
2185
+ //Checking the correct pad and border
2186
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
2187
+
2188
+ //The padding type i have to apply...
2189
+ var padPos = [ 'padding',
2190
+ /ne|nw|n/.test(i) ? 'Top' :
2191
+ /se|sw|s/.test(i) ? 'Bottom' :
2192
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
2193
+
2194
+ target.css(padPos, padWrapper);
2195
+
2196
+ this._proportionallyResize();
2197
+
2198
+ }
2199
+
2200
+ //TODO: What's that good for? There's not anything to be executed left
2201
+ if(!$(this.handles[i]).length)
2202
+ continue;
2203
+
2204
+ }
2205
+ };
2206
+
2207
+ //TODO: make renderAxis a prototype function
2208
+ this._renderAxis(this.element);
2209
+
2210
+ this._handles = $('.ui-resizable-handle', this.element)
2211
+ .disableSelection();
2212
+
2213
+ //Matching axis name
2214
+ this._handles.mouseover(function() {
2215
+ if (!that.resizing) {
2216
+ if (this.className)
2217
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
2218
+ //Axis, default = se
2219
+ that.axis = axis && axis[1] ? axis[1] : 'se';
2220
+ }
2221
+ });
2222
+
2223
+ //If we want to auto hide the elements
2224
+ if (o.autoHide) {
2225
+ this._handles.hide();
2226
+ $(this.element)
2227
+ .addClass("ui-resizable-autohide")
2228
+ .mouseenter(function() {
2229
+ if (o.disabled) return;
2230
+ $(this).removeClass("ui-resizable-autohide");
2231
+ that._handles.show();
2232
+ })
2233
+ .mouseleave(function(){
2234
+ if (o.disabled) return;
2235
+ if (!that.resizing) {
2236
+ $(this).addClass("ui-resizable-autohide");
2237
+ that._handles.hide();
2238
+ }
2239
+ });
2240
+ }
2241
+
2242
+ //Initialize the mouse interaction
2243
+ this._mouseInit();
2244
+
2245
+ },
2246
+
2247
+ _destroy: function() {
2248
+
2249
+ this._mouseDestroy();
2250
+
2251
+ var _destroy = function(exp) {
2252
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
2253
+ .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
2254
+ };
2255
+
2256
+ //TODO: Unwrap at same DOM position
2257
+ if (this.elementIsWrapper) {
2258
+ _destroy(this.element);
2259
+ var wrapper = this.element;
2260
+ wrapper.after(
2261
+ this.originalElement.css({
2262
+ position: wrapper.css('position'),
2263
+ width: wrapper.outerWidth(),
2264
+ height: wrapper.outerHeight(),
2265
+ top: wrapper.css('top'),
2266
+ left: wrapper.css('left')
2267
+ })
2268
+ ).remove();
2269
+ }
2270
+
2271
+ this.originalElement.css('resize', this.originalResizeStyle);
2272
+ _destroy(this.originalElement);
2273
+
2274
+ return this;
2275
+ },
2276
+
2277
+ _mouseCapture: function(event) {
2278
+ var handle = false;
2279
+ for (var i in this.handles) {
2280
+ if ($(this.handles[i])[0] == event.target) {
2281
+ handle = true;
2282
+ }
2283
+ }
2284
+
2285
+ return !this.options.disabled && handle;
2286
+ },
2287
+
2288
+ _mouseStart: function(event) {
2289
+
2290
+ var o = this.options, iniPos = this.element.position(), el = this.element;
2291
+
2292
+ this.resizing = true;
2293
+ this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
2294
+
2295
+ // bugfix for http://dev.jquery.com/ticket/1749
2296
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
2297
+ el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
2298
+ }
2299
+
2300
+ this._renderProxy();
2301
+
2302
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
2303
+
2304
+ if (o.containment) {
2305
+ curleft += $(o.containment).scrollLeft() || 0;
2306
+ curtop += $(o.containment).scrollTop() || 0;
2307
+ }
2308
+
2309
+ //Store needed variables
2310
+ this.offset = this.helper.offset();
2311
+ this.position = { left: curleft, top: curtop };
2312
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
2313
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
2314
+ this.originalPosition = { left: curleft, top: curtop };
2315
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
2316
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
2317
+
2318
+ //Aspect Ratio
2319
+ this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
2320
+
2321
+ var cursor = $('.ui-resizable-' + this.axis).css('cursor');
2322
+ $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
2323
+
2324
+ el.addClass("ui-resizable-resizing");
2325
+ this._propagate("start", event);
2326
+ return true;
2327
+ },
2328
+
2329
+ _mouseDrag: function(event) {
2330
+
2331
+ //Increase performance, avoid regex
2332
+ var el = this.helper, o = this.options, props = {},
2333
+ that = this, smp = this.originalMousePosition, a = this.axis;
2334
+
2335
+ var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
2336
+ var trigger = this._change[a];
2337
+ if (!trigger) return false;
2338
+
2339
+ // Calculate the attrs that will be change
2340
+ var data = trigger.apply(this, [event, dx, dy]);
2341
+
2342
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
2343
+ this._updateVirtualBoundaries(event.shiftKey);
2344
+ if (this._aspectRatio || event.shiftKey)
2345
+ data = this._updateRatio(data, event);
2346
+
2347
+ data = this._respectSize(data, event);
2348
+
2349
+ // plugins callbacks need to be called first
2350
+ this._propagate("resize", event);
2351
+
2352
+ el.css({
2353
+ top: this.position.top + "px", left: this.position.left + "px",
2354
+ width: this.size.width + "px", height: this.size.height + "px"
2355
+ });
2356
+
2357
+ if (!this._helper && this._proportionallyResizeElements.length)
2358
+ this._proportionallyResize();
2359
+
2360
+ this._updateCache(data);
2361
+
2362
+ // calling the user callback at the end
2363
+ this._trigger('resize', event, this.ui());
2364
+
2365
+ return false;
2366
+ },
2367
+
2368
+ _mouseStop: function(event) {
2369
+
2370
+ this.resizing = false;
2371
+ var o = this.options, that = this;
2372
+
2373
+ if(this._helper) {
2374
+ var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
2375
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
2376
+ soffsetw = ista ? 0 : that.sizeDiff.width;
2377
+
2378
+ var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) },
2379
+ left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
2380
+ top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
2381
+
2382
+ if (!o.animate)
2383
+ this.element.css($.extend(s, { top: top, left: left }));
2384
+
2385
+ that.helper.height(that.size.height);
2386
+ that.helper.width(that.size.width);
2387
+
2388
+ if (this._helper && !o.animate) this._proportionallyResize();
2389
+ }
2390
+
2391
+ $('body').css('cursor', 'auto');
2392
+
2393
+ this.element.removeClass("ui-resizable-resizing");
2394
+
2395
+ this._propagate("stop", event);
2396
+
2397
+ if (this._helper) this.helper.remove();
2398
+ return false;
2399
+
2400
+ },
2401
+
2402
+ _updateVirtualBoundaries: function(forceAspectRatio) {
2403
+ var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
2404
+
2405
+ b = {
2406
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
2407
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
2408
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
2409
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
2410
+ };
2411
+
2412
+ if(this._aspectRatio || forceAspectRatio) {
2413
+ // We want to create an enclosing box whose aspect ration is the requested one
2414
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
2415
+ pMinWidth = b.minHeight * this.aspectRatio;
2416
+ pMinHeight = b.minWidth / this.aspectRatio;
2417
+ pMaxWidth = b.maxHeight * this.aspectRatio;
2418
+ pMaxHeight = b.maxWidth / this.aspectRatio;
2419
+
2420
+ if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
2421
+ if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
2422
+ if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
2423
+ if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
2424
+ }
2425
+ this._vBoundaries = b;
2426
+ },
2427
+
2428
+ _updateCache: function(data) {
2429
+ var o = this.options;
2430
+ this.offset = this.helper.offset();
2431
+ if (isNumber(data.left)) this.position.left = data.left;
2432
+ if (isNumber(data.top)) this.position.top = data.top;
2433
+ if (isNumber(data.height)) this.size.height = data.height;
2434
+ if (isNumber(data.width)) this.size.width = data.width;
2435
+ },
2436
+
2437
+ _updateRatio: function(data, event) {
2438
+
2439
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
2440
+
2441
+ if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
2442
+ else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
2443
+
2444
+ if (a == 'sw') {
2445
+ data.left = cpos.left + (csize.width - data.width);
2446
+ data.top = null;
2447
+ }
2448
+ if (a == 'nw') {
2449
+ data.top = cpos.top + (csize.height - data.height);
2450
+ data.left = cpos.left + (csize.width - data.width);
2451
+ }
2452
+
2453
+ return data;
2454
+ },
2455
+
2456
+ _respectSize: function(data, event) {
2457
+
2458
+ var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
2459
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
2460
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
2461
+
2462
+ if (isminw) data.width = o.minWidth;
2463
+ if (isminh) data.height = o.minHeight;
2464
+ if (ismaxw) data.width = o.maxWidth;
2465
+ if (ismaxh) data.height = o.maxHeight;
2466
+
2467
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
2468
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
2469
+
2470
+ if (isminw && cw) data.left = dw - o.minWidth;
2471
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
2472
+ if (isminh && ch) data.top = dh - o.minHeight;
2473
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
2474
+
2475
+ // fixing jump error on top/left - bug #2330
2476
+ var isNotwh = !data.width && !data.height;
2477
+ if (isNotwh && !data.left && data.top) data.top = null;
2478
+ else if (isNotwh && !data.top && data.left) data.left = null;
2479
+
2480
+ return data;
2481
+ },
2482
+
2483
+ _proportionallyResize: function() {
2484
+
2485
+ var o = this.options;
2486
+ if (!this._proportionallyResizeElements.length) return;
2487
+ var element = this.helper || this.element;
2488
+
2489
+ for (var i=0; i < this._proportionallyResizeElements.length; i++) {
2490
+
2491
+ var prel = this._proportionallyResizeElements[i];
2492
+
2493
+ if (!this.borderDif) {
2494
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
2495
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
2496
+
2497
+ this.borderDif = $.map(b, function(v, i) {
2498
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
2499
+ return border + padding;
2500
+ });
2501
+ }
2502
+
2503
+ prel.css({
2504
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
2505
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
2506
+ });
2507
+
2508
+ };
2509
+
2510
+ },
2511
+
2512
+ _renderProxy: function() {
2513
+
2514
+ var el = this.element, o = this.options;
2515
+ this.elementOffset = el.offset();
2516
+
2517
+ if(this._helper) {
2518
+
2519
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
2520
+
2521
+ // fix ie6 offset TODO: This seems broken
2522
+ var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
2523
+ pxyoffset = ( ie6 ? 2 : -1 );
2524
+
2525
+ this.helper.addClass(this._helper).css({
2526
+ width: this.element.outerWidth() + pxyoffset,
2527
+ height: this.element.outerHeight() + pxyoffset,
2528
+ position: 'absolute',
2529
+ left: this.elementOffset.left - ie6offset +'px',
2530
+ top: this.elementOffset.top - ie6offset +'px',
2531
+ zIndex: ++o.zIndex //TODO: Don't modify option
2532
+ });
2533
+
2534
+ this.helper
2535
+ .appendTo("body")
2536
+ .disableSelection();
2537
+
2538
+ } else {
2539
+ this.helper = this.element;
2540
+ }
2541
+
2542
+ },
2543
+
2544
+ _change: {
2545
+ e: function(event, dx, dy) {
2546
+ return { width: this.originalSize.width + dx };
2547
+ },
2548
+ w: function(event, dx, dy) {
2549
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2550
+ return { left: sp.left + dx, width: cs.width - dx };
2551
+ },
2552
+ n: function(event, dx, dy) {
2553
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
2554
+ return { top: sp.top + dy, height: cs.height - dy };
2555
+ },
2556
+ s: function(event, dx, dy) {
2557
+ return { height: this.originalSize.height + dy };
2558
+ },
2559
+ se: function(event, dx, dy) {
2560
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2561
+ },
2562
+ sw: function(event, dx, dy) {
2563
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2564
+ },
2565
+ ne: function(event, dx, dy) {
2566
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
2567
+ },
2568
+ nw: function(event, dx, dy) {
2569
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
2570
+ }
2571
+ },
2572
+
2573
+ _propagate: function(n, event) {
2574
+ $.ui.plugin.call(this, n, [event, this.ui()]);
2575
+ (n != "resize" && this._trigger(n, event, this.ui()));
2576
+ },
2577
+
2578
+ plugins: {},
2579
+
2580
+ ui: function() {
2581
+ return {
2582
+ originalElement: this.originalElement,
2583
+ element: this.element,
2584
+ helper: this.helper,
2585
+ position: this.position,
2586
+ size: this.size,
2587
+ originalSize: this.originalSize,
2588
+ originalPosition: this.originalPosition
2589
+ };
2590
+ }
2591
+
2592
+ });
2593
+
2594
+ /*
2595
+ * Resizable Extensions
2596
+ */
2597
+
2598
+ $.ui.plugin.add("resizable", "alsoResize", {
2599
+
2600
+ start: function (event, ui) {
2601
+ var that = $(this).data("resizable"), o = that.options;
2602
+
2603
+ var _store = function (exp) {
2604
+ $(exp).each(function() {
2605
+ var el = $(this);
2606
+ el.data("resizable-alsoresize", {
2607
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
2608
+ left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
2609
+ });
2610
+ });
2611
+ };
2612
+
2613
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
2614
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
2615
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
2616
+ }else{
2617
+ _store(o.alsoResize);
2618
+ }
2619
+ },
2620
+
2621
+ resize: function (event, ui) {
2622
+ var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition;
2623
+
2624
+ var delta = {
2625
+ height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
2626
+ top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
2627
+ },
2628
+
2629
+ _alsoResize = function (exp, c) {
2630
+ $(exp).each(function() {
2631
+ var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
2632
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
2633
+
2634
+ $.each(css, function (i, prop) {
2635
+ var sum = (start[prop]||0) + (delta[prop]||0);
2636
+ if (sum && sum >= 0)
2637
+ style[prop] = sum || null;
2638
+ });
2639
+
2640
+ el.css(style);
2641
+ });
2642
+ };
2643
+
2644
+ if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
2645
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
2646
+ }else{
2647
+ _alsoResize(o.alsoResize);
2648
+ }
2649
+ },
2650
+
2651
+ stop: function (event, ui) {
2652
+ $(this).removeData("resizable-alsoresize");
2653
+ }
2654
+ });
2655
+
2656
+ $.ui.plugin.add("resizable", "animate", {
2657
+
2658
+ stop: function(event, ui) {
2659
+ var that = $(this).data("resizable"), o = that.options;
2660
+
2661
+ var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
2662
+ soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
2663
+ soffsetw = ista ? 0 : that.sizeDiff.width;
2664
+
2665
+ var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
2666
+ left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
2667
+ top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
2668
+
2669
+ that.element.animate(
2670
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
2671
+ duration: o.animateDuration,
2672
+ easing: o.animateEasing,
2673
+ step: function() {
2674
+
2675
+ var data = {
2676
+ width: parseInt(that.element.css('width'), 10),
2677
+ height: parseInt(that.element.css('height'), 10),
2678
+ top: parseInt(that.element.css('top'), 10),
2679
+ left: parseInt(that.element.css('left'), 10)
2680
+ };
2681
+
2682
+ if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
2683
+
2684
+ // propagating resize, and updating values for each animation step
2685
+ that._updateCache(data);
2686
+ that._propagate("resize", event);
2687
+
2688
+ }
2689
+ }
2690
+ );
2691
+ }
2692
+
2693
+ });
2694
+
2695
+ $.ui.plugin.add("resizable", "containment", {
2696
+
2697
+ start: function(event, ui) {
2698
+ var that = $(this).data("resizable"), o = that.options, el = that.element;
2699
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
2700
+ if (!ce) return;
2701
+
2702
+ that.containerElement = $(ce);
2703
+
2704
+ if (/document/.test(oc) || oc == document) {
2705
+ that.containerOffset = { left: 0, top: 0 };
2706
+ that.containerPosition = { left: 0, top: 0 };
2707
+
2708
+ that.parentData = {
2709
+ element: $(document), left: 0, top: 0,
2710
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
2711
+ };
2712
+ }
2713
+
2714
+ // i'm a node, so compute top, left, right, bottom
2715
+ else {
2716
+ var element = $(ce), p = [];
2717
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
2718
+
2719
+ that.containerOffset = element.offset();
2720
+ that.containerPosition = element.position();
2721
+ that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
2722
+
2723
+ var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width,
2724
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
2725
+
2726
+ that.parentData = {
2727
+ element: ce, left: co.left, top: co.top, width: width, height: height
2728
+ };
2729
+ }
2730
+ },
2731
+
2732
+ resize: function(event, ui) {
2733
+ var that = $(this).data("resizable"), o = that.options,
2734
+ ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position,
2735
+ pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement;
2736
+
2737
+ if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
2738
+
2739
+ if (cp.left < (that._helper ? co.left : 0)) {
2740
+ that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
2741
+ if (pRatio) that.size.height = that.size.width / that.aspectRatio;
2742
+ that.position.left = o.helper ? co.left : 0;
2743
+ }
2744
+
2745
+ if (cp.top < (that._helper ? co.top : 0)) {
2746
+ that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
2747
+ if (pRatio) that.size.width = that.size.height * that.aspectRatio;
2748
+ that.position.top = that._helper ? co.top : 0;
2749
+ }
2750
+
2751
+ that.offset.left = that.parentData.left+that.position.left;
2752
+ that.offset.top = that.parentData.top+that.position.top;
2753
+
2754
+ var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ),
2755
+ hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
2756
+
2757
+ var isParent = that.containerElement.get(0) == that.element.parent().get(0),
2758
+ isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position'));
2759
+
2760
+ if(isParent && isOffsetRelative) woset -= that.parentData.left;
2761
+
2762
+ if (woset + that.size.width >= that.parentData.width) {
2763
+ that.size.width = that.parentData.width - woset;
2764
+ if (pRatio) that.size.height = that.size.width / that.aspectRatio;
2765
+ }
2766
+
2767
+ if (hoset + that.size.height >= that.parentData.height) {
2768
+ that.size.height = that.parentData.height - hoset;
2769
+ if (pRatio) that.size.width = that.size.height * that.aspectRatio;
2770
+ }
2771
+ },
2772
+
2773
+ stop: function(event, ui){
2774
+ var that = $(this).data("resizable"), o = that.options, cp = that.position,
2775
+ co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement;
2776
+
2777
+ var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height;
2778
+
2779
+ if (that._helper && !o.animate && (/relative/).test(ce.css('position')))
2780
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2781
+
2782
+ if (that._helper && !o.animate && (/static/).test(ce.css('position')))
2783
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
2784
+
2785
+ }
2786
+ });
2787
+
2788
+ $.ui.plugin.add("resizable", "ghost", {
2789
+
2790
+ start: function(event, ui) {
2791
+
2792
+ var that = $(this).data("resizable"), o = that.options, cs = that.size;
2793
+
2794
+ that.ghost = that.originalElement.clone();
2795
+ that.ghost
2796
+ .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
2797
+ .addClass('ui-resizable-ghost')
2798
+ .addClass(typeof o.ghost == 'string' ? o.ghost : '');
2799
+
2800
+ that.ghost.appendTo(that.helper);
2801
+
2802
+ },
2803
+
2804
+ resize: function(event, ui){
2805
+ var that = $(this).data("resizable"), o = that.options;
2806
+ if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width });
2807
+ },
2808
+
2809
+ stop: function(event, ui){
2810
+ var that = $(this).data("resizable"), o = that.options;
2811
+ if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0));
2812
+ }
2813
+
2814
+ });
2815
+
2816
+ $.ui.plugin.add("resizable", "grid", {
2817
+
2818
+ resize: function(event, ui) {
2819
+ var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey;
2820
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
2821
+ var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
2822
+
2823
+ if (/^(se|s|e)$/.test(a)) {
2824
+ that.size.width = os.width + ox;
2825
+ that.size.height = os.height + oy;
2826
+ }
2827
+ else if (/^(ne)$/.test(a)) {
2828
+ that.size.width = os.width + ox;
2829
+ that.size.height = os.height + oy;
2830
+ that.position.top = op.top - oy;
2831
+ }
2832
+ else if (/^(sw)$/.test(a)) {
2833
+ that.size.width = os.width + ox;
2834
+ that.size.height = os.height + oy;
2835
+ that.position.left = op.left - ox;
2836
+ }
2837
+ else {
2838
+ that.size.width = os.width + ox;
2839
+ that.size.height = os.height + oy;
2840
+ that.position.top = op.top - oy;
2841
+ that.position.left = op.left - ox;
2842
+ }
2843
+ }
2844
+
2845
+ });
2846
+
2847
+ var num = function(v) {
2848
+ return parseInt(v, 10) || 0;
2849
+ };
2850
+
2851
+ var isNumber = function(value) {
2852
+ return !isNaN(parseInt(value, 10));
2853
+ };
2854
+
2855
+ })(jQuery);
2856
+
2857
+ (function( $, undefined ) {
2858
+
2859
+ $.widget("ui.selectable", $.ui.mouse, {
2860
+ version: "1.9.0",
2861
+ options: {
2862
+ appendTo: 'body',
2863
+ autoRefresh: true,
2864
+ distance: 0,
2865
+ filter: '*',
2866
+ tolerance: 'touch'
2867
+ },
2868
+ _create: function() {
2869
+ var that = this;
2870
+
2871
+ this.element.addClass("ui-selectable");
2872
+
2873
+ this.dragged = false;
2874
+
2875
+ // cache selectee children based on filter
2876
+ var selectees;
2877
+ this.refresh = function() {
2878
+ selectees = $(that.options.filter, that.element[0]);
2879
+ selectees.addClass("ui-selectee");
2880
+ selectees.each(function() {
2881
+ var $this = $(this);
2882
+ var pos = $this.offset();
2883
+ $.data(this, "selectable-item", {
2884
+ element: this,
2885
+ $element: $this,
2886
+ left: pos.left,
2887
+ top: pos.top,
2888
+ right: pos.left + $this.outerWidth(),
2889
+ bottom: pos.top + $this.outerHeight(),
2890
+ startselected: false,
2891
+ selected: $this.hasClass('ui-selected'),
2892
+ selecting: $this.hasClass('ui-selecting'),
2893
+ unselecting: $this.hasClass('ui-unselecting')
2894
+ });
2895
+ });
2896
+ };
2897
+ this.refresh();
2898
+
2899
+ this.selectees = selectees.addClass("ui-selectee");
2900
+
2901
+ this._mouseInit();
2902
+
2903
+ this.helper = $("<div class='ui-selectable-helper'></div>");
2904
+ },
2905
+
2906
+ _destroy: function() {
2907
+ this.selectees
2908
+ .removeClass("ui-selectee")
2909
+ .removeData("selectable-item");
2910
+ this.element
2911
+ .removeClass("ui-selectable ui-selectable-disabled");
2912
+ this._mouseDestroy();
2913
+ },
2914
+
2915
+ _mouseStart: function(event) {
2916
+ var that = this;
2917
+
2918
+ this.opos = [event.pageX, event.pageY];
2919
+
2920
+ if (this.options.disabled)
2921
+ return;
2922
+
2923
+ var options = this.options;
2924
+
2925
+ this.selectees = $(options.filter, this.element[0]);
2926
+
2927
+ this._trigger("start", event);
2928
+
2929
+ $(options.appendTo).append(this.helper);
2930
+ // position helper (lasso)
2931
+ this.helper.css({
2932
+ "left": event.clientX,
2933
+ "top": event.clientY,
2934
+ "width": 0,
2935
+ "height": 0
2936
+ });
2937
+
2938
+ if (options.autoRefresh) {
2939
+ this.refresh();
2940
+ }
2941
+
2942
+ this.selectees.filter('.ui-selected').each(function() {
2943
+ var selectee = $.data(this, "selectable-item");
2944
+ selectee.startselected = true;
2945
+ if (!event.metaKey && !event.ctrlKey) {
2946
+ selectee.$element.removeClass('ui-selected');
2947
+ selectee.selected = false;
2948
+ selectee.$element.addClass('ui-unselecting');
2949
+ selectee.unselecting = true;
2950
+ // selectable UNSELECTING callback
2951
+ that._trigger("unselecting", event, {
2952
+ unselecting: selectee.element
2953
+ });
2954
+ }
2955
+ });
2956
+
2957
+ $(event.target).parents().andSelf().each(function() {
2958
+ var selectee = $.data(this, "selectable-item");
2959
+ if (selectee) {
2960
+ var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
2961
+ selectee.$element
2962
+ .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
2963
+ .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
2964
+ selectee.unselecting = !doSelect;
2965
+ selectee.selecting = doSelect;
2966
+ selectee.selected = doSelect;
2967
+ // selectable (UN)SELECTING callback
2968
+ if (doSelect) {
2969
+ that._trigger("selecting", event, {
2970
+ selecting: selectee.element
2971
+ });
2972
+ } else {
2973
+ that._trigger("unselecting", event, {
2974
+ unselecting: selectee.element
2975
+ });
2976
+ }
2977
+ return false;
2978
+ }
2979
+ });
2980
+
2981
+ },
2982
+
2983
+ _mouseDrag: function(event) {
2984
+ var that = this;
2985
+ this.dragged = true;
2986
+
2987
+ if (this.options.disabled)
2988
+ return;
2989
+
2990
+ var options = this.options;
2991
+
2992
+ var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
2993
+ if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
2994
+ if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
2995
+ this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
2996
+
2997
+ this.selectees.each(function() {
2998
+ var selectee = $.data(this, "selectable-item");
2999
+ //prevent helper from being selected if appendTo: selectable
3000
+ if (!selectee || selectee.element == that.element[0])
3001
+ return;
3002
+ var hit = false;
3003
+ if (options.tolerance == 'touch') {
3004
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
3005
+ } else if (options.tolerance == 'fit') {
3006
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
3007
+ }
3008
+
3009
+ if (hit) {
3010
+ // SELECT
3011
+ if (selectee.selected) {
3012
+ selectee.$element.removeClass('ui-selected');
3013
+ selectee.selected = false;
3014
+ }
3015
+ if (selectee.unselecting) {
3016
+ selectee.$element.removeClass('ui-unselecting');
3017
+ selectee.unselecting = false;
3018
+ }
3019
+ if (!selectee.selecting) {
3020
+ selectee.$element.addClass('ui-selecting');
3021
+ selectee.selecting = true;
3022
+ // selectable SELECTING callback
3023
+ that._trigger("selecting", event, {
3024
+ selecting: selectee.element
3025
+ });
3026
+ }
3027
+ } else {
3028
+ // UNSELECT
3029
+ if (selectee.selecting) {
3030
+ if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
3031
+ selectee.$element.removeClass('ui-selecting');
3032
+ selectee.selecting = false;
3033
+ selectee.$element.addClass('ui-selected');
3034
+ selectee.selected = true;
3035
+ } else {
3036
+ selectee.$element.removeClass('ui-selecting');
3037
+ selectee.selecting = false;
3038
+ if (selectee.startselected) {
3039
+ selectee.$element.addClass('ui-unselecting');
3040
+ selectee.unselecting = true;
3041
+ }
3042
+ // selectable UNSELECTING callback
3043
+ that._trigger("unselecting", event, {
3044
+ unselecting: selectee.element
3045
+ });
3046
+ }
3047
+ }
3048
+ if (selectee.selected) {
3049
+ if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
3050
+ selectee.$element.removeClass('ui-selected');
3051
+ selectee.selected = false;
3052
+
3053
+ selectee.$element.addClass('ui-unselecting');
3054
+ selectee.unselecting = true;
3055
+ // selectable UNSELECTING callback
3056
+ that._trigger("unselecting", event, {
3057
+ unselecting: selectee.element
3058
+ });
3059
+ }
3060
+ }
3061
+ }
3062
+ });
3063
+
3064
+ return false;
3065
+ },
3066
+
3067
+ _mouseStop: function(event) {
3068
+ var that = this;
3069
+
3070
+ this.dragged = false;
3071
+
3072
+ var options = this.options;
3073
+
3074
+ $('.ui-unselecting', this.element[0]).each(function() {
3075
+ var selectee = $.data(this, "selectable-item");
3076
+ selectee.$element.removeClass('ui-unselecting');
3077
+ selectee.unselecting = false;
3078
+ selectee.startselected = false;
3079
+ that._trigger("unselected", event, {
3080
+ unselected: selectee.element
3081
+ });
3082
+ });
3083
+ $('.ui-selecting', this.element[0]).each(function() {
3084
+ var selectee = $.data(this, "selectable-item");
3085
+ selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
3086
+ selectee.selecting = false;
3087
+ selectee.selected = true;
3088
+ selectee.startselected = true;
3089
+ that._trigger("selected", event, {
3090
+ selected: selectee.element
3091
+ });
3092
+ });
3093
+ this._trigger("stop", event);
3094
+
3095
+ this.helper.remove();
3096
+
3097
+ return false;
3098
+ }
3099
+
3100
+ });
3101
+
3102
+ })(jQuery);
3103
+
3104
+ (function( $, undefined ) {
3105
+
3106
+ $.widget("ui.sortable", $.ui.mouse, {
3107
+ version: "1.9.0",
3108
+ widgetEventPrefix: "sort",
3109
+ ready: false,
3110
+ options: {
3111
+ appendTo: "parent",
3112
+ axis: false,
3113
+ connectWith: false,
3114
+ containment: false,
3115
+ cursor: 'auto',
3116
+ cursorAt: false,
3117
+ dropOnEmpty: true,
3118
+ forcePlaceholderSize: false,
3119
+ forceHelperSize: false,
3120
+ grid: false,
3121
+ handle: false,
3122
+ helper: "original",
3123
+ items: '> *',
3124
+ opacity: false,
3125
+ placeholder: false,
3126
+ revert: false,
3127
+ scroll: true,
3128
+ scrollSensitivity: 20,
3129
+ scrollSpeed: 20,
3130
+ scope: "default",
3131
+ tolerance: "intersect",
3132
+ zIndex: 1000
3133
+ },
3134
+ _create: function() {
3135
+
3136
+ var o = this.options;
3137
+ this.containerCache = {};
3138
+ this.element.addClass("ui-sortable");
3139
+
3140
+ //Get the items
3141
+ this.refresh();
3142
+
3143
+ //Let's determine if the items are being displayed horizontally
3144
+ this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
3145
+
3146
+ //Let's determine the parent's offset
3147
+ this.offset = this.element.offset();
3148
+
3149
+ //Initialize mouse events for interaction
3150
+ this._mouseInit();
3151
+
3152
+ //We're ready to go
3153
+ this.ready = true
3154
+
3155
+ },
3156
+
3157
+ _destroy: function() {
3158
+ this.element
3159
+ .removeClass("ui-sortable ui-sortable-disabled");
3160
+ this._mouseDestroy();
3161
+
3162
+ for ( var i = this.items.length - 1; i >= 0; i-- )
3163
+ this.items[i].item.removeData(this.widgetName + "-item");
3164
+
3165
+ return this;
3166
+ },
3167
+
3168
+ _setOption: function(key, value){
3169
+ if ( key === "disabled" ) {
3170
+ this.options[ key ] = value;
3171
+
3172
+ this.widget().toggleClass( "ui-sortable-disabled", !!value );
3173
+ } else {
3174
+ // Don't call widget base _setOption for disable as it adds ui-state-disabled class
3175
+ $.Widget.prototype._setOption.apply(this, arguments);
3176
+ }
3177
+ },
3178
+
3179
+ _mouseCapture: function(event, overrideHandle) {
3180
+ var that = this;
3181
+
3182
+ if (this.reverting) {
3183
+ return false;
3184
+ }
3185
+
3186
+ if(this.options.disabled || this.options.type == 'static') return false;
3187
+
3188
+ //We have to refresh the items data once first
3189
+ this._refreshItems(event);
3190
+
3191
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
3192
+ var currentItem = null, nodes = $(event.target).parents().each(function() {
3193
+ if($.data(this, that.widgetName + '-item') == that) {
3194
+ currentItem = $(this);
3195
+ return false;
3196
+ }
3197
+ });
3198
+ if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target);
3199
+
3200
+ if(!currentItem) return false;
3201
+ if(this.options.handle && !overrideHandle) {
3202
+ var validHandle = false;
3203
+
3204
+ $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
3205
+ if(!validHandle) return false;
3206
+ }
3207
+
3208
+ this.currentItem = currentItem;
3209
+ this._removeCurrentsFromItems();
3210
+ return true;
3211
+
3212
+ },
3213
+
3214
+ _mouseStart: function(event, overrideHandle, noActivation) {
3215
+
3216
+ var o = this.options;
3217
+ this.currentContainer = this;
3218
+
3219
+ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
3220
+ this.refreshPositions();
3221
+
3222
+ //Create and append the visible helper
3223
+ this.helper = this._createHelper(event);
3224
+
3225
+ //Cache the helper size
3226
+ this._cacheHelperProportions();
3227
+
3228
+ /*
3229
+ * - Position generation -
3230
+ * This block generates everything position related - it's the core of draggables.
3231
+ */
3232
+
3233
+ //Cache the margins of the original element
3234
+ this._cacheMargins();
3235
+
3236
+ //Get the next scrolling parent
3237
+ this.scrollParent = this.helper.scrollParent();
3238
+
3239
+ //The element's absolute position on the page minus margins
3240
+ this.offset = this.currentItem.offset();
3241
+ this.offset = {
3242
+ top: this.offset.top - this.margins.top,
3243
+ left: this.offset.left - this.margins.left
3244
+ };
3245
+
3246
+ $.extend(this.offset, {
3247
+ click: { //Where the click happened, relative to the element
3248
+ left: event.pageX - this.offset.left,
3249
+ top: event.pageY - this.offset.top
3250
+ },
3251
+ parent: this._getParentOffset(),
3252
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
3253
+ });
3254
+
3255
+ // Only after we got the offset, we can change the helper's position to absolute
3256
+ // TODO: Still need to figure out a way to make relative sorting possible
3257
+ this.helper.css("position", "absolute");
3258
+ this.cssPosition = this.helper.css("position");
3259
+
3260
+ //Generate the original position
3261
+ this.originalPosition = this._generatePosition(event);
3262
+ this.originalPageX = event.pageX;
3263
+ this.originalPageY = event.pageY;
3264
+
3265
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
3266
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
3267
+
3268
+ //Cache the former DOM position
3269
+ this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
3270
+
3271
+ //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
3272
+ if(this.helper[0] != this.currentItem[0]) {
3273
+ this.currentItem.hide();
3274
+ }
3275
+
3276
+ //Create the placeholder
3277
+ this._createPlaceholder();
3278
+
3279
+ //Set a containment if given in the options
3280
+ if(o.containment)
3281
+ this._setContainment();
3282
+
3283
+ if(o.cursor) { // cursor option
3284
+ if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
3285
+ $('body').css("cursor", o.cursor);
3286
+ }
3287
+
3288
+ if(o.opacity) { // opacity option
3289
+ if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
3290
+ this.helper.css("opacity", o.opacity);
3291
+ }
3292
+
3293
+ if(o.zIndex) { // zIndex option
3294
+ if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
3295
+ this.helper.css("zIndex", o.zIndex);
3296
+ }
3297
+
3298
+ //Prepare scrolling
3299
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
3300
+ this.overflowOffset = this.scrollParent.offset();
3301
+
3302
+ //Call callbacks
3303
+ this._trigger("start", event, this._uiHash());
3304
+
3305
+ //Recache the helper size
3306
+ if(!this._preserveHelperProportions)
3307
+ this._cacheHelperProportions();
3308
+
3309
+
3310
+ //Post 'activate' events to possible containers
3311
+ if(!noActivation) {
3312
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
3313
+ }
3314
+
3315
+ //Prepare possible droppables
3316
+ if($.ui.ddmanager)
3317
+ $.ui.ddmanager.current = this;
3318
+
3319
+ if ($.ui.ddmanager && !o.dropBehaviour)
3320
+ $.ui.ddmanager.prepareOffsets(this, event);
3321
+
3322
+ this.dragging = true;
3323
+
3324
+ this.helper.addClass("ui-sortable-helper");
3325
+ this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
3326
+ return true;
3327
+
3328
+ },
3329
+
3330
+ _mouseDrag: function(event) {
3331
+
3332
+ //Compute the helpers position
3333
+ this.position = this._generatePosition(event);
3334
+ this.positionAbs = this._convertPositionTo("absolute");
3335
+
3336
+ if (!this.lastPositionAbs) {
3337
+ this.lastPositionAbs = this.positionAbs;
3338
+ }
3339
+
3340
+ //Do scrolling
3341
+ if(this.options.scroll) {
3342
+ var o = this.options, scrolled = false;
3343
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
3344
+
3345
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
3346
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
3347
+ else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
3348
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
3349
+
3350
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
3351
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
3352
+ else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
3353
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
3354
+
3355
+ } else {
3356
+
3357
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
3358
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
3359
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
3360
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
3361
+
3362
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
3363
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
3364
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
3365
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
3366
+
3367
+ }
3368
+
3369
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
3370
+ $.ui.ddmanager.prepareOffsets(this, event);
3371
+ }
3372
+
3373
+ //Regenerate the absolute position used for position checks
3374
+ this.positionAbs = this._convertPositionTo("absolute");
3375
+
3376
+ //Set the helper position
3377
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
3378
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
3379
+
3380
+ //Rearrange
3381
+ for (var i = this.items.length - 1; i >= 0; i--) {
3382
+
3383
+ //Cache variables and intersection, continue if no intersection
3384
+ var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
3385
+ if (!intersection) continue;
3386
+
3387
+ // Only put the placeholder inside the current Container, skip all
3388
+ // items form other containers. This works because when moving
3389
+ // an item from one container to another the
3390
+ // currentContainer is switched before the placeholder is moved.
3391
+ //
3392
+ // Without this moving items in "sub-sortables" can cause the placeholder to jitter
3393
+ // beetween the outer and inner container.
3394
+ if (item.instance !== this.currentContainer) continue;
3395
+
3396
+ if (itemElement != this.currentItem[0] //cannot intersect with itself
3397
+ && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
3398
+ && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
3399
+ && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
3400
+ //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
3401
+ ) {
3402
+
3403
+ this.direction = intersection == 1 ? "down" : "up";
3404
+
3405
+ if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
3406
+ this._rearrange(event, item);
3407
+ } else {
3408
+ break;
3409
+ }
3410
+
3411
+ this._trigger("change", event, this._uiHash());
3412
+ break;
3413
+ }
3414
+ }
3415
+
3416
+ //Post events to containers
3417
+ this._contactContainers(event);
3418
+
3419
+ //Interconnect with droppables
3420
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
3421
+
3422
+ //Call callbacks
3423
+ this._trigger('sort', event, this._uiHash());
3424
+
3425
+ this.lastPositionAbs = this.positionAbs;
3426
+ return false;
3427
+
3428
+ },
3429
+
3430
+ _mouseStop: function(event, noPropagation) {
3431
+
3432
+ if(!event) return;
3433
+
3434
+ //If we are using droppables, inform the manager about the drop
3435
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
3436
+ $.ui.ddmanager.drop(this, event);
3437
+
3438
+ if(this.options.revert) {
3439
+ var that = this;
3440
+ var cur = this.placeholder.offset();
3441
+
3442
+ this.reverting = true;
3443
+
3444
+ $(this.helper).animate({
3445
+ left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
3446
+ top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
3447
+ }, parseInt(this.options.revert, 10) || 500, function() {
3448
+ that._clear(event);
3449
+ });
3450
+ } else {
3451
+ this._clear(event, noPropagation);
3452
+ }
3453
+
3454
+ return false;
3455
+
3456
+ },
3457
+
3458
+ cancel: function() {
3459
+
3460
+ if(this.dragging) {
3461
+
3462
+ this._mouseUp({ target: null });
3463
+
3464
+ if(this.options.helper == "original")
3465
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
3466
+ else
3467
+ this.currentItem.show();
3468
+
3469
+ //Post deactivating events to containers
3470
+ for (var i = this.containers.length - 1; i >= 0; i--){
3471
+ this.containers[i]._trigger("deactivate", null, this._uiHash(this));
3472
+ if(this.containers[i].containerCache.over) {
3473
+ this.containers[i]._trigger("out", null, this._uiHash(this));
3474
+ this.containers[i].containerCache.over = 0;
3475
+ }
3476
+ }
3477
+
3478
+ }
3479
+
3480
+ if (this.placeholder) {
3481
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
3482
+ if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
3483
+ if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
3484
+
3485
+ $.extend(this, {
3486
+ helper: null,
3487
+ dragging: false,
3488
+ reverting: false,
3489
+ _noFinalSort: null
3490
+ });
3491
+
3492
+ if(this.domPosition.prev) {
3493
+ $(this.domPosition.prev).after(this.currentItem);
3494
+ } else {
3495
+ $(this.domPosition.parent).prepend(this.currentItem);
3496
+ }
3497
+ }
3498
+
3499
+ return this;
3500
+
3501
+ },
3502
+
3503
+ serialize: function(o) {
3504
+
3505
+ var items = this._getItemsAsjQuery(o && o.connected);
3506
+ var str = []; o = o || {};
3507
+
3508
+ $(items).each(function() {
3509
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
3510
+ if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
3511
+ });
3512
+
3513
+ if(!str.length && o.key) {
3514
+ str.push(o.key + '=');
3515
+ }
3516
+
3517
+ return str.join('&');
3518
+
3519
+ },
3520
+
3521
+ toArray: function(o) {
3522
+
3523
+ var items = this._getItemsAsjQuery(o && o.connected);
3524
+ var ret = []; o = o || {};
3525
+
3526
+ items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
3527
+ return ret;
3528
+
3529
+ },
3530
+
3531
+ /* Be careful with the following core functions */
3532
+ _intersectsWith: function(item) {
3533
+
3534
+ var x1 = this.positionAbs.left,
3535
+ x2 = x1 + this.helperProportions.width,
3536
+ y1 = this.positionAbs.top,
3537
+ y2 = y1 + this.helperProportions.height;
3538
+
3539
+ var l = item.left,
3540
+ r = l + item.width,
3541
+ t = item.top,
3542
+ b = t + item.height;
3543
+
3544
+ var dyClick = this.offset.click.top,
3545
+ dxClick = this.offset.click.left;
3546
+
3547
+ var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
3548
+
3549
+ if( this.options.tolerance == "pointer"
3550
+ || this.options.forcePointerForContainers
3551
+ || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
3552
+ ) {
3553
+ return isOverElement;
3554
+ } else {
3555
+
3556
+ return (l < x1 + (this.helperProportions.width / 2) // Right Half
3557
+ && x2 - (this.helperProportions.width / 2) < r // Left Half
3558
+ && t < y1 + (this.helperProportions.height / 2) // Bottom Half
3559
+ && y2 - (this.helperProportions.height / 2) < b ); // Top Half
3560
+
3561
+ }
3562
+ },
3563
+
3564
+ _intersectsWithPointer: function(item) {
3565
+
3566
+ var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
3567
+ isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
3568
+ isOverElement = isOverElementHeight && isOverElementWidth,
3569
+ verticalDirection = this._getDragVerticalDirection(),
3570
+ horizontalDirection = this._getDragHorizontalDirection();
3571
+
3572
+ if (!isOverElement)
3573
+ return false;
3574
+
3575
+ return this.floating ?
3576
+ ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
3577
+ : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
3578
+
3579
+ },
3580
+
3581
+ _intersectsWithSides: function(item) {
3582
+
3583
+ var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
3584
+ isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
3585
+ verticalDirection = this._getDragVerticalDirection(),
3586
+ horizontalDirection = this._getDragHorizontalDirection();
3587
+
3588
+ if (this.floating && horizontalDirection) {
3589
+ return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
3590
+ } else {
3591
+ return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
3592
+ }
3593
+
3594
+ },
3595
+
3596
+ _getDragVerticalDirection: function() {
3597
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
3598
+ return delta != 0 && (delta > 0 ? "down" : "up");
3599
+ },
3600
+
3601
+ _getDragHorizontalDirection: function() {
3602
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
3603
+ return delta != 0 && (delta > 0 ? "right" : "left");
3604
+ },
3605
+
3606
+ refresh: function(event) {
3607
+ this._refreshItems(event);
3608
+ this.refreshPositions();
3609
+ return this;
3610
+ },
3611
+
3612
+ _connectWith: function() {
3613
+ var options = this.options;
3614
+ return options.connectWith.constructor == String
3615
+ ? [options.connectWith]
3616
+ : options.connectWith;
3617
+ },
3618
+
3619
+ _getItemsAsjQuery: function(connected) {
3620
+
3621
+ var items = [];
3622
+ var queries = [];
3623
+ var connectWith = this._connectWith();
3624
+
3625
+ if(connectWith && connected) {
3626
+ for (var i = connectWith.length - 1; i >= 0; i--){
3627
+ var cur = $(connectWith[i]);
3628
+ for (var j = cur.length - 1; j >= 0; j--){
3629
+ var inst = $.data(cur[j], this.widgetName);
3630
+ if(inst && inst != this && !inst.options.disabled) {
3631
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
3632
+ }
3633
+ };
3634
+ };
3635
+ }
3636
+
3637
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
3638
+
3639
+ for (var i = queries.length - 1; i >= 0; i--){
3640
+ queries[i][0].each(function() {
3641
+ items.push(this);
3642
+ });
3643
+ };
3644
+
3645
+ return $(items);
3646
+
3647
+ },
3648
+
3649
+ _removeCurrentsFromItems: function() {
3650
+
3651
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
3652
+
3653
+ for (var i=0; i < this.items.length; i++) {
3654
+
3655
+ for (var j=0; j < list.length; j++) {
3656
+ if(list[j] == this.items[i].item[0])
3657
+ this.items.splice(i,1);
3658
+ };
3659
+
3660
+ };
3661
+
3662
+ },
3663
+
3664
+ _refreshItems: function(event) {
3665
+
3666
+ this.items = [];
3667
+ this.containers = [this];
3668
+ var items = this.items;
3669
+ var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
3670
+ var connectWith = this._connectWith();
3671
+
3672
+ if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
3673
+ for (var i = connectWith.length - 1; i >= 0; i--){
3674
+ var cur = $(connectWith[i]);
3675
+ for (var j = cur.length - 1; j >= 0; j--){
3676
+ var inst = $.data(cur[j], this.widgetName);
3677
+ if(inst && inst != this && !inst.options.disabled) {
3678
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
3679
+ this.containers.push(inst);
3680
+ }
3681
+ };
3682
+ };
3683
+ }
3684
+
3685
+ for (var i = queries.length - 1; i >= 0; i--) {
3686
+ var targetData = queries[i][1];
3687
+ var _queries = queries[i][0];
3688
+
3689
+ for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
3690
+ var item = $(_queries[j]);
3691
+
3692
+ item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
3693
+
3694
+ items.push({
3695
+ item: item,
3696
+ instance: targetData,
3697
+ width: 0, height: 0,
3698
+ left: 0, top: 0
3699
+ });
3700
+ };
3701
+ };
3702
+
3703
+ },
3704
+
3705
+ refreshPositions: function(fast) {
3706
+
3707
+ //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
3708
+ if(this.offsetParent && this.helper) {
3709
+ this.offset.parent = this._getParentOffset();
3710
+ }
3711
+
3712
+ for (var i = this.items.length - 1; i >= 0; i--){
3713
+ var item = this.items[i];
3714
+
3715
+ //We ignore calculating positions of all connected containers when we're not over them
3716
+ if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
3717
+ continue;
3718
+
3719
+ var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
3720
+
3721
+ if (!fast) {
3722
+ item.width = t.outerWidth();
3723
+ item.height = t.outerHeight();
3724
+ }
3725
+
3726
+ var p = t.offset();
3727
+ item.left = p.left;
3728
+ item.top = p.top;
3729
+ };
3730
+
3731
+ if(this.options.custom && this.options.custom.refreshContainers) {
3732
+ this.options.custom.refreshContainers.call(this);
3733
+ } else {
3734
+ for (var i = this.containers.length - 1; i >= 0; i--){
3735
+ var p = this.containers[i].element.offset();
3736
+ this.containers[i].containerCache.left = p.left;
3737
+ this.containers[i].containerCache.top = p.top;
3738
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
3739
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
3740
+ };
3741
+ }
3742
+
3743
+ return this;
3744
+ },
3745
+
3746
+ _createPlaceholder: function(that) {
3747
+ that = that || this;
3748
+ var o = that.options;
3749
+
3750
+ if(!o.placeholder || o.placeholder.constructor == String) {
3751
+ var className = o.placeholder;
3752
+ o.placeholder = {
3753
+ element: function() {
3754
+
3755
+ var el = $(document.createElement(that.currentItem[0].nodeName))
3756
+ .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
3757
+ .removeClass("ui-sortable-helper")[0];
3758
+
3759
+ if(!className)
3760
+ el.style.visibility = "hidden";
3761
+
3762
+ return el;
3763
+ },
3764
+ update: function(container, p) {
3765
+
3766
+ // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
3767
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
3768
+ if(className && !o.forcePlaceholderSize) return;
3769
+
3770
+ //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
3771
+ if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
3772
+ if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
3773
+ }
3774
+ };
3775
+ }
3776
+
3777
+ //Create the placeholder
3778
+ that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
3779
+
3780
+ //Append it after the actual current item
3781
+ that.currentItem.after(that.placeholder);
3782
+
3783
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
3784
+ o.placeholder.update(that, that.placeholder);
3785
+
3786
+ },
3787
+
3788
+ _contactContainers: function(event) {
3789
+
3790
+ // get innermost container that intersects with item
3791
+ var innermostContainer = null, innermostIndex = null;
3792
+
3793
+
3794
+ for (var i = this.containers.length - 1; i >= 0; i--){
3795
+
3796
+ // never consider a container that's located within the item itself
3797
+ if($.contains(this.currentItem[0], this.containers[i].element[0]))
3798
+ continue;
3799
+
3800
+ if(this._intersectsWith(this.containers[i].containerCache)) {
3801
+
3802
+ // if we've already found a container and it's more "inner" than this, then continue
3803
+ if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0]))
3804
+ continue;
3805
+
3806
+ innermostContainer = this.containers[i];
3807
+ innermostIndex = i;
3808
+
3809
+ } else {
3810
+ // container doesn't intersect. trigger "out" event if necessary
3811
+ if(this.containers[i].containerCache.over) {
3812
+ this.containers[i]._trigger("out", event, this._uiHash(this));
3813
+ this.containers[i].containerCache.over = 0;
3814
+ }
3815
+ }
3816
+
3817
+ }
3818
+
3819
+ // if no intersecting containers found, return
3820
+ if(!innermostContainer) return;
3821
+
3822
+ // move the item into the container if it's not there already
3823
+ if(this.containers.length === 1) {
3824
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
3825
+ this.containers[innermostIndex].containerCache.over = 1;
3826
+ } else if(this.currentContainer != this.containers[innermostIndex]) {
3827
+
3828
+ //When entering a new container, we will find the item with the least distance and append our item near it
3829
+ var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
3830
+ for (var j = this.items.length - 1; j >= 0; j--) {
3831
+ if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
3832
+ var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
3833
+ if(Math.abs(cur - base) < dist) {
3834
+ dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
3835
+ this.direction = (cur - base > 0) ? 'down' : 'up';
3836
+ }
3837
+ }
3838
+
3839
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
3840
+ return;
3841
+
3842
+ this.currentContainer = this.containers[innermostIndex];
3843
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
3844
+ this._trigger("change", event, this._uiHash());
3845
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
3846
+
3847
+ //Update the placeholder
3848
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
3849
+
3850
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
3851
+ this.containers[innermostIndex].containerCache.over = 1;
3852
+ }
3853
+
3854
+
3855
+ },
3856
+
3857
+ _createHelper: function(event) {
3858
+
3859
+ var o = this.options;
3860
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
3861
+
3862
+ if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
3863
+ $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
3864
+
3865
+ if(helper[0] == this.currentItem[0])
3866
+ this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
3867
+
3868
+ if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
3869
+ if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
3870
+
3871
+ return helper;
3872
+
3873
+ },
3874
+
3875
+ _adjustOffsetFromHelper: function(obj) {
3876
+ if (typeof obj == 'string') {
3877
+ obj = obj.split(' ');
3878
+ }
3879
+ if ($.isArray(obj)) {
3880
+ obj = {left: +obj[0], top: +obj[1] || 0};
3881
+ }
3882
+ if ('left' in obj) {
3883
+ this.offset.click.left = obj.left + this.margins.left;
3884
+ }
3885
+ if ('right' in obj) {
3886
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
3887
+ }
3888
+ if ('top' in obj) {
3889
+ this.offset.click.top = obj.top + this.margins.top;
3890
+ }
3891
+ if ('bottom' in obj) {
3892
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
3893
+ }
3894
+ },
3895
+
3896
+ _getParentOffset: function() {
3897
+
3898
+
3899
+ //Get the offsetParent and cache its position
3900
+ this.offsetParent = this.helper.offsetParent();
3901
+ var po = this.offsetParent.offset();
3902
+
3903
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
3904
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
3905
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
3906
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
3907
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
3908
+ po.left += this.scrollParent.scrollLeft();
3909
+ po.top += this.scrollParent.scrollTop();
3910
+ }
3911
+
3912
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
3913
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
3914
+ po = { top: 0, left: 0 };
3915
+
3916
+ return {
3917
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
3918
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
3919
+ };
3920
+
3921
+ },
3922
+
3923
+ _getRelativeOffset: function() {
3924
+
3925
+ if(this.cssPosition == "relative") {
3926
+ var p = this.currentItem.position();
3927
+ return {
3928
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
3929
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
3930
+ };
3931
+ } else {
3932
+ return { top: 0, left: 0 };
3933
+ }
3934
+
3935
+ },
3936
+
3937
+ _cacheMargins: function() {
3938
+ this.margins = {
3939
+ left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
3940
+ top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
3941
+ };
3942
+ },
3943
+
3944
+ _cacheHelperProportions: function() {
3945
+ this.helperProportions = {
3946
+ width: this.helper.outerWidth(),
3947
+ height: this.helper.outerHeight()
3948
+ };
3949
+ },
3950
+
3951
+ _setContainment: function() {
3952
+
3953
+ var o = this.options;
3954
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
3955
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
3956
+ 0 - this.offset.relative.left - this.offset.parent.left,
3957
+ 0 - this.offset.relative.top - this.offset.parent.top,
3958
+ $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
3959
+ ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
3960
+ ];
3961
+
3962
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
3963
+ var ce = $(o.containment)[0];
3964
+ var co = $(o.containment).offset();
3965
+ var over = ($(ce).css("overflow") != 'hidden');
3966
+
3967
+ this.containment = [
3968
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
3969
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
3970
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
3971
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
3972
+ ];
3973
+ }
3974
+
3975
+ },
3976
+
3977
+ _convertPositionTo: function(d, pos) {
3978
+
3979
+ if(!pos) pos = this.position;
3980
+ var mod = d == "absolute" ? 1 : -1;
3981
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
3982
+
3983
+ return {
3984
+ top: (
3985
+ pos.top // The absolute mouse position
3986
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
3987
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
3988
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
3989
+ ),
3990
+ left: (
3991
+ pos.left // The absolute mouse position
3992
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
3993
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
3994
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
3995
+ )
3996
+ };
3997
+
3998
+ },
3999
+
4000
+ _generatePosition: function(event) {
4001
+
4002
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
4003
+
4004
+ // This is another very weird special case that only happens for relative elements:
4005
+ // 1. If the css position is relative
4006
+ // 2. and the scroll parent is the document or similar to the offset parent
4007
+ // we have to refresh the relative offset during the scroll so there are no jumps
4008
+ if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
4009
+ this.offset.relative = this._getRelativeOffset();
4010
+ }
4011
+
4012
+ var pageX = event.pageX;
4013
+ var pageY = event.pageY;
4014
+
4015
+ /*
4016
+ * - Position constraining -
4017
+ * Constrain the position to a mix of grid, containment.
4018
+ */
4019
+
4020
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
4021
+
4022
+ if(this.containment) {
4023
+ if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
4024
+ if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
4025
+ if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
4026
+ if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
4027
+ }
4028
+
4029
+ if(o.grid) {
4030
+ var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
4031
+ pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
4032
+
4033
+ var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
4034
+ pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
4035
+ }
4036
+
4037
+ }
4038
+
4039
+ return {
4040
+ top: (
4041
+ pageY // The absolute mouse position
4042
+ - this.offset.click.top // Click offset (relative to the element)
4043
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
4044
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
4045
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
4046
+ ),
4047
+ left: (
4048
+ pageX // The absolute mouse position
4049
+ - this.offset.click.left // Click offset (relative to the element)
4050
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
4051
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
4052
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
4053
+ )
4054
+ };
4055
+
4056
+ },
4057
+
4058
+ _rearrange: function(event, i, a, hardRefresh) {
4059
+
4060
+ a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
4061
+
4062
+ //Various things done here to improve the performance:
4063
+ // 1. we create a setTimeout, that calls refreshPositions
4064
+ // 2. on the instance, we have a counter variable, that get's higher after every append
4065
+ // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
4066
+ // 4. this lets only the last addition to the timeout stack through
4067
+ this.counter = this.counter ? ++this.counter : 1;
4068
+ var counter = this.counter;
4069
+
4070
+ this._delay(function() {
4071
+ if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
4072
+ });
4073
+
4074
+ },
4075
+
4076
+ _clear: function(event, noPropagation) {
4077
+
4078
+ this.reverting = false;
4079
+ // We delay all events that have to be triggered to after the point where the placeholder has been removed and
4080
+ // everything else normalized again
4081
+ var delayedTriggers = [];
4082
+
4083
+ // We first have to update the dom position of the actual currentItem
4084
+ // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
4085
+ if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
4086
+ this._noFinalSort = null;
4087
+
4088
+ if(this.helper[0] == this.currentItem[0]) {
4089
+ for(var i in this._storedCSS) {
4090
+ if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
4091
+ }
4092
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
4093
+ } else {
4094
+ this.currentItem.show();
4095
+ }
4096
+
4097
+ if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
4098
+ if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
4099
+
4100
+ // Check if the items Container has Changed and trigger appropriate
4101
+ // events.
4102
+ if (this !== this.currentContainer) {
4103
+ if(!noPropagation) {
4104
+ delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
4105
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
4106
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
4107
+ }
4108
+ }
4109
+
4110
+
4111
+ //Post events to containers
4112
+ for (var i = this.containers.length - 1; i >= 0; i--){
4113
+ if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
4114
+ if(this.containers[i].containerCache.over) {
4115
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
4116
+ this.containers[i].containerCache.over = 0;
4117
+ }
4118
+ }
4119
+
4120
+ //Do what was originally in plugins
4121
+ if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
4122
+ if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
4123
+ if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
4124
+
4125
+ this.dragging = false;
4126
+ if(this.cancelHelperRemoval) {
4127
+ if(!noPropagation) {
4128
+ this._trigger("beforeStop", event, this._uiHash());
4129
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
4130
+ this._trigger("stop", event, this._uiHash());
4131
+ }
4132
+
4133
+ this.fromOutside = false;
4134
+ return false;
4135
+ }
4136
+
4137
+ if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
4138
+
4139
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
4140
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
4141
+
4142
+ if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
4143
+
4144
+ if(!noPropagation) {
4145
+ for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
4146
+ this._trigger("stop", event, this._uiHash());
4147
+ }
4148
+
4149
+ this.fromOutside = false;
4150
+ return true;
4151
+
4152
+ },
4153
+
4154
+ _trigger: function() {
4155
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
4156
+ this.cancel();
4157
+ }
4158
+ },
4159
+
4160
+ _uiHash: function(_inst) {
4161
+ var inst = _inst || this;
4162
+ return {
4163
+ helper: inst.helper,
4164
+ placeholder: inst.placeholder || $([]),
4165
+ position: inst.position,
4166
+ originalPosition: inst.originalPosition,
4167
+ offset: inst.positionAbs,
4168
+ item: inst.currentItem,
4169
+ sender: _inst ? _inst.element : null
4170
+ };
4171
+ }
4172
+
4173
+ });
4174
+
4175
+ })(jQuery);
4176
+
4177
+ ;(jQuery.effects || (function($, undefined) {
4178
+
4179
+ var backCompat = $.uiBackCompat !== false,
4180
+ // prefix used for storing data on .data()
4181
+ dataSpace = "ui-effects-";
4182
+
4183
+ $.effects = {
4184
+ effect: {}
4185
+ };
4186
+
4187
+ /*!
4188
+ * jQuery Color Animations v2.0.0
4189
+ * http://jquery.com/
4190
+ *
4191
+ * Copyright 2012 jQuery Foundation and other contributors
4192
+ * Released under the MIT license.
4193
+ * http://jquery.org/license
4194
+ *
4195
+ * Date: Mon Aug 13 13:41:02 2012 -0500
4196
+ */
4197
+ (function( jQuery, undefined ) {
4198
+
4199
+ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),
4200
+
4201
+ // plusequals test for += 100 -= 100
4202
+ rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
4203
+ // a set of RE's that can match strings and generate color tuples.
4204
+ stringParsers = [{
4205
+ re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
4206
+ parse: function( execResult ) {
4207
+ return [
4208
+ execResult[ 1 ],
4209
+ execResult[ 2 ],
4210
+ execResult[ 3 ],
4211
+ execResult[ 4 ]
4212
+ ];
4213
+ }
4214
+ }, {
4215
+ re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
4216
+ parse: function( execResult ) {
4217
+ return [
4218
+ execResult[ 1 ] * 2.55,
4219
+ execResult[ 2 ] * 2.55,
4220
+ execResult[ 3 ] * 2.55,
4221
+ execResult[ 4 ]
4222
+ ];
4223
+ }
4224
+ }, {
4225
+ // this regex ignores A-F because it's compared against an already lowercased string
4226
+ re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
4227
+ parse: function( execResult ) {
4228
+ return [
4229
+ parseInt( execResult[ 1 ], 16 ),
4230
+ parseInt( execResult[ 2 ], 16 ),
4231
+ parseInt( execResult[ 3 ], 16 )
4232
+ ];
4233
+ }
4234
+ }, {
4235
+ // this regex ignores A-F because it's compared against an already lowercased string
4236
+ re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
4237
+ parse: function( execResult ) {
4238
+ return [
4239
+ parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
4240
+ parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
4241
+ parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
4242
+ ];
4243
+ }
4244
+ }, {
4245
+ re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
4246
+ space: "hsla",
4247
+ parse: function( execResult ) {
4248
+ return [
4249
+ execResult[ 1 ],
4250
+ execResult[ 2 ] / 100,
4251
+ execResult[ 3 ] / 100,
4252
+ execResult[ 4 ]
4253
+ ];
4254
+ }
4255
+ }],
4256
+
4257
+ // jQuery.Color( )
4258
+ color = jQuery.Color = function( color, green, blue, alpha ) {
4259
+ return new jQuery.Color.fn.parse( color, green, blue, alpha );
4260
+ },
4261
+ spaces = {
4262
+ rgba: {
4263
+ props: {
4264
+ red: {
4265
+ idx: 0,
4266
+ type: "byte"
4267
+ },
4268
+ green: {
4269
+ idx: 1,
4270
+ type: "byte"
4271
+ },
4272
+ blue: {
4273
+ idx: 2,
4274
+ type: "byte"
4275
+ }
4276
+ }
4277
+ },
4278
+
4279
+ hsla: {
4280
+ props: {
4281
+ hue: {
4282
+ idx: 0,
4283
+ type: "degrees"
4284
+ },
4285
+ saturation: {
4286
+ idx: 1,
4287
+ type: "percent"
4288
+ },
4289
+ lightness: {
4290
+ idx: 2,
4291
+ type: "percent"
4292
+ }
4293
+ }
4294
+ }
4295
+ },
4296
+ propTypes = {
4297
+ "byte": {
4298
+ floor: true,
4299
+ max: 255
4300
+ },
4301
+ "percent": {
4302
+ max: 1
4303
+ },
4304
+ "degrees": {
4305
+ mod: 360,
4306
+ floor: true
4307
+ }
4308
+ },
4309
+ support = color.support = {},
4310
+
4311
+ // element for support tests
4312
+ supportElem = jQuery( "<p>" )[ 0 ],
4313
+
4314
+ // colors = jQuery.Color.names
4315
+ colors,
4316
+
4317
+ // local aliases of functions called often
4318
+ each = jQuery.each;
4319
+
4320
+ // determine rgba support immediately
4321
+ supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
4322
+ support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
4323
+
4324
+ // define cache name and alpha properties
4325
+ // for rgba and hsla spaces
4326
+ each( spaces, function( spaceName, space ) {
4327
+ space.cache = "_" + spaceName;
4328
+ space.props.alpha = {
4329
+ idx: 3,
4330
+ type: "percent",
4331
+ def: 1
4332
+ };
4333
+ });
4334
+
4335
+ function clamp( value, prop, allowEmpty ) {
4336
+ var type = propTypes[ prop.type ] || {};
4337
+
4338
+ if ( value == null ) {
4339
+ return (allowEmpty || !prop.def) ? null : prop.def;
4340
+ }
4341
+
4342
+ // ~~ is an short way of doing floor for positive numbers
4343
+ value = type.floor ? ~~value : parseFloat( value );
4344
+
4345
+ // IE will pass in empty strings as value for alpha,
4346
+ // which will hit this case
4347
+ if ( isNaN( value ) ) {
4348
+ return prop.def;
4349
+ }
4350
+
4351
+ if ( type.mod ) {
4352
+ // we add mod before modding to make sure that negatives values
4353
+ // get converted properly: -10 -> 350
4354
+ return (value + type.mod) % type.mod;
4355
+ }
4356
+
4357
+ // for now all property types without mod have min and max
4358
+ return 0 > value ? 0 : type.max < value ? type.max : value;
4359
+ }
4360
+
4361
+ function stringParse( string ) {
4362
+ var inst = color(),
4363
+ rgba = inst._rgba = [];
4364
+
4365
+ string = string.toLowerCase();
4366
+
4367
+ each( stringParsers, function( i, parser ) {
4368
+ var parsed,
4369
+ match = parser.re.exec( string ),
4370
+ values = match && parser.parse( match ),
4371
+ spaceName = parser.space || "rgba";
4372
+
4373
+ if ( values ) {
4374
+ parsed = inst[ spaceName ]( values );
4375
+
4376
+ // if this was an rgba parse the assignment might happen twice
4377
+ // oh well....
4378
+ inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
4379
+ rgba = inst._rgba = parsed._rgba;
4380
+
4381
+ // exit each( stringParsers ) here because we matched
4382
+ return false;
4383
+ }
4384
+ });
4385
+
4386
+ // Found a stringParser that handled it
4387
+ if ( rgba.length ) {
4388
+
4389
+ // if this came from a parsed string, force "transparent" when alpha is 0
4390
+ // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
4391
+ if ( rgba.join() === "0,0,0,0" ) {
4392
+ jQuery.extend( rgba, colors.transparent );
4393
+ }
4394
+ return inst;
4395
+ }
4396
+
4397
+ // named colors
4398
+ return colors[ string ];
4399
+ }
4400
+
4401
+ color.fn = jQuery.extend( color.prototype, {
4402
+ parse: function( red, green, blue, alpha ) {
4403
+ if ( red === undefined ) {
4404
+ this._rgba = [ null, null, null, null ];
4405
+ return this;
4406
+ }
4407
+ if ( red.jquery || red.nodeType ) {
4408
+ red = jQuery( red ).css( green );
4409
+ green = undefined;
4410
+ }
4411
+
4412
+ var inst = this,
4413
+ type = jQuery.type( red ),
4414
+ rgba = this._rgba = [],
4415
+ source;
4416
+
4417
+ // more than 1 argument specified - assume ( red, green, blue, alpha )
4418
+ if ( green !== undefined ) {
4419
+ red = [ red, green, blue, alpha ];
4420
+ type = "array";
4421
+ }
4422
+
4423
+ if ( type === "string" ) {
4424
+ return this.parse( stringParse( red ) || colors._default );
4425
+ }
4426
+
4427
+ if ( type === "array" ) {
4428
+ each( spaces.rgba.props, function( key, prop ) {
4429
+ rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
4430
+ });
4431
+ return this;
4432
+ }
4433
+
4434
+ if ( type === "object" ) {
4435
+ if ( red instanceof color ) {
4436
+ each( spaces, function( spaceName, space ) {
4437
+ if ( red[ space.cache ] ) {
4438
+ inst[ space.cache ] = red[ space.cache ].slice();
4439
+ }
4440
+ });
4441
+ } else {
4442
+ each( spaces, function( spaceName, space ) {
4443
+ var cache = space.cache;
4444
+ each( space.props, function( key, prop ) {
4445
+
4446
+ // if the cache doesn't exist, and we know how to convert
4447
+ if ( !inst[ cache ] && space.to ) {
4448
+
4449
+ // if the value was null, we don't need to copy it
4450
+ // if the key was alpha, we don't need to copy it either
4451
+ if ( key === "alpha" || red[ key ] == null ) {
4452
+ return;
4453
+ }
4454
+ inst[ cache ] = space.to( inst._rgba );
4455
+ }
4456
+
4457
+ // this is the only case where we allow nulls for ALL properties.
4458
+ // call clamp with alwaysAllowEmpty
4459
+ inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
4460
+ });
4461
+
4462
+ // everything defined but alpha?
4463
+ if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
4464
+ // use the default of 1
4465
+ inst[ cache ][ 3 ] = 1;
4466
+ if ( space.from ) {
4467
+ inst._rgba = space.from( inst[ cache ] );
4468
+ }
4469
+ }
4470
+ });
4471
+ }
4472
+ return this;
4473
+ }
4474
+ },
4475
+ is: function( compare ) {
4476
+ var is = color( compare ),
4477
+ same = true,
4478
+ inst = this;
4479
+
4480
+ each( spaces, function( _, space ) {
4481
+ var localCache,
4482
+ isCache = is[ space.cache ];
4483
+ if (isCache) {
4484
+ localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
4485
+ each( space.props, function( _, prop ) {
4486
+ if ( isCache[ prop.idx ] != null ) {
4487
+ same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
4488
+ return same;
4489
+ }
4490
+ });
4491
+ }
4492
+ return same;
4493
+ });
4494
+ return same;
4495
+ },
4496
+ _space: function() {
4497
+ var used = [],
4498
+ inst = this;
4499
+ each( spaces, function( spaceName, space ) {
4500
+ if ( inst[ space.cache ] ) {
4501
+ used.push( spaceName );
4502
+ }
4503
+ });
4504
+ return used.pop();
4505
+ },
4506
+ transition: function( other, distance ) {
4507
+ var end = color( other ),
4508
+ spaceName = end._space(),
4509
+ space = spaces[ spaceName ],
4510
+ startColor = this.alpha() === 0 ? color( "transparent" ) : this,
4511
+ start = startColor[ space.cache ] || space.to( startColor._rgba ),
4512
+ result = start.slice();
4513
+
4514
+ end = end[ space.cache ];
4515
+ each( space.props, function( key, prop ) {
4516
+ var index = prop.idx,
4517
+ startValue = start[ index ],
4518
+ endValue = end[ index ],
4519
+ type = propTypes[ prop.type ] || {};
4520
+
4521
+ // if null, don't override start value
4522
+ if ( endValue === null ) {
4523
+ return;
4524
+ }
4525
+ // if null - use end
4526
+ if ( startValue === null ) {
4527
+ result[ index ] = endValue;
4528
+ } else {
4529
+ if ( type.mod ) {
4530
+ if ( endValue - startValue > type.mod / 2 ) {
4531
+ startValue += type.mod;
4532
+ } else if ( startValue - endValue > type.mod / 2 ) {
4533
+ startValue -= type.mod;
4534
+ }
4535
+ }
4536
+ result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
4537
+ }
4538
+ });
4539
+ return this[ spaceName ]( result );
4540
+ },
4541
+ blend: function( opaque ) {
4542
+ // if we are already opaque - return ourself
4543
+ if ( this._rgba[ 3 ] === 1 ) {
4544
+ return this;
4545
+ }
4546
+
4547
+ var rgb = this._rgba.slice(),
4548
+ a = rgb.pop(),
4549
+ blend = color( opaque )._rgba;
4550
+
4551
+ return color( jQuery.map( rgb, function( v, i ) {
4552
+ return ( 1 - a ) * blend[ i ] + a * v;
4553
+ }));
4554
+ },
4555
+ toRgbaString: function() {
4556
+ var prefix = "rgba(",
4557
+ rgba = jQuery.map( this._rgba, function( v, i ) {
4558
+ return v == null ? ( i > 2 ? 1 : 0 ) : v;
4559
+ });
4560
+
4561
+ if ( rgba[ 3 ] === 1 ) {
4562
+ rgba.pop();
4563
+ prefix = "rgb(";
4564
+ }
4565
+
4566
+ return prefix + rgba.join() + ")";
4567
+ },
4568
+ toHslaString: function() {
4569
+ var prefix = "hsla(",
4570
+ hsla = jQuery.map( this.hsla(), function( v, i ) {
4571
+ if ( v == null ) {
4572
+ v = i > 2 ? 1 : 0;
4573
+ }
4574
+
4575
+ // catch 1 and 2
4576
+ if ( i && i < 3 ) {
4577
+ v = Math.round( v * 100 ) + "%";
4578
+ }
4579
+ return v;
4580
+ });
4581
+
4582
+ if ( hsla[ 3 ] === 1 ) {
4583
+ hsla.pop();
4584
+ prefix = "hsl(";
4585
+ }
4586
+ return prefix + hsla.join() + ")";
4587
+ },
4588
+ toHexString: function( includeAlpha ) {
4589
+ var rgba = this._rgba.slice(),
4590
+ alpha = rgba.pop();
4591
+
4592
+ if ( includeAlpha ) {
4593
+ rgba.push( ~~( alpha * 255 ) );
4594
+ }
4595
+
4596
+ return "#" + jQuery.map( rgba, function( v, i ) {
4597
+
4598
+ // default to 0 when nulls exist
4599
+ v = ( v || 0 ).toString( 16 );
4600
+ return v.length === 1 ? "0" + v : v;
4601
+ }).join("");
4602
+ },
4603
+ toString: function() {
4604
+ return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
4605
+ }
4606
+ });
4607
+ color.fn.parse.prototype = color.fn;
4608
+
4609
+ // hsla conversions adapted from:
4610
+ // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
4611
+
4612
+ function hue2rgb( p, q, h ) {
4613
+ h = ( h + 1 ) % 1;
4614
+ if ( h * 6 < 1 ) {
4615
+ return p + (q - p) * h * 6;
4616
+ }
4617
+ if ( h * 2 < 1) {
4618
+ return q;
4619
+ }
4620
+ if ( h * 3 < 2 ) {
4621
+ return p + (q - p) * ((2/3) - h) * 6;
4622
+ }
4623
+ return p;
4624
+ }
4625
+
4626
+ spaces.hsla.to = function ( rgba ) {
4627
+ if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
4628
+ return [ null, null, null, rgba[ 3 ] ];
4629
+ }
4630
+ var r = rgba[ 0 ] / 255,
4631
+ g = rgba[ 1 ] / 255,
4632
+ b = rgba[ 2 ] / 255,
4633
+ a = rgba[ 3 ],
4634
+ max = Math.max( r, g, b ),
4635
+ min = Math.min( r, g, b ),
4636
+ diff = max - min,
4637
+ add = max + min,
4638
+ l = add * 0.5,
4639
+ h, s;
4640
+
4641
+ if ( min === max ) {
4642
+ h = 0;
4643
+ } else if ( r === max ) {
4644
+ h = ( 60 * ( g - b ) / diff ) + 360;
4645
+ } else if ( g === max ) {
4646
+ h = ( 60 * ( b - r ) / diff ) + 120;
4647
+ } else {
4648
+ h = ( 60 * ( r - g ) / diff ) + 240;
4649
+ }
4650
+
4651
+ if ( l === 0 || l === 1 ) {
4652
+ s = l;
4653
+ } else if ( l <= 0.5 ) {
4654
+ s = diff / add;
4655
+ } else {
4656
+ s = diff / ( 2 - add );
4657
+ }
4658
+ return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
4659
+ };
4660
+
4661
+ spaces.hsla.from = function ( hsla ) {
4662
+ if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
4663
+ return [ null, null, null, hsla[ 3 ] ];
4664
+ }
4665
+ var h = hsla[ 0 ] / 360,
4666
+ s = hsla[ 1 ],
4667
+ l = hsla[ 2 ],
4668
+ a = hsla[ 3 ],
4669
+ q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
4670
+ p = 2 * l - q,
4671
+ r, g, b;
4672
+
4673
+ return [
4674
+ Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
4675
+ Math.round( hue2rgb( p, q, h ) * 255 ),
4676
+ Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
4677
+ a
4678
+ ];
4679
+ };
4680
+
4681
+
4682
+ each( spaces, function( spaceName, space ) {
4683
+ var props = space.props,
4684
+ cache = space.cache,
4685
+ to = space.to,
4686
+ from = space.from;
4687
+
4688
+ // makes rgba() and hsla()
4689
+ color.fn[ spaceName ] = function( value ) {
4690
+
4691
+ // generate a cache for this space if it doesn't exist
4692
+ if ( to && !this[ cache ] ) {
4693
+ this[ cache ] = to( this._rgba );
4694
+ }
4695
+ if ( value === undefined ) {
4696
+ return this[ cache ].slice();
4697
+ }
4698
+
4699
+ var ret,
4700
+ type = jQuery.type( value ),
4701
+ arr = ( type === "array" || type === "object" ) ? value : arguments,
4702
+ local = this[ cache ].slice();
4703
+
4704
+ each( props, function( key, prop ) {
4705
+ var val = arr[ type === "object" ? key : prop.idx ];
4706
+ if ( val == null ) {
4707
+ val = local[ prop.idx ];
4708
+ }
4709
+ local[ prop.idx ] = clamp( val, prop );
4710
+ });
4711
+
4712
+ if ( from ) {
4713
+ ret = color( from( local ) );
4714
+ ret[ cache ] = local;
4715
+ return ret;
4716
+ } else {
4717
+ return color( local );
4718
+ }
4719
+ };
4720
+
4721
+ // makes red() green() blue() alpha() hue() saturation() lightness()
4722
+ each( props, function( key, prop ) {
4723
+ // alpha is included in more than one space
4724
+ if ( color.fn[ key ] ) {
4725
+ return;
4726
+ }
4727
+ color.fn[ key ] = function( value ) {
4728
+ var vtype = jQuery.type( value ),
4729
+ fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
4730
+ local = this[ fn ](),
4731
+ cur = local[ prop.idx ],
4732
+ match;
4733
+
4734
+ if ( vtype === "undefined" ) {
4735
+ return cur;
4736
+ }
4737
+
4738
+ if ( vtype === "function" ) {
4739
+ value = value.call( this, cur );
4740
+ vtype = jQuery.type( value );
4741
+ }
4742
+ if ( value == null && prop.empty ) {
4743
+ return this;
4744
+ }
4745
+ if ( vtype === "string" ) {
4746
+ match = rplusequals.exec( value );
4747
+ if ( match ) {
4748
+ value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
4749
+ }
4750
+ }
4751
+ local[ prop.idx ] = value;
4752
+ return this[ fn ]( local );
4753
+ };
4754
+ });
4755
+ });
4756
+
4757
+ // add .fx.step functions
4758
+ each( stepHooks, function( i, hook ) {
4759
+ jQuery.cssHooks[ hook ] = {
4760
+ set: function( elem, value ) {
4761
+ var parsed, curElem,
4762
+ backgroundColor = "";
4763
+
4764
+ if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) {
4765
+ value = color( parsed || value );
4766
+ if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
4767
+ curElem = hook === "backgroundColor" ? elem.parentNode : elem;
4768
+ while (
4769
+ (backgroundColor === "" || backgroundColor === "transparent") &&
4770
+ curElem && curElem.style
4771
+ ) {
4772
+ try {
4773
+ backgroundColor = jQuery.css( curElem, "backgroundColor" );
4774
+ curElem = curElem.parentNode;
4775
+ } catch ( e ) {
4776
+ }
4777
+ }
4778
+
4779
+ value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
4780
+ backgroundColor :
4781
+ "_default" );
4782
+ }
4783
+
4784
+ value = value.toRgbaString();
4785
+ }
4786
+ try {
4787
+ elem.style[ hook ] = value;
4788
+ } catch( value ) {
4789
+ // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
4790
+ }
4791
+ }
4792
+ };
4793
+ jQuery.fx.step[ hook ] = function( fx ) {
4794
+ if ( !fx.colorInit ) {
4795
+ fx.start = color( fx.elem, hook );
4796
+ fx.end = color( fx.end );
4797
+ fx.colorInit = true;
4798
+ }
4799
+ jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
4800
+ };
4801
+ });
4802
+
4803
+ jQuery.cssHooks.borderColor = {
4804
+ expand: function( value ) {
4805
+ var expanded = {};
4806
+
4807
+ each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
4808
+ expanded[ "border" + part + "Color" ] = value;
4809
+ });
4810
+ return expanded;
4811
+ }
4812
+ };
4813
+
4814
+ // Basic color names only.
4815
+ // Usage of any of the other color names requires adding yourself or including
4816
+ // jquery.color.svg-names.js.
4817
+ colors = jQuery.Color.names = {
4818
+ // 4.1. Basic color keywords
4819
+ aqua: "#00ffff",
4820
+ black: "#000000",
4821
+ blue: "#0000ff",
4822
+ fuchsia: "#ff00ff",
4823
+ gray: "#808080",
4824
+ green: "#008000",
4825
+ lime: "#00ff00",
4826
+ maroon: "#800000",
4827
+ navy: "#000080",
4828
+ olive: "#808000",
4829
+ purple: "#800080",
4830
+ red: "#ff0000",
4831
+ silver: "#c0c0c0",
4832
+ teal: "#008080",
4833
+ white: "#ffffff",
4834
+ yellow: "#ffff00",
4835
+
4836
+ // 4.2.3. "transparent" color keyword
4837
+ transparent: [ null, null, null, 0 ],
4838
+
4839
+ _default: "#ffffff"
4840
+ };
4841
+
4842
+ })( jQuery );
4843
+
4844
+
4845
+
4846
+ /******************************************************************************/
4847
+ /****************************** CLASS ANIMATIONS ******************************/
4848
+ /******************************************************************************/
4849
+ (function() {
4850
+
4851
+ var classAnimationActions = [ "add", "remove", "toggle" ],
4852
+ shorthandStyles = {
4853
+ border: 1,
4854
+ borderBottom: 1,
4855
+ borderColor: 1,
4856
+ borderLeft: 1,
4857
+ borderRight: 1,
4858
+ borderTop: 1,
4859
+ borderWidth: 1,
4860
+ margin: 1,
4861
+ padding: 1
4862
+ };
4863
+
4864
+ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
4865
+ $.fx.step[ prop ] = function( fx ) {
4866
+ if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
4867
+ jQuery.style( fx.elem, prop, fx.end );
4868
+ fx.setAttr = true;
4869
+ }
4870
+ };
4871
+ });
4872
+
4873
+ function getElementStyles() {
4874
+ var style = this.ownerDocument.defaultView ?
4875
+ this.ownerDocument.defaultView.getComputedStyle( this, null ) :
4876
+ this.currentStyle,
4877
+ newStyle = {},
4878
+ key,
4879
+ camelCase,
4880
+ len;
4881
+
4882
+ // webkit enumerates style porperties
4883
+ if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
4884
+ len = style.length;
4885
+ while ( len-- ) {
4886
+ key = style[ len ];
4887
+ if ( typeof style[ key ] === "string" ) {
4888
+ newStyle[ $.camelCase( key ) ] = style[ key ];
4889
+ }
4890
+ }
4891
+ } else {
4892
+ for ( key in style ) {
4893
+ if ( typeof style[ key ] === "string" ) {
4894
+ newStyle[ key ] = style[ key ];
4895
+ }
4896
+ }
4897
+ }
4898
+
4899
+ return newStyle;
4900
+ }
4901
+
4902
+
4903
+ function styleDifference( oldStyle, newStyle ) {
4904
+ var diff = {},
4905
+ name, value;
4906
+
4907
+ for ( name in newStyle ) {
4908
+ value = newStyle[ name ];
4909
+ if ( oldStyle[ name ] !== value ) {
4910
+ if ( !shorthandStyles[ name ] ) {
4911
+ if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
4912
+ diff[ name ] = value;
4913
+ }
4914
+ }
4915
+ }
4916
+ }
4917
+
4918
+ return diff;
4919
+ }
4920
+
4921
+ $.effects.animateClass = function( value, duration, easing, callback ) {
4922
+ var o = $.speed( duration, easing, callback );
4923
+
4924
+ return this.queue( function() {
4925
+ var animated = $( this ),
4926
+ baseClass = animated.attr( "class" ) || "",
4927
+ applyClassChange,
4928
+ allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
4929
+
4930
+ // map the animated objects to store the original styles.
4931
+ allAnimations = allAnimations.map(function() {
4932
+ var el = $( this );
4933
+ return {
4934
+ el: el,
4935
+ start: getElementStyles.call( this )
4936
+ };
4937
+ });
4938
+
4939
+ // apply class change
4940
+ applyClassChange = function() {
4941
+ $.each( classAnimationActions, function(i, action) {
4942
+ if ( value[ action ] ) {
4943
+ animated[ action + "Class" ]( value[ action ] );
4944
+ }
4945
+ });
4946
+ };
4947
+ applyClassChange();
4948
+
4949
+ // map all animated objects again - calculate new styles and diff
4950
+ allAnimations = allAnimations.map(function() {
4951
+ this.end = getElementStyles.call( this.el[ 0 ] );
4952
+ this.diff = styleDifference( this.start, this.end );
4953
+ return this;
4954
+ });
4955
+
4956
+ // apply original class
4957
+ animated.attr( "class", baseClass );
4958
+
4959
+ // map all animated objects again - this time collecting a promise
4960
+ allAnimations = allAnimations.map(function() {
4961
+ var styleInfo = this,
4962
+ dfd = $.Deferred(),
4963
+ opts = jQuery.extend({}, o, {
4964
+ queue: false,
4965
+ complete: function() {
4966
+ dfd.resolve( styleInfo );
4967
+ }
4968
+ });
4969
+
4970
+ this.el.animate( this.diff, opts );
4971
+ return dfd.promise();
4972
+ });
4973
+
4974
+ // once all animations have completed:
4975
+ $.when.apply( $, allAnimations.get() ).done(function() {
4976
+
4977
+ // set the final class
4978
+ applyClassChange();
4979
+
4980
+ // for each animated element,
4981
+ // clear all css properties that were animated
4982
+ $.each( arguments, function() {
4983
+ var el = this.el;
4984
+ $.each( this.diff, function(key) {
4985
+ el.css( key, '' );
4986
+ });
4987
+ });
4988
+
4989
+ // this is guarnteed to be there if you use jQuery.speed()
4990
+ // it also handles dequeuing the next anim...
4991
+ o.complete.call( animated[ 0 ] );
4992
+ });
4993
+ });
4994
+ };
4995
+
4996
+ $.fn.extend({
4997
+ _addClass: $.fn.addClass,
4998
+ addClass: function( classNames, speed, easing, callback ) {
4999
+ return speed ?
5000
+ $.effects.animateClass.call( this,
5001
+ { add: classNames }, speed, easing, callback ) :
5002
+ this._addClass( classNames );
5003
+ },
5004
+
5005
+ _removeClass: $.fn.removeClass,
5006
+ removeClass: function( classNames, speed, easing, callback ) {
5007
+ return speed ?
5008
+ $.effects.animateClass.call( this,
5009
+ { remove: classNames }, speed, easing, callback ) :
5010
+ this._removeClass( classNames );
5011
+ },
5012
+
5013
+ _toggleClass: $.fn.toggleClass,
5014
+ toggleClass: function( classNames, force, speed, easing, callback ) {
5015
+ if ( typeof force === "boolean" || force === undefined ) {
5016
+ if ( !speed ) {
5017
+ // without speed parameter
5018
+ return this._toggleClass( classNames, force );
5019
+ } else {
5020
+ return $.effects.animateClass.call( this,
5021
+ (force ? { add: classNames } : { remove: classNames }),
5022
+ speed, easing, callback );
5023
+ }
5024
+ } else {
5025
+ // without force parameter
5026
+ return $.effects.animateClass.call( this,
5027
+ { toggle: classNames }, force, speed, easing );
5028
+ }
5029
+ },
5030
+
5031
+ switchClass: function( remove, add, speed, easing, callback) {
5032
+ return $.effects.animateClass.call( this, {
5033
+ add: add,
5034
+ remove: remove
5035
+ }, speed, easing, callback );
5036
+ }
5037
+ });
5038
+
5039
+ })();
5040
+
5041
+ /******************************************************************************/
5042
+ /*********************************** EFFECTS **********************************/
5043
+ /******************************************************************************/
5044
+
5045
+ (function() {
5046
+
5047
+ $.extend( $.effects, {
5048
+ version: "1.9.0",
5049
+
5050
+ // Saves a set of properties in a data storage
5051
+ save: function( element, set ) {
5052
+ for( var i=0; i < set.length; i++ ) {
5053
+ if ( set[ i ] !== null ) {
5054
+ element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
5055
+ }
5056
+ }
5057
+ },
5058
+
5059
+ // Restores a set of previously saved properties from a data storage
5060
+ restore: function( element, set ) {
5061
+ var val, i;
5062
+ for( i=0; i < set.length; i++ ) {
5063
+ if ( set[ i ] !== null ) {
5064
+ val = element.data( dataSpace + set[ i ] );
5065
+ // support: jQuery 1.6.2
5066
+ // http://bugs.jquery.com/ticket/9917
5067
+ // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
5068
+ // We can't differentiate between "" and 0 here, so we just assume
5069
+ // empty string since it's likely to be a more common value...
5070
+ if ( val === undefined ) {
5071
+ val = "";
5072
+ }
5073
+ element.css( set[ i ], val );
5074
+ }
5075
+ }
5076
+ },
5077
+
5078
+ setMode: function( el, mode ) {
5079
+ if (mode === "toggle") {
5080
+ mode = el.is( ":hidden" ) ? "show" : "hide";
5081
+ }
5082
+ return mode;
5083
+ },
5084
+
5085
+ // Translates a [top,left] array into a baseline value
5086
+ // this should be a little more flexible in the future to handle a string & hash
5087
+ getBaseline: function( origin, original ) {
5088
+ var y, x;
5089
+ switch ( origin[ 0 ] ) {
5090
+ case "top": y = 0; break;
5091
+ case "middle": y = 0.5; break;
5092
+ case "bottom": y = 1; break;
5093
+ default: y = origin[ 0 ] / original.height;
5094
+ }
5095
+ switch ( origin[ 1 ] ) {
5096
+ case "left": x = 0; break;
5097
+ case "center": x = 0.5; break;
5098
+ case "right": x = 1; break;
5099
+ default: x = origin[ 1 ] / original.width;
5100
+ }
5101
+ return {
5102
+ x: x,
5103
+ y: y
5104
+ };
5105
+ },
5106
+
5107
+ // Wraps the element around a wrapper that copies position properties
5108
+ createWrapper: function( element ) {
5109
+
5110
+ // if the element is already wrapped, return it
5111
+ if ( element.parent().is( ".ui-effects-wrapper" )) {
5112
+ return element.parent();
5113
+ }
5114
+
5115
+ // wrap the element
5116
+ var props = {
5117
+ width: element.outerWidth(true),
5118
+ height: element.outerHeight(true),
5119
+ "float": element.css( "float" )
5120
+ },
5121
+ wrapper = $( "<div></div>" )
5122
+ .addClass( "ui-effects-wrapper" )
5123
+ .css({
5124
+ fontSize: "100%",
5125
+ background: "transparent",
5126
+ border: "none",
5127
+ margin: 0,
5128
+ padding: 0
5129
+ }),
5130
+ // Store the size in case width/height are defined in % - Fixes #5245
5131
+ size = {
5132
+ width: element.width(),
5133
+ height: element.height()
5134
+ },
5135
+ active = document.activeElement;
5136
+
5137
+ // support: Firefox
5138
+ // Firefox incorrectly exposes anonymous content
5139
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
5140
+ try {
5141
+ active.id;
5142
+ } catch( e ) {
5143
+ active = document.body;
5144
+ }
5145
+
5146
+ element.wrap( wrapper );
5147
+
5148
+ // Fixes #7595 - Elements lose focus when wrapped.
5149
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
5150
+ $( active ).focus();
5151
+ }
5152
+
5153
+ wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
5154
+
5155
+ // transfer positioning properties to the wrapper
5156
+ if ( element.css( "position" ) === "static" ) {
5157
+ wrapper.css({ position: "relative" });
5158
+ element.css({ position: "relative" });
5159
+ } else {
5160
+ $.extend( props, {
5161
+ position: element.css( "position" ),
5162
+ zIndex: element.css( "z-index" )
5163
+ });
5164
+ $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
5165
+ props[ pos ] = element.css( pos );
5166
+ if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
5167
+ props[ pos ] = "auto";
5168
+ }
5169
+ });
5170
+ element.css({
5171
+ position: "relative",
5172
+ top: 0,
5173
+ left: 0,
5174
+ right: "auto",
5175
+ bottom: "auto"
5176
+ });
5177
+ }
5178
+ element.css(size);
5179
+
5180
+ return wrapper.css( props ).show();
5181
+ },
5182
+
5183
+ removeWrapper: function( element ) {
5184
+ var active = document.activeElement;
5185
+
5186
+ if ( element.parent().is( ".ui-effects-wrapper" ) ) {
5187
+ element.parent().replaceWith( element );
5188
+
5189
+ // Fixes #7595 - Elements lose focus when wrapped.
5190
+ if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
5191
+ $( active ).focus();
5192
+ }
5193
+ }
5194
+
5195
+
5196
+ return element;
5197
+ },
5198
+
5199
+ setTransition: function( element, list, factor, value ) {
5200
+ value = value || {};
5201
+ $.each( list, function( i, x ) {
5202
+ var unit = element.cssUnit( x );
5203
+ if ( unit[ 0 ] > 0 ) {
5204
+ value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
5205
+ }
5206
+ });
5207
+ return value;
5208
+ }
5209
+ });
5210
+
5211
+ // return an effect options object for the given parameters:
5212
+ function _normalizeArguments( effect, options, speed, callback ) {
5213
+
5214
+ // allow passing all optinos as the first parameter
5215
+ if ( $.isPlainObject( effect ) ) {
5216
+ options = effect;
5217
+ effect = effect.effect;
5218
+ }
5219
+
5220
+ // convert to an object
5221
+ effect = { effect: effect };
5222
+
5223
+ // catch (effect)
5224
+ if ( options === undefined ) {
5225
+ options = {};
5226
+ }
5227
+
5228
+ // catch (effect, callback)
5229
+ if ( $.isFunction( options ) ) {
5230
+ callback = options;
5231
+ speed = null;
5232
+ options = {};
5233
+ }
5234
+
5235
+ // catch (effect, speed, ?)
5236
+ if ( typeof options === "number" || $.fx.speeds[ options ] ) {
5237
+ callback = speed;
5238
+ speed = options;
5239
+ options = {};
5240
+ }
5241
+
5242
+ // catch (effect, options, callback)
5243
+ if ( $.isFunction( speed ) ) {
5244
+ callback = speed;
5245
+ speed = null;
5246
+ }
5247
+
5248
+ // add options to effect
5249
+ if ( options ) {
5250
+ $.extend( effect, options );
5251
+ }
5252
+
5253
+ speed = speed || options.duration;
5254
+ effect.duration = $.fx.off ? 0 :
5255
+ typeof speed === "number" ? speed :
5256
+ speed in $.fx.speeds ? $.fx.speeds[ speed ] :
5257
+ $.fx.speeds._default;
5258
+
5259
+ effect.complete = callback || options.complete;
5260
+
5261
+ return effect;
5262
+ }
5263
+
5264
+ function standardSpeed( speed ) {
5265
+ // valid standard speeds
5266
+ if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
5267
+ return true;
5268
+ }
5269
+
5270
+ // invalid strings - treat as "normal" speed
5271
+ if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
5272
+ // TODO: remove in 2.0 (#7115)
5273
+ if ( backCompat && $.effects[ speed ] ) {
5274
+ return false;
5275
+ }
5276
+ return true;
5277
+ }
5278
+
5279
+ return false;
5280
+ }
5281
+
5282
+ $.fn.extend({
5283
+ effect: function( effect, options, speed, callback ) {
5284
+ var args = _normalizeArguments.apply( this, arguments ),
5285
+ mode = args.mode,
5286
+ queue = args.queue,
5287
+ effectMethod = $.effects.effect[ args.effect ],
5288
+
5289
+ // DEPRECATED: remove in 2.0 (#7115)
5290
+ oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];
5291
+
5292
+ if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
5293
+ // delegate to the original method (e.g., .show()) if possible
5294
+ if ( mode ) {
5295
+ return this[ mode ]( args.duration, args.complete );
5296
+ } else {
5297
+ return this.each( function() {
5298
+ if ( args.complete ) {
5299
+ args.complete.call( this );
5300
+ }
5301
+ });
5302
+ }
5303
+ }
5304
+
5305
+ function run( next ) {
5306
+ var elem = $( this ),
5307
+ complete = args.complete,
5308
+ mode = args.mode;
5309
+
5310
+ function done() {
5311
+ if ( $.isFunction( complete ) ) {
5312
+ complete.call( elem[0] );
5313
+ }
5314
+ if ( $.isFunction( next ) ) {
5315
+ next();
5316
+ }
5317
+ }
5318
+
5319
+ // if the element is hiddden and mode is hide,
5320
+ // or element is visible and mode is show
5321
+ if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
5322
+ done();
5323
+ } else {
5324
+ effectMethod.call( elem[0], args, done );
5325
+ }
5326
+ }
5327
+
5328
+ // TODO: remove this check in 2.0, effectMethod will always be true
5329
+ if ( effectMethod ) {
5330
+ return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
5331
+ } else {
5332
+ // DEPRECATED: remove in 2.0 (#7115)
5333
+ return oldEffectMethod.call(this, {
5334
+ options: args,
5335
+ duration: args.duration,
5336
+ callback: args.complete,
5337
+ mode: args.mode
5338
+ });
5339
+ }
5340
+ },
5341
+
5342
+ _show: $.fn.show,
5343
+ show: function( speed ) {
5344
+ if ( standardSpeed( speed ) ) {
5345
+ return this._show.apply( this, arguments );
5346
+ } else {
5347
+ var args = _normalizeArguments.apply( this, arguments );
5348
+ args.mode = "show";
5349
+ return this.effect.call( this, args );
5350
+ }
5351
+ },
5352
+
5353
+ _hide: $.fn.hide,
5354
+ hide: function( speed ) {
5355
+ if ( standardSpeed( speed ) ) {
5356
+ return this._hide.apply( this, arguments );
5357
+ } else {
5358
+ var args = _normalizeArguments.apply( this, arguments );
5359
+ args.mode = "hide";
5360
+ return this.effect.call( this, args );
5361
+ }
5362
+ },
5363
+
5364
+ // jQuery core overloads toggle and creates _toggle
5365
+ __toggle: $.fn.toggle,
5366
+ toggle: function( speed ) {
5367
+ if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
5368
+ return this.__toggle.apply( this, arguments );
5369
+ } else {
5370
+ var args = _normalizeArguments.apply( this, arguments );
5371
+ args.mode = "toggle";
5372
+ return this.effect.call( this, args );
5373
+ }
5374
+ },
5375
+
5376
+ // helper functions
5377
+ cssUnit: function(key) {
5378
+ var style = this.css( key ),
5379
+ val = [];
5380
+
5381
+ $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
5382
+ if ( style.indexOf( unit ) > 0 ) {
5383
+ val = [ parseFloat( style ), unit ];
5384
+ }
5385
+ });
5386
+ return val;
5387
+ }
5388
+ });
5389
+
5390
+ })();
5391
+
5392
+ /******************************************************************************/
5393
+ /*********************************** EASING ***********************************/
5394
+ /******************************************************************************/
5395
+
5396
+ (function() {
5397
+
5398
+ // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
5399
+
5400
+ var baseEasings = {};
5401
+
5402
+ $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
5403
+ baseEasings[ name ] = function( p ) {
5404
+ return Math.pow( p, i + 2 );
5405
+ };
5406
+ });
5407
+
5408
+ $.extend( baseEasings, {
5409
+ Sine: function ( p ) {
5410
+ return 1 - Math.cos( p * Math.PI / 2 );
5411
+ },
5412
+ Circ: function ( p ) {
5413
+ return 1 - Math.sqrt( 1 - p * p );
5414
+ },
5415
+ Elastic: function( p ) {
5416
+ return p === 0 || p === 1 ? p :
5417
+ -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
5418
+ },
5419
+ Back: function( p ) {
5420
+ return p * p * ( 3 * p - 2 );
5421
+ },
5422
+ Bounce: function ( p ) {
5423
+ var pow2,
5424
+ bounce = 4;
5425
+
5426
+ while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
5427
+ return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
5428
+ }
5429
+ });
5430
+
5431
+ $.each( baseEasings, function( name, easeIn ) {
5432
+ $.easing[ "easeIn" + name ] = easeIn;
5433
+ $.easing[ "easeOut" + name ] = function( p ) {
5434
+ return 1 - easeIn( 1 - p );
5435
+ };
5436
+ $.easing[ "easeInOut" + name ] = function( p ) {
5437
+ return p < 0.5 ?
5438
+ easeIn( p * 2 ) / 2 :
5439
+ 1 - easeIn( p * -2 + 2 ) / 2;
5440
+ };
5441
+ });
5442
+
5443
+ })();
5444
+
5445
+ })(jQuery));
5446
+
5447
+ (function( $, undefined ) {
5448
+
5449
+ var uid = 0,
5450
+ hideProps = {},
5451
+ showProps = {};
5452
+
5453
+ hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
5454
+ hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
5455
+ showProps.height = showProps.paddingTop = showProps.paddingBottom =
5456
+ showProps.borderTopWidth = showProps.borderBottomWidth = "show";
5457
+
5458
+ $.widget( "ui.accordion", {
5459
+ version: "1.9.0",
5460
+ options: {
5461
+ active: 0,
5462
+ animate: {},
5463
+ collapsible: false,
5464
+ event: "click",
5465
+ header: "> li > :first-child,> :not(li):even",
5466
+ heightStyle: "auto",
5467
+ icons: {
5468
+ activeHeader: "ui-icon-triangle-1-s",
5469
+ header: "ui-icon-triangle-1-e"
5470
+ },
5471
+
5472
+ // callbacks
5473
+ activate: null,
5474
+ beforeActivate: null
5475
+ },
5476
+
5477
+ _create: function() {
5478
+ var accordionId = this.accordionId = "ui-accordion-" +
5479
+ (this.element.attr( "id" ) || ++uid),
5480
+ options = this.options;
5481
+
5482
+ this.prevShow = this.prevHide = $();
5483
+ this.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
5484
+
5485
+ this.headers = this.element.find( options.header )
5486
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
5487
+ this._hoverable( this.headers );
5488
+ this._focusable( this.headers );
5489
+
5490
+ this.headers.next()
5491
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
5492
+ .hide();
5493
+
5494
+ // don't allow collapsible: false and active: false
5495
+ if ( !options.collapsible && options.active === false ) {
5496
+ options.active = 0;
5497
+ }
5498
+ // handle negative values
5499
+ if ( options.active < 0 ) {
5500
+ options.active += this.headers.length;
5501
+ }
5502
+ this.active = this._findActive( options.active )
5503
+ .addClass( "ui-accordion-header-active ui-state-active" )
5504
+ .toggleClass( "ui-corner-all ui-corner-top" );
5505
+ this.active.next()
5506
+ .addClass( "ui-accordion-content-active" )
5507
+ .show();
5508
+
5509
+ this._createIcons();
5510
+ this.originalHeight = this.element[0].style.height;
5511
+ this.refresh();
5512
+
5513
+ // ARIA
5514
+ this.element.attr( "role", "tablist" );
5515
+
5516
+ this.headers
5517
+ .attr( "role", "tab" )
5518
+ .each(function( i ) {
5519
+ var header = $( this ),
5520
+ headerId = header.attr( "id" ),
5521
+ panel = header.next(),
5522
+ panelId = panel.attr( "id" );
5523
+ if ( !headerId ) {
5524
+ headerId = accordionId + "-header-" + i;
5525
+ header.attr( "id", headerId );
5526
+ }
5527
+ if ( !panelId ) {
5528
+ panelId = accordionId + "-panel-" + i;
5529
+ panel.attr( "id", panelId );
5530
+ }
5531
+ header.attr( "aria-controls", panelId );
5532
+ panel.attr( "aria-labelledby", headerId );
5533
+ })
5534
+ .next()
5535
+ .attr( "role", "tabpanel" );
5536
+
5537
+ this.headers
5538
+ .not( this.active )
5539
+ .attr({
5540
+ "aria-selected": "false",
5541
+ tabIndex: -1
5542
+ })
5543
+ .next()
5544
+ .attr({
5545
+ "aria-expanded": "false",
5546
+ "aria-hidden": "true"
5547
+ })
5548
+ .hide();
5549
+
5550
+ // make sure at least one header is in the tab order
5551
+ if ( !this.active.length ) {
5552
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
5553
+ } else {
5554
+ this.active.attr({
5555
+ "aria-selected": "true",
5556
+ tabIndex: 0
5557
+ })
5558
+ .next()
5559
+ .attr({
5560
+ "aria-expanded": "true",
5561
+ "aria-hidden": "false"
5562
+ });
5563
+ }
5564
+
5565
+ this._on( this.headers, { keydown: "_keydown" });
5566
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" });
5567
+ this._setupEvents( options.event );
5568
+ },
5569
+
5570
+ _getCreateEventData: function() {
5571
+ return {
5572
+ header: this.active,
5573
+ content: !this.active.length ? $() : this.active.next()
5574
+ };
5575
+ },
5576
+
5577
+ _createIcons: function() {
5578
+ var icons = this.options.icons;
5579
+ if ( icons ) {
5580
+ $( "<span>" )
5581
+ .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
5582
+ .prependTo( this.headers );
5583
+ this.active.children( ".ui-accordion-header-icon" )
5584
+ .removeClass( icons.header )
5585
+ .addClass( icons.activeHeader );
5586
+ this.headers.addClass( "ui-accordion-icons" );
5587
+ }
5588
+ },
5589
+
5590
+ _destroyIcons: function() {
5591
+ this.headers
5592
+ .removeClass( "ui-accordion-icons" )
5593
+ .children( ".ui-accordion-header-icon" )
5594
+ .remove();
5595
+ },
5596
+
5597
+ _destroy: function() {
5598
+ var contents;
5599
+
5600
+ // clean up main element
5601
+ this.element
5602
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
5603
+ .removeAttr( "role" );
5604
+
5605
+ // clean up headers
5606
+ this.headers
5607
+ .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
5608
+ .removeAttr( "role" )
5609
+ .removeAttr( "aria-selected" )
5610
+ .removeAttr( "aria-controls" )
5611
+ .removeAttr( "tabIndex" )
5612
+ .each(function() {
5613
+ if ( /^ui-accordion/.test( this.id ) ) {
5614
+ this.removeAttribute( "id" );
5615
+ }
5616
+ });
5617
+ this._destroyIcons();
5618
+
5619
+ // clean up content panels
5620
+ contents = this.headers.next()
5621
+ .css( "display", "" )
5622
+ .removeAttr( "role" )
5623
+ .removeAttr( "aria-expanded" )
5624
+ .removeAttr( "aria-hidden" )
5625
+ .removeAttr( "aria-labelledby" )
5626
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
5627
+ .each(function() {
5628
+ if ( /^ui-accordion/.test( this.id ) ) {
5629
+ this.removeAttribute( "id" );
5630
+ }
5631
+ });
5632
+ if ( this.options.heightStyle !== "content" ) {
5633
+ this.element.css( "height", this.originalHeight );
5634
+ contents.css( "height", "" );
5635
+ }
5636
+ },
5637
+
5638
+ _setOption: function( key, value ) {
5639
+ if ( key === "active" ) {
5640
+ // _activate() will handle invalid values and update this.options
5641
+ this._activate( value );
5642
+ return;
5643
+ }
5644
+
5645
+ if ( key === "event" ) {
5646
+ if ( this.options.event ) {
5647
+ this._off( this.headers, this.options.event );
5648
+ }
5649
+ this._setupEvents( value );
5650
+ }
5651
+
5652
+ this._super( key, value );
5653
+
5654
+ // setting collapsible: false while collapsed; open first panel
5655
+ if ( key === "collapsible" && !value && this.options.active === false ) {
5656
+ this._activate( 0 );
5657
+ }
5658
+
5659
+ if ( key === "icons" ) {
5660
+ this._destroyIcons();
5661
+ if ( value ) {
5662
+ this._createIcons();
5663
+ }
5664
+ }
5665
+
5666
+ // #5332 - opacity doesn't cascade to positioned elements in IE
5667
+ // so we need to add the disabled class to the headers and panels
5668
+ if ( key === "disabled" ) {
5669
+ this.headers.add( this.headers.next() )
5670
+ .toggleClass( "ui-state-disabled", !!value );
5671
+ }
5672
+ },
5673
+
5674
+ _keydown: function( event ) {
5675
+ if ( event.altKey || event.ctrlKey ) {
5676
+ return;
5677
+ }
5678
+
5679
+ var keyCode = $.ui.keyCode,
5680
+ length = this.headers.length,
5681
+ currentIndex = this.headers.index( event.target ),
5682
+ toFocus = false;
5683
+
5684
+ switch ( event.keyCode ) {
5685
+ case keyCode.RIGHT:
5686
+ case keyCode.DOWN:
5687
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
5688
+ break;
5689
+ case keyCode.LEFT:
5690
+ case keyCode.UP:
5691
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
5692
+ break;
5693
+ case keyCode.SPACE:
5694
+ case keyCode.ENTER:
5695
+ this._eventHandler( event );
5696
+ break;
5697
+ case keyCode.HOME:
5698
+ toFocus = this.headers[ 0 ];
5699
+ break;
5700
+ case keyCode.END:
5701
+ toFocus = this.headers[ length - 1 ];
5702
+ break;
5703
+ }
5704
+
5705
+ if ( toFocus ) {
5706
+ $( event.target ).attr( "tabIndex", -1 );
5707
+ $( toFocus ).attr( "tabIndex", 0 );
5708
+ toFocus.focus();
5709
+ event.preventDefault();
5710
+ }
5711
+ },
5712
+
5713
+ _panelKeyDown : function( event ) {
5714
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
5715
+ $( event.currentTarget ).prev().focus();
5716
+ }
5717
+ },
5718
+
5719
+ refresh: function() {
5720
+ var maxHeight, overflow,
5721
+ heightStyle = this.options.heightStyle,
5722
+ parent = this.element.parent();
5723
+
5724
+ this.element.css( "height", this.originalHeight );
5725
+
5726
+ if ( heightStyle === "fill" ) {
5727
+ // IE 6 treats height like minHeight, so we need to turn off overflow
5728
+ // in order to get a reliable height
5729
+ // we use the minHeight support test because we assume that only
5730
+ // browsers that don't support minHeight will treat height as minHeight
5731
+ if ( !$.support.minHeight ) {
5732
+ overflow = parent.css( "overflow" );
5733
+ parent.css( "overflow", "hidden");
5734
+ }
5735
+ maxHeight = parent.height();
5736
+ this.element.siblings( ":visible" ).each(function() {
5737
+ var elem = $( this ),
5738
+ position = elem.css( "position" );
5739
+
5740
+ if ( position === "absolute" || position === "fixed" ) {
5741
+ return;
5742
+ }
5743
+ maxHeight -= elem.outerHeight( true );
5744
+ });
5745
+ if ( overflow ) {
5746
+ parent.css( "overflow", overflow );
5747
+ }
5748
+
5749
+ this.headers.each(function() {
5750
+ maxHeight -= $( this ).outerHeight( true );
5751
+ });
5752
+
5753
+ this.headers.next()
5754
+ .each(function() {
5755
+ $( this ).height( Math.max( 0, maxHeight -
5756
+ $( this ).innerHeight() + $( this ).height() ) );
5757
+ })
5758
+ .css( "overflow", "auto" );
5759
+ } else if ( heightStyle === "auto" ) {
5760
+ maxHeight = 0;
5761
+ this.headers.next()
5762
+ .each(function() {
5763
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
5764
+ })
5765
+ .height( maxHeight );
5766
+ }
5767
+
5768
+ if ( heightStyle !== "content" ) {
5769
+ this.element.height( this.element.height() );
5770
+ }
5771
+ },
5772
+
5773
+ _activate: function( index ) {
5774
+ var active = this._findActive( index )[ 0 ];
5775
+
5776
+ // trying to activate the already active panel
5777
+ if ( active === this.active[ 0 ] ) {
5778
+ return;
5779
+ }
5780
+
5781
+ // trying to collapse, simulate a click on the currently active header
5782
+ active = active || this.active[ 0 ];
5783
+
5784
+ this._eventHandler({
5785
+ target: active,
5786
+ currentTarget: active,
5787
+ preventDefault: $.noop
5788
+ });
5789
+ },
5790
+
5791
+ _findActive: function( selector ) {
5792
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
5793
+ },
5794
+
5795
+ _setupEvents: function( event ) {
5796
+ var events = {};
5797
+ if ( !event ) {
5798
+ return;
5799
+ }
5800
+ $.each( event.split(" "), function( index, eventName ) {
5801
+ events[ eventName ] = "_eventHandler";
5802
+ });
5803
+ this._on( this.headers, events );
5804
+ },
5805
+
5806
+ _eventHandler: function( event ) {
5807
+ var options = this.options,
5808
+ active = this.active,
5809
+ clicked = $( event.currentTarget ),
5810
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
5811
+ collapsing = clickedIsActive && options.collapsible,
5812
+ toShow = collapsing ? $() : clicked.next(),
5813
+ toHide = active.next(),
5814
+ eventData = {
5815
+ oldHeader: active,
5816
+ oldPanel: toHide,
5817
+ newHeader: collapsing ? $() : clicked,
5818
+ newPanel: toShow
5819
+ };
5820
+
5821
+ event.preventDefault();
5822
+
5823
+ if (
5824
+ // click on active header, but not collapsible
5825
+ ( clickedIsActive && !options.collapsible ) ||
5826
+ // allow canceling activation
5827
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
5828
+ return;
5829
+ }
5830
+
5831
+ options.active = collapsing ? false : this.headers.index( clicked );
5832
+
5833
+ // when the call to ._toggle() comes after the class changes
5834
+ // it causes a very odd bug in IE 8 (see #6720)
5835
+ this.active = clickedIsActive ? $() : clicked;
5836
+ this._toggle( eventData );
5837
+
5838
+ // switch classes
5839
+ // corner classes on the previously active header stay after the animation
5840
+ active.removeClass( "ui-accordion-header-active ui-state-active" );
5841
+ if ( options.icons ) {
5842
+ active.children( ".ui-accordion-header-icon" )
5843
+ .removeClass( options.icons.activeHeader )
5844
+ .addClass( options.icons.header );
5845
+ }
5846
+
5847
+ if ( !clickedIsActive ) {
5848
+ clicked
5849
+ .removeClass( "ui-corner-all" )
5850
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
5851
+ if ( options.icons ) {
5852
+ clicked.children( ".ui-accordion-header-icon" )
5853
+ .removeClass( options.icons.header )
5854
+ .addClass( options.icons.activeHeader );
5855
+ }
5856
+
5857
+ clicked
5858
+ .next()
5859
+ .addClass( "ui-accordion-content-active" );
5860
+ }
5861
+ },
5862
+
5863
+ _toggle: function( data ) {
5864
+ var toShow = data.newPanel,
5865
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
5866
+
5867
+ // handle activating a panel during the animation for another activation
5868
+ this.prevShow.add( this.prevHide ).stop( true, true );
5869
+ this.prevShow = toShow;
5870
+ this.prevHide = toHide;
5871
+
5872
+ if ( this.options.animate ) {
5873
+ this._animate( toShow, toHide, data );
5874
+ } else {
5875
+ toHide.hide();
5876
+ toShow.show();
5877
+ this._toggleComplete( data );
5878
+ }
5879
+
5880
+ toHide.attr({
5881
+ "aria-expanded": "false",
5882
+ "aria-hidden": "true"
5883
+ });
5884
+ toHide.prev().attr( "aria-selected", "false" );
5885
+ // if we're switching panels, remove the old header from the tab order
5886
+ // if we're opening from collapsed state, remove the previous header from the tab order
5887
+ // if we're collapsing, then keep the collapsing header in the tab order
5888
+ if ( toShow.length && toHide.length ) {
5889
+ toHide.prev().attr( "tabIndex", -1 );
5890
+ } else if ( toShow.length ) {
5891
+ this.headers.filter(function() {
5892
+ return $( this ).attr( "tabIndex" ) === 0;
5893
+ })
5894
+ .attr( "tabIndex", -1 );
5895
+ }
5896
+
5897
+ toShow
5898
+ .attr({
5899
+ "aria-expanded": "true",
5900
+ "aria-hidden": "false"
5901
+ })
5902
+ .prev()
5903
+ .attr({
5904
+ "aria-selected": "true",
5905
+ tabIndex: 0
5906
+ });
5907
+ },
5908
+
5909
+ _animate: function( toShow, toHide, data ) {
5910
+ var total, easing, duration,
5911
+ that = this,
5912
+ adjust = 0,
5913
+ down = toShow.length &&
5914
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
5915
+ animate = this.options.animate || {},
5916
+ options = down && animate.down || animate,
5917
+ complete = function() {
5918
+ that._toggleComplete( data );
5919
+ };
5920
+
5921
+ if ( typeof options === "number" ) {
5922
+ duration = options;
5923
+ }
5924
+ if ( typeof options === "string" ) {
5925
+ easing = options;
5926
+ }
5927
+ // fall back from options to animation in case of partial down settings
5928
+ easing = easing || options.easing || animate.easing;
5929
+ duration = duration || options.duration || animate.duration;
5930
+
5931
+ if ( !toHide.length ) {
5932
+ return toShow.animate( showProps, duration, easing, complete );
5933
+ }
5934
+ if ( !toShow.length ) {
5935
+ return toHide.animate( hideProps, duration, easing, complete );
5936
+ }
5937
+
5938
+ total = toShow.show().outerHeight();
5939
+ toHide.animate( hideProps, {
5940
+ duration: duration,
5941
+ easing: easing,
5942
+ step: function( now, fx ) {
5943
+ fx.now = Math.round( now );
5944
+ }
5945
+ });
5946
+ toShow
5947
+ .hide()
5948
+ .animate( showProps, {
5949
+ duration: duration,
5950
+ easing: easing,
5951
+ complete: complete,
5952
+ step: function( now, fx ) {
5953
+ fx.now = Math.round( now );
5954
+ if ( fx.prop !== "height" ) {
5955
+ adjust += fx.now;
5956
+ } else if ( that.options.heightStyle !== "content" ) {
5957
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
5958
+ adjust = 0;
5959
+ }
5960
+ }
5961
+ });
5962
+ },
5963
+
5964
+ _toggleComplete: function( data ) {
5965
+ var toHide = data.oldPanel;
5966
+
5967
+ toHide
5968
+ .removeClass( "ui-accordion-content-active" )
5969
+ .prev()
5970
+ .removeClass( "ui-corner-top" )
5971
+ .addClass( "ui-corner-all" );
5972
+
5973
+ // Work around for rendering bug in IE (#5421)
5974
+ if ( toHide.length ) {
5975
+ toHide.parent()[0].className = toHide.parent()[0].className;
5976
+ }
5977
+
5978
+ this._trigger( "activate", null, data );
5979
+ }
5980
+ });
5981
+
5982
+
5983
+
5984
+ // DEPRECATED
5985
+ if ( $.uiBackCompat !== false ) {
5986
+ // navigation options
5987
+ (function( $, prototype ) {
5988
+ $.extend( prototype.options, {
5989
+ navigation: false,
5990
+ navigationFilter: function() {
5991
+ return this.href.toLowerCase() === location.href.toLowerCase();
5992
+ }
5993
+ });
5994
+
5995
+ var _create = prototype._create;
5996
+ prototype._create = function() {
5997
+ if ( this.options.navigation ) {
5998
+ var that = this,
5999
+ headers = this.element.find( this.options.header ),
6000
+ content = headers.next(),
6001
+ current = headers.add( content )
6002
+ .find( "a" )
6003
+ .filter( this.options.navigationFilter )
6004
+ [ 0 ];
6005
+ if ( current ) {
6006
+ headers.add( content ).each( function( index ) {
6007
+ if ( $.contains( this, current ) ) {
6008
+ that.options.active = Math.floor( index / 2 );
6009
+ return false;
6010
+ }
6011
+ });
6012
+ }
6013
+ }
6014
+ _create.call( this );
6015
+ };
6016
+ }( jQuery, jQuery.ui.accordion.prototype ) );
6017
+
6018
+ // height options
6019
+ (function( $, prototype ) {
6020
+ $.extend( prototype.options, {
6021
+ heightStyle: null, // remove default so we fall back to old values
6022
+ autoHeight: true, // use heightStyle: "auto"
6023
+ clearStyle: false, // use heightStyle: "content"
6024
+ fillSpace: false // use heightStyle: "fill"
6025
+ });
6026
+
6027
+ var _create = prototype._create,
6028
+ _setOption = prototype._setOption;
6029
+
6030
+ $.extend( prototype, {
6031
+ _create: function() {
6032
+ this.options.heightStyle = this.options.heightStyle ||
6033
+ this._mergeHeightStyle();
6034
+
6035
+ _create.call( this );
6036
+ },
6037
+
6038
+ _setOption: function( key, value ) {
6039
+ if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
6040
+ this.options.heightStyle = this._mergeHeightStyle();
6041
+ }
6042
+ _setOption.apply( this, arguments );
6043
+ },
6044
+
6045
+ _mergeHeightStyle: function() {
6046
+ var options = this.options;
6047
+
6048
+ if ( options.fillSpace ) {
6049
+ return "fill";
6050
+ }
6051
+
6052
+ if ( options.clearStyle ) {
6053
+ return "content";
6054
+ }
6055
+
6056
+ if ( options.autoHeight ) {
6057
+ return "auto";
6058
+ }
6059
+ }
6060
+ });
6061
+ }( jQuery, jQuery.ui.accordion.prototype ) );
6062
+
6063
+ // icon options
6064
+ (function( $, prototype ) {
6065
+ $.extend( prototype.options.icons, {
6066
+ activeHeader: null, // remove default so we fall back to old values
6067
+ headerSelected: "ui-icon-triangle-1-s"
6068
+ });
6069
+
6070
+ var _createIcons = prototype._createIcons;
6071
+ prototype._createIcons = function() {
6072
+ if ( this.options.icons ) {
6073
+ this.options.icons.activeHeader = this.options.icons.activeHeader ||
6074
+ this.options.icons.headerSelected;
6075
+ }
6076
+ _createIcons.call( this );
6077
+ };
6078
+ }( jQuery, jQuery.ui.accordion.prototype ) );
6079
+
6080
+ // expanded active option, activate method
6081
+ (function( $, prototype ) {
6082
+ prototype.activate = prototype._activate;
6083
+
6084
+ var _findActive = prototype._findActive;
6085
+ prototype._findActive = function( index ) {
6086
+ if ( index === -1 ) {
6087
+ index = false;
6088
+ }
6089
+ if ( index && typeof index !== "number" ) {
6090
+ index = this.headers.index( this.headers.filter( index ) );
6091
+ if ( index === -1 ) {
6092
+ index = false;
6093
+ }
6094
+ }
6095
+ return _findActive.call( this, index );
6096
+ };
6097
+ }( jQuery, jQuery.ui.accordion.prototype ) );
6098
+
6099
+ // resize method
6100
+ jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh;
6101
+
6102
+ // change events
6103
+ (function( $, prototype ) {
6104
+ $.extend( prototype.options, {
6105
+ change: null,
6106
+ changestart: null
6107
+ });
6108
+
6109
+ var _trigger = prototype._trigger;
6110
+ prototype._trigger = function( type, event, data ) {
6111
+ var ret = _trigger.apply( this, arguments );
6112
+ if ( !ret ) {
6113
+ return false;
6114
+ }
6115
+
6116
+ if ( type === "beforeActivate" ) {
6117
+ ret = _trigger.call( this, "changestart", event, {
6118
+ oldHeader: data.oldHeader,
6119
+ oldContent: data.oldPanel,
6120
+ newHeader: data.newHeader,
6121
+ newContent: data.newPanel
6122
+ });
6123
+ } else if ( type === "activate" ) {
6124
+ ret = _trigger.call( this, "change", event, {
6125
+ oldHeader: data.oldHeader,
6126
+ oldContent: data.oldPanel,
6127
+ newHeader: data.newHeader,
6128
+ newContent: data.newPanel
6129
+ });
6130
+ }
6131
+ return ret;
6132
+ };
6133
+ }( jQuery, jQuery.ui.accordion.prototype ) );
6134
+
6135
+ // animated option
6136
+ // NOTE: this only provides support for "slide", "bounceslide", and easings
6137
+ // not the full $.ui.accordion.animations API
6138
+ (function( $, prototype ) {
6139
+ $.extend( prototype.options, {
6140
+ animate: null,
6141
+ animated: "slide"
6142
+ });
6143
+
6144
+ var _create = prototype._create;
6145
+ prototype._create = function() {
6146
+ var options = this.options;
6147
+ if ( options.animate === null ) {
6148
+ if ( !options.animated ) {
6149
+ options.animate = false;
6150
+ } else if ( options.animated === "slide" ) {
6151
+ options.animate = 300;
6152
+ } else if ( options.animated === "bounceslide" ) {
6153
+ options.animate = {
6154
+ duration: 200,
6155
+ down: {
6156
+ easing: "easeOutBounce",
6157
+ duration: 1000
6158
+ }
6159
+ };
6160
+ } else {
6161
+ options.animate = options.animated;
6162
+ }
6163
+ }
6164
+
6165
+ _create.call( this );
6166
+ };
6167
+ }( jQuery, jQuery.ui.accordion.prototype ) );
6168
+ }
6169
+
6170
+ })( jQuery );
6171
+
6172
+ (function( $, undefined ) {
6173
+
6174
+ // used to prevent race conditions with remote data sources
6175
+ var requestIndex = 0;
6176
+
6177
+ $.widget( "ui.autocomplete", {
6178
+ version: "1.9.0",
6179
+ defaultElement: "<input>",
6180
+ options: {
6181
+ appendTo: "body",
6182
+ autoFocus: false,
6183
+ delay: 300,
6184
+ minLength: 1,
6185
+ position: {
6186
+ my: "left top",
6187
+ at: "left bottom",
6188
+ collision: "none"
6189
+ },
6190
+ source: null,
6191
+
6192
+ // callbacks
6193
+ change: null,
6194
+ close: null,
6195
+ focus: null,
6196
+ open: null,
6197
+ response: null,
6198
+ search: null,
6199
+ select: null
6200
+ },
6201
+
6202
+ pending: 0,
6203
+
6204
+ _create: function() {
6205
+ // Some browsers only repeat keydown events, not keypress events,
6206
+ // so we use the suppressKeyPress flag to determine if we've already
6207
+ // handled the keydown event. #7269
6208
+ // Unfortunately the code for & in keypress is the same as the up arrow,
6209
+ // so we use the suppressKeyPressRepeat flag to avoid handling keypress
6210
+ // events when we know the keydown event was used to modify the
6211
+ // search term. #7799
6212
+ var suppressKeyPress, suppressKeyPressRepeat, suppressInput;
6213
+
6214
+ this.isMultiLine = this._isMultiLine();
6215
+ this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
6216
+ this.isNewMenu = true;
6217
+
6218
+ this.element
6219
+ .addClass( "ui-autocomplete-input" )
6220
+ .attr( "autocomplete", "off" );
6221
+
6222
+ this._on({
6223
+ keydown: function( event ) {
6224
+ if ( this.element.prop( "readOnly" ) ) {
6225
+ suppressKeyPress = true;
6226
+ suppressInput = true;
6227
+ suppressKeyPressRepeat = true;
6228
+ return;
6229
+ }
6230
+
6231
+ suppressKeyPress = false;
6232
+ suppressInput = false;
6233
+ suppressKeyPressRepeat = false;
6234
+ var keyCode = $.ui.keyCode;
6235
+ switch( event.keyCode ) {
6236
+ case keyCode.PAGE_UP:
6237
+ suppressKeyPress = true;
6238
+ this._move( "previousPage", event );
6239
+ break;
6240
+ case keyCode.PAGE_DOWN:
6241
+ suppressKeyPress = true;
6242
+ this._move( "nextPage", event );
6243
+ break;
6244
+ case keyCode.UP:
6245
+ suppressKeyPress = true;
6246
+ this._keyEvent( "previous", event );
6247
+ break;
6248
+ case keyCode.DOWN:
6249
+ suppressKeyPress = true;
6250
+ this._keyEvent( "next", event );
6251
+ break;
6252
+ case keyCode.ENTER:
6253
+ case keyCode.NUMPAD_ENTER:
6254
+ // when menu is open and has focus
6255
+ if ( this.menu.active ) {
6256
+ // #6055 - Opera still allows the keypress to occur
6257
+ // which causes forms to submit
6258
+ suppressKeyPress = true;
6259
+ event.preventDefault();
6260
+ this.menu.select( event );
6261
+ }
6262
+ break;
6263
+ case keyCode.TAB:
6264
+ if ( this.menu.active ) {
6265
+ this.menu.select( event );
6266
+ }
6267
+ break;
6268
+ case keyCode.ESCAPE:
6269
+ if ( this.menu.element.is( ":visible" ) ) {
6270
+ this._value( this.term );
6271
+ this.close( event );
6272
+ // Different browsers have different default behavior for escape
6273
+ // Single press can mean undo or clear
6274
+ // Double press in IE means clear the whole form
6275
+ event.preventDefault();
6276
+ }
6277
+ break;
6278
+ default:
6279
+ suppressKeyPressRepeat = true;
6280
+ // search timeout should be triggered before the input value is changed
6281
+ this._searchTimeout( event );
6282
+ break;
6283
+ }
6284
+ },
6285
+ keypress: function( event ) {
6286
+ if ( suppressKeyPress ) {
6287
+ suppressKeyPress = false;
6288
+ event.preventDefault();
6289
+ return;
6290
+ }
6291
+ if ( suppressKeyPressRepeat ) {
6292
+ return;
6293
+ }
6294
+
6295
+ // replicate some key handlers to allow them to repeat in Firefox and Opera
6296
+ var keyCode = $.ui.keyCode;
6297
+ switch( event.keyCode ) {
6298
+ case keyCode.PAGE_UP:
6299
+ this._move( "previousPage", event );
6300
+ break;
6301
+ case keyCode.PAGE_DOWN:
6302
+ this._move( "nextPage", event );
6303
+ break;
6304
+ case keyCode.UP:
6305
+ this._keyEvent( "previous", event );
6306
+ break;
6307
+ case keyCode.DOWN:
6308
+ this._keyEvent( "next", event );
6309
+ break;
6310
+ }
6311
+ },
6312
+ input: function( event ) {
6313
+ if ( suppressInput ) {
6314
+ suppressInput = false;
6315
+ event.preventDefault();
6316
+ return;
6317
+ }
6318
+ this._searchTimeout( event );
6319
+ },
6320
+ focus: function() {
6321
+ this.selectedItem = null;
6322
+ this.previous = this._value();
6323
+ },
6324
+ blur: function( event ) {
6325
+ if ( this.cancelBlur ) {
6326
+ delete this.cancelBlur;
6327
+ return;
6328
+ }
6329
+
6330
+ clearTimeout( this.searching );
6331
+ this.close( event );
6332
+ this._change( event );
6333
+ }
6334
+ });
6335
+
6336
+ this._initSource();
6337
+ this.menu = $( "<ul>" )
6338
+ .addClass( "ui-autocomplete" )
6339
+ .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] )
6340
+ .menu({
6341
+ // custom key handling for now
6342
+ input: $(),
6343
+ // disable ARIA support, the live region takes care of that
6344
+ role: null
6345
+ })
6346
+ .zIndex( this.element.zIndex() + 1 )
6347
+ .hide()
6348
+ .data( "menu" );
6349
+ this._on( this.menu.element, {
6350
+ mousedown: function( event ) {
6351
+ // prevent moving focus out of the text field
6352
+ event.preventDefault();
6353
+
6354
+ // IE doesn't prevent moving focus even with event.preventDefault()
6355
+ // so we set a flag to know when we should ignore the blur event
6356
+ this.cancelBlur = true;
6357
+ this._delay(function() {
6358
+ delete this.cancelBlur;
6359
+ });
6360
+
6361
+ // clicking on the scrollbar causes focus to shift to the body
6362
+ // but we can't detect a mouseup or a click immediately afterward
6363
+ // so we have to track the next mousedown and close the menu if
6364
+ // the user clicks somewhere outside of the autocomplete
6365
+ var menuElement = this.menu.element[ 0 ];
6366
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
6367
+ this._delay(function() {
6368
+ var that = this;
6369
+ this.document.one( "mousedown", function( event ) {
6370
+ if ( event.target !== that.element[ 0 ] &&
6371
+ event.target !== menuElement &&
6372
+ !$.contains( menuElement, event.target ) ) {
6373
+ that.close();
6374
+ }
6375
+ });
6376
+ });
6377
+ }
6378
+ },
6379
+ menufocus: function( event, ui ) {
6380
+ // #7024 - Prevent accidental activation of menu items in Firefox
6381
+ if ( this.isNewMenu ) {
6382
+ this.isNewMenu = false;
6383
+ if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
6384
+ this.menu.blur();
6385
+
6386
+ this.document.one( "mousemove", function() {
6387
+ $( event.target ).trigger( event.originalEvent );
6388
+ });
6389
+
6390
+ return;
6391
+ }
6392
+ }
6393
+
6394
+ // back compat for _renderItem using item.autocomplete, via #7810
6395
+ // TODO remove the fallback, see #8156
6396
+ var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
6397
+ if ( false !== this._trigger( "focus", event, { item: item } ) ) {
6398
+ // use value to match what will end up in the input, if it was a key event
6399
+ if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
6400
+ this._value( item.value );
6401
+ }
6402
+ } else {
6403
+ // Normally the input is populated with the item's value as the
6404
+ // menu is navigated, causing screen readers to notice a change and
6405
+ // announce the item. Since the focus event was canceled, this doesn't
6406
+ // happen, so we update the live region so that screen readers can
6407
+ // still notice the change and announce it.
6408
+ this.liveRegion.text( item.value );
6409
+ }
6410
+ },
6411
+ menuselect: function( event, ui ) {
6412
+ // back compat for _renderItem using item.autocomplete, via #7810
6413
+ // TODO remove the fallback, see #8156
6414
+ var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
6415
+ previous = this.previous;
6416
+
6417
+ // only trigger when focus was lost (click on menu)
6418
+ if ( this.element[0] !== this.document[0].activeElement ) {
6419
+ this.element.focus();
6420
+ this.previous = previous;
6421
+ // #6109 - IE triggers two focus events and the second
6422
+ // is asynchronous, so we need to reset the previous
6423
+ // term synchronously and asynchronously :-(
6424
+ this._delay(function() {
6425
+ this.previous = previous;
6426
+ this.selectedItem = item;
6427
+ });
6428
+ }
6429
+
6430
+ if ( false !== this._trigger( "select", event, { item: item } ) ) {
6431
+ this._value( item.value );
6432
+ }
6433
+ // reset the term after the select event
6434
+ // this allows custom select handling to work properly
6435
+ this.term = this._value();
6436
+
6437
+ this.close( event );
6438
+ this.selectedItem = item;
6439
+ }
6440
+ });
6441
+
6442
+ this.liveRegion = $( "<span>", {
6443
+ role: "status",
6444
+ "aria-live": "polite"
6445
+ })
6446
+ .addClass( "ui-helper-hidden-accessible" )
6447
+ .insertAfter( this.element );
6448
+
6449
+ if ( $.fn.bgiframe ) {
6450
+ this.menu.element.bgiframe();
6451
+ }
6452
+
6453
+ // turning off autocomplete prevents the browser from remembering the
6454
+ // value when navigating through history, so we re-enable autocomplete
6455
+ // if the page is unloaded before the widget is destroyed. #7790
6456
+ this._on( this.window, {
6457
+ beforeunload: function() {
6458
+ this.element.removeAttr( "autocomplete" );
6459
+ }
6460
+ });
6461
+ },
6462
+
6463
+ _destroy: function() {
6464
+ clearTimeout( this.searching );
6465
+ this.element
6466
+ .removeClass( "ui-autocomplete-input" )
6467
+ .removeAttr( "autocomplete" );
6468
+ this.menu.element.remove();
6469
+ this.liveRegion.remove();
6470
+ },
6471
+
6472
+ _setOption: function( key, value ) {
6473
+ this._super( key, value );
6474
+ if ( key === "source" ) {
6475
+ this._initSource();
6476
+ }
6477
+ if ( key === "appendTo" ) {
6478
+ this.menu.element.appendTo( this.document.find( value || "body" )[0] );
6479
+ }
6480
+ if ( key === "disabled" && value && this.xhr ) {
6481
+ this.xhr.abort();
6482
+ }
6483
+ },
6484
+
6485
+ _isMultiLine: function() {
6486
+ // Textareas are always multi-line
6487
+ if ( this.element.is( "textarea" ) ) {
6488
+ return true;
6489
+ }
6490
+ // Inputs are always single-line, even if inside a contentEditable element
6491
+ // IE also treats inputs as contentEditable
6492
+ if ( this.element.is( "input" ) ) {
6493
+ return false;
6494
+ }
6495
+ // All other element types are determined by whether or not they're contentEditable
6496
+ return this.element.prop( "isContentEditable" );
6497
+ },
6498
+
6499
+ _initSource: function() {
6500
+ var array, url,
6501
+ that = this;
6502
+ if ( $.isArray(this.options.source) ) {
6503
+ array = this.options.source;
6504
+ this.source = function( request, response ) {
6505
+ response( $.ui.autocomplete.filter( array, request.term ) );
6506
+ };
6507
+ } else if ( typeof this.options.source === "string" ) {
6508
+ url = this.options.source;
6509
+ this.source = function( request, response ) {
6510
+ if ( that.xhr ) {
6511
+ that.xhr.abort();
6512
+ }
6513
+ that.xhr = $.ajax({
6514
+ url: url,
6515
+ data: request,
6516
+ dataType: "json",
6517
+ success: function( data, status ) {
6518
+ response( data );
6519
+ },
6520
+ error: function() {
6521
+ response( [] );
6522
+ }
6523
+ });
6524
+ };
6525
+ } else {
6526
+ this.source = this.options.source;
6527
+ }
6528
+ },
6529
+
6530
+ _searchTimeout: function( event ) {
6531
+ clearTimeout( this.searching );
6532
+ this.searching = this._delay(function() {
6533
+ // only search if the value has changed
6534
+ if ( this.term !== this._value() ) {
6535
+ this.selectedItem = null;
6536
+ this.search( null, event );
6537
+ }
6538
+ }, this.options.delay );
6539
+ },
6540
+
6541
+ search: function( value, event ) {
6542
+ value = value != null ? value : this._value();
6543
+
6544
+ // always save the actual value, not the one passed as an argument
6545
+ this.term = this._value();
6546
+
6547
+ if ( value.length < this.options.minLength ) {
6548
+ return this.close( event );
6549
+ }
6550
+
6551
+ if ( this._trigger( "search", event ) === false ) {
6552
+ return;
6553
+ }
6554
+
6555
+ return this._search( value );
6556
+ },
6557
+
6558
+ _search: function( value ) {
6559
+ this.pending++;
6560
+ this.element.addClass( "ui-autocomplete-loading" );
6561
+ this.cancelSearch = false;
6562
+
6563
+ this.source( { term: value }, this._response() );
6564
+ },
6565
+
6566
+ _response: function() {
6567
+ var that = this,
6568
+ index = ++requestIndex;
6569
+
6570
+ return function( content ) {
6571
+ if ( index === requestIndex ) {
6572
+ that.__response( content );
6573
+ }
6574
+
6575
+ that.pending--;
6576
+ if ( !that.pending ) {
6577
+ that.element.removeClass( "ui-autocomplete-loading" );
6578
+ }
6579
+ };
6580
+ },
6581
+
6582
+ __response: function( content ) {
6583
+ if ( content ) {
6584
+ content = this._normalize( content );
6585
+ }
6586
+ this._trigger( "response", null, { content: content } );
6587
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
6588
+ this._suggest( content );
6589
+ this._trigger( "open" );
6590
+ } else {
6591
+ // use ._close() instead of .close() so we don't cancel future searches
6592
+ this._close();
6593
+ }
6594
+ },
6595
+
6596
+ close: function( event ) {
6597
+ this.cancelSearch = true;
6598
+ this._close( event );
6599
+ },
6600
+
6601
+ _close: function( event ) {
6602
+ if ( this.menu.element.is( ":visible" ) ) {
6603
+ this.menu.element.hide();
6604
+ this.menu.blur();
6605
+ this.isNewMenu = true;
6606
+ this._trigger( "close", event );
6607
+ }
6608
+ },
6609
+
6610
+ _change: function( event ) {
6611
+ if ( this.previous !== this._value() ) {
6612
+ this._trigger( "change", event, { item: this.selectedItem } );
6613
+ }
6614
+ },
6615
+
6616
+ _normalize: function( items ) {
6617
+ // assume all items have the right format when the first item is complete
6618
+ if ( items.length && items[0].label && items[0].value ) {
6619
+ return items;
6620
+ }
6621
+ return $.map( items, function( item ) {
6622
+ if ( typeof item === "string" ) {
6623
+ return {
6624
+ label: item,
6625
+ value: item
6626
+ };
6627
+ }
6628
+ return $.extend({
6629
+ label: item.label || item.value,
6630
+ value: item.value || item.label
6631
+ }, item );
6632
+ });
6633
+ },
6634
+
6635
+ _suggest: function( items ) {
6636
+ var ul = this.menu.element
6637
+ .empty()
6638
+ .zIndex( this.element.zIndex() + 1 );
6639
+ this._renderMenu( ul, items );
6640
+ this.menu.refresh();
6641
+
6642
+ // size and position menu
6643
+ ul.show();
6644
+ this._resizeMenu();
6645
+ ul.position( $.extend({
6646
+ of: this.element
6647
+ }, this.options.position ));
6648
+
6649
+ if ( this.options.autoFocus ) {
6650
+ this.menu.next();
6651
+ }
6652
+ },
6653
+
6654
+ _resizeMenu: function() {
6655
+ var ul = this.menu.element;
6656
+ ul.outerWidth( Math.max(
6657
+ // Firefox wraps long text (possibly a rounding bug)
6658
+ // so we add 1px to avoid the wrapping (#7513)
6659
+ ul.width( "" ).outerWidth() + 1,
6660
+ this.element.outerWidth()
6661
+ ) );
6662
+ },
6663
+
6664
+ _renderMenu: function( ul, items ) {
6665
+ var that = this;
6666
+ $.each( items, function( index, item ) {
6667
+ that._renderItemData( ul, item );
6668
+ });
6669
+ },
6670
+
6671
+ _renderItemData: function( ul, item ) {
6672
+ return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
6673
+ },
6674
+
6675
+ _renderItem: function( ul, item ) {
6676
+ return $( "<li>" )
6677
+ .append( $( "<a>" ).text( item.label ) )
6678
+ .appendTo( ul );
6679
+ },
6680
+
6681
+ _move: function( direction, event ) {
6682
+ if ( !this.menu.element.is( ":visible" ) ) {
6683
+ this.search( null, event );
6684
+ return;
6685
+ }
6686
+ if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
6687
+ this.menu.isLastItem() && /^next/.test( direction ) ) {
6688
+ this._value( this.term );
6689
+ this.menu.blur();
6690
+ return;
6691
+ }
6692
+ this.menu[ direction ]( event );
6693
+ },
6694
+
6695
+ widget: function() {
6696
+ return this.menu.element;
6697
+ },
6698
+
6699
+ _value: function( value ) {
6700
+ return this.valueMethod.apply( this.element, arguments );
6701
+ },
6702
+
6703
+ _keyEvent: function( keyEvent, event ) {
6704
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
6705
+ this._move( keyEvent, event );
6706
+
6707
+ // prevents moving cursor to beginning/end of the text field in some browsers
6708
+ event.preventDefault();
6709
+ }
6710
+ }
6711
+ });
6712
+
6713
+ $.extend( $.ui.autocomplete, {
6714
+ escapeRegex: function( value ) {
6715
+ return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
6716
+ },
6717
+ filter: function(array, term) {
6718
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
6719
+ return $.grep( array, function(value) {
6720
+ return matcher.test( value.label || value.value || value );
6721
+ });
6722
+ }
6723
+ });
6724
+
6725
+
6726
+ // live region extension, adding a `messages` option
6727
+ // NOTE: This is an experimental API. We are still investigating
6728
+ // a full solution for string manipulation and internationalization.
6729
+ $.widget( "ui.autocomplete", $.ui.autocomplete, {
6730
+ options: {
6731
+ messages: {
6732
+ noResults: "No search results.",
6733
+ results: function( amount ) {
6734
+ return amount + ( amount > 1 ? " results are" : " result is" ) +
6735
+ " available, use up and down arrow keys to navigate.";
6736
+ }
6737
+ }
6738
+ },
6739
+
6740
+ __response: function( content ) {
6741
+ var message;
6742
+ this._superApply( arguments );
6743
+ if ( this.options.disabled || this.cancelSearch ) {
6744
+ return;
6745
+ }
6746
+ if ( content && content.length ) {
6747
+ message = this.options.messages.results( content.length );
6748
+ } else {
6749
+ message = this.options.messages.noResults;
6750
+ }
6751
+ this.liveRegion.text( message );
6752
+ }
6753
+ });
6754
+
6755
+
6756
+ }( jQuery ));
6757
+
6758
+ (function( $, undefined ) {
6759
+
6760
+ var lastActive, startXPos, startYPos, clickDragged,
6761
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
6762
+ stateClasses = "ui-state-hover ui-state-active ",
6763
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
6764
+ formResetHandler = function() {
6765
+ var buttons = $( this ).find( ":ui-button" );
6766
+ setTimeout(function() {
6767
+ buttons.button( "refresh" );
6768
+ }, 1 );
6769
+ },
6770
+ radioGroup = function( radio ) {
6771
+ var name = radio.name,
6772
+ form = radio.form,
6773
+ radios = $( [] );
6774
+ if ( name ) {
6775
+ if ( form ) {
6776
+ radios = $( form ).find( "[name='" + name + "']" );
6777
+ } else {
6778
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
6779
+ .filter(function() {
6780
+ return !this.form;
6781
+ });
6782
+ }
6783
+ }
6784
+ return radios;
6785
+ };
6786
+
6787
+ $.widget( "ui.button", {
6788
+ version: "1.9.0",
6789
+ defaultElement: "<button>",
6790
+ options: {
6791
+ disabled: null,
6792
+ text: true,
6793
+ label: null,
6794
+ icons: {
6795
+ primary: null,
6796
+ secondary: null
6797
+ }
6798
+ },
6799
+ _create: function() {
6800
+ this.element.closest( "form" )
6801
+ .unbind( "reset" + this.eventNamespace )
6802
+ .bind( "reset" + this.eventNamespace, formResetHandler );
6803
+
6804
+ if ( typeof this.options.disabled !== "boolean" ) {
6805
+ this.options.disabled = !!this.element.prop( "disabled" );
6806
+ } else {
6807
+ this.element.prop( "disabled", this.options.disabled );
6808
+ }
6809
+
6810
+ this._determineButtonType();
6811
+ this.hasTitle = !!this.buttonElement.attr( "title" );
6812
+
6813
+ var that = this,
6814
+ options = this.options,
6815
+ toggleButton = this.type === "checkbox" || this.type === "radio",
6816
+ hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
6817
+ focusClass = "ui-state-focus";
6818
+
6819
+ if ( options.label === null ) {
6820
+ options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
6821
+ }
6822
+
6823
+ this.buttonElement
6824
+ .addClass( baseClasses )
6825
+ .attr( "role", "button" )
6826
+ .bind( "mouseenter" + this.eventNamespace, function() {
6827
+ if ( options.disabled ) {
6828
+ return;
6829
+ }
6830
+ $( this ).addClass( "ui-state-hover" );
6831
+ if ( this === lastActive ) {
6832
+ $( this ).addClass( "ui-state-active" );
6833
+ }
6834
+ })
6835
+ .bind( "mouseleave" + this.eventNamespace, function() {
6836
+ if ( options.disabled ) {
6837
+ return;
6838
+ }
6839
+ $( this ).removeClass( hoverClass );
6840
+ })
6841
+ .bind( "click" + this.eventNamespace, function( event ) {
6842
+ if ( options.disabled ) {
6843
+ event.preventDefault();
6844
+ event.stopImmediatePropagation();
6845
+ }
6846
+ });
6847
+
6848
+ this.element
6849
+ .bind( "focus" + this.eventNamespace, function() {
6850
+ // no need to check disabled, focus won't be triggered anyway
6851
+ that.buttonElement.addClass( focusClass );
6852
+ })
6853
+ .bind( "blur" + this.eventNamespace, function() {
6854
+ that.buttonElement.removeClass( focusClass );
6855
+ });
6856
+
6857
+ if ( toggleButton ) {
6858
+ this.element.bind( "change" + this.eventNamespace, function() {
6859
+ if ( clickDragged ) {
6860
+ return;
6861
+ }
6862
+ that.refresh();
6863
+ });
6864
+ // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
6865
+ // prevents issue where button state changes but checkbox/radio checked state
6866
+ // does not in Firefox (see ticket #6970)
6867
+ this.buttonElement
6868
+ .bind( "mousedown" + this.eventNamespace, function( event ) {
6869
+ if ( options.disabled ) {
6870
+ return;
6871
+ }
6872
+ clickDragged = false;
6873
+ startXPos = event.pageX;
6874
+ startYPos = event.pageY;
6875
+ })
6876
+ .bind( "mouseup" + this.eventNamespace, function( event ) {
6877
+ if ( options.disabled ) {
6878
+ return;
6879
+ }
6880
+ if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
6881
+ clickDragged = true;
6882
+ }
6883
+ });
6884
+ }
6885
+
6886
+ if ( this.type === "checkbox" ) {
6887
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
6888
+ if ( options.disabled || clickDragged ) {
6889
+ return false;
6890
+ }
6891
+ $( this ).toggleClass( "ui-state-active" );
6892
+ that.buttonElement.attr( "aria-pressed", that.element[0].checked );
6893
+ });
6894
+ } else if ( this.type === "radio" ) {
6895
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
6896
+ if ( options.disabled || clickDragged ) {
6897
+ return false;
6898
+ }
6899
+ $( this ).addClass( "ui-state-active" );
6900
+ that.buttonElement.attr( "aria-pressed", "true" );
6901
+
6902
+ var radio = that.element[ 0 ];
6903
+ radioGroup( radio )
6904
+ .not( radio )
6905
+ .map(function() {
6906
+ return $( this ).button( "widget" )[ 0 ];
6907
+ })
6908
+ .removeClass( "ui-state-active" )
6909
+ .attr( "aria-pressed", "false" );
6910
+ });
6911
+ } else {
6912
+ this.buttonElement
6913
+ .bind( "mousedown" + this.eventNamespace, function() {
6914
+ if ( options.disabled ) {
6915
+ return false;
6916
+ }
6917
+ $( this ).addClass( "ui-state-active" );
6918
+ lastActive = this;
6919
+ that.document.one( "mouseup", function() {
6920
+ lastActive = null;
6921
+ });
6922
+ })
6923
+ .bind( "mouseup" + this.eventNamespace, function() {
6924
+ if ( options.disabled ) {
6925
+ return false;
6926
+ }
6927
+ $( this ).removeClass( "ui-state-active" );
6928
+ })
6929
+ .bind( "keydown" + this.eventNamespace, function(event) {
6930
+ if ( options.disabled ) {
6931
+ return false;
6932
+ }
6933
+ if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
6934
+ $( this ).addClass( "ui-state-active" );
6935
+ }
6936
+ })
6937
+ .bind( "keyup" + this.eventNamespace, function() {
6938
+ $( this ).removeClass( "ui-state-active" );
6939
+ });
6940
+
6941
+ if ( this.buttonElement.is("a") ) {
6942
+ this.buttonElement.keyup(function(event) {
6943
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
6944
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
6945
+ $( this ).click();
6946
+ }
6947
+ });
6948
+ }
6949
+ }
6950
+
6951
+ // TODO: pull out $.Widget's handling for the disabled option into
6952
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
6953
+ // be overridden by individual plugins
6954
+ this._setOption( "disabled", options.disabled );
6955
+ this._resetButton();
6956
+ },
6957
+
6958
+ _determineButtonType: function() {
6959
+ var ancestor, labelSelector, checked;
6960
+
6961
+ if ( this.element.is("[type=checkbox]") ) {
6962
+ this.type = "checkbox";
6963
+ } else if ( this.element.is("[type=radio]") ) {
6964
+ this.type = "radio";
6965
+ } else if ( this.element.is("input") ) {
6966
+ this.type = "input";
6967
+ } else {
6968
+ this.type = "button";
6969
+ }
6970
+
6971
+ if ( this.type === "checkbox" || this.type === "radio" ) {
6972
+ // we don't search against the document in case the element
6973
+ // is disconnected from the DOM
6974
+ ancestor = this.element.parents().last();
6975
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
6976
+ this.buttonElement = ancestor.find( labelSelector );
6977
+ if ( !this.buttonElement.length ) {
6978
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
6979
+ this.buttonElement = ancestor.filter( labelSelector );
6980
+ if ( !this.buttonElement.length ) {
6981
+ this.buttonElement = ancestor.find( labelSelector );
6982
+ }
6983
+ }
6984
+ this.element.addClass( "ui-helper-hidden-accessible" );
6985
+
6986
+ checked = this.element.is( ":checked" );
6987
+ if ( checked ) {
6988
+ this.buttonElement.addClass( "ui-state-active" );
6989
+ }
6990
+ this.buttonElement.prop( "aria-pressed", checked );
6991
+ } else {
6992
+ this.buttonElement = this.element;
6993
+ }
6994
+ },
6995
+
6996
+ widget: function() {
6997
+ return this.buttonElement;
6998
+ },
6999
+
7000
+ _destroy: function() {
7001
+ this.element
7002
+ .removeClass( "ui-helper-hidden-accessible" );
7003
+ this.buttonElement
7004
+ .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
7005
+ .removeAttr( "role" )
7006
+ .removeAttr( "aria-pressed" )
7007
+ .html( this.buttonElement.find(".ui-button-text").html() );
7008
+
7009
+ if ( !this.hasTitle ) {
7010
+ this.buttonElement.removeAttr( "title" );
7011
+ }
7012
+ },
7013
+
7014
+ _setOption: function( key, value ) {
7015
+ this._super( key, value );
7016
+ if ( key === "disabled" ) {
7017
+ if ( value ) {
7018
+ this.element.prop( "disabled", true );
7019
+ } else {
7020
+ this.element.prop( "disabled", false );
7021
+ }
7022
+ return;
7023
+ }
7024
+ this._resetButton();
7025
+ },
7026
+
7027
+ refresh: function() {
7028
+ var isDisabled = this.element.is( ":disabled" );
7029
+ if ( isDisabled !== this.options.disabled ) {
7030
+ this._setOption( "disabled", isDisabled );
7031
+ }
7032
+ if ( this.type === "radio" ) {
7033
+ radioGroup( this.element[0] ).each(function() {
7034
+ if ( $( this ).is( ":checked" ) ) {
7035
+ $( this ).button( "widget" )
7036
+ .addClass( "ui-state-active" )
7037
+ .attr( "aria-pressed", "true" );
7038
+ } else {
7039
+ $( this ).button( "widget" )
7040
+ .removeClass( "ui-state-active" )
7041
+ .attr( "aria-pressed", "false" );
7042
+ }
7043
+ });
7044
+ } else if ( this.type === "checkbox" ) {
7045
+ if ( this.element.is( ":checked" ) ) {
7046
+ this.buttonElement
7047
+ .addClass( "ui-state-active" )
7048
+ .attr( "aria-pressed", "true" );
7049
+ } else {
7050
+ this.buttonElement
7051
+ .removeClass( "ui-state-active" )
7052
+ .attr( "aria-pressed", "false" );
7053
+ }
7054
+ }
7055
+ },
7056
+
7057
+ _resetButton: function() {
7058
+ if ( this.type === "input" ) {
7059
+ if ( this.options.label ) {
7060
+ this.element.val( this.options.label );
7061
+ }
7062
+ return;
7063
+ }
7064
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
7065
+ buttonText = $( "<span></span>", this.document[0] )
7066
+ .addClass( "ui-button-text" )
7067
+ .html( this.options.label )
7068
+ .appendTo( buttonElement.empty() )
7069
+ .text(),
7070
+ icons = this.options.icons,
7071
+ multipleIcons = icons.primary && icons.secondary,
7072
+ buttonClasses = [];
7073
+
7074
+ if ( icons.primary || icons.secondary ) {
7075
+ if ( this.options.text ) {
7076
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
7077
+ }
7078
+
7079
+ if ( icons.primary ) {
7080
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
7081
+ }
7082
+
7083
+ if ( icons.secondary ) {
7084
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
7085
+ }
7086
+
7087
+ if ( !this.options.text ) {
7088
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
7089
+
7090
+ if ( !this.hasTitle ) {
7091
+ buttonElement.attr( "title", $.trim( buttonText ) );
7092
+ }
7093
+ }
7094
+ } else {
7095
+ buttonClasses.push( "ui-button-text-only" );
7096
+ }
7097
+ buttonElement.addClass( buttonClasses.join( " " ) );
7098
+ }
7099
+ });
7100
+
7101
+ $.widget( "ui.buttonset", {
7102
+ version: "1.9.0",
7103
+ options: {
7104
+ items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"
7105
+ },
7106
+
7107
+ _create: function() {
7108
+ this.element.addClass( "ui-buttonset" );
7109
+ },
7110
+
7111
+ _init: function() {
7112
+ this.refresh();
7113
+ },
7114
+
7115
+ _setOption: function( key, value ) {
7116
+ if ( key === "disabled" ) {
7117
+ this.buttons.button( "option", key, value );
7118
+ }
7119
+
7120
+ this._super( key, value );
7121
+ },
7122
+
7123
+ refresh: function() {
7124
+ var rtl = this.element.css( "direction" ) === "rtl";
7125
+
7126
+ this.buttons = this.element.find( this.options.items )
7127
+ .filter( ":ui-button" )
7128
+ .button( "refresh" )
7129
+ .end()
7130
+ .not( ":ui-button" )
7131
+ .button()
7132
+ .end()
7133
+ .map(function() {
7134
+ return $( this ).button( "widget" )[ 0 ];
7135
+ })
7136
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
7137
+ .filter( ":first" )
7138
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
7139
+ .end()
7140
+ .filter( ":last" )
7141
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
7142
+ .end()
7143
+ .end();
7144
+ },
7145
+
7146
+ _destroy: function() {
7147
+ this.element.removeClass( "ui-buttonset" );
7148
+ this.buttons
7149
+ .map(function() {
7150
+ return $( this ).button( "widget" )[ 0 ];
7151
+ })
7152
+ .removeClass( "ui-corner-left ui-corner-right" )
7153
+ .end()
7154
+ .button( "destroy" );
7155
+ }
7156
+ });
7157
+
7158
+ }( jQuery ) );
7159
+
7160
+ (function( $, undefined ) {
7161
+
7162
+ $.extend($.ui, { datepicker: { version: "1.9.0" } });
7163
+
7164
+ var PROP_NAME = 'datepicker';
7165
+ var dpuuid = new Date().getTime();
7166
+ var instActive;
7167
+
7168
+ /* Date picker manager.
7169
+ Use the singleton instance of this class, $.datepicker, to interact with the date picker.
7170
+ Settings for (groups of) date pickers are maintained in an instance object,
7171
+ allowing multiple different settings on the same page. */
7172
+
7173
+ function Datepicker() {
7174
+ this.debug = false; // Change this to true to start debugging
7175
+ this._curInst = null; // The current instance in use
7176
+ this._keyEvent = false; // If the last event was a key event
7177
+ this._disabledInputs = []; // List of date picker inputs that have been disabled
7178
+ this._datepickerShowing = false; // True if the popup picker is showing , false if not
7179
+ this._inDialog = false; // True if showing within a "dialog", false if not
7180
+ this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
7181
+ this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
7182
+ this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
7183
+ this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
7184
+ this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
7185
+ this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
7186
+ this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
7187
+ this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
7188
+ this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
7189
+ this.regional = []; // Available regional settings, indexed by language code
7190
+ this.regional[''] = { // Default regional settings
7191
+ closeText: 'Done', // Display text for close link
7192
+ prevText: 'Prev', // Display text for previous month link
7193
+ nextText: 'Next', // Display text for next month link
7194
+ currentText: 'Today', // Display text for current month link
7195
+ monthNames: ['January','February','March','April','May','June',
7196
+ 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
7197
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
7198
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
7199
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
7200
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
7201
+ weekHeader: 'Wk', // Column header for week of the year
7202
+ dateFormat: 'mm/dd/yy', // See format options on parseDate
7203
+ firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
7204
+ isRTL: false, // True if right-to-left language, false if left-to-right
7205
+ showMonthAfterYear: false, // True if the year select precedes month, false for month then year
7206
+ yearSuffix: '' // Additional text to append to the year in the month headers
7207
+ };
7208
+ this._defaults = { // Global defaults for all the date picker instances
7209
+ showOn: 'focus', // 'focus' for popup on focus,
7210
+ // 'button' for trigger button, or 'both' for either
7211
+ showAnim: 'fadeIn', // Name of jQuery animation for popup
7212
+ showOptions: {}, // Options for enhanced animations
7213
+ defaultDate: null, // Used when field is blank: actual date,
7214
+ // +/-number for offset from today, null for today
7215
+ appendText: '', // Display text following the input box, e.g. showing the format
7216
+ buttonText: '...', // Text for trigger button
7217
+ buttonImage: '', // URL for trigger button image
7218
+ buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
7219
+ hideIfNoPrevNext: false, // True to hide next/previous month links
7220
+ // if not applicable, false to just disable them
7221
+ navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
7222
+ gotoCurrent: false, // True if today link goes back to current selection instead
7223
+ changeMonth: false, // True if month can be selected directly, false if only prev/next
7224
+ changeYear: false, // True if year can be selected directly, false if only prev/next
7225
+ yearRange: 'c-10:c+10', // Range of years to display in drop-down,
7226
+ // either relative to today's year (-nn:+nn), relative to currently displayed year
7227
+ // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
7228
+ showOtherMonths: false, // True to show dates in other months, false to leave blank
7229
+ selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
7230
+ showWeek: false, // True to show week of the year, false to not show it
7231
+ calculateWeek: this.iso8601Week, // How to calculate the week of the year,
7232
+ // takes a Date and returns the number of the week for it
7233
+ shortYearCutoff: '+10', // Short year values < this are in the current century,
7234
+ // > this are in the previous century,
7235
+ // string value starting with '+' for current year + value
7236
+ minDate: null, // The earliest selectable date, or null for no limit
7237
+ maxDate: null, // The latest selectable date, or null for no limit
7238
+ duration: 'fast', // Duration of display/closure
7239
+ beforeShowDay: null, // Function that takes a date and returns an array with
7240
+ // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
7241
+ // [2] = cell title (optional), e.g. $.datepicker.noWeekends
7242
+ beforeShow: null, // Function that takes an input field and
7243
+ // returns a set of custom settings for the date picker
7244
+ onSelect: null, // Define a callback function when a date is selected
7245
+ onChangeMonthYear: null, // Define a callback function when the month or year is changed
7246
+ onClose: null, // Define a callback function when the datepicker is closed
7247
+ numberOfMonths: 1, // Number of months to show at a time
7248
+ showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
7249
+ stepMonths: 1, // Number of months to step back/forward
7250
+ stepBigMonths: 12, // Number of months to step back/forward for the big links
7251
+ altField: '', // Selector for an alternate field to store selected dates into
7252
+ altFormat: '', // The date format to use for the alternate field
7253
+ constrainInput: true, // The input is constrained by the current date format
7254
+ showButtonPanel: false, // True to show button panel, false to not show it
7255
+ autoSize: false, // True to size the input for the date format, false to leave as is
7256
+ disabled: false // The initial disabled state
7257
+ };
7258
+ $.extend(this._defaults, this.regional['']);
7259
+ this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
7260
+ }
7261
+
7262
+ $.extend(Datepicker.prototype, {
7263
+ /* Class name added to elements to indicate already configured with a date picker. */
7264
+ markerClassName: 'hasDatepicker',
7265
+
7266
+ //Keep track of the maximum number of rows displayed (see #7043)
7267
+ maxRows: 4,
7268
+
7269
+ /* Debug logging (if enabled). */
7270
+ log: function () {
7271
+ if (this.debug)
7272
+ console.log.apply('', arguments);
7273
+ },
7274
+
7275
+ // TODO rename to "widget" when switching to widget factory
7276
+ _widgetDatepicker: function() {
7277
+ return this.dpDiv;
7278
+ },
7279
+
7280
+ /* Override the default settings for all instances of the date picker.
7281
+ @param settings object - the new settings to use as defaults (anonymous object)
7282
+ @return the manager object */
7283
+ setDefaults: function(settings) {
7284
+ extendRemove(this._defaults, settings || {});
7285
+ return this;
7286
+ },
7287
+
7288
+ /* Attach the date picker to a jQuery selection.
7289
+ @param target element - the target input field or division or span
7290
+ @param settings object - the new settings to use for this date picker instance (anonymous) */
7291
+ _attachDatepicker: function(target, settings) {
7292
+ // check for settings on the control itself - in namespace 'date:'
7293
+ var inlineSettings = null;
7294
+ for (var attrName in this._defaults) {
7295
+ var attrValue = target.getAttribute('date:' + attrName);
7296
+ if (attrValue) {
7297
+ inlineSettings = inlineSettings || {};
7298
+ try {
7299
+ inlineSettings[attrName] = eval(attrValue);
7300
+ } catch (err) {
7301
+ inlineSettings[attrName] = attrValue;
7302
+ }
7303
+ }
7304
+ }
7305
+ var nodeName = target.nodeName.toLowerCase();
7306
+ var inline = (nodeName == 'div' || nodeName == 'span');
7307
+ if (!target.id) {
7308
+ this.uuid += 1;
7309
+ target.id = 'dp' + this.uuid;
7310
+ }
7311
+ var inst = this._newInst($(target), inline);
7312
+ inst.settings = $.extend({}, settings || {}, inlineSettings || {});
7313
+ if (nodeName == 'input') {
7314
+ this._connectDatepicker(target, inst);
7315
+ } else if (inline) {
7316
+ this._inlineDatepicker(target, inst);
7317
+ }
7318
+ },
7319
+
7320
+ /* Create a new instance object. */
7321
+ _newInst: function(target, inline) {
7322
+ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
7323
+ return {id: id, input: target, // associated target
7324
+ selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
7325
+ drawMonth: 0, drawYear: 0, // month being drawn
7326
+ inline: inline, // is datepicker inline or not
7327
+ dpDiv: (!inline ? this.dpDiv : // presentation div
7328
+ bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))};
7329
+ },
7330
+
7331
+ /* Attach the date picker to an input field. */
7332
+ _connectDatepicker: function(target, inst) {
7333
+ var input = $(target);
7334
+ inst.append = $([]);
7335
+ inst.trigger = $([]);
7336
+ if (input.hasClass(this.markerClassName))
7337
+ return;
7338
+ this._attachments(input, inst);
7339
+ input.addClass(this.markerClassName).keydown(this._doKeyDown).
7340
+ keypress(this._doKeyPress).keyup(this._doKeyUp).
7341
+ bind("setData.datepicker", function(event, key, value) {
7342
+ inst.settings[key] = value;
7343
+ }).bind("getData.datepicker", function(event, key) {
7344
+ return this._get(inst, key);
7345
+ });
7346
+ this._autoSize(inst);
7347
+ $.data(target, PROP_NAME, inst);
7348
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
7349
+ if( inst.settings.disabled ) {
7350
+ this._disableDatepicker( target );
7351
+ }
7352
+ },
7353
+
7354
+ /* Make attachments based on settings. */
7355
+ _attachments: function(input, inst) {
7356
+ var appendText = this._get(inst, 'appendText');
7357
+ var isRTL = this._get(inst, 'isRTL');
7358
+ if (inst.append)
7359
+ inst.append.remove();
7360
+ if (appendText) {
7361
+ inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
7362
+ input[isRTL ? 'before' : 'after'](inst.append);
7363
+ }
7364
+ input.unbind('focus', this._showDatepicker);
7365
+ if (inst.trigger)
7366
+ inst.trigger.remove();
7367
+ var showOn = this._get(inst, 'showOn');
7368
+ if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
7369
+ input.focus(this._showDatepicker);
7370
+ if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
7371
+ var buttonText = this._get(inst, 'buttonText');
7372
+ var buttonImage = this._get(inst, 'buttonImage');
7373
+ inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
7374
+ $('<img/>').addClass(this._triggerClass).
7375
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
7376
+ $('<button type="button"></button>').addClass(this._triggerClass).
7377
+ html(buttonImage == '' ? buttonText : $('<img/>').attr(
7378
+ { src:buttonImage, alt:buttonText, title:buttonText })));
7379
+ input[isRTL ? 'before' : 'after'](inst.trigger);
7380
+ inst.trigger.click(function() {
7381
+ if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
7382
+ $.datepicker._hideDatepicker();
7383
+ else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
7384
+ $.datepicker._hideDatepicker();
7385
+ $.datepicker._showDatepicker(input[0]);
7386
+ } else
7387
+ $.datepicker._showDatepicker(input[0]);
7388
+ return false;
7389
+ });
7390
+ }
7391
+ },
7392
+
7393
+ /* Apply the maximum length for the date format. */
7394
+ _autoSize: function(inst) {
7395
+ if (this._get(inst, 'autoSize') && !inst.inline) {
7396
+ var date = new Date(2009, 12 - 1, 20); // Ensure double digits
7397
+ var dateFormat = this._get(inst, 'dateFormat');
7398
+ if (dateFormat.match(/[DM]/)) {
7399
+ var findMax = function(names) {
7400
+ var max = 0;
7401
+ var maxI = 0;
7402
+ for (var i = 0; i < names.length; i++) {
7403
+ if (names[i].length > max) {
7404
+ max = names[i].length;
7405
+ maxI = i;
7406
+ }
7407
+ }
7408
+ return maxI;
7409
+ };
7410
+ date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
7411
+ 'monthNames' : 'monthNamesShort'))));
7412
+ date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
7413
+ 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
7414
+ }
7415
+ inst.input.attr('size', this._formatDate(inst, date).length);
7416
+ }
7417
+ },
7418
+
7419
+ /* Attach an inline date picker to a div. */
7420
+ _inlineDatepicker: function(target, inst) {
7421
+ var divSpan = $(target);
7422
+ if (divSpan.hasClass(this.markerClassName))
7423
+ return;
7424
+ divSpan.addClass(this.markerClassName).append(inst.dpDiv).
7425
+ bind("setData.datepicker", function(event, key, value){
7426
+ inst.settings[key] = value;
7427
+ }).bind("getData.datepicker", function(event, key){
7428
+ return this._get(inst, key);
7429
+ });
7430
+ $.data(target, PROP_NAME, inst);
7431
+ this._setDate(inst, this._getDefaultDate(inst), true);
7432
+ this._updateDatepicker(inst);
7433
+ this._updateAlternate(inst);
7434
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
7435
+ if( inst.settings.disabled ) {
7436
+ this._disableDatepicker( target );
7437
+ }
7438
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
7439
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
7440
+ inst.dpDiv.css( "display", "block" );
7441
+ },
7442
+
7443
+ /* Pop-up the date picker in a "dialog" box.
7444
+ @param input element - ignored
7445
+ @param date string or Date - the initial date to display
7446
+ @param onSelect function - the function to call when a date is selected
7447
+ @param settings object - update the dialog date picker instance's settings (anonymous object)
7448
+ @param pos int[2] - coordinates for the dialog's position within the screen or
7449
+ event - with x/y coordinates or
7450
+ leave empty for default (screen centre)
7451
+ @return the manager object */
7452
+ _dialogDatepicker: function(input, date, onSelect, settings, pos) {
7453
+ var inst = this._dialogInst; // internal instance
7454
+ if (!inst) {
7455
+ this.uuid += 1;
7456
+ var id = 'dp' + this.uuid;
7457
+ this._dialogInput = $('<input type="text" id="' + id +
7458
+ '" style="position: absolute; top: -100px; width: 0px;"/>');
7459
+ this._dialogInput.keydown(this._doKeyDown);
7460
+ $('body').append(this._dialogInput);
7461
+ inst = this._dialogInst = this._newInst(this._dialogInput, false);
7462
+ inst.settings = {};
7463
+ $.data(this._dialogInput[0], PROP_NAME, inst);
7464
+ }
7465
+ extendRemove(inst.settings, settings || {});
7466
+ date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
7467
+ this._dialogInput.val(date);
7468
+
7469
+ this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
7470
+ if (!this._pos) {
7471
+ var browserWidth = document.documentElement.clientWidth;
7472
+ var browserHeight = document.documentElement.clientHeight;
7473
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
7474
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
7475
+ this._pos = // should use actual width/height below
7476
+ [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
7477
+ }
7478
+
7479
+ // move input on screen for focus, but hidden behind dialog
7480
+ this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
7481
+ inst.settings.onSelect = onSelect;
7482
+ this._inDialog = true;
7483
+ this.dpDiv.addClass(this._dialogClass);
7484
+ this._showDatepicker(this._dialogInput[0]);
7485
+ if ($.blockUI)
7486
+ $.blockUI(this.dpDiv);
7487
+ $.data(this._dialogInput[0], PROP_NAME, inst);
7488
+ return this;
7489
+ },
7490
+
7491
+ /* Detach a datepicker from its control.
7492
+ @param target element - the target input field or division or span */
7493
+ _destroyDatepicker: function(target) {
7494
+ var $target = $(target);
7495
+ var inst = $.data(target, PROP_NAME);
7496
+ if (!$target.hasClass(this.markerClassName)) {
7497
+ return;
7498
+ }
7499
+ var nodeName = target.nodeName.toLowerCase();
7500
+ $.removeData(target, PROP_NAME);
7501
+ if (nodeName == 'input') {
7502
+ inst.append.remove();
7503
+ inst.trigger.remove();
7504
+ $target.removeClass(this.markerClassName).
7505
+ unbind('focus', this._showDatepicker).
7506
+ unbind('keydown', this._doKeyDown).
7507
+ unbind('keypress', this._doKeyPress).
7508
+ unbind('keyup', this._doKeyUp);
7509
+ } else if (nodeName == 'div' || nodeName == 'span')
7510
+ $target.removeClass(this.markerClassName).empty();
7511
+ },
7512
+
7513
+ /* Enable the date picker to a jQuery selection.
7514
+ @param target element - the target input field or division or span */
7515
+ _enableDatepicker: function(target) {
7516
+ var $target = $(target);
7517
+ var inst = $.data(target, PROP_NAME);
7518
+ if (!$target.hasClass(this.markerClassName)) {
7519
+ return;
7520
+ }
7521
+ var nodeName = target.nodeName.toLowerCase();
7522
+ if (nodeName == 'input') {
7523
+ target.disabled = false;
7524
+ inst.trigger.filter('button').
7525
+ each(function() { this.disabled = false; }).end().
7526
+ filter('img').css({opacity: '1.0', cursor: ''});
7527
+ }
7528
+ else if (nodeName == 'div' || nodeName == 'span') {
7529
+ var inline = $target.children('.' + this._inlineClass);
7530
+ inline.children().removeClass('ui-state-disabled');
7531
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
7532
+ prop("disabled", false);
7533
+ }
7534
+ this._disabledInputs = $.map(this._disabledInputs,
7535
+ function(value) { return (value == target ? null : value); }); // delete entry
7536
+ },
7537
+
7538
+ /* Disable the date picker to a jQuery selection.
7539
+ @param target element - the target input field or division or span */
7540
+ _disableDatepicker: function(target) {
7541
+ var $target = $(target);
7542
+ var inst = $.data(target, PROP_NAME);
7543
+ if (!$target.hasClass(this.markerClassName)) {
7544
+ return;
7545
+ }
7546
+ var nodeName = target.nodeName.toLowerCase();
7547
+ if (nodeName == 'input') {
7548
+ target.disabled = true;
7549
+ inst.trigger.filter('button').
7550
+ each(function() { this.disabled = true; }).end().
7551
+ filter('img').css({opacity: '0.5', cursor: 'default'});
7552
+ }
7553
+ else if (nodeName == 'div' || nodeName == 'span') {
7554
+ var inline = $target.children('.' + this._inlineClass);
7555
+ inline.children().addClass('ui-state-disabled');
7556
+ inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
7557
+ prop("disabled", true);
7558
+ }
7559
+ this._disabledInputs = $.map(this._disabledInputs,
7560
+ function(value) { return (value == target ? null : value); }); // delete entry
7561
+ this._disabledInputs[this._disabledInputs.length] = target;
7562
+ },
7563
+
7564
+ /* Is the first field in a jQuery collection disabled as a datepicker?
7565
+ @param target element - the target input field or division or span
7566
+ @return boolean - true if disabled, false if enabled */
7567
+ _isDisabledDatepicker: function(target) {
7568
+ if (!target) {
7569
+ return false;
7570
+ }
7571
+ for (var i = 0; i < this._disabledInputs.length; i++) {
7572
+ if (this._disabledInputs[i] == target)
7573
+ return true;
7574
+ }
7575
+ return false;
7576
+ },
7577
+
7578
+ /* Retrieve the instance data for the target control.
7579
+ @param target element - the target input field or division or span
7580
+ @return object - the associated instance data
7581
+ @throws error if a jQuery problem getting data */
7582
+ _getInst: function(target) {
7583
+ try {
7584
+ return $.data(target, PROP_NAME);
7585
+ }
7586
+ catch (err) {
7587
+ throw 'Missing instance data for this datepicker';
7588
+ }
7589
+ },
7590
+
7591
+ /* Update or retrieve the settings for a date picker attached to an input field or division.
7592
+ @param target element - the target input field or division or span
7593
+ @param name object - the new settings to update or
7594
+ string - the name of the setting to change or retrieve,
7595
+ when retrieving also 'all' for all instance settings or
7596
+ 'defaults' for all global defaults
7597
+ @param value any - the new value for the setting
7598
+ (omit if above is an object or to retrieve a value) */
7599
+ _optionDatepicker: function(target, name, value) {
7600
+ var inst = this._getInst(target);
7601
+ if (arguments.length == 2 && typeof name == 'string') {
7602
+ return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
7603
+ (inst ? (name == 'all' ? $.extend({}, inst.settings) :
7604
+ this._get(inst, name)) : null));
7605
+ }
7606
+ var settings = name || {};
7607
+ if (typeof name == 'string') {
7608
+ settings = {};
7609
+ settings[name] = value;
7610
+ }
7611
+ if (inst) {
7612
+ if (this._curInst == inst) {
7613
+ this._hideDatepicker();
7614
+ }
7615
+ var date = this._getDateDatepicker(target, true);
7616
+ var minDate = this._getMinMaxDate(inst, 'min');
7617
+ var maxDate = this._getMinMaxDate(inst, 'max');
7618
+ extendRemove(inst.settings, settings);
7619
+ // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
7620
+ if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
7621
+ inst.settings.minDate = this._formatDate(inst, minDate);
7622
+ if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
7623
+ inst.settings.maxDate = this._formatDate(inst, maxDate);
7624
+ this._attachments($(target), inst);
7625
+ this._autoSize(inst);
7626
+ this._setDate(inst, date);
7627
+ this._updateAlternate(inst);
7628
+ this._updateDatepicker(inst);
7629
+ }
7630
+ },
7631
+
7632
+ // change method deprecated
7633
+ _changeDatepicker: function(target, name, value) {
7634
+ this._optionDatepicker(target, name, value);
7635
+ },
7636
+
7637
+ /* Redraw the date picker attached to an input field or division.
7638
+ @param target element - the target input field or division or span */
7639
+ _refreshDatepicker: function(target) {
7640
+ var inst = this._getInst(target);
7641
+ if (inst) {
7642
+ this._updateDatepicker(inst);
7643
+ }
7644
+ },
7645
+
7646
+ /* Set the dates for a jQuery selection.
7647
+ @param target element - the target input field or division or span
7648
+ @param date Date - the new date */
7649
+ _setDateDatepicker: function(target, date) {
7650
+ var inst = this._getInst(target);
7651
+ if (inst) {
7652
+ this._setDate(inst, date);
7653
+ this._updateDatepicker(inst);
7654
+ this._updateAlternate(inst);
7655
+ }
7656
+ },
7657
+
7658
+ /* Get the date(s) for the first entry in a jQuery selection.
7659
+ @param target element - the target input field or division or span
7660
+ @param noDefault boolean - true if no default date is to be used
7661
+ @return Date - the current date */
7662
+ _getDateDatepicker: function(target, noDefault) {
7663
+ var inst = this._getInst(target);
7664
+ if (inst && !inst.inline)
7665
+ this._setDateFromField(inst, noDefault);
7666
+ return (inst ? this._getDate(inst) : null);
7667
+ },
7668
+
7669
+ /* Handle keystrokes. */
7670
+ _doKeyDown: function(event) {
7671
+ var inst = $.datepicker._getInst(event.target);
7672
+ var handled = true;
7673
+ var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
7674
+ inst._keyEvent = true;
7675
+ if ($.datepicker._datepickerShowing)
7676
+ switch (event.keyCode) {
7677
+ case 9: $.datepicker._hideDatepicker();
7678
+ handled = false;
7679
+ break; // hide on tab out
7680
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
7681
+ $.datepicker._currentClass + ')', inst.dpDiv);
7682
+ if (sel[0])
7683
+ $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
7684
+ var onSelect = $.datepicker._get(inst, 'onSelect');
7685
+ if (onSelect) {
7686
+ var dateStr = $.datepicker._formatDate(inst);
7687
+
7688
+ // trigger custom callback
7689
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
7690
+ }
7691
+ else
7692
+ $.datepicker._hideDatepicker();
7693
+ return false; // don't submit the form
7694
+ break; // select the value on enter
7695
+ case 27: $.datepicker._hideDatepicker();
7696
+ break; // hide on escape
7697
+ case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
7698
+ -$.datepicker._get(inst, 'stepBigMonths') :
7699
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
7700
+ break; // previous month/year on page up/+ ctrl
7701
+ case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
7702
+ +$.datepicker._get(inst, 'stepBigMonths') :
7703
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
7704
+ break; // next month/year on page down/+ ctrl
7705
+ case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
7706
+ handled = event.ctrlKey || event.metaKey;
7707
+ break; // clear on ctrl or command +end
7708
+ case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
7709
+ handled = event.ctrlKey || event.metaKey;
7710
+ break; // current on ctrl or command +home
7711
+ case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
7712
+ handled = event.ctrlKey || event.metaKey;
7713
+ // -1 day on ctrl or command +left
7714
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
7715
+ -$.datepicker._get(inst, 'stepBigMonths') :
7716
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
7717
+ // next month/year on alt +left on Mac
7718
+ break;
7719
+ case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
7720
+ handled = event.ctrlKey || event.metaKey;
7721
+ break; // -1 week on ctrl or command +up
7722
+ case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
7723
+ handled = event.ctrlKey || event.metaKey;
7724
+ // +1 day on ctrl or command +right
7725
+ if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
7726
+ +$.datepicker._get(inst, 'stepBigMonths') :
7727
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
7728
+ // next month/year on alt +right
7729
+ break;
7730
+ case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
7731
+ handled = event.ctrlKey || event.metaKey;
7732
+ break; // +1 week on ctrl or command +down
7733
+ default: handled = false;
7734
+ }
7735
+ else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
7736
+ $.datepicker._showDatepicker(this);
7737
+ else {
7738
+ handled = false;
7739
+ }
7740
+ if (handled) {
7741
+ event.preventDefault();
7742
+ event.stopPropagation();
7743
+ }
7744
+ },
7745
+
7746
+ /* Filter entered characters - based on date format. */
7747
+ _doKeyPress: function(event) {
7748
+ var inst = $.datepicker._getInst(event.target);
7749
+ if ($.datepicker._get(inst, 'constrainInput')) {
7750
+ var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
7751
+ var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
7752
+ return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
7753
+ }
7754
+ },
7755
+
7756
+ /* Synchronise manual entry and field/alternate field. */
7757
+ _doKeyUp: function(event) {
7758
+ var inst = $.datepicker._getInst(event.target);
7759
+ if (inst.input.val() != inst.lastVal) {
7760
+ try {
7761
+ var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
7762
+ (inst.input ? inst.input.val() : null),
7763
+ $.datepicker._getFormatConfig(inst));
7764
+ if (date) { // only if valid
7765
+ $.datepicker._setDateFromField(inst);
7766
+ $.datepicker._updateAlternate(inst);
7767
+ $.datepicker._updateDatepicker(inst);
7768
+ }
7769
+ }
7770
+ catch (err) {
7771
+ $.datepicker.log(err);
7772
+ }
7773
+ }
7774
+ return true;
7775
+ },
7776
+
7777
+ /* Pop-up the date picker for a given input field.
7778
+ If false returned from beforeShow event handler do not show.
7779
+ @param input element - the input field attached to the date picker or
7780
+ event - if triggered by focus */
7781
+ _showDatepicker: function(input) {
7782
+ input = input.target || input;
7783
+ if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
7784
+ input = $('input', input.parentNode)[0];
7785
+ if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
7786
+ return;
7787
+ var inst = $.datepicker._getInst(input);
7788
+ if ($.datepicker._curInst && $.datepicker._curInst != inst) {
7789
+ $.datepicker._curInst.dpDiv.stop(true, true);
7790
+ if ( inst && $.datepicker._datepickerShowing ) {
7791
+ $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
7792
+ }
7793
+ }
7794
+ var beforeShow = $.datepicker._get(inst, 'beforeShow');
7795
+ var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
7796
+ if(beforeShowSettings === false){
7797
+ //false
7798
+ return;
7799
+ }
7800
+ extendRemove(inst.settings, beforeShowSettings);
7801
+ inst.lastVal = null;
7802
+ $.datepicker._lastInput = input;
7803
+ $.datepicker._setDateFromField(inst);
7804
+ if ($.datepicker._inDialog) // hide cursor
7805
+ input.value = '';
7806
+ if (!$.datepicker._pos) { // position below input
7807
+ $.datepicker._pos = $.datepicker._findPos(input);
7808
+ $.datepicker._pos[1] += input.offsetHeight; // add the height
7809
+ }
7810
+ var isFixed = false;
7811
+ $(input).parents().each(function() {
7812
+ isFixed |= $(this).css('position') == 'fixed';
7813
+ return !isFixed;
7814
+ });
7815
+ var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
7816
+ $.datepicker._pos = null;
7817
+ //to avoid flashes on Firefox
7818
+ inst.dpDiv.empty();
7819
+ // determine sizing offscreen
7820
+ inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
7821
+ $.datepicker._updateDatepicker(inst);
7822
+ // fix width for dynamic number of date pickers
7823
+ // and adjust position before showing
7824
+ offset = $.datepicker._checkOffset(inst, offset, isFixed);
7825
+ inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
7826
+ 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
7827
+ left: offset.left + 'px', top: offset.top + 'px'});
7828
+ if (!inst.inline) {
7829
+ var showAnim = $.datepicker._get(inst, 'showAnim');
7830
+ var duration = $.datepicker._get(inst, 'duration');
7831
+ var postProcess = function() {
7832
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
7833
+ if( !! cover.length ){
7834
+ var borders = $.datepicker._getBorders(inst.dpDiv);
7835
+ cover.css({left: -borders[0], top: -borders[1],
7836
+ width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
7837
+ }
7838
+ };
7839
+ inst.dpDiv.zIndex($(input).zIndex()+1);
7840
+ $.datepicker._datepickerShowing = true;
7841
+
7842
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
7843
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
7844
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
7845
+ else
7846
+ inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
7847
+ if (!showAnim || !duration)
7848
+ postProcess();
7849
+ if (inst.input.is(':visible') && !inst.input.is(':disabled'))
7850
+ inst.input.focus();
7851
+ $.datepicker._curInst = inst;
7852
+ }
7853
+ },
7854
+
7855
+ /* Generate the date picker content. */
7856
+ _updateDatepicker: function(inst) {
7857
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
7858
+ var borders = $.datepicker._getBorders(inst.dpDiv);
7859
+ instActive = inst; // for delegate hover events
7860
+ inst.dpDiv.empty().append(this._generateHTML(inst));
7861
+ this._attachHandlers(inst);
7862
+ var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
7863
+ if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
7864
+ cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
7865
+ }
7866
+ inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
7867
+ var numMonths = this._getNumberOfMonths(inst);
7868
+ var cols = numMonths[1];
7869
+ var width = 17;
7870
+ inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
7871
+ if (cols > 1)
7872
+ inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
7873
+ inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
7874
+ 'Class']('ui-datepicker-multi');
7875
+ inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
7876
+ 'Class']('ui-datepicker-rtl');
7877
+ if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
7878
+ // #6694 - don't focus the input if it's already focused
7879
+ // this breaks the change event in IE
7880
+ inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
7881
+ inst.input.focus();
7882
+ // deffered render of the years select (to avoid flashes on Firefox)
7883
+ if( inst.yearshtml ){
7884
+ var origyearshtml = inst.yearshtml;
7885
+ setTimeout(function(){
7886
+ //assure that inst.yearshtml didn't change.
7887
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
7888
+ inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
7889
+ }
7890
+ origyearshtml = inst.yearshtml = null;
7891
+ }, 0);
7892
+ }
7893
+ },
7894
+
7895
+ /* Retrieve the size of left and top borders for an element.
7896
+ @param elem (jQuery object) the element of interest
7897
+ @return (number[2]) the left and top borders */
7898
+ _getBorders: function(elem) {
7899
+ var convert = function(value) {
7900
+ return {thin: 1, medium: 2, thick: 3}[value] || value;
7901
+ };
7902
+ return [parseFloat(convert(elem.css('border-left-width'))),
7903
+ parseFloat(convert(elem.css('border-top-width')))];
7904
+ },
7905
+
7906
+ /* Check positioning to remain on screen. */
7907
+ _checkOffset: function(inst, offset, isFixed) {
7908
+ var dpWidth = inst.dpDiv.outerWidth();
7909
+ var dpHeight = inst.dpDiv.outerHeight();
7910
+ var inputWidth = inst.input ? inst.input.outerWidth() : 0;
7911
+ var inputHeight = inst.input ? inst.input.outerHeight() : 0;
7912
+ var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft());
7913
+ var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
7914
+
7915
+ offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
7916
+ offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
7917
+ offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
7918
+
7919
+ // now check if datepicker is showing outside window viewport - move to a better place if so.
7920
+ offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
7921
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
7922
+ offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
7923
+ Math.abs(dpHeight + inputHeight) : 0);
7924
+
7925
+ return offset;
7926
+ },
7927
+
7928
+ /* Find an object's position on the screen. */
7929
+ _findPos: function(obj) {
7930
+ var inst = this._getInst(obj);
7931
+ var isRTL = this._get(inst, 'isRTL');
7932
+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
7933
+ obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
7934
+ }
7935
+ var position = $(obj).offset();
7936
+ return [position.left, position.top];
7937
+ },
7938
+
7939
+ /* Hide the date picker from view.
7940
+ @param input element - the input field attached to the date picker */
7941
+ _hideDatepicker: function(input) {
7942
+ var inst = this._curInst;
7943
+ if (!inst || (input && inst != $.data(input, PROP_NAME)))
7944
+ return;
7945
+ if (this._datepickerShowing) {
7946
+ var showAnim = this._get(inst, 'showAnim');
7947
+ var duration = this._get(inst, 'duration');
7948
+ var postProcess = function() {
7949
+ $.datepicker._tidyDialog(inst);
7950
+ };
7951
+
7952
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
7953
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
7954
+ inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
7955
+ else
7956
+ inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
7957
+ (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
7958
+ if (!showAnim)
7959
+ postProcess();
7960
+ this._datepickerShowing = false;
7961
+ var onClose = this._get(inst, 'onClose');
7962
+ if (onClose)
7963
+ onClose.apply((inst.input ? inst.input[0] : null),
7964
+ [(inst.input ? inst.input.val() : ''), inst]);
7965
+ this._lastInput = null;
7966
+ if (this._inDialog) {
7967
+ this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
7968
+ if ($.blockUI) {
7969
+ $.unblockUI();
7970
+ $('body').append(this.dpDiv);
7971
+ }
7972
+ }
7973
+ this._inDialog = false;
7974
+ }
7975
+ },
7976
+
7977
+ /* Tidy up after a dialog display. */
7978
+ _tidyDialog: function(inst) {
7979
+ inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
7980
+ },
7981
+
7982
+ /* Close date picker if clicked elsewhere. */
7983
+ _checkExternalClick: function(event) {
7984
+ if (!$.datepicker._curInst)
7985
+ return;
7986
+
7987
+ var $target = $(event.target),
7988
+ inst = $.datepicker._getInst($target[0]);
7989
+
7990
+ if ( ( ( $target[0].id != $.datepicker._mainDivId &&
7991
+ $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
7992
+ !$target.hasClass($.datepicker.markerClassName) &&
7993
+ !$target.closest("." + $.datepicker._triggerClass).length &&
7994
+ $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
7995
+ ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
7996
+ $.datepicker._hideDatepicker();
7997
+ },
7998
+
7999
+ /* Adjust one of the date sub-fields. */
8000
+ _adjustDate: function(id, offset, period) {
8001
+ var target = $(id);
8002
+ var inst = this._getInst(target[0]);
8003
+ if (this._isDisabledDatepicker(target[0])) {
8004
+ return;
8005
+ }
8006
+ this._adjustInstDate(inst, offset +
8007
+ (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
8008
+ period);
8009
+ this._updateDatepicker(inst);
8010
+ },
8011
+
8012
+ /* Action for current link. */
8013
+ _gotoToday: function(id) {
8014
+ var target = $(id);
8015
+ var inst = this._getInst(target[0]);
8016
+ if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
8017
+ inst.selectedDay = inst.currentDay;
8018
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth;
8019
+ inst.drawYear = inst.selectedYear = inst.currentYear;
8020
+ }
8021
+ else {
8022
+ var date = new Date();
8023
+ inst.selectedDay = date.getDate();
8024
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
8025
+ inst.drawYear = inst.selectedYear = date.getFullYear();
8026
+ }
8027
+ this._notifyChange(inst);
8028
+ this._adjustDate(target);
8029
+ },
8030
+
8031
+ /* Action for selecting a new month/year. */
8032
+ _selectMonthYear: function(id, select, period) {
8033
+ var target = $(id);
8034
+ var inst = this._getInst(target[0]);
8035
+ inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
8036
+ inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
8037
+ parseInt(select.options[select.selectedIndex].value,10);
8038
+ this._notifyChange(inst);
8039
+ this._adjustDate(target);
8040
+ },
8041
+
8042
+ /* Action for selecting a day. */
8043
+ _selectDay: function(id, month, year, td) {
8044
+ var target = $(id);
8045
+ if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
8046
+ return;
8047
+ }
8048
+ var inst = this._getInst(target[0]);
8049
+ inst.selectedDay = inst.currentDay = $('a', td).html();
8050
+ inst.selectedMonth = inst.currentMonth = month;
8051
+ inst.selectedYear = inst.currentYear = year;
8052
+ this._selectDate(id, this._formatDate(inst,
8053
+ inst.currentDay, inst.currentMonth, inst.currentYear));
8054
+ },
8055
+
8056
+ /* Erase the input field and hide the date picker. */
8057
+ _clearDate: function(id) {
8058
+ var target = $(id);
8059
+ var inst = this._getInst(target[0]);
8060
+ this._selectDate(target, '');
8061
+ },
8062
+
8063
+ /* Update the input field with the selected date. */
8064
+ _selectDate: function(id, dateStr) {
8065
+ var target = $(id);
8066
+ var inst = this._getInst(target[0]);
8067
+ dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
8068
+ if (inst.input)
8069
+ inst.input.val(dateStr);
8070
+ this._updateAlternate(inst);
8071
+ var onSelect = this._get(inst, 'onSelect');
8072
+ if (onSelect)
8073
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
8074
+ else if (inst.input)
8075
+ inst.input.trigger('change'); // fire the change event
8076
+ if (inst.inline)
8077
+ this._updateDatepicker(inst);
8078
+ else {
8079
+ this._hideDatepicker();
8080
+ this._lastInput = inst.input[0];
8081
+ if (typeof(inst.input[0]) != 'object')
8082
+ inst.input.focus(); // restore focus
8083
+ this._lastInput = null;
8084
+ }
8085
+ },
8086
+
8087
+ /* Update any alternate field to synchronise with the main field. */
8088
+ _updateAlternate: function(inst) {
8089
+ var altField = this._get(inst, 'altField');
8090
+ if (altField) { // update alternate field too
8091
+ var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
8092
+ var date = this._getDate(inst);
8093
+ var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
8094
+ $(altField).each(function() { $(this).val(dateStr); });
8095
+ }
8096
+ },
8097
+
8098
+ /* Set as beforeShowDay function to prevent selection of weekends.
8099
+ @param date Date - the date to customise
8100
+ @return [boolean, string] - is this date selectable?, what is its CSS class? */
8101
+ noWeekends: function(date) {
8102
+ var day = date.getDay();
8103
+ return [(day > 0 && day < 6), ''];
8104
+ },
8105
+
8106
+ /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
8107
+ @param date Date - the date to get the week for
8108
+ @return number - the number of the week within the year that contains this date */
8109
+ iso8601Week: function(date) {
8110
+ var checkDate = new Date(date.getTime());
8111
+ // Find Thursday of this week starting on Monday
8112
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
8113
+ var time = checkDate.getTime();
8114
+ checkDate.setMonth(0); // Compare with Jan 1
8115
+ checkDate.setDate(1);
8116
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
8117
+ },
8118
+
8119
+ /* Parse a string value into a date object.
8120
+ See formatDate below for the possible formats.
8121
+
8122
+ @param format string - the expected format of the date
8123
+ @param value string - the date in the above format
8124
+ @param settings Object - attributes include:
8125
+ shortYearCutoff number - the cutoff year for determining the century (optional)
8126
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
8127
+ dayNames string[7] - names of the days from Sunday (optional)
8128
+ monthNamesShort string[12] - abbreviated names of the months (optional)
8129
+ monthNames string[12] - names of the months (optional)
8130
+ @return Date - the extracted date value or null if value is blank */
8131
+ parseDate: function (format, value, settings) {
8132
+ if (format == null || value == null)
8133
+ throw 'Invalid arguments';
8134
+ value = (typeof value == 'object' ? value.toString() : value + '');
8135
+ if (value == '')
8136
+ return null;
8137
+ var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
8138
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
8139
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
8140
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
8141
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
8142
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
8143
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
8144
+ var year = -1;
8145
+ var month = -1;
8146
+ var day = -1;
8147
+ var doy = -1;
8148
+ var literal = false;
8149
+ // Check whether a format character is doubled
8150
+ var lookAhead = function(match) {
8151
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
8152
+ if (matches)
8153
+ iFormat++;
8154
+ return matches;
8155
+ };
8156
+ // Extract a number from the string value
8157
+ var getNumber = function(match) {
8158
+ var isDoubled = lookAhead(match);
8159
+ var size = (match == '@' ? 14 : (match == '!' ? 20 :
8160
+ (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
8161
+ var digits = new RegExp('^\\d{1,' + size + '}');
8162
+ var num = value.substring(iValue).match(digits);
8163
+ if (!num)
8164
+ throw 'Missing number at position ' + iValue;
8165
+ iValue += num[0].length;
8166
+ return parseInt(num[0], 10);
8167
+ };
8168
+ // Extract a name from the string value and convert to an index
8169
+ var getName = function(match, shortNames, longNames) {
8170
+ var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
8171
+ return [ [k, v] ];
8172
+ }).sort(function (a, b) {
8173
+ return -(a[1].length - b[1].length);
8174
+ });
8175
+ var index = -1;
8176
+ $.each(names, function (i, pair) {
8177
+ var name = pair[1];
8178
+ if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
8179
+ index = pair[0];
8180
+ iValue += name.length;
8181
+ return false;
8182
+ }
8183
+ });
8184
+ if (index != -1)
8185
+ return index + 1;
8186
+ else
8187
+ throw 'Unknown name at position ' + iValue;
8188
+ };
8189
+ // Confirm that a literal character matches the string value
8190
+ var checkLiteral = function() {
8191
+ if (value.charAt(iValue) != format.charAt(iFormat))
8192
+ throw 'Unexpected literal at position ' + iValue;
8193
+ iValue++;
8194
+ };
8195
+ var iValue = 0;
8196
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
8197
+ if (literal)
8198
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
8199
+ literal = false;
8200
+ else
8201
+ checkLiteral();
8202
+ else
8203
+ switch (format.charAt(iFormat)) {
8204
+ case 'd':
8205
+ day = getNumber('d');
8206
+ break;
8207
+ case 'D':
8208
+ getName('D', dayNamesShort, dayNames);
8209
+ break;
8210
+ case 'o':
8211
+ doy = getNumber('o');
8212
+ break;
8213
+ case 'm':
8214
+ month = getNumber('m');
8215
+ break;
8216
+ case 'M':
8217
+ month = getName('M', monthNamesShort, monthNames);
8218
+ break;
8219
+ case 'y':
8220
+ year = getNumber('y');
8221
+ break;
8222
+ case '@':
8223
+ var date = new Date(getNumber('@'));
8224
+ year = date.getFullYear();
8225
+ month = date.getMonth() + 1;
8226
+ day = date.getDate();
8227
+ break;
8228
+ case '!':
8229
+ var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
8230
+ year = date.getFullYear();
8231
+ month = date.getMonth() + 1;
8232
+ day = date.getDate();
8233
+ break;
8234
+ case "'":
8235
+ if (lookAhead("'"))
8236
+ checkLiteral();
8237
+ else
8238
+ literal = true;
8239
+ break;
8240
+ default:
8241
+ checkLiteral();
8242
+ }
8243
+ }
8244
+ if (iValue < value.length){
8245
+ var extra = value.substr(iValue);
8246
+ if (!/^\s+/.test(extra)) {
8247
+ throw "Extra/unparsed characters found in date: " + extra;
8248
+ }
8249
+ }
8250
+ if (year == -1)
8251
+ year = new Date().getFullYear();
8252
+ else if (year < 100)
8253
+ year += new Date().getFullYear() - new Date().getFullYear() % 100 +
8254
+ (year <= shortYearCutoff ? 0 : -100);
8255
+ if (doy > -1) {
8256
+ month = 1;
8257
+ day = doy;
8258
+ do {
8259
+ var dim = this._getDaysInMonth(year, month - 1);
8260
+ if (day <= dim)
8261
+ break;
8262
+ month++;
8263
+ day -= dim;
8264
+ } while (true);
8265
+ }
8266
+ var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
8267
+ if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
8268
+ throw 'Invalid date'; // E.g. 31/02/00
8269
+ return date;
8270
+ },
8271
+
8272
+ /* Standard date formats. */
8273
+ ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
8274
+ COOKIE: 'D, dd M yy',
8275
+ ISO_8601: 'yy-mm-dd',
8276
+ RFC_822: 'D, d M y',
8277
+ RFC_850: 'DD, dd-M-y',
8278
+ RFC_1036: 'D, d M y',
8279
+ RFC_1123: 'D, d M yy',
8280
+ RFC_2822: 'D, d M yy',
8281
+ RSS: 'D, d M y', // RFC 822
8282
+ TICKS: '!',
8283
+ TIMESTAMP: '@',
8284
+ W3C: 'yy-mm-dd', // ISO 8601
8285
+
8286
+ _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
8287
+ Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
8288
+
8289
+ /* Format a date object into a string value.
8290
+ The format can be combinations of the following:
8291
+ d - day of month (no leading zero)
8292
+ dd - day of month (two digit)
8293
+ o - day of year (no leading zeros)
8294
+ oo - day of year (three digit)
8295
+ D - day name short
8296
+ DD - day name long
8297
+ m - month of year (no leading zero)
8298
+ mm - month of year (two digit)
8299
+ M - month name short
8300
+ MM - month name long
8301
+ y - year (two digit)
8302
+ yy - year (four digit)
8303
+ @ - Unix timestamp (ms since 01/01/1970)
8304
+ ! - Windows ticks (100ns since 01/01/0001)
8305
+ '...' - literal text
8306
+ '' - single quote
8307
+
8308
+ @param format string - the desired format of the date
8309
+ @param date Date - the date value to format
8310
+ @param settings Object - attributes include:
8311
+ dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
8312
+ dayNames string[7] - names of the days from Sunday (optional)
8313
+ monthNamesShort string[12] - abbreviated names of the months (optional)
8314
+ monthNames string[12] - names of the months (optional)
8315
+ @return string - the date in the above format */
8316
+ formatDate: function (format, date, settings) {
8317
+ if (!date)
8318
+ return '';
8319
+ var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
8320
+ var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
8321
+ var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
8322
+ var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
8323
+ // Check whether a format character is doubled
8324
+ var lookAhead = function(match) {
8325
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
8326
+ if (matches)
8327
+ iFormat++;
8328
+ return matches;
8329
+ };
8330
+ // Format a number, with leading zero if necessary
8331
+ var formatNumber = function(match, value, len) {
8332
+ var num = '' + value;
8333
+ if (lookAhead(match))
8334
+ while (num.length < len)
8335
+ num = '0' + num;
8336
+ return num;
8337
+ };
8338
+ // Format a name, short or long as requested
8339
+ var formatName = function(match, value, shortNames, longNames) {
8340
+ return (lookAhead(match) ? longNames[value] : shortNames[value]);
8341
+ };
8342
+ var output = '';
8343
+ var literal = false;
8344
+ if (date)
8345
+ for (var iFormat = 0; iFormat < format.length; iFormat++) {
8346
+ if (literal)
8347
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
8348
+ literal = false;
8349
+ else
8350
+ output += format.charAt(iFormat);
8351
+ else
8352
+ switch (format.charAt(iFormat)) {
8353
+ case 'd':
8354
+ output += formatNumber('d', date.getDate(), 2);
8355
+ break;
8356
+ case 'D':
8357
+ output += formatName('D', date.getDay(), dayNamesShort, dayNames);
8358
+ break;
8359
+ case 'o':
8360
+ output += formatNumber('o',
8361
+ Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
8362
+ break;
8363
+ case 'm':
8364
+ output += formatNumber('m', date.getMonth() + 1, 2);
8365
+ break;
8366
+ case 'M':
8367
+ output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
8368
+ break;
8369
+ case 'y':
8370
+ output += (lookAhead('y') ? date.getFullYear() :
8371
+ (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
8372
+ break;
8373
+ case '@':
8374
+ output += date.getTime();
8375
+ break;
8376
+ case '!':
8377
+ output += date.getTime() * 10000 + this._ticksTo1970;
8378
+ break;
8379
+ case "'":
8380
+ if (lookAhead("'"))
8381
+ output += "'";
8382
+ else
8383
+ literal = true;
8384
+ break;
8385
+ default:
8386
+ output += format.charAt(iFormat);
8387
+ }
8388
+ }
8389
+ return output;
8390
+ },
8391
+
8392
+ /* Extract all possible characters from the date format. */
8393
+ _possibleChars: function (format) {
8394
+ var chars = '';
8395
+ var literal = false;
8396
+ // Check whether a format character is doubled
8397
+ var lookAhead = function(match) {
8398
+ var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
8399
+ if (matches)
8400
+ iFormat++;
8401
+ return matches;
8402
+ };
8403
+ for (var iFormat = 0; iFormat < format.length; iFormat++)
8404
+ if (literal)
8405
+ if (format.charAt(iFormat) == "'" && !lookAhead("'"))
8406
+ literal = false;
8407
+ else
8408
+ chars += format.charAt(iFormat);
8409
+ else
8410
+ switch (format.charAt(iFormat)) {
8411
+ case 'd': case 'm': case 'y': case '@':
8412
+ chars += '0123456789';
8413
+ break;
8414
+ case 'D': case 'M':
8415
+ return null; // Accept anything
8416
+ case "'":
8417
+ if (lookAhead("'"))
8418
+ chars += "'";
8419
+ else
8420
+ literal = true;
8421
+ break;
8422
+ default:
8423
+ chars += format.charAt(iFormat);
8424
+ }
8425
+ return chars;
8426
+ },
8427
+
8428
+ /* Get a setting value, defaulting if necessary. */
8429
+ _get: function(inst, name) {
8430
+ return inst.settings[name] !== undefined ?
8431
+ inst.settings[name] : this._defaults[name];
8432
+ },
8433
+
8434
+ /* Parse existing date and initialise date picker. */
8435
+ _setDateFromField: function(inst, noDefault) {
8436
+ if (inst.input.val() == inst.lastVal) {
8437
+ return;
8438
+ }
8439
+ var dateFormat = this._get(inst, 'dateFormat');
8440
+ var dates = inst.lastVal = inst.input ? inst.input.val() : null;
8441
+ var date, defaultDate;
8442
+ date = defaultDate = this._getDefaultDate(inst);
8443
+ var settings = this._getFormatConfig(inst);
8444
+ try {
8445
+ date = this.parseDate(dateFormat, dates, settings) || defaultDate;
8446
+ } catch (event) {
8447
+ this.log(event);
8448
+ dates = (noDefault ? '' : dates);
8449
+ }
8450
+ inst.selectedDay = date.getDate();
8451
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
8452
+ inst.drawYear = inst.selectedYear = date.getFullYear();
8453
+ inst.currentDay = (dates ? date.getDate() : 0);
8454
+ inst.currentMonth = (dates ? date.getMonth() : 0);
8455
+ inst.currentYear = (dates ? date.getFullYear() : 0);
8456
+ this._adjustInstDate(inst);
8457
+ },
8458
+
8459
+ /* Retrieve the default date shown on opening. */
8460
+ _getDefaultDate: function(inst) {
8461
+ return this._restrictMinMax(inst,
8462
+ this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
8463
+ },
8464
+
8465
+ /* A date may be specified as an exact value or a relative one. */
8466
+ _determineDate: function(inst, date, defaultDate) {
8467
+ var offsetNumeric = function(offset) {
8468
+ var date = new Date();
8469
+ date.setDate(date.getDate() + offset);
8470
+ return date;
8471
+ };
8472
+ var offsetString = function(offset) {
8473
+ try {
8474
+ return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
8475
+ offset, $.datepicker._getFormatConfig(inst));
8476
+ }
8477
+ catch (e) {
8478
+ // Ignore
8479
+ }
8480
+ var date = (offset.toLowerCase().match(/^c/) ?
8481
+ $.datepicker._getDate(inst) : null) || new Date();
8482
+ var year = date.getFullYear();
8483
+ var month = date.getMonth();
8484
+ var day = date.getDate();
8485
+ var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
8486
+ var matches = pattern.exec(offset);
8487
+ while (matches) {
8488
+ switch (matches[2] || 'd') {
8489
+ case 'd' : case 'D' :
8490
+ day += parseInt(matches[1],10); break;
8491
+ case 'w' : case 'W' :
8492
+ day += parseInt(matches[1],10) * 7; break;
8493
+ case 'm' : case 'M' :
8494
+ month += parseInt(matches[1],10);
8495
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
8496
+ break;
8497
+ case 'y': case 'Y' :
8498
+ year += parseInt(matches[1],10);
8499
+ day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
8500
+ break;
8501
+ }
8502
+ matches = pattern.exec(offset);
8503
+ }
8504
+ return new Date(year, month, day);
8505
+ };
8506
+ var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
8507
+ (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
8508
+ newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
8509
+ if (newDate) {
8510
+ newDate.setHours(0);
8511
+ newDate.setMinutes(0);
8512
+ newDate.setSeconds(0);
8513
+ newDate.setMilliseconds(0);
8514
+ }
8515
+ return this._daylightSavingAdjust(newDate);
8516
+ },
8517
+
8518
+ /* Handle switch to/from daylight saving.
8519
+ Hours may be non-zero on daylight saving cut-over:
8520
+ > 12 when midnight changeover, but then cannot generate
8521
+ midnight datetime, so jump to 1AM, otherwise reset.
8522
+ @param date (Date) the date to check
8523
+ @return (Date) the corrected date */
8524
+ _daylightSavingAdjust: function(date) {
8525
+ if (!date) return null;
8526
+ date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
8527
+ return date;
8528
+ },
8529
+
8530
+ /* Set the date(s) directly. */
8531
+ _setDate: function(inst, date, noChange) {
8532
+ var clear = !date;
8533
+ var origMonth = inst.selectedMonth;
8534
+ var origYear = inst.selectedYear;
8535
+ var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
8536
+ inst.selectedDay = inst.currentDay = newDate.getDate();
8537
+ inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
8538
+ inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
8539
+ if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
8540
+ this._notifyChange(inst);
8541
+ this._adjustInstDate(inst);
8542
+ if (inst.input) {
8543
+ inst.input.val(clear ? '' : this._formatDate(inst));
8544
+ }
8545
+ },
8546
+
8547
+ /* Retrieve the date(s) directly. */
8548
+ _getDate: function(inst) {
8549
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
8550
+ this._daylightSavingAdjust(new Date(
8551
+ inst.currentYear, inst.currentMonth, inst.currentDay)));
8552
+ return startDate;
8553
+ },
8554
+
8555
+ /* Attach the onxxx handlers. These are declared statically so
8556
+ * they work with static code transformers like Caja.
8557
+ */
8558
+ _attachHandlers: function(inst) {
8559
+ var stepMonths = this._get(inst, 'stepMonths');
8560
+ var id = '#' + inst.id.replace( /\\\\/g, "\\" );
8561
+ inst.dpDiv.find('[data-handler]').map(function () {
8562
+ var handler = {
8563
+ prev: function () {
8564
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M');
8565
+ },
8566
+ next: function () {
8567
+ window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M');
8568
+ },
8569
+ hide: function () {
8570
+ window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker();
8571
+ },
8572
+ today: function () {
8573
+ window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id);
8574
+ },
8575
+ selectDay: function () {
8576
+ window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this);
8577
+ return false;
8578
+ },
8579
+ selectMonth: function () {
8580
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M');
8581
+ return false;
8582
+ },
8583
+ selectYear: function () {
8584
+ window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y');
8585
+ return false;
8586
+ }
8587
+ };
8588
+ $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
8589
+ });
8590
+ },
8591
+
8592
+ /* Generate the HTML for the current state of the date picker. */
8593
+ _generateHTML: function(inst) {
8594
+ var today = new Date();
8595
+ today = this._daylightSavingAdjust(
8596
+ new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
8597
+ var isRTL = this._get(inst, 'isRTL');
8598
+ var showButtonPanel = this._get(inst, 'showButtonPanel');
8599
+ var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
8600
+ var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
8601
+ var numMonths = this._getNumberOfMonths(inst);
8602
+ var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
8603
+ var stepMonths = this._get(inst, 'stepMonths');
8604
+ var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
8605
+ var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
8606
+ new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
8607
+ var minDate = this._getMinMaxDate(inst, 'min');
8608
+ var maxDate = this._getMinMaxDate(inst, 'max');
8609
+ var drawMonth = inst.drawMonth - showCurrentAtPos;
8610
+ var drawYear = inst.drawYear;
8611
+ if (drawMonth < 0) {
8612
+ drawMonth += 12;
8613
+ drawYear--;
8614
+ }
8615
+ if (maxDate) {
8616
+ var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
8617
+ maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
8618
+ maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
8619
+ while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
8620
+ drawMonth--;
8621
+ if (drawMonth < 0) {
8622
+ drawMonth = 11;
8623
+ drawYear--;
8624
+ }
8625
+ }
8626
+ }
8627
+ inst.drawMonth = drawMonth;
8628
+ inst.drawYear = drawYear;
8629
+ var prevText = this._get(inst, 'prevText');
8630
+ prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
8631
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
8632
+ this._getFormatConfig(inst)));
8633
+ var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
8634
+ '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' +
8635
+ ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
8636
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
8637
+ var nextText = this._get(inst, 'nextText');
8638
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
8639
+ this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
8640
+ this._getFormatConfig(inst)));
8641
+ var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
8642
+ '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' +
8643
+ ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
8644
+ (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
8645
+ var currentText = this._get(inst, 'currentText');
8646
+ var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
8647
+ currentText = (!navigationAsDateFormat ? currentText :
8648
+ this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
8649
+ var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' +
8650
+ this._get(inst, 'closeText') + '</button>' : '');
8651
+ var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
8652
+ (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
8653
+ '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
8654
+ var firstDay = parseInt(this._get(inst, 'firstDay'),10);
8655
+ firstDay = (isNaN(firstDay) ? 0 : firstDay);
8656
+ var showWeek = this._get(inst, 'showWeek');
8657
+ var dayNames = this._get(inst, 'dayNames');
8658
+ var dayNamesShort = this._get(inst, 'dayNamesShort');
8659
+ var dayNamesMin = this._get(inst, 'dayNamesMin');
8660
+ var monthNames = this._get(inst, 'monthNames');
8661
+ var monthNamesShort = this._get(inst, 'monthNamesShort');
8662
+ var beforeShowDay = this._get(inst, 'beforeShowDay');
8663
+ var showOtherMonths = this._get(inst, 'showOtherMonths');
8664
+ var selectOtherMonths = this._get(inst, 'selectOtherMonths');
8665
+ var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
8666
+ var defaultDate = this._getDefaultDate(inst);
8667
+ var html = '';
8668
+ for (var row = 0; row < numMonths[0]; row++) {
8669
+ var group = '';
8670
+ this.maxRows = 4;
8671
+ for (var col = 0; col < numMonths[1]; col++) {
8672
+ var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
8673
+ var cornerClass = ' ui-corner-all';
8674
+ var calender = '';
8675
+ if (isMultiMonth) {
8676
+ calender += '<div class="ui-datepicker-group';
8677
+ if (numMonths[1] > 1)
8678
+ switch (col) {
8679
+ case 0: calender += ' ui-datepicker-group-first';
8680
+ cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
8681
+ case numMonths[1]-1: calender += ' ui-datepicker-group-last';
8682
+ cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
8683
+ default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
8684
+ }
8685
+ calender += '">';
8686
+ }
8687
+ calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
8688
+ (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
8689
+ (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
8690
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
8691
+ row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
8692
+ '</div><table class="ui-datepicker-calendar"><thead>' +
8693
+ '<tr>';
8694
+ var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
8695
+ for (var dow = 0; dow < 7; dow++) { // days of the week
8696
+ var day = (dow + firstDay) % 7;
8697
+ thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
8698
+ '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
8699
+ }
8700
+ calender += thead + '</tr></thead><tbody>';
8701
+ var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
8702
+ if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
8703
+ inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
8704
+ var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
8705
+ var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
8706
+ var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
8707
+ this.maxRows = numRows;
8708
+ var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
8709
+ for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
8710
+ calender += '<tr>';
8711
+ var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
8712
+ this._get(inst, 'calculateWeek')(printDate) + '</td>');
8713
+ for (var dow = 0; dow < 7; dow++) { // create date picker days
8714
+ var daySettings = (beforeShowDay ?
8715
+ beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
8716
+ var otherMonth = (printDate.getMonth() != drawMonth);
8717
+ var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
8718
+ (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
8719
+ tbody += '<td class="' +
8720
+ ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
8721
+ (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
8722
+ ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
8723
+ (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
8724
+ // or defaultDate is current printedDate and defaultDate is selectedDate
8725
+ ' ' + this._dayOverClass : '') + // highlight selected day
8726
+ (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
8727
+ (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
8728
+ (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
8729
+ (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
8730
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
8731
+ (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions
8732
+ (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
8733
+ (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
8734
+ (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
8735
+ (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
8736
+ (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
8737
+ '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
8738
+ printDate.setDate(printDate.getDate() + 1);
8739
+ printDate = this._daylightSavingAdjust(printDate);
8740
+ }
8741
+ calender += tbody + '</tr>';
8742
+ }
8743
+ drawMonth++;
8744
+ if (drawMonth > 11) {
8745
+ drawMonth = 0;
8746
+ drawYear++;
8747
+ }
8748
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
8749
+ ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
8750
+ group += calender;
8751
+ }
8752
+ html += group;
8753
+ }
8754
+ html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
8755
+ '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
8756
+ inst._keyEvent = false;
8757
+ return html;
8758
+ },
8759
+
8760
+ /* Generate the month and year header. */
8761
+ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
8762
+ secondary, monthNames, monthNamesShort) {
8763
+ var changeMonth = this._get(inst, 'changeMonth');
8764
+ var changeYear = this._get(inst, 'changeYear');
8765
+ var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
8766
+ var html = '<div class="ui-datepicker-title">';
8767
+ var monthHtml = '';
8768
+ // month selection
8769
+ if (secondary || !changeMonth)
8770
+ monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
8771
+ else {
8772
+ var inMinYear = (minDate && minDate.getFullYear() == drawYear);
8773
+ var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
8774
+ monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';
8775
+ for (var month = 0; month < 12; month++) {
8776
+ if ((!inMinYear || month >= minDate.getMonth()) &&
8777
+ (!inMaxYear || month <= maxDate.getMonth()))
8778
+ monthHtml += '<option value="' + month + '"' +
8779
+ (month == drawMonth ? ' selected="selected"' : '') +
8780
+ '>' + monthNamesShort[month] + '</option>';
8781
+ }
8782
+ monthHtml += '</select>';
8783
+ }
8784
+ if (!showMonthAfterYear)
8785
+ html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
8786
+ // year selection
8787
+ if ( !inst.yearshtml ) {
8788
+ inst.yearshtml = '';
8789
+ if (secondary || !changeYear)
8790
+ html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
8791
+ else {
8792
+ // determine range of years to display
8793
+ var years = this._get(inst, 'yearRange').split(':');
8794
+ var thisYear = new Date().getFullYear();
8795
+ var determineYear = function(value) {
8796
+ var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
8797
+ (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
8798
+ parseInt(value, 10)));
8799
+ return (isNaN(year) ? thisYear : year);
8800
+ };
8801
+ var year = determineYear(years[0]);
8802
+ var endYear = Math.max(year, determineYear(years[1] || ''));
8803
+ year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
8804
+ endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
8805
+ inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';
8806
+ for (; year <= endYear; year++) {
8807
+ inst.yearshtml += '<option value="' + year + '"' +
8808
+ (year == drawYear ? ' selected="selected"' : '') +
8809
+ '>' + year + '</option>';
8810
+ }
8811
+ inst.yearshtml += '</select>';
8812
+
8813
+ html += inst.yearshtml;
8814
+ inst.yearshtml = null;
8815
+ }
8816
+ }
8817
+ html += this._get(inst, 'yearSuffix');
8818
+ if (showMonthAfterYear)
8819
+ html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
8820
+ html += '</div>'; // Close datepicker_header
8821
+ return html;
8822
+ },
8823
+
8824
+ /* Adjust one of the date sub-fields. */
8825
+ _adjustInstDate: function(inst, offset, period) {
8826
+ var year = inst.drawYear + (period == 'Y' ? offset : 0);
8827
+ var month = inst.drawMonth + (period == 'M' ? offset : 0);
8828
+ var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
8829
+ (period == 'D' ? offset : 0);
8830
+ var date = this._restrictMinMax(inst,
8831
+ this._daylightSavingAdjust(new Date(year, month, day)));
8832
+ inst.selectedDay = date.getDate();
8833
+ inst.drawMonth = inst.selectedMonth = date.getMonth();
8834
+ inst.drawYear = inst.selectedYear = date.getFullYear();
8835
+ if (period == 'M' || period == 'Y')
8836
+ this._notifyChange(inst);
8837
+ },
8838
+
8839
+ /* Ensure a date is within any min/max bounds. */
8840
+ _restrictMinMax: function(inst, date) {
8841
+ var minDate = this._getMinMaxDate(inst, 'min');
8842
+ var maxDate = this._getMinMaxDate(inst, 'max');
8843
+ var newDate = (minDate && date < minDate ? minDate : date);
8844
+ newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
8845
+ return newDate;
8846
+ },
8847
+
8848
+ /* Notify change of month/year. */
8849
+ _notifyChange: function(inst) {
8850
+ var onChange = this._get(inst, 'onChangeMonthYear');
8851
+ if (onChange)
8852
+ onChange.apply((inst.input ? inst.input[0] : null),
8853
+ [inst.selectedYear, inst.selectedMonth + 1, inst]);
8854
+ },
8855
+
8856
+ /* Determine the number of months to show. */
8857
+ _getNumberOfMonths: function(inst) {
8858
+ var numMonths = this._get(inst, 'numberOfMonths');
8859
+ return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
8860
+ },
8861
+
8862
+ /* Determine the current maximum date - ensure no time components are set. */
8863
+ _getMinMaxDate: function(inst, minMax) {
8864
+ return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
8865
+ },
8866
+
8867
+ /* Find the number of days in a given month. */
8868
+ _getDaysInMonth: function(year, month) {
8869
+ return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
8870
+ },
8871
+
8872
+ /* Find the day of the week of the first of a month. */
8873
+ _getFirstDayOfMonth: function(year, month) {
8874
+ return new Date(year, month, 1).getDay();
8875
+ },
8876
+
8877
+ /* Determines if we should allow a "next/prev" month display change. */
8878
+ _canAdjustMonth: function(inst, offset, curYear, curMonth) {
8879
+ var numMonths = this._getNumberOfMonths(inst);
8880
+ var date = this._daylightSavingAdjust(new Date(curYear,
8881
+ curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
8882
+ if (offset < 0)
8883
+ date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
8884
+ return this._isInRange(inst, date);
8885
+ },
8886
+
8887
+ /* Is the given date in the accepted range? */
8888
+ _isInRange: function(inst, date) {
8889
+ var minDate = this._getMinMaxDate(inst, 'min');
8890
+ var maxDate = this._getMinMaxDate(inst, 'max');
8891
+ return ((!minDate || date.getTime() >= minDate.getTime()) &&
8892
+ (!maxDate || date.getTime() <= maxDate.getTime()));
8893
+ },
8894
+
8895
+ /* Provide the configuration settings for formatting/parsing. */
8896
+ _getFormatConfig: function(inst) {
8897
+ var shortYearCutoff = this._get(inst, 'shortYearCutoff');
8898
+ shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
8899
+ new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
8900
+ return {shortYearCutoff: shortYearCutoff,
8901
+ dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
8902
+ monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
8903
+ },
8904
+
8905
+ /* Format the given date for display. */
8906
+ _formatDate: function(inst, day, month, year) {
8907
+ if (!day) {
8908
+ inst.currentDay = inst.selectedDay;
8909
+ inst.currentMonth = inst.selectedMonth;
8910
+ inst.currentYear = inst.selectedYear;
8911
+ }
8912
+ var date = (day ? (typeof day == 'object' ? day :
8913
+ this._daylightSavingAdjust(new Date(year, month, day))) :
8914
+ this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
8915
+ return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
8916
+ }
8917
+ });
8918
+
8919
+ /*
8920
+ * Bind hover events for datepicker elements.
8921
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
8922
+ * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
8923
+ */
8924
+ function bindHover(dpDiv) {
8925
+ var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
8926
+ return dpDiv.delegate(selector, 'mouseout', function() {
8927
+ $(this).removeClass('ui-state-hover');
8928
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
8929
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
8930
+ })
8931
+ .delegate(selector, 'mouseover', function(){
8932
+ if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
8933
+ $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
8934
+ $(this).addClass('ui-state-hover');
8935
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
8936
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
8937
+ }
8938
+ });
8939
+ }
8940
+
8941
+ /* jQuery extend now ignores nulls! */
8942
+ function extendRemove(target, props) {
8943
+ $.extend(target, props);
8944
+ for (var name in props)
8945
+ if (props[name] == null || props[name] == undefined)
8946
+ target[name] = props[name];
8947
+ return target;
8948
+ };
8949
+
8950
+ /* Invoke the datepicker functionality.
8951
+ @param options string - a command, optionally followed by additional parameters or
8952
+ Object - settings for attaching new datepicker functionality
8953
+ @return jQuery object */
8954
+ $.fn.datepicker = function(options){
8955
+
8956
+ /* Verify an empty collection wasn't passed - Fixes #6976 */
8957
+ if ( !this.length ) {
8958
+ return this;
8959
+ }
8960
+
8961
+ /* Initialise the date picker. */
8962
+ if (!$.datepicker.initialized) {
8963
+ $(document).mousedown($.datepicker._checkExternalClick).
8964
+ find(document.body).append($.datepicker.dpDiv);
8965
+ $.datepicker.initialized = true;
8966
+ }
8967
+
8968
+ var otherArgs = Array.prototype.slice.call(arguments, 1);
8969
+ if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
8970
+ return $.datepicker['_' + options + 'Datepicker'].
8971
+ apply($.datepicker, [this[0]].concat(otherArgs));
8972
+ if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
8973
+ return $.datepicker['_' + options + 'Datepicker'].
8974
+ apply($.datepicker, [this[0]].concat(otherArgs));
8975
+ return this.each(function() {
8976
+ typeof options == 'string' ?
8977
+ $.datepicker['_' + options + 'Datepicker'].
8978
+ apply($.datepicker, [this].concat(otherArgs)) :
8979
+ $.datepicker._attachDatepicker(this, options);
8980
+ });
8981
+ };
8982
+
8983
+ $.datepicker = new Datepicker(); // singleton instance
8984
+ $.datepicker.initialized = false;
8985
+ $.datepicker.uuid = new Date().getTime();
8986
+ $.datepicker.version = "1.9.0";
8987
+
8988
+ // Workaround for #4055
8989
+ // Add another global to avoid noConflict issues with inline event handlers
8990
+ window['DP_jQuery_' + dpuuid] = $;
8991
+
8992
+ })(jQuery);
8993
+
8994
+ (function( $, undefined ) {
8995
+
8996
+ var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
8997
+ sizeRelatedOptions = {
8998
+ buttons: true,
8999
+ height: true,
9000
+ maxHeight: true,
9001
+ maxWidth: true,
9002
+ minHeight: true,
9003
+ minWidth: true,
9004
+ width: true
9005
+ },
9006
+ resizableRelatedOptions = {
9007
+ maxHeight: true,
9008
+ maxWidth: true,
9009
+ minHeight: true,
9010
+ minWidth: true
9011
+ };
9012
+
9013
+ $.widget("ui.dialog", {
9014
+ version: "1.9.0",
9015
+ options: {
9016
+ autoOpen: true,
9017
+ buttons: {},
9018
+ closeOnEscape: true,
9019
+ closeText: "close",
9020
+ dialogClass: "",
9021
+ draggable: true,
9022
+ hide: null,
9023
+ height: "auto",
9024
+ maxHeight: false,
9025
+ maxWidth: false,
9026
+ minHeight: 150,
9027
+ minWidth: 150,
9028
+ modal: false,
9029
+ position: {
9030
+ my: "center",
9031
+ at: "center",
9032
+ of: window,
9033
+ collision: "fit",
9034
+ // ensure that the titlebar is never outside the document
9035
+ using: function( pos ) {
9036
+ var topOffset = $( this ).css( pos ).offset().top;
9037
+ if ( topOffset < 0 ) {
9038
+ $( this ).css( "top", pos.top - topOffset );
9039
+ }
9040
+ }
9041
+ },
9042
+ resizable: true,
9043
+ show: null,
9044
+ stack: true,
9045
+ title: "",
9046
+ width: 300,
9047
+ zIndex: 1000
9048
+ },
9049
+
9050
+ _create: function() {
9051
+ this.originalTitle = this.element.attr( "title" );
9052
+ // #5742 - .attr() might return a DOMElement
9053
+ if ( typeof this.originalTitle !== "string" ) {
9054
+ this.originalTitle = "";
9055
+ }
9056
+ this.oldPosition = {
9057
+ parent: this.element.parent(),
9058
+ index: this.element.parent().children().index( this.element )
9059
+ };
9060
+ this.options.title = this.options.title || this.originalTitle;
9061
+ var that = this,
9062
+ options = this.options,
9063
+
9064
+ title = options.title || "&#160;",
9065
+
9066
+ uiDialog = ( this.uiDialog = $( "<div>" ) )
9067
+ .addClass( uiDialogClasses + options.dialogClass )
9068
+ .css({
9069
+ display: "none",
9070
+ outline: 0, // TODO: move to stylesheet
9071
+ zIndex: options.zIndex
9072
+ })
9073
+ // setting tabIndex makes the div focusable
9074
+ .attr( "tabIndex", -1)
9075
+ .keydown(function( event ) {
9076
+ if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
9077
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
9078
+ that.close( event );
9079
+ event.preventDefault();
9080
+ }
9081
+ })
9082
+ .mousedown(function( event ) {
9083
+ that.moveToTop( false, event );
9084
+ })
9085
+ .appendTo( "body" ),
9086
+
9087
+ uiDialogContent = this.element
9088
+ .show()
9089
+ .removeAttr( "title" )
9090
+ .addClass( "ui-dialog-content ui-widget-content" )
9091
+ .appendTo( uiDialog ),
9092
+
9093
+ uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
9094
+ .addClass( "ui-dialog-titlebar ui-widget-header " +
9095
+ "ui-corner-all ui-helper-clearfix" )
9096
+ .prependTo( uiDialog ),
9097
+
9098
+ uiDialogTitlebarClose = $( "<a href='#'></a>" )
9099
+ .addClass( "ui-dialog-titlebar-close ui-corner-all" )
9100
+ .attr( "role", "button" )
9101
+ .click(function( event ) {
9102
+ event.preventDefault();
9103
+ that.close( event );
9104
+ })
9105
+ .appendTo( uiDialogTitlebar ),
9106
+
9107
+ uiDialogTitlebarCloseText = ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
9108
+ .addClass( "ui-icon ui-icon-closethick" )
9109
+ .text( options.closeText )
9110
+ .appendTo( uiDialogTitlebarClose ),
9111
+
9112
+ uiDialogTitle = $( "<span>" )
9113
+ .uniqueId()
9114
+ .addClass( "ui-dialog-title" )
9115
+ .html( title )
9116
+ .prependTo( uiDialogTitlebar ),
9117
+
9118
+ uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
9119
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ),
9120
+
9121
+ uiButtonSet = ( this.uiButtonSet = $( "<div>" ) )
9122
+ .addClass( "ui-dialog-buttonset" )
9123
+ .appendTo( uiDialogButtonPane );
9124
+
9125
+ uiDialog.attr({
9126
+ role: "dialog",
9127
+ "aria-labelledby": uiDialogTitle.attr( "id" )
9128
+ });
9129
+
9130
+ uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection();
9131
+ this._hoverable( uiDialogTitlebarClose );
9132
+ this._focusable( uiDialogTitlebarClose );
9133
+
9134
+ if ( options.draggable && $.fn.draggable ) {
9135
+ this._makeDraggable();
9136
+ }
9137
+ if ( options.resizable && $.fn.resizable ) {
9138
+ this._makeResizable();
9139
+ }
9140
+
9141
+ this._createButtons( options.buttons );
9142
+ this._isOpen = false;
9143
+
9144
+ if ( $.fn.bgiframe ) {
9145
+ uiDialog.bgiframe();
9146
+ }
9147
+
9148
+ // prevent tabbing out of modal dialogs
9149
+ this._on( uiDialog, { keydown: function( event ) {
9150
+ if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) {
9151
+ return;
9152
+ }
9153
+
9154
+ var tabbables = $( ":tabbable", uiDialog ),
9155
+ first = tabbables.filter( ":first" ),
9156
+ last = tabbables.filter( ":last" );
9157
+
9158
+ if ( event.target === last[0] && !event.shiftKey ) {
9159
+ first.focus( 1 );
9160
+ return false;
9161
+ } else if ( event.target === first[0] && event.shiftKey ) {
9162
+ last.focus( 1 );
9163
+ return false;
9164
+ }
9165
+ }});
9166
+ },
9167
+
9168
+ _init: function() {
9169
+ if ( this.options.autoOpen ) {
9170
+ this.open();
9171
+ }
9172
+ },
9173
+
9174
+ _destroy: function() {
9175
+ var next,
9176
+ oldPosition = this.oldPosition;
9177
+
9178
+ if ( this.overlay ) {
9179
+ this.overlay.destroy();
9180
+ }
9181
+ this.uiDialog.hide();
9182
+ this.element
9183
+ .removeClass( "ui-dialog-content ui-widget-content" )
9184
+ .hide()
9185
+ .appendTo( "body" );
9186
+ this.uiDialog.remove();
9187
+
9188
+ if ( this.originalTitle ) {
9189
+ this.element.attr( "title", this.originalTitle );
9190
+ }
9191
+
9192
+ next = oldPosition.parent.children().eq( oldPosition.index );
9193
+ // Don't try to place the dialog next to itself (#8613)
9194
+ if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
9195
+ next.before( this.element );
9196
+ } else {
9197
+ oldPosition.parent.append( this.element );
9198
+ }
9199
+ },
9200
+
9201
+ widget: function() {
9202
+ return this.uiDialog;
9203
+ },
9204
+
9205
+ close: function( event ) {
9206
+ var that = this,
9207
+ maxZ, thisZ;
9208
+
9209
+ if ( !this._isOpen ) {
9210
+ return;
9211
+ }
9212
+
9213
+ if ( false === this._trigger( "beforeClose", event ) ) {
9214
+ return;
9215
+ }
9216
+
9217
+ this._isOpen = false;
9218
+
9219
+ if ( this.overlay ) {
9220
+ this.overlay.destroy();
9221
+ }
9222
+
9223
+ if ( this.options.hide ) {
9224
+ this.uiDialog.hide( this.options.hide, function() {
9225
+ that._trigger( "close", event );
9226
+ });
9227
+ } else {
9228
+ this.uiDialog.hide();
9229
+ this._trigger( "close", event );
9230
+ }
9231
+
9232
+ $.ui.dialog.overlay.resize();
9233
+
9234
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
9235
+ if ( this.options.modal ) {
9236
+ maxZ = 0;
9237
+ $( ".ui-dialog" ).each(function() {
9238
+ if ( this !== that.uiDialog[0] ) {
9239
+ thisZ = $( this ).css( "z-index" );
9240
+ if ( !isNaN( thisZ ) ) {
9241
+ maxZ = Math.max( maxZ, thisZ );
9242
+ }
9243
+ }
9244
+ });
9245
+ $.ui.dialog.maxZ = maxZ;
9246
+ }
9247
+
9248
+ return this;
9249
+ },
9250
+
9251
+ isOpen: function() {
9252
+ return this._isOpen;
9253
+ },
9254
+
9255
+ // the force parameter allows us to move modal dialogs to their correct
9256
+ // position on open
9257
+ moveToTop: function( force, event ) {
9258
+ var options = this.options,
9259
+ saveScroll;
9260
+
9261
+ if ( ( options.modal && !force ) ||
9262
+ ( !options.stack && !options.modal ) ) {
9263
+ return this._trigger( "focus", event );
9264
+ }
9265
+
9266
+ if ( options.zIndex > $.ui.dialog.maxZ ) {
9267
+ $.ui.dialog.maxZ = options.zIndex;
9268
+ }
9269
+ if ( this.overlay ) {
9270
+ $.ui.dialog.maxZ += 1;
9271
+ $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
9272
+ this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ );
9273
+ }
9274
+
9275
+ // Save and then restore scroll
9276
+ // Opera 9.5+ resets when parent z-index is changed.
9277
+ // http://bugs.jqueryui.com/ticket/3193
9278
+ saveScroll = {
9279
+ scrollTop: this.element.scrollTop(),
9280
+ scrollLeft: this.element.scrollLeft()
9281
+ };
9282
+ $.ui.dialog.maxZ += 1;
9283
+ this.uiDialog.css( "z-index", $.ui.dialog.maxZ );
9284
+ this.element.attr( saveScroll );
9285
+ this._trigger( "focus", event );
9286
+
9287
+ return this;
9288
+ },
9289
+
9290
+ open: function() {
9291
+ if ( this._isOpen ) {
9292
+ return;
9293
+ }
9294
+
9295
+ var hasFocus,
9296
+ options = this.options,
9297
+ uiDialog = this.uiDialog;
9298
+
9299
+ this._size();
9300
+ this._position( options.position );
9301
+ uiDialog.show( options.show );
9302
+ this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null;
9303
+ this.moveToTop( true );
9304
+
9305
+ // set focus to the first tabbable element in the content area or the first button
9306
+ // if there are no tabbable elements, set focus on the dialog itself
9307
+ hasFocus = this.element.find( ":tabbable" );
9308
+ if ( !hasFocus.length ) {
9309
+ hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
9310
+ if ( !hasFocus.length ) {
9311
+ hasFocus = uiDialog;
9312
+ }
9313
+ }
9314
+ hasFocus.eq( 0 ).focus();
9315
+
9316
+ this._isOpen = true;
9317
+ this._trigger( "open" );
9318
+
9319
+ return this;
9320
+ },
9321
+
9322
+ _createButtons: function( buttons ) {
9323
+ var uiDialogButtonPane, uiButtonSet,
9324
+ that = this,
9325
+ hasButtons = false;
9326
+
9327
+ // if we already have a button pane, remove it
9328
+ this.uiDialogButtonPane.remove();
9329
+ this.uiButtonSet.empty();
9330
+
9331
+ if ( typeof buttons === "object" && buttons !== null ) {
9332
+ $.each( buttons, function() {
9333
+ return !(hasButtons = true);
9334
+ });
9335
+ }
9336
+ if ( hasButtons ) {
9337
+ $.each( buttons, function( name, props ) {
9338
+ props = $.isFunction( props ) ?
9339
+ { click: props, text: name } :
9340
+ props;
9341
+ var button = $( "<button type='button'>" )
9342
+ .attr( props, true )
9343
+ .unbind( "click" )
9344
+ .click(function() {
9345
+ props.click.apply( that.element[0], arguments );
9346
+ })
9347
+ .appendTo( that.uiButtonSet );
9348
+ if ( $.fn.button ) {
9349
+ button.button();
9350
+ }
9351
+ });
9352
+ this.uiDialog.addClass( "ui-dialog-buttons" );
9353
+ this.uiDialogButtonPane.appendTo( this.uiDialog );
9354
+ } else {
9355
+ this.uiDialog.removeClass( "ui-dialog-buttons" );
9356
+ }
9357
+ },
9358
+
9359
+ _makeDraggable: function() {
9360
+ var that = this,
9361
+ options = this.options;
9362
+
9363
+ function filteredUi( ui ) {
9364
+ return {
9365
+ position: ui.position,
9366
+ offset: ui.offset
9367
+ };
9368
+ }
9369
+
9370
+ this.uiDialog.draggable({
9371
+ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
9372
+ handle: ".ui-dialog-titlebar",
9373
+ containment: "document",
9374
+ start: function( event, ui ) {
9375
+ $( this )
9376
+ .addClass( "ui-dialog-dragging" );
9377
+ that._trigger( "dragStart", event, filteredUi( ui ) );
9378
+ },
9379
+ drag: function( event, ui ) {
9380
+ that._trigger( "drag", event, filteredUi( ui ) );
9381
+ },
9382
+ stop: function( event, ui ) {
9383
+ options.position = [
9384
+ ui.position.left - that.document.scrollLeft(),
9385
+ ui.position.top - that.document.scrollTop()
9386
+ ];
9387
+ $( this )
9388
+ .removeClass( "ui-dialog-dragging" );
9389
+ that._trigger( "dragStop", event, filteredUi( ui ) );
9390
+ $.ui.dialog.overlay.resize();
9391
+ }
9392
+ });
9393
+ },
9394
+
9395
+ _makeResizable: function( handles ) {
9396
+ handles = (handles === undefined ? this.options.resizable : handles);
9397
+ var that = this,
9398
+ options = this.options,
9399
+ // .ui-resizable has position: relative defined in the stylesheet
9400
+ // but dialogs have to use absolute or fixed positioning
9401
+ position = this.uiDialog.css( "position" ),
9402
+ resizeHandles = typeof handles === 'string' ?
9403
+ handles :
9404
+ "n,e,s,w,se,sw,ne,nw";
9405
+
9406
+ function filteredUi( ui ) {
9407
+ return {
9408
+ originalPosition: ui.originalPosition,
9409
+ originalSize: ui.originalSize,
9410
+ position: ui.position,
9411
+ size: ui.size
9412
+ };
9413
+ }
9414
+
9415
+ this.uiDialog.resizable({
9416
+ cancel: ".ui-dialog-content",
9417
+ containment: "document",
9418
+ alsoResize: this.element,
9419
+ maxWidth: options.maxWidth,
9420
+ maxHeight: options.maxHeight,
9421
+ minWidth: options.minWidth,
9422
+ minHeight: this._minHeight(),
9423
+ handles: resizeHandles,
9424
+ start: function( event, ui ) {
9425
+ $( this ).addClass( "ui-dialog-resizing" );
9426
+ that._trigger( "resizeStart", event, filteredUi( ui ) );
9427
+ },
9428
+ resize: function( event, ui ) {
9429
+ that._trigger( "resize", event, filteredUi( ui ) );
9430
+ },
9431
+ stop: function( event, ui ) {
9432
+ $( this ).removeClass( "ui-dialog-resizing" );
9433
+ options.height = $( this ).height();
9434
+ options.width = $( this ).width();
9435
+ that._trigger( "resizeStop", event, filteredUi( ui ) );
9436
+ $.ui.dialog.overlay.resize();
9437
+ }
9438
+ })
9439
+ .css( "position", position )
9440
+ .find( ".ui-resizable-se" )
9441
+ .addClass( "ui-icon ui-icon-grip-diagonal-se" );
9442
+ },
9443
+
9444
+ _minHeight: function() {
9445
+ var options = this.options;
9446
+
9447
+ if ( options.height === "auto" ) {
9448
+ return options.minHeight;
9449
+ } else {
9450
+ return Math.min( options.minHeight, options.height );
9451
+ }
9452
+ },
9453
+
9454
+ _position: function( position ) {
9455
+ var myAt = [],
9456
+ offset = [ 0, 0 ],
9457
+ isVisible;
9458
+
9459
+ if ( position ) {
9460
+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
9461
+ // if (typeof position == 'string' || $.isArray(position)) {
9462
+ // myAt = $.isArray(position) ? position : position.split(' ');
9463
+
9464
+ if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
9465
+ myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ];
9466
+ if ( myAt.length === 1 ) {
9467
+ myAt[ 1 ] = myAt[ 0 ];
9468
+ }
9469
+
9470
+ $.each( [ "left", "top" ], function( i, offsetPosition ) {
9471
+ if ( +myAt[ i ] === myAt[ i ] ) {
9472
+ offset[ i ] = myAt[ i ];
9473
+ myAt[ i ] = offsetPosition;
9474
+ }
9475
+ });
9476
+
9477
+ position = {
9478
+ my: myAt.join( " " ),
9479
+ at: myAt.join( " " ),
9480
+ offset: offset.join( " " )
9481
+ };
9482
+ }
9483
+
9484
+ position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
9485
+ } else {
9486
+ position = $.ui.dialog.prototype.options.position;
9487
+ }
9488
+
9489
+ // need to show the dialog to get the actual offset in the position plugin
9490
+ isVisible = this.uiDialog.is( ":visible" );
9491
+ if ( !isVisible ) {
9492
+ this.uiDialog.show();
9493
+ }
9494
+ this.uiDialog.position( position );
9495
+ if ( !isVisible ) {
9496
+ this.uiDialog.hide();
9497
+ }
9498
+ },
9499
+
9500
+ _setOptions: function( options ) {
9501
+ var that = this,
9502
+ resizableOptions = {},
9503
+ resize = false;
9504
+
9505
+ $.each( options, function( key, value ) {
9506
+ that._setOption( key, value );
9507
+
9508
+ if ( key in sizeRelatedOptions ) {
9509
+ resize = true;
9510
+ }
9511
+ if ( key in resizableRelatedOptions ) {
9512
+ resizableOptions[ key ] = value;
9513
+ }
9514
+ });
9515
+
9516
+ if ( resize ) {
9517
+ this._size();
9518
+ }
9519
+ if ( this.uiDialog.is( ":data(resizable)" ) ) {
9520
+ this.uiDialog.resizable( "option", resizableOptions );
9521
+ }
9522
+ },
9523
+
9524
+ _setOption: function( key, value ) {
9525
+ var isDraggable, isResizable,
9526
+ uiDialog = this.uiDialog;
9527
+
9528
+ switch ( key ) {
9529
+ case "buttons":
9530
+ this._createButtons( value );
9531
+ break;
9532
+ case "closeText":
9533
+ // ensure that we always pass a string
9534
+ this.uiDialogTitlebarCloseText.text( "" + value );
9535
+ break;
9536
+ case "dialogClass":
9537
+ uiDialog
9538
+ .removeClass( this.options.dialogClass )
9539
+ .addClass( uiDialogClasses + value );
9540
+ break;
9541
+ case "disabled":
9542
+ if ( value ) {
9543
+ uiDialog.addClass( "ui-dialog-disabled" );
9544
+ } else {
9545
+ uiDialog.removeClass( "ui-dialog-disabled" );
9546
+ }
9547
+ break;
9548
+ case "draggable":
9549
+ isDraggable = uiDialog.is( ":data(draggable)" );
9550
+ if ( isDraggable && !value ) {
9551
+ uiDialog.draggable( "destroy" );
9552
+ }
9553
+
9554
+ if ( !isDraggable && value ) {
9555
+ this._makeDraggable();
9556
+ }
9557
+ break;
9558
+ case "position":
9559
+ this._position( value );
9560
+ break;
9561
+ case "resizable":
9562
+ // currently resizable, becoming non-resizable
9563
+ isResizable = uiDialog.is( ":data(resizable)" );
9564
+ if ( isResizable && !value ) {
9565
+ uiDialog.resizable( "destroy" );
9566
+ }
9567
+
9568
+ // currently resizable, changing handles
9569
+ if ( isResizable && typeof value === "string" ) {
9570
+ uiDialog.resizable( "option", "handles", value );
9571
+ }
9572
+
9573
+ // currently non-resizable, becoming resizable
9574
+ if ( !isResizable && value !== false ) {
9575
+ this._makeResizable( value );
9576
+ }
9577
+ break;
9578
+ case "title":
9579
+ // convert whatever was passed in o a string, for html() to not throw up
9580
+ $( ".ui-dialog-title", this.uiDialogTitlebar )
9581
+ .html( "" + ( value || "&#160;" ) );
9582
+ break;
9583
+ }
9584
+
9585
+ this._super( key, value );
9586
+ },
9587
+
9588
+ _size: function() {
9589
+ /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
9590
+ * divs will both have width and height set, so we need to reset them
9591
+ */
9592
+ var nonContentHeight, minContentHeight, autoHeight,
9593
+ options = this.options,
9594
+ isVisible = this.uiDialog.is( ":visible" );
9595
+
9596
+ // reset content sizing
9597
+ this.element.show().css({
9598
+ width: "auto",
9599
+ minHeight: 0,
9600
+ height: 0
9601
+ });
9602
+
9603
+ if ( options.minWidth > options.width ) {
9604
+ options.width = options.minWidth;
9605
+ }
9606
+
9607
+ // reset wrapper sizing
9608
+ // determine the height of all the non-content elements
9609
+ nonContentHeight = this.uiDialog.css({
9610
+ height: "auto",
9611
+ width: options.width
9612
+ })
9613
+ .outerHeight();
9614
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
9615
+
9616
+ if ( options.height === "auto" ) {
9617
+ // only needed for IE6 support
9618
+ if ( $.support.minHeight ) {
9619
+ this.element.css({
9620
+ minHeight: minContentHeight,
9621
+ height: "auto"
9622
+ });
9623
+ } else {
9624
+ this.uiDialog.show();
9625
+ autoHeight = this.element.css( "height", "auto" ).height();
9626
+ if ( !isVisible ) {
9627
+ this.uiDialog.hide();
9628
+ }
9629
+ this.element.height( Math.max( autoHeight, minContentHeight ) );
9630
+ }
9631
+ } else {
9632
+ this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
9633
+ }
9634
+
9635
+ if (this.uiDialog.is( ":data(resizable)" ) ) {
9636
+ this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
9637
+ }
9638
+ }
9639
+ });
9640
+
9641
+ $.extend($.ui.dialog, {
9642
+ uuid: 0,
9643
+ maxZ: 0,
9644
+
9645
+ getTitleId: function($el) {
9646
+ var id = $el.attr( "id" );
9647
+ if ( !id ) {
9648
+ this.uuid += 1;
9649
+ id = this.uuid;
9650
+ }
9651
+ return "ui-dialog-title-" + id;
9652
+ },
9653
+
9654
+ overlay: function( dialog ) {
9655
+ this.$el = $.ui.dialog.overlay.create( dialog );
9656
+ }
9657
+ });
9658
+
9659
+ $.extend( $.ui.dialog.overlay, {
9660
+ instances: [],
9661
+ // reuse old instances due to IE memory leak with alpha transparency (see #5185)
9662
+ oldInstances: [],
9663
+ maxZ: 0,
9664
+ events: $.map(
9665
+ "focus,mousedown,mouseup,keydown,keypress,click".split( "," ),
9666
+ function( event ) {
9667
+ return event + ".dialog-overlay";
9668
+ }
9669
+ ).join( " " ),
9670
+ create: function( dialog ) {
9671
+ if ( this.instances.length === 0 ) {
9672
+ // prevent use of anchors and inputs
9673
+ // we use a setTimeout in case the overlay is created from an
9674
+ // event that we're going to be cancelling (see #2804)
9675
+ setTimeout(function() {
9676
+ // handle $(el).dialog().dialog('close') (see #4065)
9677
+ if ( $.ui.dialog.overlay.instances.length ) {
9678
+ $( document ).bind( $.ui.dialog.overlay.events, function( event ) {
9679
+ // stop events if the z-index of the target is < the z-index of the overlay
9680
+ // we cannot return true when we don't want to cancel the event (#3523)
9681
+ if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) {
9682
+ return false;
9683
+ }
9684
+ });
9685
+ }
9686
+ }, 1 );
9687
+
9688
+ // handle window resize
9689
+ $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize );
9690
+ }
9691
+
9692
+ var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) );
9693
+
9694
+ // allow closing by pressing the escape key
9695
+ $( document ).bind( "keydown.dialog-overlay", function( event ) {
9696
+ var instances = $.ui.dialog.overlay.instances;
9697
+ // only react to the event if we're the top overlay
9698
+ if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el &&
9699
+ dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
9700
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
9701
+
9702
+ dialog.close( event );
9703
+ event.preventDefault();
9704
+ }
9705
+ });
9706
+
9707
+ $el.appendTo( document.body ).css({
9708
+ width: this.width(),
9709
+ height: this.height()
9710
+ });
9711
+
9712
+ if ( $.fn.bgiframe ) {
9713
+ $el.bgiframe();
9714
+ }
9715
+
9716
+ this.instances.push( $el );
9717
+ return $el;
9718
+ },
9719
+
9720
+ destroy: function( $el ) {
9721
+ var indexOf = $.inArray( $el, this.instances ),
9722
+ maxZ = 0;
9723
+
9724
+ if ( indexOf !== -1 ) {
9725
+ this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
9726
+ }
9727
+
9728
+ if ( this.instances.length === 0 ) {
9729
+ $( [ document, window ] ).unbind( ".dialog-overlay" );
9730
+ }
9731
+
9732
+ $el.height( 0 ).width( 0 ).remove();
9733
+
9734
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
9735
+ $.each( this.instances, function() {
9736
+ maxZ = Math.max( maxZ, this.css( "z-index" ) );
9737
+ });
9738
+ this.maxZ = maxZ;
9739
+ },
9740
+
9741
+ height: function() {
9742
+ var scrollHeight,
9743
+ offsetHeight;
9744
+ // handle IE
9745
+ if ( $.browser.msie ) {
9746
+ scrollHeight = Math.max(
9747
+ document.documentElement.scrollHeight,
9748
+ document.body.scrollHeight
9749
+ );
9750
+ offsetHeight = Math.max(
9751
+ document.documentElement.offsetHeight,
9752
+ document.body.offsetHeight
9753
+ );
9754
+
9755
+ if ( scrollHeight < offsetHeight ) {
9756
+ return $( window ).height() + "px";
9757
+ } else {
9758
+ return scrollHeight + "px";
9759
+ }
9760
+ // handle "good" browsers
9761
+ } else {
9762
+ return $( document ).height() + "px";
9763
+ }
9764
+ },
9765
+
9766
+ width: function() {
9767
+ var scrollWidth,
9768
+ offsetWidth;
9769
+ // handle IE
9770
+ if ( $.browser.msie ) {
9771
+ scrollWidth = Math.max(
9772
+ document.documentElement.scrollWidth,
9773
+ document.body.scrollWidth
9774
+ );
9775
+ offsetWidth = Math.max(
9776
+ document.documentElement.offsetWidth,
9777
+ document.body.offsetWidth
9778
+ );
9779
+
9780
+ if ( scrollWidth < offsetWidth ) {
9781
+ return $( window ).width() + "px";
9782
+ } else {
9783
+ return scrollWidth + "px";
9784
+ }
9785
+ // handle "good" browsers
9786
+ } else {
9787
+ return $( document ).width() + "px";
9788
+ }
9789
+ },
9790
+
9791
+ resize: function() {
9792
+ /* If the dialog is draggable and the user drags it past the
9793
+ * right edge of the window, the document becomes wider so we
9794
+ * need to stretch the overlay. If the user then drags the
9795
+ * dialog back to the left, the document will become narrower,
9796
+ * so we need to shrink the overlay to the appropriate size.
9797
+ * This is handled by shrinking the overlay before setting it
9798
+ * to the full document size.
9799
+ */
9800
+ var $overlays = $( [] );
9801
+ $.each( $.ui.dialog.overlay.instances, function() {
9802
+ $overlays = $overlays.add( this );
9803
+ });
9804
+
9805
+ $overlays.css({
9806
+ width: 0,
9807
+ height: 0
9808
+ }).css({
9809
+ width: $.ui.dialog.overlay.width(),
9810
+ height: $.ui.dialog.overlay.height()
9811
+ });
9812
+ }
9813
+ });
9814
+
9815
+ $.extend( $.ui.dialog.overlay.prototype, {
9816
+ destroy: function() {
9817
+ $.ui.dialog.overlay.destroy( this.$el );
9818
+ }
9819
+ });
9820
+
9821
+ }( jQuery ) );
9822
+
9823
+ (function( $, undefined ) {
9824
+
9825
+ var rvertical = /up|down|vertical/,
9826
+ rpositivemotion = /up|left|vertical|horizontal/;
9827
+
9828
+ $.effects.effect.blind = function( o, done ) {
9829
+ // Create element
9830
+ var el = $( this ),
9831
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
9832
+ mode = $.effects.setMode( el, o.mode || "hide" ),
9833
+ direction = o.direction || "up",
9834
+ vertical = rvertical.test( direction ),
9835
+ ref = vertical ? "height" : "width",
9836
+ ref2 = vertical ? "top" : "left",
9837
+ motion = rpositivemotion.test( direction ),
9838
+ animation = {},
9839
+ show = mode === "show",
9840
+ wrapper, distance, margin;
9841
+
9842
+ // if already wrapped, the wrapper's properties are my property. #6245
9843
+ if ( el.parent().is( ".ui-effects-wrapper" ) ) {
9844
+ $.effects.save( el.parent(), props );
9845
+ } else {
9846
+ $.effects.save( el, props );
9847
+ }
9848
+ el.show();
9849
+ wrapper = $.effects.createWrapper( el ).css({
9850
+ overflow: "hidden"
9851
+ });
9852
+
9853
+ distance = wrapper[ ref ]();
9854
+ margin = parseFloat( wrapper.css( ref2 ) ) || 0;
9855
+
9856
+ animation[ ref ] = show ? distance : 0;
9857
+ if ( !motion ) {
9858
+ el
9859
+ .css( vertical ? "bottom" : "right", 0 )
9860
+ .css( vertical ? "top" : "left", "auto" )
9861
+ .css({ position: "absolute" });
9862
+
9863
+ animation[ ref2 ] = show ? margin : distance + margin;
9864
+ }
9865
+
9866
+ // start at 0 if we are showing
9867
+ if ( show ) {
9868
+ wrapper.css( ref, 0 );
9869
+ if ( ! motion ) {
9870
+ wrapper.css( ref2, margin + distance );
9871
+ }
9872
+ }
9873
+
9874
+ // Animate
9875
+ wrapper.animate( animation, {
9876
+ duration: o.duration,
9877
+ easing: o.easing,
9878
+ queue: false,
9879
+ complete: function() {
9880
+ if ( mode === "hide" ) {
9881
+ el.hide();
9882
+ }
9883
+ $.effects.restore( el, props );
9884
+ $.effects.removeWrapper( el );
9885
+ done();
9886
+ }
9887
+ });
9888
+
9889
+ };
9890
+
9891
+ })(jQuery);
9892
+
9893
+ (function( $, undefined ) {
9894
+
9895
+ $.effects.effect.bounce = function( o, done ) {
9896
+ var el = $( this ),
9897
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
9898
+
9899
+ // defaults:
9900
+ mode = $.effects.setMode( el, o.mode || "effect" ),
9901
+ hide = mode === "hide",
9902
+ show = mode === "show",
9903
+ direction = o.direction || "up",
9904
+ distance = o.distance,
9905
+ times = o.times || 5,
9906
+
9907
+ // number of internal animations
9908
+ anims = times * 2 + ( show || hide ? 1 : 0 ),
9909
+ speed = o.duration / anims,
9910
+ easing = o.easing,
9911
+
9912
+ // utility:
9913
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
9914
+ motion = ( direction === "up" || direction === "left" ),
9915
+ i,
9916
+ upAnim,
9917
+ downAnim,
9918
+
9919
+ // we will need to re-assemble the queue to stack our animations in place
9920
+ queue = el.queue(),
9921
+ queuelen = queue.length;
9922
+
9923
+ // Avoid touching opacity to prevent clearType and PNG issues in IE
9924
+ if ( show || hide ) {
9925
+ props.push( "opacity" );
9926
+ }
9927
+
9928
+ $.effects.save( el, props );
9929
+ el.show();
9930
+ $.effects.createWrapper( el ); // Create Wrapper
9931
+
9932
+ // default distance for the BIGGEST bounce is the outer Distance / 3
9933
+ if ( !distance ) {
9934
+ distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
9935
+ }
9936
+
9937
+ if ( show ) {
9938
+ downAnim = { opacity: 1 };
9939
+ downAnim[ ref ] = 0;
9940
+
9941
+ // if we are showing, force opacity 0 and set the initial position
9942
+ // then do the "first" animation
9943
+ el.css( "opacity", 0 )
9944
+ .css( ref, motion ? -distance * 2 : distance * 2 )
9945
+ .animate( downAnim, speed, easing );
9946
+ }
9947
+
9948
+ // start at the smallest distance if we are hiding
9949
+ if ( hide ) {
9950
+ distance = distance / Math.pow( 2, times - 1 );
9951
+ }
9952
+
9953
+ downAnim = {};
9954
+ downAnim[ ref ] = 0;
9955
+ // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
9956
+ for ( i = 0; i < times; i++ ) {
9957
+ upAnim = {};
9958
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
9959
+
9960
+ el.animate( upAnim, speed, easing )
9961
+ .animate( downAnim, speed, easing );
9962
+
9963
+ distance = hide ? distance * 2 : distance / 2;
9964
+ }
9965
+
9966
+ // Last Bounce when Hiding
9967
+ if ( hide ) {
9968
+ upAnim = { opacity: 0 };
9969
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
9970
+
9971
+ el.animate( upAnim, speed, easing );
9972
+ }
9973
+
9974
+ el.queue(function() {
9975
+ if ( hide ) {
9976
+ el.hide();
9977
+ }
9978
+ $.effects.restore( el, props );
9979
+ $.effects.removeWrapper( el );
9980
+ done();
9981
+ });
9982
+
9983
+ // inject all the animations we just queued to be first in line (after "inprogress")
9984
+ if ( queuelen > 1) {
9985
+ queue.splice.apply( queue,
9986
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
9987
+ }
9988
+ el.dequeue();
9989
+
9990
+ };
9991
+
9992
+ })(jQuery);
9993
+
9994
+ (function( $, undefined ) {
9995
+
9996
+ $.effects.effect.clip = function( o, done ) {
9997
+ // Create element
9998
+ var el = $( this ),
9999
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
10000
+ mode = $.effects.setMode( el, o.mode || "hide" ),
10001
+ show = mode === "show",
10002
+ direction = o.direction || "vertical",
10003
+ vert = direction === "vertical",
10004
+ size = vert ? "height" : "width",
10005
+ position = vert ? "top" : "left",
10006
+ animation = {},
10007
+ wrapper, animate, distance;
10008
+
10009
+ // Save & Show
10010
+ $.effects.save( el, props );
10011
+ el.show();
10012
+
10013
+ // Create Wrapper
10014
+ wrapper = $.effects.createWrapper( el ).css({
10015
+ overflow: "hidden"
10016
+ });
10017
+ animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
10018
+ distance = animate[ size ]();
10019
+
10020
+ // Shift
10021
+ if ( show ) {
10022
+ animate.css( size, 0 );
10023
+ animate.css( position, distance / 2 );
10024
+ }
10025
+
10026
+ // Create Animation Object:
10027
+ animation[ size ] = show ? distance : 0;
10028
+ animation[ position ] = show ? 0 : distance / 2;
10029
+
10030
+ // Animate
10031
+ animate.animate( animation, {
10032
+ queue: false,
10033
+ duration: o.duration,
10034
+ easing: o.easing,
10035
+ complete: function() {
10036
+ if ( !show ) {
10037
+ el.hide();
10038
+ }
10039
+ $.effects.restore( el, props );
10040
+ $.effects.removeWrapper( el );
10041
+ done();
10042
+ }
10043
+ });
10044
+
10045
+ };
10046
+
10047
+ })(jQuery);
10048
+
10049
+ (function( $, undefined ) {
10050
+
10051
+ $.effects.effect.drop = function( o, done ) {
10052
+
10053
+ var el = $( this ),
10054
+ props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
10055
+ mode = $.effects.setMode( el, o.mode || "hide" ),
10056
+ show = mode === "show",
10057
+ direction = o.direction || "left",
10058
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
10059
+ motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
10060
+ animation = {
10061
+ opacity: show ? 1 : 0
10062
+ },
10063
+ distance;
10064
+
10065
+ // Adjust
10066
+ $.effects.save( el, props );
10067
+ el.show();
10068
+ $.effects.createWrapper( el );
10069
+
10070
+ distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
10071
+
10072
+ if ( show ) {
10073
+ el
10074
+ .css( "opacity", 0 )
10075
+ .css( ref, motion === "pos" ? -distance : distance );
10076
+ }
10077
+
10078
+ // Animation
10079
+ animation[ ref ] = ( show ?
10080
+ ( motion === "pos" ? "+=" : "-=" ) :
10081
+ ( motion === "pos" ? "-=" : "+=" ) ) +
10082
+ distance;
10083
+
10084
+ // Animate
10085
+ el.animate( animation, {
10086
+ queue: false,
10087
+ duration: o.duration,
10088
+ easing: o.easing,
10089
+ complete: function() {
10090
+ if ( mode === "hide" ) {
10091
+ el.hide();
10092
+ }
10093
+ $.effects.restore( el, props );
10094
+ $.effects.removeWrapper( el );
10095
+ done();
10096
+ }
10097
+ });
10098
+ };
10099
+
10100
+ })(jQuery);
10101
+
10102
+ (function( $, undefined ) {
10103
+
10104
+ $.effects.effect.explode = function( o, done ) {
10105
+
10106
+ var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
10107
+ cells = rows,
10108
+ el = $( this ),
10109
+ mode = $.effects.setMode( el, o.mode || "hide" ),
10110
+ show = mode === "show",
10111
+
10112
+ // show and then visibility:hidden the element before calculating offset
10113
+ offset = el.show().css( "visibility", "hidden" ).offset(),
10114
+
10115
+ // width and height of a piece
10116
+ width = Math.ceil( el.outerWidth() / cells ),
10117
+ height = Math.ceil( el.outerHeight() / rows ),
10118
+ pieces = [],
10119
+
10120
+ // loop
10121
+ i, j, left, top, mx, my;
10122
+
10123
+ // children animate complete:
10124
+ function childComplete() {
10125
+ pieces.push( this );
10126
+ if ( pieces.length === rows * cells ) {
10127
+ animComplete();
10128
+ }
10129
+ }
10130
+
10131
+ // clone the element for each row and cell.
10132
+ for( i = 0; i < rows ; i++ ) { // ===>
10133
+ top = offset.top + i * height;
10134
+ my = i - ( rows - 1 ) / 2 ;
10135
+
10136
+ for( j = 0; j < cells ; j++ ) { // |||
10137
+ left = offset.left + j * width;
10138
+ mx = j - ( cells - 1 ) / 2 ;
10139
+
10140
+ // Create a clone of the now hidden main element that will be absolute positioned
10141
+ // within a wrapper div off the -left and -top equal to size of our pieces
10142
+ el
10143
+ .clone()
10144
+ .appendTo( "body" )
10145
+ .wrap( "<div></div>" )
10146
+ .css({
10147
+ position: "absolute",
10148
+ visibility: "visible",
10149
+ left: -j * width,
10150
+ top: -i * height
10151
+ })
10152
+
10153
+ // select the wrapper - make it overflow: hidden and absolute positioned based on
10154
+ // where the original was located +left and +top equal to the size of pieces
10155
+ .parent()
10156
+ .addClass( "ui-effects-explode" )
10157
+ .css({
10158
+ position: "absolute",
10159
+ overflow: "hidden",
10160
+ width: width,
10161
+ height: height,
10162
+ left: left + ( show ? mx * width : 0 ),
10163
+ top: top + ( show ? my * height : 0 ),
10164
+ opacity: show ? 0 : 1
10165
+ }).animate({
10166
+ left: left + ( show ? 0 : mx * width ),
10167
+ top: top + ( show ? 0 : my * height ),
10168
+ opacity: show ? 1 : 0
10169
+ }, o.duration || 500, o.easing, childComplete );
10170
+ }
10171
+ }
10172
+
10173
+ function animComplete() {
10174
+ el.css({
10175
+ visibility: "visible"
10176
+ });
10177
+ $( pieces ).remove();
10178
+ if ( !show ) {
10179
+ el.hide();
10180
+ }
10181
+ done();
10182
+ }
10183
+ };
10184
+
10185
+ })(jQuery);
10186
+
10187
+ (function( $, undefined ) {
10188
+
10189
+ $.effects.effect.fade = function( o, done ) {
10190
+ var el = $( this ),
10191
+ mode = $.effects.setMode( el, o.mode || "toggle" );
10192
+
10193
+ el.animate({
10194
+ opacity: mode
10195
+ }, {
10196
+ queue: false,
10197
+ duration: o.duration,
10198
+ easing: o.easing,
10199
+ complete: done
10200
+ });
10201
+ };
10202
+
10203
+ })( jQuery );
10204
+
10205
+ (function( $, undefined ) {
10206
+
10207
+ $.effects.effect.fold = function( o, done ) {
10208
+
10209
+ // Create element
10210
+ var el = $( this ),
10211
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
10212
+ mode = $.effects.setMode( el, o.mode || "hide" ),
10213
+ show = mode === "show",
10214
+ hide = mode === "hide",
10215
+ size = o.size || 15,
10216
+ percent = /([0-9]+)%/.exec( size ),
10217
+ horizFirst = !!o.horizFirst,
10218
+ widthFirst = show !== horizFirst,
10219
+ ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
10220
+ duration = o.duration / 2,
10221
+ wrapper, distance,
10222
+ animation1 = {},
10223
+ animation2 = {};
10224
+
10225
+ $.effects.save( el, props );
10226
+ el.show();
10227
+
10228
+ // Create Wrapper
10229
+ wrapper = $.effects.createWrapper( el ).css({
10230
+ overflow: "hidden"
10231
+ });
10232
+ distance = widthFirst ?
10233
+ [ wrapper.width(), wrapper.height() ] :
10234
+ [ wrapper.height(), wrapper.width() ];
10235
+
10236
+ if ( percent ) {
10237
+ size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
10238
+ }
10239
+ if ( show ) {
10240
+ wrapper.css( horizFirst ? {
10241
+ height: 0,
10242
+ width: size
10243
+ } : {
10244
+ height: size,
10245
+ width: 0
10246
+ });
10247
+ }
10248
+
10249
+ // Animation
10250
+ animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
10251
+ animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
10252
+
10253
+ // Animate
10254
+ wrapper
10255
+ .animate( animation1, duration, o.easing )
10256
+ .animate( animation2, duration, o.easing, function() {
10257
+ if ( hide ) {
10258
+ el.hide();
10259
+ }
10260
+ $.effects.restore( el, props );
10261
+ $.effects.removeWrapper( el );
10262
+ done();
10263
+ });
10264
+
10265
+ };
10266
+
10267
+ })(jQuery);
10268
+
10269
+ (function( $, undefined ) {
10270
+
10271
+ $.effects.effect.highlight = function( o, done ) {
10272
+ var elem = $( this ),
10273
+ props = [ "backgroundImage", "backgroundColor", "opacity" ],
10274
+ mode = $.effects.setMode( elem, o.mode || "show" ),
10275
+ animation = {
10276
+ backgroundColor: elem.css( "backgroundColor" )
10277
+ };
10278
+
10279
+ if (mode === "hide") {
10280
+ animation.opacity = 0;
10281
+ }
10282
+
10283
+ $.effects.save( elem, props );
10284
+
10285
+ elem
10286
+ .show()
10287
+ .css({
10288
+ backgroundImage: "none",
10289
+ backgroundColor: o.color || "#ffff99"
10290
+ })
10291
+ .animate( animation, {
10292
+ queue: false,
10293
+ duration: o.duration,
10294
+ easing: o.easing,
10295
+ complete: function() {
10296
+ if ( mode === "hide" ) {
10297
+ elem.hide();
10298
+ }
10299
+ $.effects.restore( elem, props );
10300
+ done();
10301
+ }
10302
+ });
10303
+ };
10304
+
10305
+ })(jQuery);
10306
+
10307
+ (function( $, undefined ) {
10308
+
10309
+ $.effects.effect.pulsate = function( o, done ) {
10310
+ var elem = $( this ),
10311
+ mode = $.effects.setMode( elem, o.mode || "show" ),
10312
+ show = mode === "show",
10313
+ hide = mode === "hide",
10314
+ showhide = ( show || mode === "hide" ),
10315
+
10316
+ // showing or hiding leaves of the "last" animation
10317
+ anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
10318
+ duration = o.duration / anims,
10319
+ animateTo = 0,
10320
+ queue = elem.queue(),
10321
+ queuelen = queue.length,
10322
+ i;
10323
+
10324
+ if ( show || !elem.is(":visible")) {
10325
+ elem.css( "opacity", 0 ).show();
10326
+ animateTo = 1;
10327
+ }
10328
+
10329
+ // anims - 1 opacity "toggles"
10330
+ for ( i = 1; i < anims; i++ ) {
10331
+ elem.animate({
10332
+ opacity: animateTo
10333
+ }, duration, o.easing );
10334
+ animateTo = 1 - animateTo;
10335
+ }
10336
+
10337
+ elem.animate({
10338
+ opacity: animateTo
10339
+ }, duration, o.easing);
10340
+
10341
+ elem.queue(function() {
10342
+ if ( hide ) {
10343
+ elem.hide();
10344
+ }
10345
+ done();
10346
+ });
10347
+
10348
+ // We just queued up "anims" animations, we need to put them next in the queue
10349
+ if ( queuelen > 1 ) {
10350
+ queue.splice.apply( queue,
10351
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
10352
+ }
10353
+ elem.dequeue();
10354
+ };
10355
+
10356
+ })(jQuery);
10357
+
10358
+ (function( $, undefined ) {
10359
+
10360
+ $.effects.effect.puff = function( o, done ) {
10361
+ var elem = $( this ),
10362
+ mode = $.effects.setMode( elem, o.mode || "hide" ),
10363
+ hide = mode === "hide",
10364
+ percent = parseInt( o.percent, 10 ) || 150,
10365
+ factor = percent / 100,
10366
+ original = {
10367
+ height: elem.height(),
10368
+ width: elem.width()
10369
+ };
10370
+
10371
+ $.extend( o, {
10372
+ effect: "scale",
10373
+ queue: false,
10374
+ fade: true,
10375
+ mode: mode,
10376
+ complete: done,
10377
+ percent: hide ? percent : 100,
10378
+ from: hide ?
10379
+ original :
10380
+ {
10381
+ height: original.height * factor,
10382
+ width: original.width * factor
10383
+ }
10384
+ });
10385
+
10386
+ elem.effect( o );
10387
+ };
10388
+
10389
+ $.effects.effect.scale = function( o, done ) {
10390
+
10391
+ // Create element
10392
+ var el = $( this ),
10393
+ options = $.extend( true, {}, o ),
10394
+ mode = $.effects.setMode( el, o.mode || "effect" ),
10395
+ percent = parseInt( o.percent, 10 ) ||
10396
+ ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
10397
+ direction = o.direction || "both",
10398
+ origin = o.origin,
10399
+ original = {
10400
+ height: el.height(),
10401
+ width: el.width(),
10402
+ outerHeight: el.outerHeight(),
10403
+ outerWidth: el.outerWidth()
10404
+ },
10405
+ factor = {
10406
+ y: direction !== "horizontal" ? (percent / 100) : 1,
10407
+ x: direction !== "vertical" ? (percent / 100) : 1
10408
+ };
10409
+
10410
+ // We are going to pass this effect to the size effect:
10411
+ options.effect = "size";
10412
+ options.queue = false;
10413
+ options.complete = done;
10414
+
10415
+ // Set default origin and restore for show/hide
10416
+ if ( mode !== "effect" ) {
10417
+ options.origin = origin || ["middle","center"];
10418
+ options.restore = true;
10419
+ }
10420
+
10421
+ options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original );
10422
+ options.to = {
10423
+ height: original.height * factor.y,
10424
+ width: original.width * factor.x,
10425
+ outerHeight: original.outerHeight * factor.y,
10426
+ outerWidth: original.outerWidth * factor.x
10427
+ };
10428
+
10429
+ // Fade option to support puff
10430
+ if ( options.fade ) {
10431
+ if ( mode === "show" ) {
10432
+ options.from.opacity = 0;
10433
+ options.to.opacity = 1;
10434
+ }
10435
+ if ( mode === "hide" ) {
10436
+ options.from.opacity = 1;
10437
+ options.to.opacity = 0;
10438
+ }
10439
+ }
10440
+
10441
+ // Animate
10442
+ el.effect( options );
10443
+
10444
+ };
10445
+
10446
+ $.effects.effect.size = function( o, done ) {
10447
+
10448
+ // Create element
10449
+ var el = $( this ),
10450
+ props = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
10451
+
10452
+ // Always restore
10453
+ props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
10454
+
10455
+ // Copy for children
10456
+ props2 = [ "width", "height", "overflow" ],
10457
+ cProps = [ "fontSize" ],
10458
+ vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
10459
+ hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
10460
+
10461
+ // Set options
10462
+ mode = $.effects.setMode( el, o.mode || "effect" ),
10463
+ restore = o.restore || mode !== "effect",
10464
+ scale = o.scale || "both",
10465
+ origin = o.origin || [ "middle", "center" ],
10466
+ original, baseline, factor,
10467
+ position = el.css( "position" );
10468
+
10469
+ if ( mode === "show" ) {
10470
+ el.show();
10471
+ }
10472
+ original = {
10473
+ height: el.height(),
10474
+ width: el.width(),
10475
+ outerHeight: el.outerHeight(),
10476
+ outerWidth: el.outerWidth()
10477
+ };
10478
+
10479
+ el.from = o.from || original;
10480
+ el.to = o.to || original;
10481
+
10482
+ // Set scaling factor
10483
+ factor = {
10484
+ from: {
10485
+ y: el.from.height / original.height,
10486
+ x: el.from.width / original.width
10487
+ },
10488
+ to: {
10489
+ y: el.to.height / original.height,
10490
+ x: el.to.width / original.width
10491
+ }
10492
+ };
10493
+
10494
+ // Scale the css box
10495
+ if ( scale === "box" || scale === "both" ) {
10496
+
10497
+ // Vertical props scaling
10498
+ if ( factor.from.y !== factor.to.y ) {
10499
+ props = props.concat( vProps );
10500
+ el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
10501
+ el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
10502
+ }
10503
+
10504
+ // Horizontal props scaling
10505
+ if ( factor.from.x !== factor.to.x ) {
10506
+ props = props.concat( hProps );
10507
+ el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
10508
+ el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
10509
+ }
10510
+ }
10511
+
10512
+ // Scale the content
10513
+ if ( scale === "content" || scale === "both" ) {
10514
+
10515
+ // Vertical props scaling
10516
+ if ( factor.from.y !== factor.to.y ) {
10517
+ props = props.concat( cProps );
10518
+ el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
10519
+ el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
10520
+ }
10521
+ }
10522
+
10523
+ $.effects.save( el, restore ? props : props1 );
10524
+ el.show();
10525
+ $.effects.createWrapper( el );
10526
+ el.css( "overflow", "hidden" ).css( el.from );
10527
+
10528
+ // Adjust
10529
+ if (origin) { // Calculate baseline shifts
10530
+ baseline = $.effects.getBaseline( origin, original );
10531
+ el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
10532
+ el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
10533
+ el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
10534
+ el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
10535
+ }
10536
+ el.css( el.from ); // set top & left
10537
+
10538
+ // Animate
10539
+ if ( scale === "content" || scale === "both" ) { // Scale the children
10540
+
10541
+ // Add margins/font-size
10542
+ vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
10543
+ hProps = hProps.concat([ "marginLeft", "marginRight" ]);
10544
+ props2 = props.concat(vProps).concat(hProps);
10545
+
10546
+ el.find( "*[width]" ).each( function(){
10547
+ var child = $( this ),
10548
+ c_original = {
10549
+ height: child.height(),
10550
+ width: child.width()
10551
+ };
10552
+ if (restore) {
10553
+ $.effects.save(child, props2);
10554
+ }
10555
+
10556
+ child.from = {
10557
+ height: c_original.height * factor.from.y,
10558
+ width: c_original.width * factor.from.x
10559
+ };
10560
+ child.to = {
10561
+ height: c_original.height * factor.to.y,
10562
+ width: c_original.width * factor.to.x
10563
+ };
10564
+
10565
+ // Vertical props scaling
10566
+ if ( factor.from.y !== factor.to.y ) {
10567
+ child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
10568
+ child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
10569
+ }
10570
+
10571
+ // Horizontal props scaling
10572
+ if ( factor.from.x !== factor.to.x ) {
10573
+ child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
10574
+ child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
10575
+ }
10576
+
10577
+ // Animate children
10578
+ child.css( child.from );
10579
+ child.animate( child.to, o.duration, o.easing, function() {
10580
+
10581
+ // Restore children
10582
+ if ( restore ) {
10583
+ $.effects.restore( child, props2 );
10584
+ }
10585
+ });
10586
+ });
10587
+ }
10588
+
10589
+ // Animate
10590
+ el.animate( el.to, {
10591
+ queue: false,
10592
+ duration: o.duration,
10593
+ easing: o.easing,
10594
+ complete: function() {
10595
+ if ( el.to.opacity === 0 ) {
10596
+ el.css( "opacity", el.from.opacity );
10597
+ }
10598
+ if( mode === "hide" ) {
10599
+ el.hide();
10600
+ }
10601
+ $.effects.restore( el, restore ? props : props1 );
10602
+ if ( !restore ) {
10603
+
10604
+ // we need to calculate our new positioning based on the scaling
10605
+ if ( position === "static" ) {
10606
+ el.css({
10607
+ position: "relative",
10608
+ top: el.to.top,
10609
+ left: el.to.left
10610
+ });
10611
+ } else {
10612
+ $.each([ "top", "left" ], function( idx, pos ) {
10613
+ el.css( pos, function( _, str ) {
10614
+ var val = parseInt( str, 10 ),
10615
+ toRef = idx ? el.to.left : el.to.top;
10616
+
10617
+ // if original was "auto", recalculate the new value from wrapper
10618
+ if ( str === "auto" ) {
10619
+ return toRef + "px";
10620
+ }
10621
+
10622
+ return val + toRef + "px";
10623
+ });
10624
+ });
10625
+ }
10626
+ }
10627
+
10628
+ $.effects.removeWrapper( el );
10629
+ done();
10630
+ }
10631
+ });
10632
+
10633
+ };
10634
+
10635
+ })(jQuery);
10636
+
10637
+ (function( $, undefined ) {
10638
+
10639
+ $.effects.effect.shake = function( o, done ) {
10640
+
10641
+ var el = $( this ),
10642
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
10643
+ mode = $.effects.setMode( el, o.mode || "effect" ),
10644
+ direction = o.direction || "left",
10645
+ distance = o.distance || 20,
10646
+ times = o.times || 3,
10647
+ anims = times * 2 + 1,
10648
+ speed = Math.round(o.duration/anims),
10649
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
10650
+ positiveMotion = (direction === "up" || direction === "left"),
10651
+ animation = {},
10652
+ animation1 = {},
10653
+ animation2 = {},
10654
+ i,
10655
+
10656
+ // we will need to re-assemble the queue to stack our animations in place
10657
+ queue = el.queue(),
10658
+ queuelen = queue.length;
10659
+
10660
+ $.effects.save( el, props );
10661
+ el.show();
10662
+ $.effects.createWrapper( el );
10663
+
10664
+ // Animation
10665
+ animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
10666
+ animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
10667
+ animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
10668
+
10669
+ // Animate
10670
+ el.animate( animation, speed, o.easing );
10671
+
10672
+ // Shakes
10673
+ for ( i = 1; i < times; i++ ) {
10674
+ el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
10675
+ }
10676
+ el
10677
+ .animate( animation1, speed, o.easing )
10678
+ .animate( animation, speed / 2, o.easing )
10679
+ .queue(function() {
10680
+ if ( mode === "hide" ) {
10681
+ el.hide();
10682
+ }
10683
+ $.effects.restore( el, props );
10684
+ $.effects.removeWrapper( el );
10685
+ done();
10686
+ });
10687
+
10688
+ // inject all the animations we just queued to be first in line (after "inprogress")
10689
+ if ( queuelen > 1) {
10690
+ queue.splice.apply( queue,
10691
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
10692
+ }
10693
+ el.dequeue();
10694
+
10695
+ };
10696
+
10697
+ })(jQuery);
10698
+
10699
+ (function( $, undefined ) {
10700
+
10701
+ $.effects.effect.slide = function( o, done ) {
10702
+
10703
+ // Create element
10704
+ var el = $( this ),
10705
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
10706
+ mode = $.effects.setMode( el, o.mode || "show" ),
10707
+ show = mode === "show",
10708
+ direction = o.direction || "left",
10709
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
10710
+ positiveMotion = (direction === "up" || direction === "left"),
10711
+ distance,
10712
+ animation = {};
10713
+
10714
+ // Adjust
10715
+ $.effects.save( el, props );
10716
+ el.show();
10717
+ distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
10718
+
10719
+ $.effects.createWrapper( el ).css({
10720
+ overflow: "hidden"
10721
+ });
10722
+
10723
+ if ( show ) {
10724
+ el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
10725
+ }
10726
+
10727
+ // Animation
10728
+ animation[ ref ] = ( show ?
10729
+ ( positiveMotion ? "+=" : "-=") :
10730
+ ( positiveMotion ? "-=" : "+=")) +
10731
+ distance;
10732
+
10733
+ // Animate
10734
+ el.animate( animation, {
10735
+ queue: false,
10736
+ duration: o.duration,
10737
+ easing: o.easing,
10738
+ complete: function() {
10739
+ if ( mode === "hide" ) {
10740
+ el.hide();
10741
+ }
10742
+ $.effects.restore( el, props );
10743
+ $.effects.removeWrapper( el );
10744
+ done();
10745
+ }
10746
+ });
10747
+ };
10748
+
10749
+ })(jQuery);
10750
+
10751
+ (function( $, undefined ) {
10752
+
10753
+ $.effects.effect.transfer = function( o, done ) {
10754
+ var elem = $( this ),
10755
+ target = $( o.to ),
10756
+ targetFixed = target.css( "position" ) === "fixed",
10757
+ body = $("body"),
10758
+ fixTop = targetFixed ? body.scrollTop() : 0,
10759
+ fixLeft = targetFixed ? body.scrollLeft() : 0,
10760
+ endPosition = target.offset(),
10761
+ animation = {
10762
+ top: endPosition.top - fixTop ,
10763
+ left: endPosition.left - fixLeft ,
10764
+ height: target.innerHeight(),
10765
+ width: target.innerWidth()
10766
+ },
10767
+ startPosition = elem.offset(),
10768
+ transfer = $( '<div class="ui-effects-transfer"></div>' )
10769
+ .appendTo( document.body )
10770
+ .addClass( o.className )
10771
+ .css({
10772
+ top: startPosition.top - fixTop ,
10773
+ left: startPosition.left - fixLeft ,
10774
+ height: elem.innerHeight(),
10775
+ width: elem.innerWidth(),
10776
+ position: targetFixed ? "fixed" : "absolute"
10777
+ })
10778
+ .animate( animation, o.duration, o.easing, function() {
10779
+ transfer.remove();
10780
+ done();
10781
+ });
10782
+ };
10783
+
10784
+ })(jQuery);
10785
+
10786
+ (function( $, undefined ) {
10787
+
10788
+ var mouseHandled = false;
10789
+
10790
+ $.widget( "ui.menu", {
10791
+ version: "1.9.0",
10792
+ defaultElement: "<ul>",
10793
+ delay: 300,
10794
+ options: {
10795
+ icons: {
10796
+ submenu: "ui-icon-carat-1-e"
10797
+ },
10798
+ menus: "ul",
10799
+ position: {
10800
+ my: "left top",
10801
+ at: "right top"
10802
+ },
10803
+ role: "menu",
10804
+
10805
+ // callbacks
10806
+ blur: null,
10807
+ focus: null,
10808
+ select: null
10809
+ },
10810
+
10811
+ _create: function() {
10812
+ this.activeMenu = this.element;
10813
+ this.element
10814
+ .uniqueId()
10815
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
10816
+ .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
10817
+ .attr({
10818
+ role: this.options.role,
10819
+ tabIndex: 0
10820
+ })
10821
+ // need to catch all clicks on disabled menu
10822
+ // not possible through _on
10823
+ .bind( "click" + this.eventNamespace, $.proxy(function( event ) {
10824
+ if ( this.options.disabled ) {
10825
+ event.preventDefault();
10826
+ }
10827
+ }, this ));
10828
+
10829
+ if ( this.options.disabled ) {
10830
+ this.element
10831
+ .addClass( "ui-state-disabled" )
10832
+ .attr( "aria-disabled", "true" );
10833
+ }
10834
+
10835
+ this._on({
10836
+ // Prevent focus from sticking to links inside menu after clicking
10837
+ // them (focus should always stay on UL during navigation).
10838
+ "mousedown .ui-menu-item > a": function( event ) {
10839
+ event.preventDefault();
10840
+ },
10841
+ "click .ui-state-disabled > a": function( event ) {
10842
+ event.preventDefault();
10843
+ },
10844
+ "click .ui-menu-item:has(a)": function( event ) {
10845
+ var target = $( event.target ).closest( ".ui-menu-item" );
10846
+ if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
10847
+ mouseHandled = true;
10848
+
10849
+ this.select( event );
10850
+ // Open submenu on click
10851
+ if ( target.has( ".ui-menu" ).length ) {
10852
+ this.expand( event );
10853
+ } else if ( !this.element.is( ":focus" ) ) {
10854
+ // Redirect focus to the menu
10855
+ this.element.trigger( "focus", [ true ] );
10856
+
10857
+ // If the active item is on the top level, let it stay active.
10858
+ // Otherwise, blur the active item since it is no longer visible.
10859
+ if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
10860
+ clearTimeout( this.timer );
10861
+ }
10862
+ }
10863
+ }
10864
+ },
10865
+ "mouseenter .ui-menu-item": function( event ) {
10866
+ var target = $( event.currentTarget );
10867
+ // Remove ui-state-active class from siblings of the newly focused menu item
10868
+ // to avoid a jump caused by adjacent elements both having a class with a border
10869
+ target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
10870
+ this.focus( event, target );
10871
+ },
10872
+ mouseleave: "collapseAll",
10873
+ "mouseleave .ui-menu": "collapseAll",
10874
+ focus: function( event, keepActiveItem ) {
10875
+ // If there's already an active item, keep it active
10876
+ // If not, activate the first item
10877
+ var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
10878
+
10879
+ if ( !keepActiveItem ) {
10880
+ this.focus( event, item );
10881
+ }
10882
+ },
10883
+ blur: function( event ) {
10884
+ this._delay(function() {
10885
+ if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
10886
+ this.collapseAll( event );
10887
+ }
10888
+ });
10889
+ },
10890
+ keydown: "_keydown"
10891
+ });
10892
+
10893
+ this.refresh();
10894
+
10895
+ // Clicks outside of a menu collapse any open menus
10896
+ this._on( this.document, {
10897
+ click: function( event ) {
10898
+ if ( !$( event.target ).closest( ".ui-menu" ).length ) {
10899
+ this.collapseAll( event );
10900
+ }
10901
+
10902
+ // Reset the mouseHandled flag
10903
+ mouseHandled = false;
10904
+ }
10905
+ });
10906
+ },
10907
+
10908
+ _destroy: function() {
10909
+ // Destroy (sub)menus
10910
+ this.element
10911
+ .removeAttr( "aria-activedescendant" )
10912
+ .find( ".ui-menu" ).andSelf()
10913
+ .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
10914
+ .removeAttr( "role" )
10915
+ .removeAttr( "tabIndex" )
10916
+ .removeAttr( "aria-labelledby" )
10917
+ .removeAttr( "aria-expanded" )
10918
+ .removeAttr( "aria-hidden" )
10919
+ .removeAttr( "aria-disabled" )
10920
+ .removeUniqueId()
10921
+ .show();
10922
+
10923
+ // Destroy menu items
10924
+ this.element.find( ".ui-menu-item" )
10925
+ .removeClass( "ui-menu-item" )
10926
+ .removeAttr( "role" )
10927
+ .removeAttr( "aria-disabled" )
10928
+ .children( "a" )
10929
+ .removeUniqueId()
10930
+ .removeClass( "ui-corner-all ui-state-hover" )
10931
+ .removeAttr( "tabIndex" )
10932
+ .removeAttr( "role" )
10933
+ .removeAttr( "aria-haspopup" )
10934
+ .children().each( function() {
10935
+ var elem = $( this );
10936
+ if ( elem.data( "ui-menu-submenu-carat" ) ) {
10937
+ elem.remove();
10938
+ }
10939
+ });
10940
+
10941
+ // Destroy menu dividers
10942
+ this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
10943
+ },
10944
+
10945
+ _keydown: function( event ) {
10946
+ var match, prev, character, skip, regex,
10947
+ preventDefault = true;
10948
+
10949
+ function escape( value ) {
10950
+ return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
10951
+ }
10952
+
10953
+ switch ( event.keyCode ) {
10954
+ case $.ui.keyCode.PAGE_UP:
10955
+ this.previousPage( event );
10956
+ break;
10957
+ case $.ui.keyCode.PAGE_DOWN:
10958
+ this.nextPage( event );
10959
+ break;
10960
+ case $.ui.keyCode.HOME:
10961
+ this._move( "first", "first", event );
10962
+ break;
10963
+ case $.ui.keyCode.END:
10964
+ this._move( "last", "last", event );
10965
+ break;
10966
+ case $.ui.keyCode.UP:
10967
+ this.previous( event );
10968
+ break;
10969
+ case $.ui.keyCode.DOWN:
10970
+ this.next( event );
10971
+ break;
10972
+ case $.ui.keyCode.LEFT:
10973
+ this.collapse( event );
10974
+ break;
10975
+ case $.ui.keyCode.RIGHT:
10976
+ if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
10977
+ this.expand( event );
10978
+ }
10979
+ break;
10980
+ case $.ui.keyCode.ENTER:
10981
+ case $.ui.keyCode.SPACE:
10982
+ this._activate( event );
10983
+ break;
10984
+ case $.ui.keyCode.ESCAPE:
10985
+ this.collapse( event );
10986
+ break;
10987
+ default:
10988
+ preventDefault = false;
10989
+ prev = this.previousFilter || "";
10990
+ character = String.fromCharCode( event.keyCode );
10991
+ skip = false;
10992
+
10993
+ clearTimeout( this.filterTimer );
10994
+
10995
+ if ( character === prev ) {
10996
+ skip = true;
10997
+ } else {
10998
+ character = prev + character;
10999
+ }
11000
+
11001
+ regex = new RegExp( "^" + escape( character ), "i" );
11002
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
11003
+ return regex.test( $( this ).children( "a" ).text() );
11004
+ });
11005
+ match = skip && match.index( this.active.next() ) !== -1 ?
11006
+ this.active.nextAll( ".ui-menu-item" ) :
11007
+ match;
11008
+
11009
+ // If no matches on the current filter, reset to the last character pressed
11010
+ // to move down the menu to the first item that starts with that character
11011
+ if ( !match.length ) {
11012
+ character = String.fromCharCode( event.keyCode );
11013
+ regex = new RegExp( "^" + escape( character ), "i" );
11014
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
11015
+ return regex.test( $( this ).children( "a" ).text() );
11016
+ });
11017
+ }
11018
+
11019
+ if ( match.length ) {
11020
+ this.focus( event, match );
11021
+ if ( match.length > 1 ) {
11022
+ this.previousFilter = character;
11023
+ this.filterTimer = this._delay(function() {
11024
+ delete this.previousFilter;
11025
+ }, 1000 );
11026
+ } else {
11027
+ delete this.previousFilter;
11028
+ }
11029
+ } else {
11030
+ delete this.previousFilter;
11031
+ }
11032
+ }
11033
+
11034
+ if ( preventDefault ) {
11035
+ event.preventDefault();
11036
+ }
11037
+ },
11038
+
11039
+ _activate: function( event ) {
11040
+ if ( !this.active.is( ".ui-state-disabled" ) ) {
11041
+ if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
11042
+ this.expand( event );
11043
+ } else {
11044
+ this.select( event );
11045
+ }
11046
+ }
11047
+ },
11048
+
11049
+ refresh: function() {
11050
+ // Initialize nested menus
11051
+ var menus,
11052
+ icon = this.options.icons.submenu,
11053
+ submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
11054
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
11055
+ .hide()
11056
+ .attr({
11057
+ role: this.options.role,
11058
+ "aria-hidden": "true",
11059
+ "aria-expanded": "false"
11060
+ });
11061
+
11062
+ // Don't refresh list items that are already adapted
11063
+ menus = submenus.add( this.element );
11064
+
11065
+ menus.children( ":not(.ui-menu-item):has(a)" )
11066
+ .addClass( "ui-menu-item" )
11067
+ .attr( "role", "presentation" )
11068
+ .children( "a" )
11069
+ .uniqueId()
11070
+ .addClass( "ui-corner-all" )
11071
+ .attr({
11072
+ tabIndex: -1,
11073
+ role: this._itemRole()
11074
+ });
11075
+
11076
+ // Initialize unlinked menu-items containing spaces and/or dashes only as dividers
11077
+ menus.children( ":not(.ui-menu-item)" ).each(function() {
11078
+ var item = $( this );
11079
+ // hyphen, em dash, en dash
11080
+ if ( !/[^\-—–\s]/.test( item.text() ) ) {
11081
+ item.addClass( "ui-widget-content ui-menu-divider" );
11082
+ }
11083
+ });
11084
+
11085
+ // Add aria-disabled attribute to any disabled menu item
11086
+ menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
11087
+
11088
+ submenus.each(function() {
11089
+ var menu = $( this ),
11090
+ item = menu.prev( "a" ),
11091
+ submenuCarat = $( "<span>" )
11092
+ .addClass( "ui-menu-icon ui-icon " + icon )
11093
+ .data( "ui-menu-submenu-carat", true );
11094
+
11095
+ item
11096
+ .attr( "aria-haspopup", "true" )
11097
+ .prepend( submenuCarat );
11098
+ menu.attr( "aria-labelledby", item.attr( "id" ) );
11099
+ });
11100
+
11101
+ // If the active item has been removed, blur the menu
11102
+ if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
11103
+ this.blur();
11104
+ }
11105
+ },
11106
+
11107
+ _itemRole: function() {
11108
+ return {
11109
+ menu: "menuitem",
11110
+ listbox: "option"
11111
+ }[ this.options.role ];
11112
+ },
11113
+
11114
+ focus: function( event, item ) {
11115
+ var nested, focused;
11116
+ this.blur( event, event && event.type === "focus" );
11117
+
11118
+ this._scrollIntoView( item );
11119
+
11120
+ this.active = item.first();
11121
+ focused = this.active.children( "a" ).addClass( "ui-state-focus" );
11122
+ // Only update aria-activedescendant if there's a role
11123
+ // otherwise we assume focus is managed elsewhere
11124
+ if ( this.options.role ) {
11125
+ this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
11126
+ }
11127
+
11128
+ // Highlight active parent menu item, if any
11129
+ this.active
11130
+ .parent()
11131
+ .closest( ".ui-menu-item" )
11132
+ .children( "a:first" )
11133
+ .addClass( "ui-state-active" );
11134
+
11135
+ if ( event && event.type === "keydown" ) {
11136
+ this._close();
11137
+ } else {
11138
+ this.timer = this._delay(function() {
11139
+ this._close();
11140
+ }, this.delay );
11141
+ }
11142
+
11143
+ nested = item.children( ".ui-menu" );
11144
+ if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
11145
+ this._startOpening(nested);
11146
+ }
11147
+ this.activeMenu = item.parent();
11148
+
11149
+ this._trigger( "focus", event, { item: item } );
11150
+ },
11151
+
11152
+ _scrollIntoView: function( item ) {
11153
+ var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
11154
+ if ( this._hasScroll() ) {
11155
+ borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
11156
+ paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
11157
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
11158
+ scroll = this.activeMenu.scrollTop();
11159
+ elementHeight = this.activeMenu.height();
11160
+ itemHeight = item.height();
11161
+
11162
+ if ( offset < 0 ) {
11163
+ this.activeMenu.scrollTop( scroll + offset );
11164
+ } else if ( offset + itemHeight > elementHeight ) {
11165
+ this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
11166
+ }
11167
+ }
11168
+ },
11169
+
11170
+ blur: function( event, fromFocus ) {
11171
+ if ( !fromFocus ) {
11172
+ clearTimeout( this.timer );
11173
+ }
11174
+
11175
+ if ( !this.active ) {
11176
+ return;
11177
+ }
11178
+
11179
+ this.active.children( "a" ).removeClass( "ui-state-focus" );
11180
+ this.active = null;
11181
+
11182
+ this._trigger( "blur", event, { item: this.active } );
11183
+ },
11184
+
11185
+ _startOpening: function( submenu ) {
11186
+ clearTimeout( this.timer );
11187
+
11188
+ // Don't open if already open fixes a Firefox bug that caused a .5 pixel
11189
+ // shift in the submenu position when mousing over the carat icon
11190
+ if ( submenu.attr( "aria-hidden" ) !== "true" ) {
11191
+ return;
11192
+ }
11193
+
11194
+ this.timer = this._delay(function() {
11195
+ this._close();
11196
+ this._open( submenu );
11197
+ }, this.delay );
11198
+ },
11199
+
11200
+ _open: function( submenu ) {
11201
+ var position = $.extend({
11202
+ of: this.active
11203
+ }, this.options.position );
11204
+
11205
+ clearTimeout( this.timer );
11206
+ this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
11207
+ .hide()
11208
+ .attr( "aria-hidden", "true" );
11209
+
11210
+ submenu
11211
+ .show()
11212
+ .removeAttr( "aria-hidden" )
11213
+ .attr( "aria-expanded", "true" )
11214
+ .position( position );
11215
+ },
11216
+
11217
+ collapseAll: function( event, all ) {
11218
+ clearTimeout( this.timer );
11219
+ this.timer = this._delay(function() {
11220
+ // If we were passed an event, look for the submenu that contains the event
11221
+ var currentMenu = all ? this.element :
11222
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
11223
+
11224
+ // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
11225
+ if ( !currentMenu.length ) {
11226
+ currentMenu = this.element;
11227
+ }
11228
+
11229
+ this._close( currentMenu );
11230
+
11231
+ this.blur( event );
11232
+ this.activeMenu = currentMenu;
11233
+ }, this.delay );
11234
+ },
11235
+
11236
+ // With no arguments, closes the currently active menu - if nothing is active
11237
+ // it closes all menus. If passed an argument, it will search for menus BELOW
11238
+ _close: function( startMenu ) {
11239
+ if ( !startMenu ) {
11240
+ startMenu = this.active ? this.active.parent() : this.element;
11241
+ }
11242
+
11243
+ startMenu
11244
+ .find( ".ui-menu" )
11245
+ .hide()
11246
+ .attr( "aria-hidden", "true" )
11247
+ .attr( "aria-expanded", "false" )
11248
+ .end()
11249
+ .find( "a.ui-state-active" )
11250
+ .removeClass( "ui-state-active" );
11251
+ },
11252
+
11253
+ collapse: function( event ) {
11254
+ var newItem = this.active &&
11255
+ this.active.parent().closest( ".ui-menu-item", this.element );
11256
+ if ( newItem && newItem.length ) {
11257
+ this._close();
11258
+ this.focus( event, newItem );
11259
+ }
11260
+ },
11261
+
11262
+ expand: function( event ) {
11263
+ var newItem = this.active &&
11264
+ this.active
11265
+ .children( ".ui-menu " )
11266
+ .children( ".ui-menu-item" )
11267
+ .first();
11268
+
11269
+ if ( newItem && newItem.length ) {
11270
+ this._open( newItem.parent() );
11271
+
11272
+ // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
11273
+ this._delay(function() {
11274
+ this.focus( event, newItem );
11275
+ });
11276
+ }
11277
+ },
11278
+
11279
+ next: function( event ) {
11280
+ this._move( "next", "first", event );
11281
+ },
11282
+
11283
+ previous: function( event ) {
11284
+ this._move( "prev", "last", event );
11285
+ },
11286
+
11287
+ isFirstItem: function() {
11288
+ return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
11289
+ },
11290
+
11291
+ isLastItem: function() {
11292
+ return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
11293
+ },
11294
+
11295
+ _move: function( direction, filter, event ) {
11296
+ var next;
11297
+ if ( this.active ) {
11298
+ if ( direction === "first" || direction === "last" ) {
11299
+ next = this.active
11300
+ [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
11301
+ .eq( -1 );
11302
+ } else {
11303
+ next = this.active
11304
+ [ direction + "All" ]( ".ui-menu-item" )
11305
+ .eq( 0 );
11306
+ }
11307
+ }
11308
+ if ( !next || !next.length || !this.active ) {
11309
+ next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
11310
+ }
11311
+
11312
+ this.focus( event, next );
11313
+ },
11314
+
11315
+ nextPage: function( event ) {
11316
+ var item, base, height;
11317
+
11318
+ if ( !this.active ) {
11319
+ this.next( event );
11320
+ return;
11321
+ }
11322
+ if ( this.isLastItem() ) {
11323
+ return;
11324
+ }
11325
+ if ( this._hasScroll() ) {
11326
+ base = this.active.offset().top;
11327
+ height = this.element.height();
11328
+ this.active.nextAll( ".ui-menu-item" ).each(function() {
11329
+ item = $( this );
11330
+ return item.offset().top - base - height < 0;
11331
+ });
11332
+
11333
+ this.focus( event, item );
11334
+ } else {
11335
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" )
11336
+ [ !this.active ? "first" : "last" ]() );
11337
+ }
11338
+ },
11339
+
11340
+ previousPage: function( event ) {
11341
+ var item, base, height;
11342
+ if ( !this.active ) {
11343
+ this.next( event );
11344
+ return;
11345
+ }
11346
+ if ( this.isFirstItem() ) {
11347
+ return;
11348
+ }
11349
+ if ( this._hasScroll() ) {
11350
+ base = this.active.offset().top;
11351
+ height = this.element.height();
11352
+ this.active.prevAll( ".ui-menu-item" ).each(function() {
11353
+ item = $( this );
11354
+ return item.offset().top - base + height > 0;
11355
+ });
11356
+
11357
+ this.focus( event, item );
11358
+ } else {
11359
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
11360
+ }
11361
+ },
11362
+
11363
+ _hasScroll: function() {
11364
+ return this.element.outerHeight() < this.element.prop( "scrollHeight" );
11365
+ },
11366
+
11367
+ select: function( event ) {
11368
+ // TODO: It should never be possible to not have an active item at this
11369
+ // point, but the tests don't trigger mouseenter before click.
11370
+ this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
11371
+ var ui = { item: this.active };
11372
+ if ( !this.active.has( ".ui-menu" ).length ) {
11373
+ this.collapseAll( event, true );
11374
+ }
11375
+ this._trigger( "select", event, ui );
11376
+ }
11377
+ });
11378
+
11379
+ }( jQuery ));
11380
+
11381
+ (function( $, undefined ) {
11382
+
11383
+ $.ui = $.ui || {};
11384
+
11385
+ var cachedScrollbarWidth,
11386
+ max = Math.max,
11387
+ abs = Math.abs,
11388
+ round = Math.round,
11389
+ rhorizontal = /left|center|right/,
11390
+ rvertical = /top|center|bottom/,
11391
+ roffset = /[\+\-]\d+%?/,
11392
+ rposition = /^\w+/,
11393
+ rpercent = /%$/,
11394
+ _position = $.fn.position;
11395
+
11396
+ function getOffsets( offsets, width, height ) {
11397
+ return [
11398
+ parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
11399
+ parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
11400
+ ];
11401
+ }
11402
+ function parseCss( element, property ) {
11403
+ return parseInt( $.css( element, property ), 10 ) || 0;
11404
+ }
11405
+
11406
+ $.position = {
11407
+ scrollbarWidth: function() {
11408
+ if ( cachedScrollbarWidth !== undefined ) {
11409
+ return cachedScrollbarWidth;
11410
+ }
11411
+ var w1, w2,
11412
+ div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
11413
+ innerDiv = div.children()[0];
11414
+
11415
+ $( "body" ).append( div );
11416
+ w1 = innerDiv.offsetWidth;
11417
+ div.css( "overflow", "scroll" );
11418
+
11419
+ w2 = innerDiv.offsetWidth;
11420
+
11421
+ if ( w1 === w2 ) {
11422
+ w2 = div[0].clientWidth;
11423
+ }
11424
+
11425
+ div.remove();
11426
+
11427
+ return (cachedScrollbarWidth = w1 - w2);
11428
+ },
11429
+ getScrollInfo: function( within ) {
11430
+ var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
11431
+ overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
11432
+ hasOverflowX = overflowX === "scroll" ||
11433
+ ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
11434
+ hasOverflowY = overflowY === "scroll" ||
11435
+ ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
11436
+ return {
11437
+ width: hasOverflowX ? $.position.scrollbarWidth() : 0,
11438
+ height: hasOverflowY ? $.position.scrollbarWidth() : 0
11439
+ };
11440
+ },
11441
+ getWithinInfo: function( element ) {
11442
+ var withinElement = $( element || window ),
11443
+ isWindow = $.isWindow( withinElement[0] );
11444
+ return {
11445
+ element: withinElement,
11446
+ isWindow: isWindow,
11447
+ offset: withinElement.offset() || { left: 0, top: 0 },
11448
+ scrollLeft: withinElement.scrollLeft(),
11449
+ scrollTop: withinElement.scrollTop(),
11450
+ width: isWindow ? withinElement.width() : withinElement.outerWidth(),
11451
+ height: isWindow ? withinElement.height() : withinElement.outerHeight()
11452
+ };
11453
+ }
11454
+ };
11455
+
11456
+ $.fn.position = function( options ) {
11457
+ if ( !options || !options.of ) {
11458
+ return _position.apply( this, arguments );
11459
+ }
11460
+
11461
+ // make a copy, we don't want to modify arguments
11462
+ options = $.extend( {}, options );
11463
+
11464
+ var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
11465
+ target = $( options.of ),
11466
+ within = $.position.getWithinInfo( options.within ),
11467
+ scrollInfo = $.position.getScrollInfo( within ),
11468
+ targetElem = target[0],
11469
+ collision = ( options.collision || "flip" ).split( " " ),
11470
+ offsets = {};
11471
+
11472
+ if ( targetElem.nodeType === 9 ) {
11473
+ targetWidth = target.width();
11474
+ targetHeight = target.height();
11475
+ targetOffset = { top: 0, left: 0 };
11476
+ } else if ( $.isWindow( targetElem ) ) {
11477
+ targetWidth = target.width();
11478
+ targetHeight = target.height();
11479
+ targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
11480
+ } else if ( targetElem.preventDefault ) {
11481
+ // force left top to allow flipping
11482
+ options.at = "left top";
11483
+ targetWidth = targetHeight = 0;
11484
+ targetOffset = { top: targetElem.pageY, left: targetElem.pageX };
11485
+ } else {
11486
+ targetWidth = target.outerWidth();
11487
+ targetHeight = target.outerHeight();
11488
+ targetOffset = target.offset();
11489
+ }
11490
+ // clone to reuse original targetOffset later
11491
+ basePosition = $.extend( {}, targetOffset );
11492
+
11493
+ // force my and at to have valid horizontal and vertical positions
11494
+ // if a value is missing or invalid, it will be converted to center
11495
+ $.each( [ "my", "at" ], function() {
11496
+ var pos = ( options[ this ] || "" ).split( " " ),
11497
+ horizontalOffset,
11498
+ verticalOffset;
11499
+
11500
+ if ( pos.length === 1) {
11501
+ pos = rhorizontal.test( pos[ 0 ] ) ?
11502
+ pos.concat( [ "center" ] ) :
11503
+ rvertical.test( pos[ 0 ] ) ?
11504
+ [ "center" ].concat( pos ) :
11505
+ [ "center", "center" ];
11506
+ }
11507
+ pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
11508
+ pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
11509
+
11510
+ // calculate offsets
11511
+ horizontalOffset = roffset.exec( pos[ 0 ] );
11512
+ verticalOffset = roffset.exec( pos[ 1 ] );
11513
+ offsets[ this ] = [
11514
+ horizontalOffset ? horizontalOffset[ 0 ] : 0,
11515
+ verticalOffset ? verticalOffset[ 0 ] : 0
11516
+ ];
11517
+
11518
+ // reduce to just the positions without the offsets
11519
+ options[ this ] = [
11520
+ rposition.exec( pos[ 0 ] )[ 0 ],
11521
+ rposition.exec( pos[ 1 ] )[ 0 ]
11522
+ ];
11523
+ });
11524
+
11525
+ // normalize collision option
11526
+ if ( collision.length === 1 ) {
11527
+ collision[ 1 ] = collision[ 0 ];
11528
+ }
11529
+
11530
+ if ( options.at[ 0 ] === "right" ) {
11531
+ basePosition.left += targetWidth;
11532
+ } else if ( options.at[ 0 ] === "center" ) {
11533
+ basePosition.left += targetWidth / 2;
11534
+ }
11535
+
11536
+ if ( options.at[ 1 ] === "bottom" ) {
11537
+ basePosition.top += targetHeight;
11538
+ } else if ( options.at[ 1 ] === "center" ) {
11539
+ basePosition.top += targetHeight / 2;
11540
+ }
11541
+
11542
+ atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
11543
+ basePosition.left += atOffset[ 0 ];
11544
+ basePosition.top += atOffset[ 1 ];
11545
+
11546
+ return this.each(function() {
11547
+ var collisionPosition, using,
11548
+ elem = $( this ),
11549
+ elemWidth = elem.outerWidth(),
11550
+ elemHeight = elem.outerHeight(),
11551
+ marginLeft = parseCss( this, "marginLeft" ),
11552
+ marginTop = parseCss( this, "marginTop" ),
11553
+ collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
11554
+ collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
11555
+ position = $.extend( {}, basePosition ),
11556
+ myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
11557
+
11558
+ if ( options.my[ 0 ] === "right" ) {
11559
+ position.left -= elemWidth;
11560
+ } else if ( options.my[ 0 ] === "center" ) {
11561
+ position.left -= elemWidth / 2;
11562
+ }
11563
+
11564
+ if ( options.my[ 1 ] === "bottom" ) {
11565
+ position.top -= elemHeight;
11566
+ } else if ( options.my[ 1 ] === "center" ) {
11567
+ position.top -= elemHeight / 2;
11568
+ }
11569
+
11570
+ position.left += myOffset[ 0 ];
11571
+ position.top += myOffset[ 1 ];
11572
+
11573
+ // if the browser doesn't support fractions, then round for consistent results
11574
+ if ( !$.support.offsetFractions ) {
11575
+ position.left = round( position.left );
11576
+ position.top = round( position.top );
11577
+ }
11578
+
11579
+ collisionPosition = {
11580
+ marginLeft: marginLeft,
11581
+ marginTop: marginTop
11582
+ };
11583
+
11584
+ $.each( [ "left", "top" ], function( i, dir ) {
11585
+ if ( $.ui.position[ collision[ i ] ] ) {
11586
+ $.ui.position[ collision[ i ] ][ dir ]( position, {
11587
+ targetWidth: targetWidth,
11588
+ targetHeight: targetHeight,
11589
+ elemWidth: elemWidth,
11590
+ elemHeight: elemHeight,
11591
+ collisionPosition: collisionPosition,
11592
+ collisionWidth: collisionWidth,
11593
+ collisionHeight: collisionHeight,
11594
+ offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
11595
+ my: options.my,
11596
+ at: options.at,
11597
+ within: within,
11598
+ elem : elem
11599
+ });
11600
+ }
11601
+ });
11602
+
11603
+ if ( $.fn.bgiframe ) {
11604
+ elem.bgiframe();
11605
+ }
11606
+
11607
+ if ( options.using ) {
11608
+ // adds feedback as second argument to using callback, if present
11609
+ using = function( props ) {
11610
+ var left = targetOffset.left - position.left,
11611
+ right = left + targetWidth - elemWidth,
11612
+ top = targetOffset.top - position.top,
11613
+ bottom = top + targetHeight - elemHeight,
11614
+ feedback = {
11615
+ target: {
11616
+ element: target,
11617
+ left: targetOffset.left,
11618
+ top: targetOffset.top,
11619
+ width: targetWidth,
11620
+ height: targetHeight
11621
+ },
11622
+ element: {
11623
+ element: elem,
11624
+ left: position.left,
11625
+ top: position.top,
11626
+ width: elemWidth,
11627
+ height: elemHeight
11628
+ },
11629
+ horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
11630
+ vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
11631
+ };
11632
+ if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
11633
+ feedback.horizontal = "center";
11634
+ }
11635
+ if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
11636
+ feedback.vertical = "middle";
11637
+ }
11638
+ if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
11639
+ feedback.important = "horizontal";
11640
+ } else {
11641
+ feedback.important = "vertical";
11642
+ }
11643
+ options.using.call( this, props, feedback );
11644
+ };
11645
+ }
11646
+
11647
+ elem.offset( $.extend( position, { using: using } ) );
11648
+ });
11649
+ };
11650
+
11651
+ $.ui.position = {
11652
+ fit: {
11653
+ left: function( position, data ) {
11654
+ var within = data.within,
11655
+ withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
11656
+ outerWidth = within.width,
11657
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
11658
+ overLeft = withinOffset - collisionPosLeft,
11659
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
11660
+ newOverRight;
11661
+
11662
+ // element is wider than within
11663
+ if ( data.collisionWidth > outerWidth ) {
11664
+ // element is initially over the left side of within
11665
+ if ( overLeft > 0 && overRight <= 0 ) {
11666
+ newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
11667
+ position.left += overLeft - newOverRight;
11668
+ // element is initially over right side of within
11669
+ } else if ( overRight > 0 && overLeft <= 0 ) {
11670
+ position.left = withinOffset;
11671
+ // element is initially over both left and right sides of within
11672
+ } else {
11673
+ if ( overLeft > overRight ) {
11674
+ position.left = withinOffset + outerWidth - data.collisionWidth;
11675
+ } else {
11676
+ position.left = withinOffset;
11677
+ }
11678
+ }
11679
+ // too far left -> align with left edge
11680
+ } else if ( overLeft > 0 ) {
11681
+ position.left += overLeft;
11682
+ // too far right -> align with right edge
11683
+ } else if ( overRight > 0 ) {
11684
+ position.left -= overRight;
11685
+ // adjust based on position and margin
11686
+ } else {
11687
+ position.left = max( position.left - collisionPosLeft, position.left );
11688
+ }
11689
+ },
11690
+ top: function( position, data ) {
11691
+ var within = data.within,
11692
+ withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
11693
+ outerHeight = data.within.height,
11694
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
11695
+ overTop = withinOffset - collisionPosTop,
11696
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
11697
+ newOverBottom;
11698
+
11699
+ // element is taller than within
11700
+ if ( data.collisionHeight > outerHeight ) {
11701
+ // element is initially over the top of within
11702
+ if ( overTop > 0 && overBottom <= 0 ) {
11703
+ newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
11704
+ position.top += overTop - newOverBottom;
11705
+ // element is initially over bottom of within
11706
+ } else if ( overBottom > 0 && overTop <= 0 ) {
11707
+ position.top = withinOffset;
11708
+ // element is initially over both top and bottom of within
11709
+ } else {
11710
+ if ( overTop > overBottom ) {
11711
+ position.top = withinOffset + outerHeight - data.collisionHeight;
11712
+ } else {
11713
+ position.top = withinOffset;
11714
+ }
11715
+ }
11716
+ // too far up -> align with top
11717
+ } else if ( overTop > 0 ) {
11718
+ position.top += overTop;
11719
+ // too far down -> align with bottom edge
11720
+ } else if ( overBottom > 0 ) {
11721
+ position.top -= overBottom;
11722
+ // adjust based on position and margin
11723
+ } else {
11724
+ position.top = max( position.top - collisionPosTop, position.top );
11725
+ }
11726
+ }
11727
+ },
11728
+ flip: {
11729
+ left: function( position, data ) {
11730
+ var within = data.within,
11731
+ withinOffset = within.offset.left + within.scrollLeft,
11732
+ outerWidth = within.width,
11733
+ offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
11734
+ collisionPosLeft = position.left - data.collisionPosition.marginLeft,
11735
+ overLeft = collisionPosLeft - offsetLeft,
11736
+ overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
11737
+ myOffset = data.my[ 0 ] === "left" ?
11738
+ -data.elemWidth :
11739
+ data.my[ 0 ] === "right" ?
11740
+ data.elemWidth :
11741
+ 0,
11742
+ atOffset = data.at[ 0 ] === "left" ?
11743
+ data.targetWidth :
11744
+ data.at[ 0 ] === "right" ?
11745
+ -data.targetWidth :
11746
+ 0,
11747
+ offset = -2 * data.offset[ 0 ],
11748
+ newOverRight,
11749
+ newOverLeft;
11750
+
11751
+ if ( overLeft < 0 ) {
11752
+ newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
11753
+ if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
11754
+ position.left += myOffset + atOffset + offset;
11755
+ }
11756
+ }
11757
+ else if ( overRight > 0 ) {
11758
+ newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
11759
+ if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
11760
+ position.left += myOffset + atOffset + offset;
11761
+ }
11762
+ }
11763
+ },
11764
+ top: function( position, data ) {
11765
+ var within = data.within,
11766
+ withinOffset = within.offset.top + within.scrollTop,
11767
+ outerHeight = within.height,
11768
+ offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
11769
+ collisionPosTop = position.top - data.collisionPosition.marginTop,
11770
+ overTop = collisionPosTop - offsetTop,
11771
+ overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
11772
+ top = data.my[ 1 ] === "top",
11773
+ myOffset = top ?
11774
+ -data.elemHeight :
11775
+ data.my[ 1 ] === "bottom" ?
11776
+ data.elemHeight :
11777
+ 0,
11778
+ atOffset = data.at[ 1 ] === "top" ?
11779
+ data.targetHeight :
11780
+ data.at[ 1 ] === "bottom" ?
11781
+ -data.targetHeight :
11782
+ 0,
11783
+ offset = -2 * data.offset[ 1 ],
11784
+ newOverTop,
11785
+ newOverBottom;
11786
+ if ( overTop < 0 ) {
11787
+ newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
11788
+ if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
11789
+ position.top += myOffset + atOffset + offset;
11790
+ }
11791
+ }
11792
+ else if ( overBottom > 0 ) {
11793
+ newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
11794
+ if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
11795
+ position.top += myOffset + atOffset + offset;
11796
+ }
11797
+ }
11798
+ }
11799
+ },
11800
+ flipfit: {
11801
+ left: function() {
11802
+ $.ui.position.flip.left.apply( this, arguments );
11803
+ $.ui.position.fit.left.apply( this, arguments );
11804
+ },
11805
+ top: function() {
11806
+ $.ui.position.flip.top.apply( this, arguments );
11807
+ $.ui.position.fit.top.apply( this, arguments );
11808
+ }
11809
+ }
11810
+ };
11811
+
11812
+ // fraction support test
11813
+ (function () {
11814
+ var testElement, testElementParent, testElementStyle, offsetLeft, i,
11815
+ body = document.getElementsByTagName( "body" )[ 0 ],
11816
+ div = document.createElement( "div" );
11817
+
11818
+ //Create a "fake body" for testing based on method used in jQuery.support
11819
+ testElement = document.createElement( body ? "div" : "body" );
11820
+ testElementStyle = {
11821
+ visibility: "hidden",
11822
+ width: 0,
11823
+ height: 0,
11824
+ border: 0,
11825
+ margin: 0,
11826
+ background: "none"
11827
+ };
11828
+ if ( body ) {
11829
+ $.extend( testElementStyle, {
11830
+ position: "absolute",
11831
+ left: "-1000px",
11832
+ top: "-1000px"
11833
+ });
11834
+ }
11835
+ for ( i in testElementStyle ) {
11836
+ testElement.style[ i ] = testElementStyle[ i ];
11837
+ }
11838
+ testElement.appendChild( div );
11839
+ testElementParent = body || document.documentElement;
11840
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
11841
+
11842
+ div.style.cssText = "position: absolute; left: 10.7432222px;";
11843
+
11844
+ offsetLeft = $( div ).offset().left;
11845
+ $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
11846
+
11847
+ testElement.innerHTML = "";
11848
+ testElementParent.removeChild( testElement );
11849
+ })();
11850
+
11851
+ // DEPRECATED
11852
+ if ( $.uiBackCompat !== false ) {
11853
+ // offset option
11854
+ (function( $ ) {
11855
+ var _position = $.fn.position;
11856
+ $.fn.position = function( options ) {
11857
+ if ( !options || !options.offset ) {
11858
+ return _position.call( this, options );
11859
+ }
11860
+ var offset = options.offset.split( " " ),
11861
+ at = options.at.split( " " );
11862
+ if ( offset.length === 1 ) {
11863
+ offset[ 1 ] = offset[ 0 ];
11864
+ }
11865
+ if ( /^\d/.test( offset[ 0 ] ) ) {
11866
+ offset[ 0 ] = "+" + offset[ 0 ];
11867
+ }
11868
+ if ( /^\d/.test( offset[ 1 ] ) ) {
11869
+ offset[ 1 ] = "+" + offset[ 1 ];
11870
+ }
11871
+ if ( at.length === 1 ) {
11872
+ if ( /left|center|right/.test( at[ 0 ] ) ) {
11873
+ at[ 1 ] = "center";
11874
+ } else {
11875
+ at[ 1 ] = at[ 0 ];
11876
+ at[ 0 ] = "center";
11877
+ }
11878
+ }
11879
+ return _position.call( this, $.extend( options, {
11880
+ at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
11881
+ offset: undefined
11882
+ } ) );
11883
+ };
11884
+ }( jQuery ) );
11885
+ }
11886
+
11887
+ }( jQuery ) );
11888
+
11889
+ (function( $, undefined ) {
11890
+
11891
+ $.widget( "ui.progressbar", {
11892
+ version: "1.9.0",
11893
+ options: {
11894
+ value: 0,
11895
+ max: 100
11896
+ },
11897
+
11898
+ min: 0,
11899
+
11900
+ _create: function() {
11901
+ this.element
11902
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
11903
+ .attr({
11904
+ role: "progressbar",
11905
+ "aria-valuemin": this.min,
11906
+ "aria-valuemax": this.options.max,
11907
+ "aria-valuenow": this._value()
11908
+ });
11909
+
11910
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
11911
+ .appendTo( this.element );
11912
+
11913
+ this.oldValue = this._value();
11914
+ this._refreshValue();
11915
+ },
11916
+
11917
+ _destroy: function() {
11918
+ this.element
11919
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
11920
+ .removeAttr( "role" )
11921
+ .removeAttr( "aria-valuemin" )
11922
+ .removeAttr( "aria-valuemax" )
11923
+ .removeAttr( "aria-valuenow" );
11924
+
11925
+ this.valueDiv.remove();
11926
+ },
11927
+
11928
+ value: function( newValue ) {
11929
+ if ( newValue === undefined ) {
11930
+ return this._value();
11931
+ }
11932
+
11933
+ this._setOption( "value", newValue );
11934
+ return this;
11935
+ },
11936
+
11937
+ _setOption: function( key, value ) {
11938
+ if ( key === "value" ) {
11939
+ this.options.value = value;
11940
+ this._refreshValue();
11941
+ if ( this._value() === this.options.max ) {
11942
+ this._trigger( "complete" );
11943
+ }
11944
+ }
11945
+
11946
+ this._super( key, value );
11947
+ },
11948
+
11949
+ _value: function() {
11950
+ var val = this.options.value;
11951
+ // normalize invalid value
11952
+ if ( typeof val !== "number" ) {
11953
+ val = 0;
11954
+ }
11955
+ return Math.min( this.options.max, Math.max( this.min, val ) );
11956
+ },
11957
+
11958
+ _percentage: function() {
11959
+ return 100 * this._value() / this.options.max;
11960
+ },
11961
+
11962
+ _refreshValue: function() {
11963
+ var value = this.value(),
11964
+ percentage = this._percentage();
11965
+
11966
+ if ( this.oldValue !== value ) {
11967
+ this.oldValue = value;
11968
+ this._trigger( "change" );
11969
+ }
11970
+
11971
+ this.valueDiv
11972
+ .toggle( value > this.min )
11973
+ .toggleClass( "ui-corner-right", value === this.options.max )
11974
+ .width( percentage.toFixed(0) + "%" );
11975
+ this.element.attr( "aria-valuenow", value );
11976
+ }
11977
+ });
11978
+
11979
+ })( jQuery );
11980
+
11981
+ (function( $, undefined ) {
11982
+
11983
+ // number of pages in a slider
11984
+ // (how many times can you page up/down to go through the whole range)
11985
+ var numPages = 5;
11986
+
11987
+ $.widget( "ui.slider", $.ui.mouse, {
11988
+ version: "1.9.0",
11989
+ widgetEventPrefix: "slide",
11990
+
11991
+ options: {
11992
+ animate: false,
11993
+ distance: 0,
11994
+ max: 100,
11995
+ min: 0,
11996
+ orientation: "horizontal",
11997
+ range: false,
11998
+ step: 1,
11999
+ value: 0,
12000
+ values: null
12001
+ },
12002
+
12003
+ _create: function() {
12004
+ var i,
12005
+ o = this.options,
12006
+ existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
12007
+ handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
12008
+ handleCount = ( o.values && o.values.length ) || 1,
12009
+ handles = [];
12010
+
12011
+ this._keySliding = false;
12012
+ this._mouseSliding = false;
12013
+ this._animateOff = true;
12014
+ this._handleIndex = null;
12015
+ this._detectOrientation();
12016
+ this._mouseInit();
12017
+
12018
+ this.element
12019
+ .addClass( "ui-slider" +
12020
+ " ui-slider-" + this.orientation +
12021
+ " ui-widget" +
12022
+ " ui-widget-content" +
12023
+ " ui-corner-all" +
12024
+ ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
12025
+
12026
+ this.range = $([]);
12027
+
12028
+ if ( o.range ) {
12029
+ if ( o.range === true ) {
12030
+ if ( !o.values ) {
12031
+ o.values = [ this._valueMin(), this._valueMin() ];
12032
+ }
12033
+ if ( o.values.length && o.values.length !== 2 ) {
12034
+ o.values = [ o.values[0], o.values[0] ];
12035
+ }
12036
+ }
12037
+
12038
+ this.range = $( "<div></div>" )
12039
+ .appendTo( this.element )
12040
+ .addClass( "ui-slider-range" +
12041
+ // note: this isn't the most fittingly semantic framework class for this element,
12042
+ // but worked best visually with a variety of themes
12043
+ " ui-widget-header" +
12044
+ ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
12045
+ }
12046
+
12047
+ for ( i = existingHandles.length; i < handleCount; i++ ) {
12048
+ handles.push( handle );
12049
+ }
12050
+
12051
+ this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
12052
+
12053
+ this.handle = this.handles.eq( 0 );
12054
+
12055
+ this.handles.add( this.range ).filter( "a" )
12056
+ .click(function( event ) {
12057
+ event.preventDefault();
12058
+ })
12059
+ .mouseenter(function() {
12060
+ if ( !o.disabled ) {
12061
+ $( this ).addClass( "ui-state-hover" );
12062
+ }
12063
+ })
12064
+ .mouseleave(function() {
12065
+ $( this ).removeClass( "ui-state-hover" );
12066
+ })
12067
+ .focus(function() {
12068
+ if ( !o.disabled ) {
12069
+ $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
12070
+ $( this ).addClass( "ui-state-focus" );
12071
+ } else {
12072
+ $( this ).blur();
12073
+ }
12074
+ })
12075
+ .blur(function() {
12076
+ $( this ).removeClass( "ui-state-focus" );
12077
+ });
12078
+
12079
+ this.handles.each(function( i ) {
12080
+ $( this ).data( "ui-slider-handle-index", i );
12081
+ });
12082
+
12083
+ this._on( this.handles, {
12084
+ keydown: function( event ) {
12085
+ var allowed, curVal, newVal, step,
12086
+ index = $( event.target ).data( "ui-slider-handle-index" );
12087
+
12088
+ switch ( event.keyCode ) {
12089
+ case $.ui.keyCode.HOME:
12090
+ case $.ui.keyCode.END:
12091
+ case $.ui.keyCode.PAGE_UP:
12092
+ case $.ui.keyCode.PAGE_DOWN:
12093
+ case $.ui.keyCode.UP:
12094
+ case $.ui.keyCode.RIGHT:
12095
+ case $.ui.keyCode.DOWN:
12096
+ case $.ui.keyCode.LEFT:
12097
+ event.preventDefault();
12098
+ if ( !this._keySliding ) {
12099
+ this._keySliding = true;
12100
+ $( event.target ).addClass( "ui-state-active" );
12101
+ allowed = this._start( event, index );
12102
+ if ( allowed === false ) {
12103
+ return;
12104
+ }
12105
+ }
12106
+ break;
12107
+ }
12108
+
12109
+ step = this.options.step;
12110
+ if ( this.options.values && this.options.values.length ) {
12111
+ curVal = newVal = this.values( index );
12112
+ } else {
12113
+ curVal = newVal = this.value();
12114
+ }
12115
+
12116
+ switch ( event.keyCode ) {
12117
+ case $.ui.keyCode.HOME:
12118
+ newVal = this._valueMin();
12119
+ break;
12120
+ case $.ui.keyCode.END:
12121
+ newVal = this._valueMax();
12122
+ break;
12123
+ case $.ui.keyCode.PAGE_UP:
12124
+ newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
12125
+ break;
12126
+ case $.ui.keyCode.PAGE_DOWN:
12127
+ newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
12128
+ break;
12129
+ case $.ui.keyCode.UP:
12130
+ case $.ui.keyCode.RIGHT:
12131
+ if ( curVal === this._valueMax() ) {
12132
+ return;
12133
+ }
12134
+ newVal = this._trimAlignValue( curVal + step );
12135
+ break;
12136
+ case $.ui.keyCode.DOWN:
12137
+ case $.ui.keyCode.LEFT:
12138
+ if ( curVal === this._valueMin() ) {
12139
+ return;
12140
+ }
12141
+ newVal = this._trimAlignValue( curVal - step );
12142
+ break;
12143
+ }
12144
+
12145
+ this._slide( event, index, newVal );
12146
+ },
12147
+ keyup: function( event ) {
12148
+ var index = $( event.target ).data( "ui-slider-handle-index" );
12149
+
12150
+ if ( this._keySliding ) {
12151
+ this._keySliding = false;
12152
+ this._stop( event, index );
12153
+ this._change( event, index );
12154
+ $( event.target ).removeClass( "ui-state-active" );
12155
+ }
12156
+ }
12157
+ });
12158
+
12159
+ this._refreshValue();
12160
+
12161
+ this._animateOff = false;
12162
+ },
12163
+
12164
+ _destroy: function() {
12165
+ this.handles.remove();
12166
+ this.range.remove();
12167
+
12168
+ this.element
12169
+ .removeClass( "ui-slider" +
12170
+ " ui-slider-horizontal" +
12171
+ " ui-slider-vertical" +
12172
+ " ui-slider-disabled" +
12173
+ " ui-widget" +
12174
+ " ui-widget-content" +
12175
+ " ui-corner-all" );
12176
+
12177
+ this._mouseDestroy();
12178
+ },
12179
+
12180
+ _mouseCapture: function( event ) {
12181
+ var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
12182
+ that = this,
12183
+ o = this.options;
12184
+
12185
+ if ( o.disabled ) {
12186
+ return false;
12187
+ }
12188
+
12189
+ this.elementSize = {
12190
+ width: this.element.outerWidth(),
12191
+ height: this.element.outerHeight()
12192
+ };
12193
+ this.elementOffset = this.element.offset();
12194
+
12195
+ position = { x: event.pageX, y: event.pageY };
12196
+ normValue = this._normValueFromMouse( position );
12197
+ distance = this._valueMax() - this._valueMin() + 1;
12198
+ this.handles.each(function( i ) {
12199
+ var thisDistance = Math.abs( normValue - that.values(i) );
12200
+ if ( distance > thisDistance ) {
12201
+ distance = thisDistance;
12202
+ closestHandle = $( this );
12203
+ index = i;
12204
+ }
12205
+ });
12206
+
12207
+ // workaround for bug #3736 (if both handles of a range are at 0,
12208
+ // the first is always used as the one with least distance,
12209
+ // and moving it is obviously prevented by preventing negative ranges)
12210
+ if( o.range === true && this.values(1) === o.min ) {
12211
+ index += 1;
12212
+ closestHandle = $( this.handles[index] );
12213
+ }
12214
+
12215
+ allowed = this._start( event, index );
12216
+ if ( allowed === false ) {
12217
+ return false;
12218
+ }
12219
+ this._mouseSliding = true;
12220
+
12221
+ this._handleIndex = index;
12222
+
12223
+ closestHandle
12224
+ .addClass( "ui-state-active" )
12225
+ .focus();
12226
+
12227
+ offset = closestHandle.offset();
12228
+ mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
12229
+ this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
12230
+ left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
12231
+ top: event.pageY - offset.top -
12232
+ ( closestHandle.height() / 2 ) -
12233
+ ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
12234
+ ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
12235
+ ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
12236
+ };
12237
+
12238
+ if ( !this.handles.hasClass( "ui-state-hover" ) ) {
12239
+ this._slide( event, index, normValue );
12240
+ }
12241
+ this._animateOff = true;
12242
+ return true;
12243
+ },
12244
+
12245
+ _mouseStart: function( event ) {
12246
+ return true;
12247
+ },
12248
+
12249
+ _mouseDrag: function( event ) {
12250
+ var position = { x: event.pageX, y: event.pageY },
12251
+ normValue = this._normValueFromMouse( position );
12252
+
12253
+ this._slide( event, this._handleIndex, normValue );
12254
+
12255
+ return false;
12256
+ },
12257
+
12258
+ _mouseStop: function( event ) {
12259
+ this.handles.removeClass( "ui-state-active" );
12260
+ this._mouseSliding = false;
12261
+
12262
+ this._stop( event, this._handleIndex );
12263
+ this._change( event, this._handleIndex );
12264
+
12265
+ this._handleIndex = null;
12266
+ this._clickOffset = null;
12267
+ this._animateOff = false;
12268
+
12269
+ return false;
12270
+ },
12271
+
12272
+ _detectOrientation: function() {
12273
+ this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
12274
+ },
12275
+
12276
+ _normValueFromMouse: function( position ) {
12277
+ var pixelTotal,
12278
+ pixelMouse,
12279
+ percentMouse,
12280
+ valueTotal,
12281
+ valueMouse;
12282
+
12283
+ if ( this.orientation === "horizontal" ) {
12284
+ pixelTotal = this.elementSize.width;
12285
+ pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
12286
+ } else {
12287
+ pixelTotal = this.elementSize.height;
12288
+ pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
12289
+ }
12290
+
12291
+ percentMouse = ( pixelMouse / pixelTotal );
12292
+ if ( percentMouse > 1 ) {
12293
+ percentMouse = 1;
12294
+ }
12295
+ if ( percentMouse < 0 ) {
12296
+ percentMouse = 0;
12297
+ }
12298
+ if ( this.orientation === "vertical" ) {
12299
+ percentMouse = 1 - percentMouse;
12300
+ }
12301
+
12302
+ valueTotal = this._valueMax() - this._valueMin();
12303
+ valueMouse = this._valueMin() + percentMouse * valueTotal;
12304
+
12305
+ return this._trimAlignValue( valueMouse );
12306
+ },
12307
+
12308
+ _start: function( event, index ) {
12309
+ var uiHash = {
12310
+ handle: this.handles[ index ],
12311
+ value: this.value()
12312
+ };
12313
+ if ( this.options.values && this.options.values.length ) {
12314
+ uiHash.value = this.values( index );
12315
+ uiHash.values = this.values();
12316
+ }
12317
+ return this._trigger( "start", event, uiHash );
12318
+ },
12319
+
12320
+ _slide: function( event, index, newVal ) {
12321
+ var otherVal,
12322
+ newValues,
12323
+ allowed;
12324
+
12325
+ if ( this.options.values && this.options.values.length ) {
12326
+ otherVal = this.values( index ? 0 : 1 );
12327
+
12328
+ if ( ( this.options.values.length === 2 && this.options.range === true ) &&
12329
+ ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
12330
+ ) {
12331
+ newVal = otherVal;
12332
+ }
12333
+
12334
+ if ( newVal !== this.values( index ) ) {
12335
+ newValues = this.values();
12336
+ newValues[ index ] = newVal;
12337
+ // A slide can be canceled by returning false from the slide callback
12338
+ allowed = this._trigger( "slide", event, {
12339
+ handle: this.handles[ index ],
12340
+ value: newVal,
12341
+ values: newValues
12342
+ } );
12343
+ otherVal = this.values( index ? 0 : 1 );
12344
+ if ( allowed !== false ) {
12345
+ this.values( index, newVal, true );
12346
+ }
12347
+ }
12348
+ } else {
12349
+ if ( newVal !== this.value() ) {
12350
+ // A slide can be canceled by returning false from the slide callback
12351
+ allowed = this._trigger( "slide", event, {
12352
+ handle: this.handles[ index ],
12353
+ value: newVal
12354
+ } );
12355
+ if ( allowed !== false ) {
12356
+ this.value( newVal );
12357
+ }
12358
+ }
12359
+ }
12360
+ },
12361
+
12362
+ _stop: function( event, index ) {
12363
+ var uiHash = {
12364
+ handle: this.handles[ index ],
12365
+ value: this.value()
12366
+ };
12367
+ if ( this.options.values && this.options.values.length ) {
12368
+ uiHash.value = this.values( index );
12369
+ uiHash.values = this.values();
12370
+ }
12371
+
12372
+ this._trigger( "stop", event, uiHash );
12373
+ },
12374
+
12375
+ _change: function( event, index ) {
12376
+ if ( !this._keySliding && !this._mouseSliding ) {
12377
+ var uiHash = {
12378
+ handle: this.handles[ index ],
12379
+ value: this.value()
12380
+ };
12381
+ if ( this.options.values && this.options.values.length ) {
12382
+ uiHash.value = this.values( index );
12383
+ uiHash.values = this.values();
12384
+ }
12385
+
12386
+ this._trigger( "change", event, uiHash );
12387
+ }
12388
+ },
12389
+
12390
+ value: function( newValue ) {
12391
+ if ( arguments.length ) {
12392
+ this.options.value = this._trimAlignValue( newValue );
12393
+ this._refreshValue();
12394
+ this._change( null, 0 );
12395
+ return;
12396
+ }
12397
+
12398
+ return this._value();
12399
+ },
12400
+
12401
+ values: function( index, newValue ) {
12402
+ var vals,
12403
+ newValues,
12404
+ i;
12405
+
12406
+ if ( arguments.length > 1 ) {
12407
+ this.options.values[ index ] = this._trimAlignValue( newValue );
12408
+ this._refreshValue();
12409
+ this._change( null, index );
12410
+ return;
12411
+ }
12412
+
12413
+ if ( arguments.length ) {
12414
+ if ( $.isArray( arguments[ 0 ] ) ) {
12415
+ vals = this.options.values;
12416
+ newValues = arguments[ 0 ];
12417
+ for ( i = 0; i < vals.length; i += 1 ) {
12418
+ vals[ i ] = this._trimAlignValue( newValues[ i ] );
12419
+ this._change( null, i );
12420
+ }
12421
+ this._refreshValue();
12422
+ } else {
12423
+ if ( this.options.values && this.options.values.length ) {
12424
+ return this._values( index );
12425
+ } else {
12426
+ return this.value();
12427
+ }
12428
+ }
12429
+ } else {
12430
+ return this._values();
12431
+ }
12432
+ },
12433
+
12434
+ _setOption: function( key, value ) {
12435
+ var i,
12436
+ valsLength = 0;
12437
+
12438
+ if ( $.isArray( this.options.values ) ) {
12439
+ valsLength = this.options.values.length;
12440
+ }
12441
+
12442
+ $.Widget.prototype._setOption.apply( this, arguments );
12443
+
12444
+ switch ( key ) {
12445
+ case "disabled":
12446
+ if ( value ) {
12447
+ this.handles.filter( ".ui-state-focus" ).blur();
12448
+ this.handles.removeClass( "ui-state-hover" );
12449
+ this.handles.prop( "disabled", true );
12450
+ this.element.addClass( "ui-disabled" );
12451
+ } else {
12452
+ this.handles.prop( "disabled", false );
12453
+ this.element.removeClass( "ui-disabled" );
12454
+ }
12455
+ break;
12456
+ case "orientation":
12457
+ this._detectOrientation();
12458
+ this.element
12459
+ .removeClass( "ui-slider-horizontal ui-slider-vertical" )
12460
+ .addClass( "ui-slider-" + this.orientation );
12461
+ this._refreshValue();
12462
+ break;
12463
+ case "value":
12464
+ this._animateOff = true;
12465
+ this._refreshValue();
12466
+ this._change( null, 0 );
12467
+ this._animateOff = false;
12468
+ break;
12469
+ case "values":
12470
+ this._animateOff = true;
12471
+ this._refreshValue();
12472
+ for ( i = 0; i < valsLength; i += 1 ) {
12473
+ this._change( null, i );
12474
+ }
12475
+ this._animateOff = false;
12476
+ break;
12477
+ }
12478
+ },
12479
+
12480
+ //internal value getter
12481
+ // _value() returns value trimmed by min and max, aligned by step
12482
+ _value: function() {
12483
+ var val = this.options.value;
12484
+ val = this._trimAlignValue( val );
12485
+
12486
+ return val;
12487
+ },
12488
+
12489
+ //internal values getter
12490
+ // _values() returns array of values trimmed by min and max, aligned by step
12491
+ // _values( index ) returns single value trimmed by min and max, aligned by step
12492
+ _values: function( index ) {
12493
+ var val,
12494
+ vals,
12495
+ i;
12496
+
12497
+ if ( arguments.length ) {
12498
+ val = this.options.values[ index ];
12499
+ val = this._trimAlignValue( val );
12500
+
12501
+ return val;
12502
+ } else {
12503
+ // .slice() creates a copy of the array
12504
+ // this copy gets trimmed by min and max and then returned
12505
+ vals = this.options.values.slice();
12506
+ for ( i = 0; i < vals.length; i+= 1) {
12507
+ vals[ i ] = this._trimAlignValue( vals[ i ] );
12508
+ }
12509
+
12510
+ return vals;
12511
+ }
12512
+ },
12513
+
12514
+ // returns the step-aligned value that val is closest to, between (inclusive) min and max
12515
+ _trimAlignValue: function( val ) {
12516
+ if ( val <= this._valueMin() ) {
12517
+ return this._valueMin();
12518
+ }
12519
+ if ( val >= this._valueMax() ) {
12520
+ return this._valueMax();
12521
+ }
12522
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
12523
+ valModStep = (val - this._valueMin()) % step,
12524
+ alignValue = val - valModStep;
12525
+
12526
+ if ( Math.abs(valModStep) * 2 >= step ) {
12527
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
12528
+ }
12529
+
12530
+ // Since JavaScript has problems with large floats, round
12531
+ // the final value to 5 digits after the decimal point (see #4124)
12532
+ return parseFloat( alignValue.toFixed(5) );
12533
+ },
12534
+
12535
+ _valueMin: function() {
12536
+ return this.options.min;
12537
+ },
12538
+
12539
+ _valueMax: function() {
12540
+ return this.options.max;
12541
+ },
12542
+
12543
+ _refreshValue: function() {
12544
+ var lastValPercent, valPercent, value, valueMin, valueMax,
12545
+ oRange = this.options.range,
12546
+ o = this.options,
12547
+ that = this,
12548
+ animate = ( !this._animateOff ) ? o.animate : false,
12549
+ _set = {};
12550
+
12551
+ if ( this.options.values && this.options.values.length ) {
12552
+ this.handles.each(function( i, j ) {
12553
+ valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
12554
+ _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
12555
+ $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
12556
+ if ( that.options.range === true ) {
12557
+ if ( that.orientation === "horizontal" ) {
12558
+ if ( i === 0 ) {
12559
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
12560
+ }
12561
+ if ( i === 1 ) {
12562
+ that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
12563
+ }
12564
+ } else {
12565
+ if ( i === 0 ) {
12566
+ that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
12567
+ }
12568
+ if ( i === 1 ) {
12569
+ that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
12570
+ }
12571
+ }
12572
+ }
12573
+ lastValPercent = valPercent;
12574
+ });
12575
+ } else {
12576
+ value = this.value();
12577
+ valueMin = this._valueMin();
12578
+ valueMax = this._valueMax();
12579
+ valPercent = ( valueMax !== valueMin ) ?
12580
+ ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
12581
+ 0;
12582
+ _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
12583
+ this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
12584
+
12585
+ if ( oRange === "min" && this.orientation === "horizontal" ) {
12586
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
12587
+ }
12588
+ if ( oRange === "max" && this.orientation === "horizontal" ) {
12589
+ this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
12590
+ }
12591
+ if ( oRange === "min" && this.orientation === "vertical" ) {
12592
+ this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
12593
+ }
12594
+ if ( oRange === "max" && this.orientation === "vertical" ) {
12595
+ this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
12596
+ }
12597
+ }
12598
+ }
12599
+
12600
+ });
12601
+
12602
+ }(jQuery));
12603
+
12604
+ (function( $ ) {
12605
+
12606
+ function modifier( fn ) {
12607
+ return function() {
12608
+ var previous = this.element.val();
12609
+ fn.apply( this, arguments );
12610
+ this._refresh();
12611
+ if ( previous !== this.element.val() ) {
12612
+ this._trigger( "change" );
12613
+ }
12614
+ };
12615
+ }
12616
+
12617
+ $.widget( "ui.spinner", {
12618
+ version: "1.9.0",
12619
+ defaultElement: "<input>",
12620
+ widgetEventPrefix: "spin",
12621
+ options: {
12622
+ culture: null,
12623
+ icons: {
12624
+ down: "ui-icon-triangle-1-s",
12625
+ up: "ui-icon-triangle-1-n"
12626
+ },
12627
+ incremental: true,
12628
+ max: null,
12629
+ min: null,
12630
+ numberFormat: null,
12631
+ page: 10,
12632
+ step: 1,
12633
+
12634
+ change: null,
12635
+ spin: null,
12636
+ start: null,
12637
+ stop: null
12638
+ },
12639
+
12640
+ _create: function() {
12641
+ // handle string values that need to be parsed
12642
+ this._setOption( "max", this.options.max );
12643
+ this._setOption( "min", this.options.min );
12644
+ this._setOption( "step", this.options.step );
12645
+
12646
+ // format the value, but don't constrain
12647
+ this._value( this.element.val(), true );
12648
+
12649
+ this._draw();
12650
+ this._on( this._events );
12651
+ this._refresh();
12652
+
12653
+ // turning off autocomplete prevents the browser from remembering the
12654
+ // value when navigating through history, so we re-enable autocomplete
12655
+ // if the page is unloaded before the widget is destroyed. #7790
12656
+ this._on( this.window, {
12657
+ beforeunload: function() {
12658
+ this.element.removeAttr( "autocomplete" );
12659
+ }
12660
+ });
12661
+ },
12662
+
12663
+ _getCreateOptions: function() {
12664
+ var options = {},
12665
+ element = this.element;
12666
+
12667
+ $.each( [ "min", "max", "step" ], function( i, option ) {
12668
+ var value = element.attr( option );
12669
+ if ( value !== undefined && value.length ) {
12670
+ options[ option ] = value;
12671
+ }
12672
+ });
12673
+
12674
+ return options;
12675
+ },
12676
+
12677
+ _events: {
12678
+ keydown: function( event ) {
12679
+ if ( this._start( event ) && this._keydown( event ) ) {
12680
+ event.preventDefault();
12681
+ }
12682
+ },
12683
+ keyup: "_stop",
12684
+ focus: function() {
12685
+ this.uiSpinner.addClass( "ui-state-active" );
12686
+ this.previous = this.element.val();
12687
+ },
12688
+ blur: function( event ) {
12689
+ if ( this.cancelBlur ) {
12690
+ delete this.cancelBlur;
12691
+ return;
12692
+ }
12693
+
12694
+ this._refresh();
12695
+ this.uiSpinner.removeClass( "ui-state-active" );
12696
+ if ( this.previous !== this.element.val() ) {
12697
+ this._trigger( "change", event );
12698
+ }
12699
+ },
12700
+ mousewheel: function( event, delta ) {
12701
+ if ( !delta ) {
12702
+ return;
12703
+ }
12704
+ if ( !this.spinning && !this._start( event ) ) {
12705
+ return false;
12706
+ }
12707
+
12708
+ this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
12709
+ clearTimeout( this.mousewheelTimer );
12710
+ this.mousewheelTimer = this._delay(function() {
12711
+ if ( this.spinning ) {
12712
+ this._stop( event );
12713
+ }
12714
+ }, 100 );
12715
+ event.preventDefault();
12716
+ },
12717
+ "mousedown .ui-spinner-button": function( event ) {
12718
+ var previous;
12719
+
12720
+ // We never want the buttons to have focus; whenever the user is
12721
+ // interacting with the spinner, the focus should be on the input.
12722
+ // If the input is focused then this.previous is properly set from
12723
+ // when the input first received focus. If the input is not focused
12724
+ // then we need to set this.previous based on the value before spinning.
12725
+ previous = this.element[0] === this.document[0].activeElement ?
12726
+ this.previous : this.element.val();
12727
+ function checkFocus() {
12728
+ var isActive = this.element[0] === this.document[0].activeElement;
12729
+ if ( !isActive ) {
12730
+ this.element.focus();
12731
+ this.previous = previous;
12732
+ // support: IE
12733
+ // IE sets focus asynchronously, so we need to check if focus
12734
+ // moved off of the input because the user clicked on the button.
12735
+ this._delay(function() {
12736
+ this.previous = previous;
12737
+ });
12738
+ }
12739
+ }
12740
+
12741
+ // ensure focus is on (or stays on) the text field
12742
+ event.preventDefault();
12743
+ checkFocus.call( this );
12744
+
12745
+ // support: IE
12746
+ // IE doesn't prevent moving focus even with event.preventDefault()
12747
+ // so we set a flag to know when we should ignore the blur event
12748
+ // and check (again) if focus moved off of the input.
12749
+ this.cancelBlur = true;
12750
+ this._delay(function() {
12751
+ delete this.cancelBlur;
12752
+ checkFocus.call( this );
12753
+ });
12754
+
12755
+ if ( this._start( event ) === false ) {
12756
+ return;
12757
+ }
12758
+
12759
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
12760
+ },
12761
+ "mouseup .ui-spinner-button": "_stop",
12762
+ "mouseenter .ui-spinner-button": function( event ) {
12763
+ // button will add ui-state-active if mouse was down while mouseleave and kept down
12764
+ if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
12765
+ return;
12766
+ }
12767
+
12768
+ if ( this._start( event ) === false ) {
12769
+ return false;
12770
+ }
12771
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
12772
+ },
12773
+ // TODO: do we really want to consider this a stop?
12774
+ // shouldn't we just stop the repeater and wait until mouseup before
12775
+ // we trigger the stop event?
12776
+ "mouseleave .ui-spinner-button": "_stop"
12777
+ },
12778
+
12779
+ _draw: function() {
12780
+ var uiSpinner = this.uiSpinner = this.element
12781
+ .addClass( "ui-spinner-input" )
12782
+ .attr( "autocomplete", "off" )
12783
+ .wrap( this._uiSpinnerHtml() )
12784
+ .parent()
12785
+ // add buttons
12786
+ .append( this._buttonHtml() );
12787
+ this._hoverable( uiSpinner );
12788
+
12789
+ this.element.attr( "role", "spinbutton" );
12790
+
12791
+ // button bindings
12792
+ this.buttons = uiSpinner.find( ".ui-spinner-button" )
12793
+ .attr( "tabIndex", -1 )
12794
+ .button()
12795
+ .removeClass( "ui-corner-all" );
12796
+
12797
+ // IE 6 doesn't understand height: 50% for the buttons
12798
+ // unless the wrapper has an explicit height
12799
+ if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
12800
+ uiSpinner.height() > 0 ) {
12801
+ uiSpinner.height( uiSpinner.height() );
12802
+ }
12803
+
12804
+ // disable spinner if element was already disabled
12805
+ if ( this.options.disabled ) {
12806
+ this.disable();
12807
+ }
12808
+ },
12809
+
12810
+ _keydown: function( event ) {
12811
+ var options = this.options,
12812
+ keyCode = $.ui.keyCode;
12813
+
12814
+ switch ( event.keyCode ) {
12815
+ case keyCode.UP:
12816
+ this._repeat( null, 1, event );
12817
+ return true;
12818
+ case keyCode.DOWN:
12819
+ this._repeat( null, -1, event );
12820
+ return true;
12821
+ case keyCode.PAGE_UP:
12822
+ this._repeat( null, options.page, event );
12823
+ return true;
12824
+ case keyCode.PAGE_DOWN:
12825
+ this._repeat( null, -options.page, event );
12826
+ return true;
12827
+ }
12828
+
12829
+ return false;
12830
+ },
12831
+
12832
+ _uiSpinnerHtml: function() {
12833
+ return "<span class='ui-spinner ui-state-default ui-widget ui-widget-content ui-corner-all'></span>";
12834
+ },
12835
+
12836
+ _buttonHtml: function() {
12837
+ return "" +
12838
+ "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
12839
+ "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
12840
+ "</a>" +
12841
+ "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
12842
+ "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
12843
+ "</a>";
12844
+ },
12845
+
12846
+ _start: function( event ) {
12847
+ if ( !this.spinning && this._trigger( "start", event ) === false ) {
12848
+ return false;
12849
+ }
12850
+
12851
+ if ( !this.counter ) {
12852
+ this.counter = 1;
12853
+ }
12854
+ this.spinning = true;
12855
+ return true;
12856
+ },
12857
+
12858
+ _repeat: function( i, steps, event ) {
12859
+ i = i || 500;
12860
+
12861
+ clearTimeout( this.timer );
12862
+ this.timer = this._delay(function() {
12863
+ this._repeat( 40, steps, event );
12864
+ }, i );
12865
+
12866
+ this._spin( steps * this.options.step, event );
12867
+ },
12868
+
12869
+ _spin: function( step, event ) {
12870
+ var value = this.value() || 0;
12871
+
12872
+ if ( !this.counter ) {
12873
+ this.counter = 1;
12874
+ }
12875
+
12876
+ value = this._adjustValue( value + step * this._increment( this.counter ) );
12877
+
12878
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
12879
+ this._value( value );
12880
+ this.counter++;
12881
+ }
12882
+ },
12883
+
12884
+ _increment: function( i ) {
12885
+ var incremental = this.options.incremental;
12886
+
12887
+ if ( incremental ) {
12888
+ return $.isFunction( incremental ) ?
12889
+ incremental( i ) :
12890
+ Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
12891
+ }
12892
+
12893
+ return 1;
12894
+ },
12895
+
12896
+ _precision: function() {
12897
+ var precision = this._precisionOf( this.options.step );
12898
+ if ( this.options.min !== null ) {
12899
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
12900
+ }
12901
+ return precision;
12902
+ },
12903
+
12904
+ _precisionOf: function( num ) {
12905
+ var str = num.toString(),
12906
+ decimal = str.indexOf( "." );
12907
+ return decimal === -1 ? 0 : str.length - decimal - 1;
12908
+ },
12909
+
12910
+ _adjustValue: function( value ) {
12911
+ var base, aboveMin,
12912
+ options = this.options;
12913
+
12914
+ // make sure we're at a valid step
12915
+ // - find out where we are relative to the base (min or 0)
12916
+ base = options.min !== null ? options.min : 0;
12917
+ aboveMin = value - base;
12918
+ // - round to the nearest step
12919
+ aboveMin = Math.round(aboveMin / options.step) * options.step;
12920
+ // - rounding is based on 0, so adjust back to our base
12921
+ value = base + aboveMin;
12922
+
12923
+ // fix precision from bad JS floating point math
12924
+ value = parseFloat( value.toFixed( this._precision() ) );
12925
+
12926
+ // clamp the value
12927
+ if ( options.max !== null && value > options.max) {
12928
+ return options.max;
12929
+ }
12930
+ if ( options.min !== null && value < options.min ) {
12931
+ return options.min;
12932
+ }
12933
+
12934
+ return value;
12935
+ },
12936
+
12937
+ _stop: function( event ) {
12938
+ if ( !this.spinning ) {
12939
+ return;
12940
+ }
12941
+
12942
+ clearTimeout( this.timer );
12943
+ clearTimeout( this.mousewheelTimer );
12944
+ this.counter = 0;
12945
+ this.spinning = false;
12946
+ this._trigger( "stop", event );
12947
+ },
12948
+
12949
+ _setOption: function( key, value ) {
12950
+ if ( key === "culture" || key === "numberFormat" ) {
12951
+ var prevValue = this._parse( this.element.val() );
12952
+ this.options[ key ] = value;
12953
+ this.element.val( this._format( prevValue ) );
12954
+ return;
12955
+ }
12956
+
12957
+ if ( key === "max" || key === "min" || key === "step" ) {
12958
+ if ( typeof value === "string" ) {
12959
+ value = this._parse( value );
12960
+ }
12961
+ }
12962
+
12963
+ this._super( key, value );
12964
+
12965
+ if ( key === "disabled" ) {
12966
+ if ( value ) {
12967
+ this.element.prop( "disabled", true );
12968
+ this.buttons.button( "disable" );
12969
+ } else {
12970
+ this.element.prop( "disabled", false );
12971
+ this.buttons.button( "enable" );
12972
+ }
12973
+ }
12974
+ },
12975
+
12976
+ _setOptions: modifier(function( options ) {
12977
+ this._super( options );
12978
+ this._value( this.element.val() );
12979
+ }),
12980
+
12981
+ _parse: function( val ) {
12982
+ if ( typeof val === "string" && val !== "" ) {
12983
+ val = window.Globalize && this.options.numberFormat ?
12984
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;
12985
+ }
12986
+ return val === "" || isNaN( val ) ? null : val;
12987
+ },
12988
+
12989
+ _format: function( value ) {
12990
+ if ( value === "" ) {
12991
+ return "";
12992
+ }
12993
+ return window.Globalize && this.options.numberFormat ?
12994
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :
12995
+ value;
12996
+ },
12997
+
12998
+ _refresh: function() {
12999
+ this.element.attr({
13000
+ "aria-valuemin": this.options.min,
13001
+ "aria-valuemax": this.options.max,
13002
+ // TODO: what should we do with values that can't be parsed?
13003
+ "aria-valuenow": this._parse( this.element.val() )
13004
+ });
13005
+ },
13006
+
13007
+ // update the value without triggering change
13008
+ _value: function( value, allowAny ) {
13009
+ var parsed;
13010
+ if ( value !== "" ) {
13011
+ parsed = this._parse( value );
13012
+ if ( parsed !== null ) {
13013
+ if ( !allowAny ) {
13014
+ parsed = this._adjustValue( parsed );
13015
+ }
13016
+ value = this._format( parsed );
13017
+ }
13018
+ }
13019
+ this.element.val( value );
13020
+ this._refresh();
13021
+ },
13022
+
13023
+ _destroy: function() {
13024
+ this.element
13025
+ .removeClass( "ui-spinner-input" )
13026
+ .prop( "disabled", false )
13027
+ .removeAttr( "autocomplete" )
13028
+ .removeAttr( "role" )
13029
+ .removeAttr( "aria-valuemin" )
13030
+ .removeAttr( "aria-valuemax" )
13031
+ .removeAttr( "aria-valuenow" );
13032
+ this.uiSpinner.replaceWith( this.element );
13033
+ },
13034
+
13035
+ stepUp: modifier(function( steps ) {
13036
+ this._stepUp( steps );
13037
+ }),
13038
+ _stepUp: function( steps ) {
13039
+ this._spin( (steps || 1) * this.options.step );
13040
+ },
13041
+
13042
+ stepDown: modifier(function( steps ) {
13043
+ this._stepDown( steps );
13044
+ }),
13045
+ _stepDown: function( steps ) {
13046
+ this._spin( (steps || 1) * -this.options.step );
13047
+ },
13048
+
13049
+ pageUp: modifier(function( pages ) {
13050
+ this._stepUp( (pages || 1) * this.options.page );
13051
+ }),
13052
+
13053
+ pageDown: modifier(function( pages ) {
13054
+ this._stepDown( (pages || 1) * this.options.page );
13055
+ }),
13056
+
13057
+ value: function( newVal ) {
13058
+ if ( !arguments.length ) {
13059
+ return this._parse( this.element.val() );
13060
+ }
13061
+ modifier( this._value ).call( this, newVal );
13062
+ },
13063
+
13064
+ widget: function() {
13065
+ return this.uiSpinner;
13066
+ }
13067
+ });
13068
+
13069
+ }( jQuery ) );
13070
+
13071
+ (function( $, undefined ) {
13072
+
13073
+ var tabId = 0,
13074
+ rhash = /#.*$/;
13075
+
13076
+ function getNextTabId() {
13077
+ return ++tabId;
13078
+ }
13079
+
13080
+ function isLocal( anchor ) {
13081
+ // clone the node to work around IE 6 not normalizing the href property
13082
+ // if it's manually set, i.e., a.href = "#foo" kills the normalization
13083
+ anchor = anchor.cloneNode( false );
13084
+ return anchor.hash.length > 1 &&
13085
+ anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
13086
+ }
13087
+
13088
+ $.widget( "ui.tabs", {
13089
+ version: "1.9.0",
13090
+ delay: 300,
13091
+ options: {
13092
+ active: null,
13093
+ collapsible: false,
13094
+ event: "click",
13095
+ heightStyle: "content",
13096
+ hide: null,
13097
+ show: null,
13098
+
13099
+ // callbacks
13100
+ activate: null,
13101
+ beforeActivate: null,
13102
+ beforeLoad: null,
13103
+ load: null
13104
+ },
13105
+
13106
+ _create: function() {
13107
+ var panel,
13108
+ that = this,
13109
+ options = this.options,
13110
+ active = options.active;
13111
+
13112
+ this.running = false;
13113
+
13114
+ this.element
13115
+ .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
13116
+ .toggleClass( "ui-tabs-collapsible", options.collapsible )
13117
+ // Prevent users from focusing disabled tabs via click
13118
+ .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) {
13119
+ if ( $( this ).is( ".ui-state-disabled" ) ) {
13120
+ event.preventDefault();
13121
+ }
13122
+ })
13123
+ // support: IE <9
13124
+ // Preventing the default action in mousedown doesn't prevent IE
13125
+ // from focusing the element, so if the anchor gets focused, blur.
13126
+ // We don't have to worry about focusing the previously focused
13127
+ // element since clicking on a non-focusable element should focus
13128
+ // the body anyway.
13129
+ .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
13130
+ if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
13131
+ this.blur();
13132
+ }
13133
+ });
13134
+
13135
+ this._processTabs();
13136
+
13137
+ if ( active === null ) {
13138
+ // check the fragment identifier in the URL
13139
+ if ( location.hash ) {
13140
+ this.anchors.each(function( i, anchor ) {
13141
+ if ( anchor.hash === location.hash ) {
13142
+ active = i;
13143
+ return false;
13144
+ }
13145
+ });
13146
+ }
13147
+
13148
+ // check for a tab marked active via a class
13149
+ if ( active === null ) {
13150
+ active = this.tabs.filter( ".ui-tabs-active" ).index();
13151
+ }
13152
+
13153
+ // no active tab, set to false
13154
+ if ( active === null || active === -1 ) {
13155
+ active = this.tabs.length ? 0 : false;
13156
+ }
13157
+ }
13158
+
13159
+ // handle numbers: negative, out of range
13160
+ if ( active !== false ) {
13161
+ active = this.tabs.index( this.tabs.eq( active ) );
13162
+ if ( active === -1 ) {
13163
+ active = options.collapsible ? false : 0;
13164
+ }
13165
+ }
13166
+ options.active = active;
13167
+
13168
+ // don't allow collapsible: false and active: false
13169
+ if ( !options.collapsible && options.active === false && this.anchors.length ) {
13170
+ options.active = 0;
13171
+ }
13172
+
13173
+ // Take disabling tabs via class attribute from HTML
13174
+ // into account and update option properly.
13175
+ if ( $.isArray( options.disabled ) ) {
13176
+ options.disabled = $.unique( options.disabled.concat(
13177
+ $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
13178
+ return that.tabs.index( li );
13179
+ })
13180
+ ) ).sort();
13181
+ }
13182
+
13183
+ // check for length avoids error when initializing empty list
13184
+ if ( this.options.active !== false && this.anchors.length ) {
13185
+ this.active = this._findActive( this.options.active );
13186
+ } else {
13187
+ this.active = $();
13188
+ }
13189
+
13190
+ this._refresh();
13191
+
13192
+ if ( this.active.length ) {
13193
+ this.load( options.active );
13194
+ }
13195
+ },
13196
+
13197
+ _getCreateEventData: function() {
13198
+ return {
13199
+ tab: this.active,
13200
+ panel: !this.active.length ? $() : this._getPanelForTab( this.active )
13201
+ };
13202
+ },
13203
+
13204
+ _tabKeydown: function( event ) {
13205
+ var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
13206
+ selectedIndex = this.tabs.index( focusedTab ),
13207
+ goingForward = true;
13208
+
13209
+ if ( this._handlePageNav( event ) ) {
13210
+ return;
13211
+ }
13212
+
13213
+ switch ( event.keyCode ) {
13214
+ case $.ui.keyCode.RIGHT:
13215
+ case $.ui.keyCode.DOWN:
13216
+ selectedIndex++;
13217
+ break;
13218
+ case $.ui.keyCode.UP:
13219
+ case $.ui.keyCode.LEFT:
13220
+ goingForward = false;
13221
+ selectedIndex--;
13222
+ break;
13223
+ case $.ui.keyCode.END:
13224
+ selectedIndex = this.anchors.length - 1;
13225
+ break;
13226
+ case $.ui.keyCode.HOME:
13227
+ selectedIndex = 0;
13228
+ break;
13229
+ case $.ui.keyCode.SPACE:
13230
+ // Activate only, no collapsing
13231
+ event.preventDefault();
13232
+ clearTimeout( this.activating );
13233
+ this._activate( selectedIndex );
13234
+ return;
13235
+ case $.ui.keyCode.ENTER:
13236
+ // Toggle (cancel delayed activation, allow collapsing)
13237
+ event.preventDefault();
13238
+ clearTimeout( this.activating );
13239
+ // Determine if we should collapse or activate
13240
+ this._activate( selectedIndex === this.options.active ? false : selectedIndex );
13241
+ return;
13242
+ default:
13243
+ return;
13244
+ }
13245
+
13246
+ // Focus the appropriate tab, based on which key was pressed
13247
+ event.preventDefault();
13248
+ clearTimeout( this.activating );
13249
+ selectedIndex = this._focusNextTab( selectedIndex, goingForward );
13250
+
13251
+ // Navigating with control key will prevent automatic activation
13252
+ if ( !event.ctrlKey ) {
13253
+ // Update aria-selected immediately so that AT think the tab is already selected.
13254
+ // Otherwise AT may confuse the user by stating that they need to activate the tab,
13255
+ // but the tab will already be activated by the time the announcement finishes.
13256
+ focusedTab.attr( "aria-selected", "false" );
13257
+ this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
13258
+
13259
+ this.activating = this._delay(function() {
13260
+ this.option( "active", selectedIndex );
13261
+ }, this.delay );
13262
+ }
13263
+ },
13264
+
13265
+ _panelKeydown: function( event ) {
13266
+ if ( this._handlePageNav( event ) ) {
13267
+ return;
13268
+ }
13269
+
13270
+ // Ctrl+up moves focus to the current tab
13271
+ if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
13272
+ event.preventDefault();
13273
+ this.active.focus();
13274
+ }
13275
+ },
13276
+
13277
+ // Alt+page up/down moves focus to the previous/next tab (and activates)
13278
+ _handlePageNav: function( event ) {
13279
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
13280
+ this._activate( this._focusNextTab( this.options.active - 1, false ) );
13281
+ return true;
13282
+ }
13283
+ if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
13284
+ this._activate( this._focusNextTab( this.options.active + 1, true ) );
13285
+ return true;
13286
+ }
13287
+ },
13288
+
13289
+ _findNextTab: function( index, goingForward ) {
13290
+ var lastTabIndex = this.tabs.length - 1;
13291
+
13292
+ function constrain() {
13293
+ if ( index > lastTabIndex ) {
13294
+ index = 0;
13295
+ }
13296
+ if ( index < 0 ) {
13297
+ index = lastTabIndex;
13298
+ }
13299
+ return index;
13300
+ }
13301
+
13302
+ while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
13303
+ index = goingForward ? index + 1 : index - 1;
13304
+ }
13305
+
13306
+ return index;
13307
+ },
13308
+
13309
+ _focusNextTab: function( index, goingForward ) {
13310
+ index = this._findNextTab( index, goingForward );
13311
+ this.tabs.eq( index ).focus();
13312
+ return index;
13313
+ },
13314
+
13315
+ _setOption: function( key, value ) {
13316
+ if ( key === "active" ) {
13317
+ // _activate() will handle invalid values and update this.options
13318
+ this._activate( value );
13319
+ return;
13320
+ }
13321
+
13322
+ if ( key === "disabled" ) {
13323
+ // don't use the widget factory's disabled handling
13324
+ this._setupDisabled( value );
13325
+ return;
13326
+ }
13327
+
13328
+ this._super( key, value);
13329
+
13330
+ if ( key === "collapsible" ) {
13331
+ this.element.toggleClass( "ui-tabs-collapsible", value );
13332
+ // Setting collapsible: false while collapsed; open first panel
13333
+ if ( !value && this.options.active === false ) {
13334
+ this._activate( 0 );
13335
+ }
13336
+ }
13337
+
13338
+ if ( key === "event" ) {
13339
+ this._setupEvents( value );
13340
+ }
13341
+
13342
+ if ( key === "heightStyle" ) {
13343
+ this._setupHeightStyle( value );
13344
+ }
13345
+ },
13346
+
13347
+ _tabId: function( tab ) {
13348
+ return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId();
13349
+ },
13350
+
13351
+ _sanitizeSelector: function( hash ) {
13352
+ return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
13353
+ },
13354
+
13355
+ refresh: function() {
13356
+ var next,
13357
+ options = this.options,
13358
+ lis = this.tablist.children( ":has(a[href])" );
13359
+
13360
+ // get disabled tabs from class attribute from HTML
13361
+ // this will get converted to a boolean if needed in _refresh()
13362
+ options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
13363
+ return lis.index( tab );
13364
+ });
13365
+
13366
+ this._processTabs();
13367
+
13368
+ // was collapsed or no tabs
13369
+ if ( options.active === false || !this.anchors.length ) {
13370
+ options.active = false;
13371
+ this.active = $();
13372
+ // was active, but active tab is gone
13373
+ } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
13374
+ // all remaining tabs are disabled
13375
+ if ( this.tabs.length === options.disabled.length ) {
13376
+ options.active = false;
13377
+ this.active = $();
13378
+ // activate previous tab
13379
+ } else {
13380
+ this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
13381
+ }
13382
+ // was active, active tab still exists
13383
+ } else {
13384
+ // make sure active index is correct
13385
+ options.active = this.tabs.index( this.active );
13386
+ }
13387
+
13388
+ this._refresh();
13389
+ },
13390
+
13391
+ _refresh: function() {
13392
+ this._setupDisabled( this.options.disabled );
13393
+ this._setupEvents( this.options.event );
13394
+ this._setupHeightStyle( this.options.heightStyle );
13395
+
13396
+ this.tabs.not( this.active ).attr({
13397
+ "aria-selected": "false",
13398
+ tabIndex: -1
13399
+ });
13400
+ this.panels.not( this._getPanelForTab( this.active ) )
13401
+ .hide()
13402
+ .attr({
13403
+ "aria-expanded": "false",
13404
+ "aria-hidden": "true"
13405
+ });
13406
+
13407
+ // Make sure one tab is in the tab order
13408
+ if ( !this.active.length ) {
13409
+ this.tabs.eq( 0 ).attr( "tabIndex", 0 );
13410
+ } else {
13411
+ this.active
13412
+ .addClass( "ui-tabs-active ui-state-active" )
13413
+ .attr({
13414
+ "aria-selected": "true",
13415
+ tabIndex: 0
13416
+ });
13417
+ this._getPanelForTab( this.active )
13418
+ .show()
13419
+ .attr({
13420
+ "aria-expanded": "true",
13421
+ "aria-hidden": "false"
13422
+ });
13423
+ }
13424
+ },
13425
+
13426
+ _processTabs: function() {
13427
+ var that = this;
13428
+
13429
+ this.tablist = this._getList()
13430
+ .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
13431
+ .attr( "role", "tablist" );
13432
+
13433
+ this.tabs = this.tablist.find( "> li:has(a[href])" )
13434
+ .addClass( "ui-state-default ui-corner-top" )
13435
+ .attr({
13436
+ role: "tab",
13437
+ tabIndex: -1
13438
+ });
13439
+
13440
+ this.anchors = this.tabs.map(function() {
13441
+ return $( "a", this )[ 0 ];
13442
+ })
13443
+ .addClass( "ui-tabs-anchor" )
13444
+ .attr({
13445
+ role: "presentation",
13446
+ tabIndex: -1
13447
+ });
13448
+
13449
+ this.panels = $();
13450
+
13451
+ this.anchors.each(function( i, anchor ) {
13452
+ var selector, panel, panelId,
13453
+ anchorId = $( anchor ).uniqueId().attr( "id" ),
13454
+ tab = $( anchor ).closest( "li" ),
13455
+ originalAriaControls = tab.attr( "aria-controls" );
13456
+
13457
+ // inline tab
13458
+ if ( isLocal( anchor ) ) {
13459
+ selector = anchor.hash;
13460
+ panel = that.element.find( that._sanitizeSelector( selector ) );
13461
+ // remote tab
13462
+ } else {
13463
+ panelId = that._tabId( tab );
13464
+ selector = "#" + panelId;
13465
+ panel = that.element.find( selector );
13466
+ if ( !panel.length ) {
13467
+ panel = that._createPanel( panelId );
13468
+ panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
13469
+ }
13470
+ panel.attr( "aria-live", "polite" );
13471
+ }
13472
+
13473
+ if ( panel.length) {
13474
+ that.panels = that.panels.add( panel );
13475
+ }
13476
+ if ( originalAriaControls ) {
13477
+ tab.data( "ui-tabs-aria-controls", originalAriaControls );
13478
+ }
13479
+ tab.attr({
13480
+ "aria-controls": selector.substring( 1 ),
13481
+ "aria-labelledby": anchorId
13482
+ });
13483
+ panel.attr( "aria-labelledby", anchorId );
13484
+ });
13485
+
13486
+ this.panels
13487
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
13488
+ .attr( "role", "tabpanel" );
13489
+ },
13490
+
13491
+ // allow overriding how to find the list for rare usage scenarios (#7715)
13492
+ _getList: function() {
13493
+ return this.element.find( "ol,ul" ).eq( 0 );
13494
+ },
13495
+
13496
+ _createPanel: function( id ) {
13497
+ return $( "<div>" )
13498
+ .attr( "id", id )
13499
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
13500
+ .data( "ui-tabs-destroy", true );
13501
+ },
13502
+
13503
+ _setupDisabled: function( disabled ) {
13504
+ if ( $.isArray( disabled ) ) {
13505
+ if ( !disabled.length ) {
13506
+ disabled = false;
13507
+ } else if ( disabled.length === this.anchors.length ) {
13508
+ disabled = true;
13509
+ }
13510
+ }
13511
+
13512
+ // disable tabs
13513
+ for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
13514
+ if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
13515
+ $( li )
13516
+ .addClass( "ui-state-disabled" )
13517
+ .attr( "aria-disabled", "true" );
13518
+ } else {
13519
+ $( li )
13520
+ .removeClass( "ui-state-disabled" )
13521
+ .removeAttr( "aria-disabled" );
13522
+ }
13523
+ }
13524
+
13525
+ this.options.disabled = disabled;
13526
+ },
13527
+
13528
+ _setupEvents: function( event ) {
13529
+ var events = {
13530
+ click: function( event ) {
13531
+ event.preventDefault();
13532
+ }
13533
+ };
13534
+ if ( event ) {
13535
+ $.each( event.split(" "), function( index, eventName ) {
13536
+ events[ eventName ] = "_eventHandler";
13537
+ });
13538
+ }
13539
+
13540
+ this._off( this.anchors.add( this.tabs ).add( this.panels ) );
13541
+ this._on( this.anchors, events );
13542
+ this._on( this.tabs, { keydown: "_tabKeydown" } );
13543
+ this._on( this.panels, { keydown: "_panelKeydown" } );
13544
+
13545
+ this._focusable( this.tabs );
13546
+ this._hoverable( this.tabs );
13547
+ },
13548
+
13549
+ _setupHeightStyle: function( heightStyle ) {
13550
+ var maxHeight, overflow,
13551
+ parent = this.element.parent();
13552
+
13553
+ if ( heightStyle === "fill" ) {
13554
+ // IE 6 treats height like minHeight, so we need to turn off overflow
13555
+ // in order to get a reliable height
13556
+ // we use the minHeight support test because we assume that only
13557
+ // browsers that don't support minHeight will treat height as minHeight
13558
+ if ( !$.support.minHeight ) {
13559
+ overflow = parent.css( "overflow" );
13560
+ parent.css( "overflow", "hidden");
13561
+ }
13562
+ maxHeight = parent.height();
13563
+ this.element.siblings( ":visible" ).each(function() {
13564
+ var elem = $( this ),
13565
+ position = elem.css( "position" );
13566
+
13567
+ if ( position === "absolute" || position === "fixed" ) {
13568
+ return;
13569
+ }
13570
+ maxHeight -= elem.outerHeight( true );
13571
+ });
13572
+ if ( overflow ) {
13573
+ parent.css( "overflow", overflow );
13574
+ }
13575
+
13576
+ this.element.children().not( this.panels ).each(function() {
13577
+ maxHeight -= $( this ).outerHeight( true );
13578
+ });
13579
+
13580
+ this.panels.each(function() {
13581
+ $( this ).height( Math.max( 0, maxHeight -
13582
+ $( this ).innerHeight() + $( this ).height() ) );
13583
+ })
13584
+ .css( "overflow", "auto" );
13585
+ } else if ( heightStyle === "auto" ) {
13586
+ maxHeight = 0;
13587
+ this.panels.each(function() {
13588
+ maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
13589
+ }).height( maxHeight );
13590
+ }
13591
+ },
13592
+
13593
+ _eventHandler: function( event ) {
13594
+ var options = this.options,
13595
+ active = this.active,
13596
+ anchor = $( event.currentTarget ),
13597
+ tab = anchor.closest( "li" ),
13598
+ clickedIsActive = tab[ 0 ] === active[ 0 ],
13599
+ collapsing = clickedIsActive && options.collapsible,
13600
+ toShow = collapsing ? $() : this._getPanelForTab( tab ),
13601
+ toHide = !active.length ? $() : this._getPanelForTab( active ),
13602
+ eventData = {
13603
+ oldTab: active,
13604
+ oldPanel: toHide,
13605
+ newTab: collapsing ? $() : tab,
13606
+ newPanel: toShow
13607
+ };
13608
+
13609
+ event.preventDefault();
13610
+
13611
+ if ( tab.hasClass( "ui-state-disabled" ) ||
13612
+ // tab is already loading
13613
+ tab.hasClass( "ui-tabs-loading" ) ||
13614
+ // can't switch durning an animation
13615
+ this.running ||
13616
+ // click on active header, but not collapsible
13617
+ ( clickedIsActive && !options.collapsible ) ||
13618
+ // allow canceling activation
13619
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
13620
+ return;
13621
+ }
13622
+
13623
+ options.active = collapsing ? false : this.tabs.index( tab );
13624
+
13625
+ this.active = clickedIsActive ? $() : tab;
13626
+ if ( this.xhr ) {
13627
+ this.xhr.abort();
13628
+ }
13629
+
13630
+ if ( !toHide.length && !toShow.length ) {
13631
+ $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
13632
+ }
13633
+
13634
+ if ( toShow.length ) {
13635
+ this.load( this.tabs.index( tab ), event );
13636
+ }
13637
+ this._toggle( event, eventData );
13638
+ },
13639
+
13640
+ // handles show/hide for selecting tabs
13641
+ _toggle: function( event, eventData ) {
13642
+ var that = this,
13643
+ toShow = eventData.newPanel,
13644
+ toHide = eventData.oldPanel;
13645
+
13646
+ this.running = true;
13647
+
13648
+ function complete() {
13649
+ that.running = false;
13650
+ that._trigger( "activate", event, eventData );
13651
+ }
13652
+
13653
+ function show() {
13654
+ eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
13655
+
13656
+ if ( toShow.length && that.options.show ) {
13657
+ that._show( toShow, that.options.show, complete );
13658
+ } else {
13659
+ toShow.show();
13660
+ complete();
13661
+ }
13662
+ }
13663
+
13664
+ // start out by hiding, then showing, then completing
13665
+ if ( toHide.length && this.options.hide ) {
13666
+ this._hide( toHide, this.options.hide, function() {
13667
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
13668
+ show();
13669
+ });
13670
+ } else {
13671
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
13672
+ toHide.hide();
13673
+ show();
13674
+ }
13675
+
13676
+ toHide.attr({
13677
+ "aria-expanded": "false",
13678
+ "aria-hidden": "true"
13679
+ });
13680
+ eventData.oldTab.attr( "aria-selected", "false" );
13681
+ // If we're switching tabs, remove the old tab from the tab order.
13682
+ // If we're opening from collapsed state, remove the previous tab from the tab order.
13683
+ // If we're collapsing, then keep the collapsing tab in the tab order.
13684
+ if ( toShow.length && toHide.length ) {
13685
+ eventData.oldTab.attr( "tabIndex", -1 );
13686
+ } else if ( toShow.length ) {
13687
+ this.tabs.filter(function() {
13688
+ return $( this ).attr( "tabIndex" ) === 0;
13689
+ })
13690
+ .attr( "tabIndex", -1 );
13691
+ }
13692
+
13693
+ toShow.attr({
13694
+ "aria-expanded": "true",
13695
+ "aria-hidden": "false"
13696
+ });
13697
+ eventData.newTab.attr({
13698
+ "aria-selected": "true",
13699
+ tabIndex: 0
13700
+ });
13701
+ },
13702
+
13703
+ _activate: function( index ) {
13704
+ var anchor,
13705
+ active = this._findActive( index );
13706
+
13707
+ // trying to activate the already active panel
13708
+ if ( active[ 0 ] === this.active[ 0 ] ) {
13709
+ return;
13710
+ }
13711
+
13712
+ // trying to collapse, simulate a click on the current active header
13713
+ if ( !active.length ) {
13714
+ active = this.active;
13715
+ }
13716
+
13717
+ anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
13718
+ this._eventHandler({
13719
+ target: anchor,
13720
+ currentTarget: anchor,
13721
+ preventDefault: $.noop
13722
+ });
13723
+ },
13724
+
13725
+ _findActive: function( index ) {
13726
+ return index === false ? $() : this.tabs.eq( index );
13727
+ },
13728
+
13729
+ _getIndex: function( index ) {
13730
+ // meta-function to give users option to provide a href string instead of a numerical index.
13731
+ if ( typeof index === "string" ) {
13732
+ index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
13733
+ }
13734
+
13735
+ return index;
13736
+ },
13737
+
13738
+ _destroy: function() {
13739
+ if ( this.xhr ) {
13740
+ this.xhr.abort();
13741
+ }
13742
+
13743
+ this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
13744
+
13745
+ this.tablist
13746
+ .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
13747
+ .removeAttr( "role" );
13748
+
13749
+ this.anchors
13750
+ .removeClass( "ui-tabs-anchor" )
13751
+ .removeAttr( "role" )
13752
+ .removeAttr( "tabIndex" )
13753
+ .removeData( "href.tabs" )
13754
+ .removeData( "load.tabs" )
13755
+ .removeUniqueId();
13756
+
13757
+ this.tabs.add( this.panels ).each(function() {
13758
+ if ( $.data( this, "ui-tabs-destroy" ) ) {
13759
+ $( this ).remove();
13760
+ } else {
13761
+ $( this )
13762
+ .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
13763
+ "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
13764
+ .removeAttr( "tabIndex" )
13765
+ .removeAttr( "aria-live" )
13766
+ .removeAttr( "aria-busy" )
13767
+ .removeAttr( "aria-selected" )
13768
+ .removeAttr( "aria-labelledby" )
13769
+ .removeAttr( "aria-hidden" )
13770
+ .removeAttr( "aria-expanded" )
13771
+ .removeAttr( "role" );
13772
+ }
13773
+ });
13774
+
13775
+ this.tabs.each(function() {
13776
+ var li = $( this ),
13777
+ prev = li.data( "ui-tabs-aria-controls" );
13778
+ if ( prev ) {
13779
+ li.attr( "aria-controls", prev );
13780
+ } else {
13781
+ li.removeAttr( "aria-controls" );
13782
+ }
13783
+ });
13784
+
13785
+ if ( this.options.heightStyle !== "content" ) {
13786
+ this.panels.css( "height", "" );
13787
+ }
13788
+ },
13789
+
13790
+ enable: function( index ) {
13791
+ var disabled = this.options.disabled;
13792
+ if ( disabled === false ) {
13793
+ return;
13794
+ }
13795
+
13796
+ if ( index === undefined ) {
13797
+ disabled = false;
13798
+ } else {
13799
+ index = this._getIndex( index );
13800
+ if ( $.isArray( disabled ) ) {
13801
+ disabled = $.map( disabled, function( num ) {
13802
+ return num !== index ? num : null;
13803
+ });
13804
+ } else {
13805
+ disabled = $.map( this.tabs, function( li, num ) {
13806
+ return num !== index ? num : null;
13807
+ });
13808
+ }
13809
+ }
13810
+ this._setupDisabled( disabled );
13811
+ },
13812
+
13813
+ disable: function( index ) {
13814
+ var disabled = this.options.disabled;
13815
+ if ( disabled === true ) {
13816
+ return;
13817
+ }
13818
+
13819
+ if ( index === undefined ) {
13820
+ disabled = true;
13821
+ } else {
13822
+ index = this._getIndex( index );
13823
+ if ( $.inArray( index, disabled ) !== -1 ) {
13824
+ return;
13825
+ }
13826
+ if ( $.isArray( disabled ) ) {
13827
+ disabled = $.merge( [ index ], disabled ).sort();
13828
+ } else {
13829
+ disabled = [ index ];
13830
+ }
13831
+ }
13832
+ this._setupDisabled( disabled );
13833
+ },
13834
+
13835
+ load: function( index, event ) {
13836
+ index = this._getIndex( index );
13837
+ var that = this,
13838
+ tab = this.tabs.eq( index ),
13839
+ anchor = tab.find( ".ui-tabs-anchor" ),
13840
+ panel = this._getPanelForTab( tab ),
13841
+ eventData = {
13842
+ tab: tab,
13843
+ panel: panel
13844
+ };
13845
+
13846
+ // not remote
13847
+ if ( isLocal( anchor[ 0 ] ) ) {
13848
+ return;
13849
+ }
13850
+
13851
+ this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
13852
+
13853
+ // support: jQuery <1.8
13854
+ // jQuery <1.8 returns false if the request is canceled in beforeSend,
13855
+ // but as of 1.8, $.ajax() always returns a jqXHR object.
13856
+ if ( this.xhr && this.xhr.statusText !== "canceled" ) {
13857
+ tab.addClass( "ui-tabs-loading" );
13858
+ panel.attr( "aria-busy", "true" );
13859
+
13860
+ this.xhr
13861
+ .success(function( response ) {
13862
+ // support: jQuery <1.8
13863
+ // http://bugs.jquery.com/ticket/11778
13864
+ setTimeout(function() {
13865
+ panel.html( response );
13866
+ that._trigger( "load", event, eventData );
13867
+ }, 1 );
13868
+ })
13869
+ .complete(function( jqXHR, status ) {
13870
+ // support: jQuery <1.8
13871
+ // http://bugs.jquery.com/ticket/11778
13872
+ setTimeout(function() {
13873
+ if ( status === "abort" ) {
13874
+ that.panels.stop( false, true );
13875
+ }
13876
+
13877
+ tab.removeClass( "ui-tabs-loading" );
13878
+ panel.removeAttr( "aria-busy" );
13879
+
13880
+ if ( jqXHR === that.xhr ) {
13881
+ delete that.xhr;
13882
+ }
13883
+ }, 1 );
13884
+ });
13885
+ }
13886
+ },
13887
+
13888
+ // TODO: Remove this function in 1.10 when ajaxOptions is removed
13889
+ _ajaxSettings: function( anchor, event, eventData ) {
13890
+ var that = this;
13891
+ return {
13892
+ url: anchor.attr( "href" ),
13893
+ beforeSend: function( jqXHR, settings ) {
13894
+ return that._trigger( "beforeLoad", event,
13895
+ $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) );
13896
+ }
13897
+ };
13898
+ },
13899
+
13900
+ _getPanelForTab: function( tab ) {
13901
+ var id = $( tab ).attr( "aria-controls" );
13902
+ return this.element.find( this._sanitizeSelector( "#" + id ) );
13903
+ }
13904
+ });
13905
+
13906
+ // DEPRECATED
13907
+ if ( $.uiBackCompat !== false ) {
13908
+
13909
+ // helper method for a lot of the back compat extensions
13910
+ $.ui.tabs.prototype._ui = function( tab, panel ) {
13911
+ return {
13912
+ tab: tab,
13913
+ panel: panel,
13914
+ index: this.anchors.index( tab )
13915
+ };
13916
+ };
13917
+
13918
+ // url method
13919
+ $.widget( "ui.tabs", $.ui.tabs, {
13920
+ url: function( index, url ) {
13921
+ this.anchors.eq( index ).attr( "href", url );
13922
+ }
13923
+ });
13924
+
13925
+ // TODO: Remove _ajaxSettings() method when removing this extension
13926
+ // ajaxOptions and cache options
13927
+ $.widget( "ui.tabs", $.ui.tabs, {
13928
+ options: {
13929
+ ajaxOptions: null,
13930
+ cache: false
13931
+ },
13932
+
13933
+ _create: function() {
13934
+ this._super();
13935
+
13936
+ var that = this;
13937
+
13938
+ this._on({ tabsbeforeload: function( event, ui ) {
13939
+ // tab is already cached
13940
+ if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) {
13941
+ event.preventDefault();
13942
+ return;
13943
+ }
13944
+
13945
+ ui.jqXHR.success(function() {
13946
+ if ( that.options.cache ) {
13947
+ $.data( ui.tab[ 0 ], "cache.tabs", true );
13948
+ }
13949
+ });
13950
+ }});
13951
+ },
13952
+
13953
+ _ajaxSettings: function( anchor, event, ui ) {
13954
+ var ajaxOptions = this.options.ajaxOptions;
13955
+ return $.extend( {}, ajaxOptions, {
13956
+ error: function( xhr, s, e ) {
13957
+ try {
13958
+ // Passing index avoid a race condition when this method is
13959
+ // called after the user has selected another tab.
13960
+ // Pass the anchor that initiated this request allows
13961
+ // loadError to manipulate the tab content panel via $(a.hash)
13962
+ ajaxOptions.error(
13963
+ xhr, s, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
13964
+ }
13965
+ catch ( e ) {}
13966
+ }
13967
+ }, this._superApply( arguments ) );
13968
+ },
13969
+
13970
+ _setOption: function( key, value ) {
13971
+ // reset cache if switching from cached to not cached
13972
+ if ( key === "cache" && value === false ) {
13973
+ this.anchors.removeData( "cache.tabs" );
13974
+ }
13975
+ this._super( key, value );
13976
+ },
13977
+
13978
+ _destroy: function() {
13979
+ this.anchors.removeData( "cache.tabs" );
13980
+ this._super();
13981
+ },
13982
+
13983
+ url: function( index, url ){
13984
+ this.anchors.eq( index ).removeData( "cache.tabs" );
13985
+ this._superApply( arguments );
13986
+ }
13987
+ });
13988
+
13989
+ // abort method
13990
+ $.widget( "ui.tabs", $.ui.tabs, {
13991
+ abort: function() {
13992
+ if ( this.xhr ) {
13993
+ this.xhr.abort();
13994
+ }
13995
+ }
13996
+ });
13997
+
13998
+ // spinner
13999
+ $.widget( "ui.tabs", $.ui.tabs, {
14000
+ options: {
14001
+ spinner: "<em>Loading&#8230;</em>"
14002
+ },
14003
+ _create: function() {
14004
+ this._super();
14005
+ this._on({
14006
+ tabsbeforeload: function( event, ui ) {
14007
+ // Don't react to nested tabs or tabs that don't use a spinner
14008
+ if ( event.target !== this.element[ 0 ] ||
14009
+ !this.options.spinner ) {
14010
+ return;
14011
+ }
14012
+
14013
+ var span = ui.tab.find( "span" ),
14014
+ html = span.html();
14015
+ span.html( this.options.spinner );
14016
+ ui.jqXHR.complete(function() {
14017
+ span.html( html );
14018
+ });
14019
+ }
14020
+ });
14021
+ }
14022
+ });
14023
+
14024
+ // enable/disable events
14025
+ $.widget( "ui.tabs", $.ui.tabs, {
14026
+ options: {
14027
+ enable: null,
14028
+ disable: null
14029
+ },
14030
+
14031
+ enable: function( index ) {
14032
+ var options = this.options,
14033
+ trigger;
14034
+
14035
+ if ( index && options.disabled === true ||
14036
+ ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
14037
+ trigger = true;
14038
+ }
14039
+
14040
+ this._superApply( arguments );
14041
+
14042
+ if ( trigger ) {
14043
+ this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
14044
+ }
14045
+ },
14046
+
14047
+ disable: function( index ) {
14048
+ var options = this.options,
14049
+ trigger;
14050
+
14051
+ if ( index && options.disabled === false ||
14052
+ ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
14053
+ trigger = true;
14054
+ }
14055
+
14056
+ this._superApply( arguments );
14057
+
14058
+ if ( trigger ) {
14059
+ this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
14060
+ }
14061
+ }
14062
+ });
14063
+
14064
+ // add/remove methods and events
14065
+ $.widget( "ui.tabs", $.ui.tabs, {
14066
+ options: {
14067
+ add: null,
14068
+ remove: null,
14069
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
14070
+ },
14071
+
14072
+ add: function( url, label, index ) {
14073
+ if ( index === undefined ) {
14074
+ index = this.anchors.length;
14075
+ }
14076
+
14077
+ var doInsertAfter, panel,
14078
+ options = this.options,
14079
+ li = $( options.tabTemplate
14080
+ .replace( /#\{href\}/g, url )
14081
+ .replace( /#\{label\}/g, label ) ),
14082
+ id = !url.indexOf( "#" ) ?
14083
+ url.replace( "#", "" ) :
14084
+ this._tabId( li );
14085
+
14086
+ li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
14087
+ li.attr( "aria-controls", id );
14088
+
14089
+ doInsertAfter = index >= this.tabs.length;
14090
+
14091
+ // try to find an existing element before creating a new one
14092
+ panel = this.element.find( "#" + id );
14093
+ if ( !panel.length ) {
14094
+ panel = this._createPanel( id );
14095
+ if ( doInsertAfter ) {
14096
+ if ( index > 0 ) {
14097
+ panel.insertAfter( this.panels.eq( -1 ) );
14098
+ } else {
14099
+ panel.appendTo( this.element );
14100
+ }
14101
+ } else {
14102
+ panel.insertBefore( this.panels[ index ] );
14103
+ }
14104
+ }
14105
+ panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide();
14106
+
14107
+ if ( doInsertAfter ) {
14108
+ li.appendTo( this.tablist );
14109
+ } else {
14110
+ li.insertBefore( this.tabs[ index ] );
14111
+ }
14112
+
14113
+ options.disabled = $.map( options.disabled, function( n ) {
14114
+ return n >= index ? ++n : n;
14115
+ });
14116
+
14117
+ this.refresh();
14118
+ if ( this.tabs.length === 1 && options.active === false ) {
14119
+ this.option( "active", 0 );
14120
+ }
14121
+
14122
+ this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
14123
+ return this;
14124
+ },
14125
+
14126
+ remove: function( index ) {
14127
+ index = this._getIndex( index );
14128
+ var options = this.options,
14129
+ tab = this.tabs.eq( index ).remove(),
14130
+ panel = this._getPanelForTab( tab ).remove();
14131
+
14132
+ // If selected tab was removed focus tab to the right or
14133
+ // in case the last tab was removed the tab to the left.
14134
+ // We check for more than 2 tabs, because if there are only 2,
14135
+ // then when we remove this tab, there will only be one tab left
14136
+ // so we don't need to detect which tab to activate.
14137
+ if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
14138
+ this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
14139
+ }
14140
+
14141
+ options.disabled = $.map(
14142
+ $.grep( options.disabled, function( n ) {
14143
+ return n !== index;
14144
+ }),
14145
+ function( n ) {
14146
+ return n >= index ? --n : n;
14147
+ });
14148
+
14149
+ this.refresh();
14150
+
14151
+ this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) );
14152
+ return this;
14153
+ }
14154
+ });
14155
+
14156
+ // length method
14157
+ $.widget( "ui.tabs", $.ui.tabs, {
14158
+ length: function() {
14159
+ return this.anchors.length;
14160
+ }
14161
+ });
14162
+
14163
+ // panel ids (idPrefix option + title attribute)
14164
+ $.widget( "ui.tabs", $.ui.tabs, {
14165
+ options: {
14166
+ idPrefix: "ui-tabs-"
14167
+ },
14168
+
14169
+ _tabId: function( tab ) {
14170
+ var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab;
14171
+ a = a[0];
14172
+ return $( a ).closest( "li" ).attr( "aria-controls" ) ||
14173
+ a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) ||
14174
+ this.options.idPrefix + getNextTabId();
14175
+ }
14176
+ });
14177
+
14178
+ // _createPanel method
14179
+ $.widget( "ui.tabs", $.ui.tabs, {
14180
+ options: {
14181
+ panelTemplate: "<div></div>"
14182
+ },
14183
+
14184
+ _createPanel: function( id ) {
14185
+ return $( this.options.panelTemplate )
14186
+ .attr( "id", id )
14187
+ .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
14188
+ .data( "ui-tabs-destroy", true );
14189
+ }
14190
+ });
14191
+
14192
+ // selected option
14193
+ $.widget( "ui.tabs", $.ui.tabs, {
14194
+ _create: function() {
14195
+ var options = this.options;
14196
+ if ( options.active === null && options.selected !== undefined ) {
14197
+ options.active = options.selected === -1 ? false : options.selected;
14198
+ }
14199
+ this._super();
14200
+ options.selected = options.active;
14201
+ if ( options.selected === false ) {
14202
+ options.selected = -1;
14203
+ }
14204
+ },
14205
+
14206
+ _setOption: function( key, value ) {
14207
+ if ( key !== "selected" ) {
14208
+ return this._super( key, value );
14209
+ }
14210
+
14211
+ var options = this.options;
14212
+ this._super( "active", value === -1 ? false : value );
14213
+ options.selected = options.active;
14214
+ if ( options.selected === false ) {
14215
+ options.selected = -1;
14216
+ }
14217
+ },
14218
+
14219
+ _eventHandler: function( event ) {
14220
+ this._superApply( arguments );
14221
+ this.options.selected = this.options.active;
14222
+ if ( this.options.selected === false ) {
14223
+ this.options.selected = -1;
14224
+ }
14225
+ }
14226
+ });
14227
+
14228
+ // show and select event
14229
+ $.widget( "ui.tabs", $.ui.tabs, {
14230
+ options: {
14231
+ show: null,
14232
+ select: null
14233
+ },
14234
+ _create: function() {
14235
+ this._super();
14236
+ if ( this.options.active !== false ) {
14237
+ this._trigger( "show", null, this._ui(
14238
+ this.active.find( ".ui-tabs-anchor" )[ 0 ],
14239
+ this._getPanelForTab( this.active )[ 0 ] ) );
14240
+ }
14241
+ },
14242
+ _trigger: function( type, event, data ) {
14243
+ var ret = this._superApply( arguments );
14244
+ if ( !ret ) {
14245
+ return false;
14246
+ }
14247
+ if ( type === "beforeActivate" && data.newTab.length ) {
14248
+ ret = this._super( "select", event, {
14249
+ tab: data.newTab.find( ".ui-tabs-anchor" )[ 0],
14250
+ panel: data.newPanel[ 0 ],
14251
+ index: data.newTab.closest( "li" ).index()
14252
+ });
14253
+ } else if ( type === "activate" && data.newTab.length ) {
14254
+ ret = this._super( "show", event, {
14255
+ tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ],
14256
+ panel: data.newPanel[ 0 ],
14257
+ index: data.newTab.closest( "li" ).index()
14258
+ });
14259
+ }
14260
+ return ret;
14261
+ }
14262
+ });
14263
+
14264
+ // select method
14265
+ $.widget( "ui.tabs", $.ui.tabs, {
14266
+ select: function( index ) {
14267
+ index = this._getIndex( index );
14268
+ if ( index === -1 ) {
14269
+ if ( this.options.collapsible && this.options.selected !== -1 ) {
14270
+ index = this.options.selected;
14271
+ } else {
14272
+ return;
14273
+ }
14274
+ }
14275
+ this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace );
14276
+ }
14277
+ });
14278
+
14279
+ // cookie option
14280
+ (function() {
14281
+
14282
+ var listId = 0;
14283
+
14284
+ $.widget( "ui.tabs", $.ui.tabs, {
14285
+ options: {
14286
+ cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
14287
+ },
14288
+ _create: function() {
14289
+ var options = this.options,
14290
+ active;
14291
+ if ( options.active == null && options.cookie ) {
14292
+ active = parseInt( this._cookie(), 10 );
14293
+ if ( active === -1 ) {
14294
+ active = false;
14295
+ }
14296
+ options.active = active;
14297
+ }
14298
+ this._super();
14299
+ },
14300
+ _cookie: function( active ) {
14301
+ var cookie = [ this.cookie ||
14302
+ ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ];
14303
+ if ( arguments.length ) {
14304
+ cookie.push( active === false ? -1 : active );
14305
+ cookie.push( this.options.cookie );
14306
+ }
14307
+ return $.cookie.apply( null, cookie );
14308
+ },
14309
+ _refresh: function() {
14310
+ this._super();
14311
+ if ( this.options.cookie ) {
14312
+ this._cookie( this.options.active, this.options.cookie );
14313
+ }
14314
+ },
14315
+ _eventHandler: function( event ) {
14316
+ this._superApply( arguments );
14317
+ if ( this.options.cookie ) {
14318
+ this._cookie( this.options.active, this.options.cookie );
14319
+ }
14320
+ },
14321
+ _destroy: function() {
14322
+ this._super();
14323
+ if ( this.options.cookie ) {
14324
+ this._cookie( null, this.options.cookie );
14325
+ }
14326
+ }
14327
+ });
14328
+
14329
+ })();
14330
+
14331
+ // load event
14332
+ $.widget( "ui.tabs", $.ui.tabs, {
14333
+ _trigger: function( type, event, data ) {
14334
+ var _data = $.extend( {}, data );
14335
+ if ( type === "load" ) {
14336
+ _data.panel = _data.panel[ 0 ];
14337
+ _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ];
14338
+ }
14339
+ return this._super( type, event, _data );
14340
+ }
14341
+ });
14342
+
14343
+ // fx option
14344
+ // The new animation options (show, hide) conflict with the old show callback.
14345
+ // The old fx option wins over show/hide anyway (always favor back-compat).
14346
+ // If a user wants to use the new animation API, they must give up the old API.
14347
+ $.widget( "ui.tabs", $.ui.tabs, {
14348
+ options: {
14349
+ fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 }
14350
+ },
14351
+
14352
+ _getFx: function() {
14353
+ var hide, show,
14354
+ fx = this.options.fx;
14355
+
14356
+ if ( fx ) {
14357
+ if ( $.isArray( fx ) ) {
14358
+ hide = fx[ 0 ];
14359
+ show = fx[ 1 ];
14360
+ } else {
14361
+ hide = show = fx;
14362
+ }
14363
+ }
14364
+
14365
+ return fx ? { show: show, hide: hide } : null;
14366
+ },
14367
+
14368
+ _toggle: function( event, eventData ) {
14369
+ var that = this,
14370
+ toShow = eventData.newPanel,
14371
+ toHide = eventData.oldPanel,
14372
+ fx = this._getFx();
14373
+
14374
+ if ( !fx ) {
14375
+ return this._super( event, eventData );
14376
+ }
14377
+
14378
+ that.running = true;
14379
+
14380
+ function complete() {
14381
+ that.running = false;
14382
+ that._trigger( "activate", event, eventData );
14383
+ }
14384
+
14385
+ function show() {
14386
+ eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
14387
+
14388
+ if ( toShow.length && fx.show ) {
14389
+ toShow
14390
+ .animate( fx.show, fx.show.duration, function() {
14391
+ complete();
14392
+ });
14393
+ } else {
14394
+ toShow.show();
14395
+ complete();
14396
+ }
14397
+ }
14398
+
14399
+ // start out by hiding, then showing, then completing
14400
+ if ( toHide.length && fx.hide ) {
14401
+ toHide.animate( fx.hide, fx.hide.duration, function() {
14402
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
14403
+ show();
14404
+ });
14405
+ } else {
14406
+ eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
14407
+ toHide.hide();
14408
+ show();
14409
+ }
14410
+ }
14411
+ });
14412
+ }
14413
+
14414
+ })( jQuery );
14415
+
14416
+ (function( $ ) {
14417
+
14418
+ var increments = 0;
14419
+
14420
+ function addDescribedBy( elem, id ) {
14421
+ var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
14422
+ describedby.push( id );
14423
+ elem
14424
+ .data( "ui-tooltip-id", id )
14425
+ .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
14426
+ }
14427
+
14428
+ function removeDescribedBy( elem ) {
14429
+ var id = elem.data( "ui-tooltip-id" ),
14430
+ describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
14431
+ index = $.inArray( id, describedby );
14432
+ if ( index !== -1 ) {
14433
+ describedby.splice( index, 1 );
14434
+ }
14435
+
14436
+ elem.removeData( "ui-tooltip-id" );
14437
+ describedby = $.trim( describedby.join( " " ) );
14438
+ if ( describedby ) {
14439
+ elem.attr( "aria-describedby", describedby );
14440
+ } else {
14441
+ elem.removeAttr( "aria-describedby" );
14442
+ }
14443
+ }
14444
+
14445
+ $.widget( "ui.tooltip", {
14446
+ version: "1.9.0",
14447
+ options: {
14448
+ content: function() {
14449
+ return $( this ).attr( "title" );
14450
+ },
14451
+ hide: true,
14452
+ items: "[title]",
14453
+ position: {
14454
+ my: "left+15 center",
14455
+ at: "right center",
14456
+ collision: "flipfit flipfit"
14457
+ },
14458
+ show: true,
14459
+ tooltipClass: null,
14460
+ track: false,
14461
+
14462
+ // callbacks
14463
+ close: null,
14464
+ open: null
14465
+ },
14466
+
14467
+ _create: function() {
14468
+ this._on({
14469
+ mouseover: "open",
14470
+ focusin: "open"
14471
+ });
14472
+
14473
+ // IDs of generated tooltips, needed for destroy
14474
+ this.tooltips = {};
14475
+ },
14476
+
14477
+ _setOption: function( key, value ) {
14478
+ var that = this;
14479
+
14480
+ if ( key === "disabled" ) {
14481
+ this[ value ? "_disable" : "_enable" ]();
14482
+ this.options[ key ] = value;
14483
+ // disable element style changes
14484
+ return;
14485
+ }
14486
+
14487
+ this._super( key, value );
14488
+
14489
+ if ( key === "content" ) {
14490
+ $.each( this.tooltips, function( id, element ) {
14491
+ that._updateContent( element );
14492
+ });
14493
+ }
14494
+ },
14495
+
14496
+ _disable: function() {
14497
+ var that = this;
14498
+
14499
+ // close open tooltips
14500
+ $.each( this.tooltips, function( id, element ) {
14501
+ var event = $.Event( "blur" );
14502
+ event.target = event.currentTarget = element[0];
14503
+ that.close( event, true );
14504
+ });
14505
+
14506
+ // remove title attributes to prevent native tooltips
14507
+ this.element.find( this.options.items ).andSelf().each(function() {
14508
+ var element = $( this );
14509
+ if ( element.is( "[title]" ) ) {
14510
+ element
14511
+ .data( "ui-tooltip-title", element.attr( "title" ) )
14512
+ .attr( "title", "" );
14513
+ }
14514
+ });
14515
+ },
14516
+
14517
+ _enable: function() {
14518
+ // restore title attributes
14519
+ this.element.find( this.options.items ).andSelf().each(function() {
14520
+ var element = $( this );
14521
+ if ( element.data( "ui-tooltip-title" ) ) {
14522
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
14523
+ }
14524
+ });
14525
+ },
14526
+
14527
+ open: function( event ) {
14528
+ var target = $( event ? event.target : this.element )
14529
+ .closest( this.options.items );
14530
+
14531
+ // No element to show a tooltip for
14532
+ if ( !target.length ) {
14533
+ return;
14534
+ }
14535
+
14536
+ // If the tooltip is open and we're tracking then reposition the tooltip.
14537
+ // This makes sure that a tracking tooltip doesn't obscure a focused element
14538
+ // if the user was hovering when the element gained focused.
14539
+ if ( this.options.track && target.data( "ui-tooltip-id" ) ) {
14540
+ this._find( target ).position( $.extend({
14541
+ of: target
14542
+ }, this.options.position ) );
14543
+ // Stop tracking (#8622)
14544
+ this._off( this.document, "mousemove" );
14545
+ return;
14546
+ }
14547
+
14548
+ if ( target.attr( "title" ) ) {
14549
+ target.data( "ui-tooltip-title", target.attr( "title" ) );
14550
+ }
14551
+
14552
+ target.data( "tooltip-open", true );
14553
+
14554
+ this._updateContent( target, event );
14555
+ },
14556
+
14557
+ _updateContent: function( target, event ) {
14558
+ var content,
14559
+ contentOption = this.options.content,
14560
+ that = this;
14561
+
14562
+ if ( typeof contentOption === "string" ) {
14563
+ return this._open( event, target, contentOption );
14564
+ }
14565
+
14566
+ content = contentOption.call( target[0], function( response ) {
14567
+ // ignore async response if tooltip was closed already
14568
+ if ( !target.data( "tooltip-open" ) ) {
14569
+ return;
14570
+ }
14571
+ // IE may instantly serve a cached response for ajax requests
14572
+ // delay this call to _open so the other call to _open runs first
14573
+ that._delay(function() {
14574
+ this._open( event, target, response );
14575
+ });
14576
+ });
14577
+ if ( content ) {
14578
+ this._open( event, target, content );
14579
+ }
14580
+ },
14581
+
14582
+ _open: function( event, target, content ) {
14583
+ var tooltip, positionOption;
14584
+ if ( !content ) {
14585
+ return;
14586
+ }
14587
+
14588
+ // Content can be updated multiple times. If the tooltip already
14589
+ // exists, then just update the content and bail.
14590
+ tooltip = this._find( target );
14591
+ if ( tooltip.length ) {
14592
+ tooltip.find( ".ui-tooltip-content" ).html( content );
14593
+ return;
14594
+ }
14595
+
14596
+ // if we have a title, clear it to prevent the native tooltip
14597
+ // we have to check first to avoid defining a title if none exists
14598
+ // (we don't want to cause an element to start matching [title])
14599
+ //
14600
+ // We use removeAttr only for key events, to allow IE to export the correct
14601
+ // accessible attributes. For mouse events, set to empty string to avoid
14602
+ // native tooltip showing up (happens only when removing inside mouseover).
14603
+ if ( target.is( "[title]" ) ) {
14604
+ if ( event && event.type === "mouseover" ) {
14605
+ target.attr( "title", "" );
14606
+ } else {
14607
+ target.removeAttr( "title" );
14608
+ }
14609
+ }
14610
+
14611
+ tooltip = this._tooltip( target );
14612
+ addDescribedBy( target, tooltip.attr( "id" ) );
14613
+ tooltip.find( ".ui-tooltip-content" ).html( content );
14614
+
14615
+ function position( event ) {
14616
+ positionOption.of = event;
14617
+ tooltip.position( positionOption );
14618
+ }
14619
+ if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
14620
+ positionOption = $.extend( {}, this.options.position );
14621
+ this._on( this.document, {
14622
+ mousemove: position
14623
+ });
14624
+ // trigger once to override element-relative positioning
14625
+ position( event );
14626
+ } else {
14627
+ tooltip.position( $.extend({
14628
+ of: target
14629
+ }, this.options.position ) );
14630
+ }
14631
+
14632
+ tooltip.hide();
14633
+
14634
+ this._show( tooltip, this.options.show );
14635
+
14636
+ this._trigger( "open", event, { tooltip: tooltip } );
14637
+
14638
+ this._on( target, {
14639
+ mouseleave: "close",
14640
+ focusout: "close",
14641
+ keyup: function( event ) {
14642
+ if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
14643
+ var fakeEvent = $.Event(event);
14644
+ fakeEvent.currentTarget = target[0];
14645
+ this.close( fakeEvent, true );
14646
+ }
14647
+ }
14648
+ });
14649
+ },
14650
+
14651
+ close: function( event, force ) {
14652
+ var that = this,
14653
+ target = $( event ? event.currentTarget : this.element ),
14654
+ tooltip = this._find( target );
14655
+
14656
+ // disabling closes the tooltip, so we need to track when we're closing
14657
+ // to avoid an infinite loop in case the tooltip becomes disabled on close
14658
+ if ( this.closing ) {
14659
+ return;
14660
+ }
14661
+
14662
+ // don't close if the element has focus
14663
+ // this prevents the tooltip from closing if you hover while focused
14664
+ //
14665
+ // we have to check the event type because tabbing out of the document
14666
+ // may leave the element as the activeElement
14667
+ if ( !force && event && event.type !== "focusout" &&
14668
+ this.document[0].activeElement === target[0] ) {
14669
+ return;
14670
+ }
14671
+
14672
+ // only set title if we had one before (see comment in _open())
14673
+ if ( target.data( "ui-tooltip-title" ) ) {
14674
+ target.attr( "title", target.data( "ui-tooltip-title" ) );
14675
+ }
14676
+
14677
+ removeDescribedBy( target );
14678
+
14679
+ tooltip.stop( true );
14680
+ this._hide( tooltip, this.options.hide, function() {
14681
+ $( this ).remove();
14682
+ delete that.tooltips[ this.id ];
14683
+ });
14684
+
14685
+ target.removeData( "tooltip-open" );
14686
+ this._off( target, "mouseleave focusout keyup" );
14687
+ this._off( this.document, "mousemove" );
14688
+
14689
+ this.closing = true;
14690
+ this._trigger( "close", event, { tooltip: tooltip } );
14691
+ this.closing = false;
14692
+ },
14693
+
14694
+ _tooltip: function( element ) {
14695
+ var id = "ui-tooltip-" + increments++,
14696
+ tooltip = $( "<div>" )
14697
+ .attr({
14698
+ id: id,
14699
+ role: "tooltip"
14700
+ })
14701
+ .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
14702
+ ( this.options.tooltipClass || "" ) );
14703
+ $( "<div>" )
14704
+ .addClass( "ui-tooltip-content" )
14705
+ .appendTo( tooltip );
14706
+ tooltip.appendTo( this.document[0].body );
14707
+ if ( $.fn.bgiframe ) {
14708
+ tooltip.bgiframe();
14709
+ }
14710
+ this.tooltips[ id ] = element;
14711
+ return tooltip;
14712
+ },
14713
+
14714
+ _find: function( target ) {
14715
+ var id = target.data( "ui-tooltip-id" );
14716
+ return id ? $( "#" + id ) : $();
14717
+ },
14718
+
14719
+ _destroy: function() {
14720
+ var that = this;
14721
+
14722
+ // close open tooltips
14723
+ $.each( this.tooltips, function( id, element ) {
14724
+ // Delegate to close method to handle common cleanup
14725
+ var event = $.Event( "blur" );
14726
+ event.target = event.currentTarget = element[0];
14727
+ that.close( event, true );
14728
+
14729
+ // Remove immediately; destroying an open tooltip doesn't use the
14730
+ // hide animation
14731
+ $( "#" + id ).remove();
14732
+
14733
+ // Restore the title
14734
+ if ( element.data( "ui-tooltip-title" ) ) {
14735
+ element.attr( "title", element.data( "ui-tooltip-title" ) );
14736
+ element.removeData( "ui-tooltip-title" );
14737
+ }
14738
+ });
14739
+ }
14740
+ });
14741
+
14742
+ }( jQuery ) );
js/kd/jquery.cookie.js ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Cookie plugin
3
+ *
4
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
5
+ * Dual licensed under the MIT and GPL licenses:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ * http://www.gnu.org/licenses/gpl.html
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Create a cookie with the given name and value and other optional parameters.
13
+ *
14
+ * @example $.cookie('the_cookie', 'the_value');
15
+ * @desc Set the value of a cookie.
16
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
17
+ * @desc Create a cookie with all available options.
18
+ * @example $.cookie('the_cookie', 'the_value');
19
+ * @desc Create a session cookie.
20
+ * @example $.cookie('the_cookie', null);
21
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
22
+ * used when the cookie was set.
23
+ *
24
+ * @param String name The name of the cookie.
25
+ * @param String value The value of the cookie.
26
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
27
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
28
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
29
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
30
+ * when the the browser exits.
31
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
32
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
33
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
34
+ * require a secure protocol (like HTTPS).
35
+ * @type undefined
36
+ *
37
+ * @name $.cookie
38
+ * @cat Plugins/Cookie
39
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
40
+ */
41
+
42
+ /**
43
+ * Get the value of a cookie with the given name.
44
+ *
45
+ * @example $.cookie('the_cookie');
46
+ * @desc Get the value of a cookie.
47
+ *
48
+ * @param String name The name of the cookie.
49
+ * @return The value of the cookie.
50
+ * @type String
51
+ *
52
+ * @name $.cookie
53
+ * @cat Plugins/Cookie
54
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
55
+ */
56
+ jQuery.cookie = function(name, value, options) {
57
+ if (typeof value != 'undefined') { // name and value given, set cookie
58
+ options = options || {};
59
+ if (value === null) {
60
+ value = '';
61
+ options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
62
+ options.expires = -1;
63
+ }
64
+ var expires = '';
65
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
66
+ var date;
67
+ if (typeof options.expires == 'number') {
68
+ date = new Date();
69
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
70
+ } else {
71
+ date = options.expires;
72
+ }
73
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
74
+ }
75
+ // NOTE Needed to parenthesize options.path and options.domain
76
+ // in the following expressions, otherwise they evaluate to undefined
77
+ // in the packed version for some reason...
78
+ var path = options.path ? '; path=' + (options.path) : '';
79
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
80
+ var secure = options.secure ? '; secure' : '';
81
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
82
+ } else { // only name given, get cookie
83
+ var cookieValue = null;
84
+ if (document.cookie && document.cookie != '') {
85
+ var cookies = document.cookie.split(';');
86
+ for (var i = 0; i < cookies.length; i++) {
87
+ var cookie = jQuery.trim(cookies[i]);
88
+ // Does this cookie string begin with the name we want?
89
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
90
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
91
+ break;
92
+ }
93
+ }
94
+ }
95
+ return cookieValue;
96
+ }
97
+ };
js/kd/jquery.dynatree.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! jQuery Dynatree Plugin - v1.2.2 - 2012-10-07
2
+ * http://dynatree.googlecode.com/
3
+ * Copyright (c) 2012 Martin Wendt; Licensed MIT, GPL */
4
+ function _log(a,b){if(!_canLog)return;var c=Array.prototype.slice.apply(arguments,[1]),d=new Date,e=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()+"."+d.getMilliseconds();c[0]=e+" - "+c[0];try{switch(a){case"info":window.console.info.apply(window.console,c);break;case"warn":window.console.warn.apply(window.console,c);break;default:window.console.log.apply(window.console,c)}}catch(f){window.console||(_canLog=!1)}}function logMsg(a){Array.prototype.unshift.apply(arguments,["debug"]),_log.apply(this,arguments)}var _canLog=!0,getDynaTreePersistData=null,DTNodeStatus_Error=-1,DTNodeStatus_Loading=1,DTNodeStatus_Ok=0;(function($){function getDtNodeFromElement(a){return alert("getDtNodeFromElement is deprecated"),$.ui.dynatree.getNode(a)}function noop(){}function _initDragAndDrop(a){var b=a.options.dnd||null;b&&(b.onDragStart||b.onDrop)&&_registerDnd(),b&&b.onDragStart&&a.$tree.draggable({addClasses:!1,appendTo:"body",containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToDynatree:!0,helper:function(a){var b=$.ui.dynatree.getNode(a.target);return b?b.tree._onDragEvent("helper",b,null,a,null,null):"<div></div>"},start:function(a,b){var c=b.helper.data("dtSourceNode");return!!c},_last:null}),b&&b.onDrop&&a.$tree.droppable({addClasses:!1,tolerance:"intersect",greedy:!1,_last:null})}var Class={create:function(){return function(){this.initialize.apply(this,arguments)}}},DynaTreeNode=Class.create();DynaTreeNode.prototype={initialize:function(a,b,c){this.parent=a,this.tree=b,typeof c=="string"&&(c={title:c}),c.key===undefined&&(c.key="_"+b._nodeCount++),this.data=$.extend({},$.ui.dynatree.nodedatadefaults,c),this.li=null,this.span=null,this.ul=null,this.childList=null,this._isLoading=!1,this.hasSubSel=!1,this.bExpanded=!1,this.bSelected=!1},toString:function(){return"DynaTreeNode<"+this.data.key+">: '"+this.data.title+"'"},toDict:function(a,b){var c=$.extend({},this.data);c.activate=this.tree.activeNode===this,c.focus=this.tree.focusNode===this,c.expand=this.bExpanded,c.select=this.bSelected,b&&b(c);if(a&&this.childList){c.children=[];for(var d=0,e=this.childList.length;d<e;d++)c.children.push(this.childList[d].toDict(!0,b))}else delete c.children;return c},fromDict:function(a){var b=a.children;if(b===undefined){this.data=$.extend(this.data,a),this.render();return}a=$.extend({},a),a.children=undefined,this.data=$.extend(this.data,a),this.removeChildren(),this.addChild(b)},_getInnerHtml:function(){var a=this.tree,b=a.options,c=a.cache,d=this.getLevel(),e=this.data,f="",g;d<b.minExpandLevel?d>1&&(f+=c.tagConnector):this.hasChildren()!==!1?f+=c.tagExpander:f+=c.tagConnector,b.checkbox&&e.hideCheckbox!==!0&&!e.isStatusNode&&(f+=c.tagCheckbox),e.icon?(e.icon.charAt(0)==="/"?g=e.icon:g=b.imagePath+e.icon,f+="<img src='"+g+"' alt='' />"):e.icon!==!1&&(f+=c.tagNodeIcon);var h="";b.onCustomRender&&(h=b.onCustomRender.call(a,this)||"");if(!h){var i=e.tooltip?' title="'+e.tooltip.replace(/\"/g,"&quot;")+'"':"",j=e.href||"#";b.noLink||e.noLink?h='<span style="display:inline-block;" class="'+b.classNames.title+'"'+i+">"+e.title+"</span>":h='<a href="'+j+'" class="'+b.classNames.title+'"'+i+">"+e.title+"</a>"}return f+=h,f},_fixOrder:function(){var a=this.childList;if(!a||!this.ul)return;var b=this.ul.firstChild;for(var c=0,d=a.length-1;c<d;c++){var e=a[c],f=b.dtnode;e!==f?(this.tree.logDebug("_fixOrder: mismatch at index "+c+": "+e+" != "+f),this.ul.insertBefore(e.li,f.li)):b=b.nextSibling}},render:function(a,b){var c=this.tree,d=this.parent,e=this.data,f=c.options,g=f.classNames,h=this.isLastSibling(),i=!1;if(!d&&!this.ul)this.li=this.span=null,this.ul=document.createElement("ul"),f.minExpandLevel>1?this.ul.className=g.container+" "+g.noConnector:this.ul.className=g.container;else if(d){this.li||(i=!0,this.li=document.createElement("li"),this.li.dtnode=this,e.key&&f.generateIds&&(this.li.id=f.idPrefix+e.key),this.span=document.createElement("span"),this.span.className=g.title,this.li.appendChild(this.span),d.ul||(d.ul=document.createElement("ul"),d.ul.style.display="none",d.li.appendChild(d.ul)),d.ul.appendChild(this.li)),this.span.innerHTML=this._getInnerHtml();var j=[];j.push(g.node),e.isFolder&&j.push(g.folder),this.bExpanded&&j.push(g.expanded),this.hasChildren()!==!1&&j.push(g.hasChildren),e.isLazy&&this.childList===null&&j.push(g.lazy),h&&j.push(g.lastsib),this.bSelected&&j.push(g.selected),this.hasSubSel&&j.push(g.partsel),c.activeNode===this&&j.push(g.active),e.addClass&&j.push(e.addClass),j.push(g.combinedExpanderPrefix+(this.bExpanded?"e":"c")+(e.isLazy&&this.childList===null?"d":"")+(h?"l":"")),j.push(g.combinedIconPrefix+(this.bExpanded?"e":"c")+(e.isFolder?"f":"")),this.span.className=j.join(" "),this.li.className=h?g.lastsib:"",i&&f.onCreate&&f.onCreate.call(c,this,this.span),f.onRender&&f.onRender.call(c,this,this.span)}if((this.bExpanded||b===!0)&&this.childList){for(var k=0,l=this.childList.length;k<l;k++)this.childList[k].render(!1,b);this._fixOrder()}if(this.ul){var m=this.ul.style.display==="none",n=!!this.bExpanded;if(a&&f.fx&&m===n){var o=f.fx.duration||200;$(this.ul).animate(f.fx,o)}else this.ul.style.display=this.bExpanded||!d?"":"none"}},getKeyPath:function(a){var b=[];return this.visitParents(function(a){a.parent&&b.unshift(a.data.key)},!a),"/"+b.join(this.tree.options.keyPathSeparator)},getParent:function(){return this.parent},getChildren:function(){return this.hasChildren()===undefined?undefined:this.childList},hasChildren:function(){if(this.data.isLazy)return this.childList===null||this.childList===undefined?undefined:this.childList.length===0?!1:this.childList.length===1&&this.childList[0].isStatusNode()?undefined:!0;return!!this.childList},isFirstSibling:function(){var a=this.parent;return!a||a.childList[0]===this},isLastSibling:function(){var a=this.parent;return!a||a.childList[a.childList.length-1]===this},isLoading:function(){return!!this._isLoading},getPrevSibling:function(){if(!this.parent)return null;var a=this.parent.childList;for(var b=1,c=a.length;b<c;b++)if(a[b]===this)return a[b-1];return null},getNextSibling:function(){if(!this.parent)return null;var a=this.parent.childList;for(var b=0,c=a.length-1;b<c;b++)if(a[b]===this)return a[b+1];return null},isStatusNode:function(){return this.data.isStatusNode===!0},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a)return!1;var b=this.parent;while(b){if(b===a)return!0;b=b.parent}return!1},countChildren:function(){var a=this.childList;if(!a)return 0;var b=a.length;for(var c=0,d=b;c<d;c++){var e=a[c];b+=e.countChildren()}return b},sortChildren:function(a,b){var c=this.childList;if(!c)return;a=a||function(a,b){var c=a.data.title.toLowerCase(),d=b.data.title.toLowerCase();return c===d?0:c>d?1:-1},c.sort(a);if(b)for(var d=0,e=c.length;d<e;d++)c[d].childList&&c[d].sortChildren(a,"$norender$");b!=="$norender$"&&this.render()},_setStatusNode:function(a){var b=this.childList?this.childList[0]:null;if(!a){if(b&&b.isStatusNode()){try{this.ul&&(this.ul.removeChild(b.li),b.li=null)}catch(c){}this.childList.length===1?this.childList=[]:this.childList.shift()}}else b?(a.isStatusNode=!0,a.key="_statusNode",b.data=a,b.render()):(a.isStatusNode=!0,a.key="_statusNode",b=this.addChild(a))},setLazyNodeStatus:function(a,b){var c=b&&b.tooltip?b.tooltip:null,d=b&&b.info?" ("+b.info+")":"";switch(a){case DTNodeStatus_Ok:this._setStatusNode(null),$(this.span).removeClass(this.tree.options.classNames.nodeLoading),this._isLoading=!1,this.tree.options.autoFocus&&(this===this.tree.tnRoot&&this.childList&&this.childList.length>0?this.childList[0].focus():this.focus());break;case DTNodeStatus_Loading:this._isLoading=!0,$(this.span).addClass(this.tree.options.classNames.nodeLoading),this.parent||this._setStatusNode({title:this.tree.options.strings.loading+d,tooltip:c,addClass:this.tree.options.classNames.nodeWait});break;case DTNodeStatus_Error:this._isLoading=!1,this._setStatusNode({title:this.tree.options.strings.loadError+d,tooltip:c,addClass:this.tree.options.classNames.nodeError});break;default:throw"Bad LazyNodeStatus: '"+a+"'."}},_parentList:function(a,b){var c=[],d=b?this:this.parent;while(d)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getLevel:function(){var a=0,b=this.parent;while(b)a++,b=b.parent;return a},_getTypeForOuterNodeEvent:function(a){var b=this.tree.options.classNames,c=a.target;if(c.className.indexOf(b.node)<0)return null;var d=a.pageX-c.offsetLeft,e=a.pageY-c.offsetTop;for(var f=0,g=c.childNodes.length;f<g;f++){var h=c.childNodes[f],i=h.offsetLeft-c.offsetLeft,j=h.offsetTop-c.offsetTop,k=h.clientWidth,l=h.clientHeight;if(d>=i&&d<=i+k&&e>=j&&e<=j+l){if(h.className==b.title)return"title";if(h.className==b.expander)return"expander";if(h.className==b.checkbox)return"checkbox";if(h.className==b.nodeIcon)return"icon"}}return"prefix"},getEventTargetType:function(a){var b=a&&a.target?a.target.className:"",c=this.tree.options.classNames;return b===c.title?"title":b===c.expander?"expander":b===c.checkbox?"checkbox":b===c.nodeIcon?"icon":b===c.empty||b===c.vline||b===c.connector?"prefix":b.indexOf(c.node)>=0?this._getTypeForOuterNodeEvent(a):null},isVisible:function(){var a=this._parentList(!0,!1);for(var b=0,c=a.length;b<c;b++)if(!a[b].bExpanded)return!1;return!0},makeVisible:function(){var a=this._parentList(!0,!1);for(var b=0,c=a.length;b<c;b++)a[b]._expand(!0)},focus:function(){this.makeVisible();try{$(this.span).find(">a").focus()}catch(a){}},isFocused:function(){return this.tree.tnFocused===this},_activate:function(a,b){this.tree.logDebug("dtnode._activate(%o, fireEvents=%o) - %o",a,b,this);var c=this.tree.options;if(this.data.isStatusNode)return;if(b&&c.onQueryActivate&&c.onQueryActivate.call(this.tree,a,this)===!1)return;if(a){if(this.tree.activeNode){if(this.tree.activeNode===this)return;this.tree.activeNode.deactivate()}c.activeVisible&&this.makeVisible(),this.tree.activeNode=this,c.persist&&$.cookie(c.cookieId+"-active",this.data.key,c.cookie),this.tree.persistence.activeKey=this.data.key,$(this.span).addClass(c.classNames.active),b&&c.onActivate&&c.onActivate.call(this.tree,this)}else if(this.tree.activeNode===this){if(c.onQueryActivate&&c.onQueryActivate.call(this.tree,!1,this)===!1)return;$(this.span).removeClass(c.classNames.active),c.persist&&$.cookie(c.cookieId+"-active","",c.cookie),this.tree.persistence.activeKey=null,this.tree.activeNode=null,b&&c.onDeactivate&&c.onDeactivate.call(this.tree,this)}},activate:function(){this._activate(!0,!0)},activateSilently:function(){this._activate(!0,!1)},deactivate:function(){this._activate(!1,!0)},isActive:function(){return this.tree.activeNode===this},_userActivate:function(){var a=!0,b=!1;if(this.data.isFolder)switch(this.tree.options.clickFolderMode){case 2:a=!1,b=!0;break;case 3:a=b=!0}this.parent===null&&(b=!1),b&&(this.toggleExpand(),this.focus()),a&&this.activate()},_setSubSel:function(a){a?(this.hasSubSel=!0,$(this.span).addClass(this.tree.options.classNames.partsel)):(this.hasSubSel=!1,$(this.span).removeClass(this.tree.options.classNames.partsel))},_updatePartSelectionState:function(){var a;if(!this.hasChildren())return a=this.bSelected&&!this.data.unselectable&&!this.data.isStatusNode,this._setSubSel(!1),a;var b,c,d=this.childList,e=!0,f=!0;for(b=0,c=d.length;b<c;b++){var g=d[b],h=g._updatePartSelectionState();h!==!1&&(f=!1),h!==!0&&(e=!1)}return e?a=!0:f?a=!1:a=undefined,this._setSubSel(a===undefined),this.bSelected=a===!0,a},_fixSelectionState:function(){var a,b,c;if(this.bSelected){this.visit(function(a){a.parent._setSubSel(!0),a.data.unselectable||a._select(!0,!1,!1)}),a=this.parent;while(a){a._setSubSel(!0);var d=!0;for(b=0,c=a.childList.length;b<c;b++){var e=a.childList[b];if(!e.bSelected&&!e.data.isStatusNode&&!e.data.unselectable){d=!1;break}}d&&a._select(!0,!1,!1),a=a.parent}}else{this._setSubSel(!1),this.visit(function(a){a._setSubSel(!1),a._select(!1,!1,!1)}),a=this.parent;while(a){a._select(!1,!1,!1);var f=!1;for(b=0,c=a.childList.length;b<c;b++)if(a.childList[b].bSelected||a.childList[b].hasSubSel){f=!0;break}a._setSubSel(f),a=a.parent}}},_select:function(a,b,c){var d=this.tree.options;if(this.data.isStatusNode)return;if(this.bSelected===a)return;if(b&&d.onQuerySelect&&d.onQuerySelect.call(this.tree,a,this)===!1)return;d.selectMode==1&&a&&this.tree.visit(function(a){if(a.bSelected)return a._select(!1,!1,!1),!1}),this.bSelected=a,a?(d.persist&&this.tree.persistence.addSelect(this.data.key),$(this.span).addClass(d.classNames.selected),c&&d.selectMode===3&&this._fixSelectionState(),b&&d.onSelect&&d.onSelect.call(this.tree,!0,this)):(d.persist&&this.tree.persistence.clearSelect(this.data.key),$(this.span).removeClass(d.classNames.selected),c&&d.selectMode===3&&this._fixSelectionState(),b&&d.onSelect&&d.onSelect.call(this.tree,!1,this))},select:function(a){return this.data.unselectable?this.bSelected:this._select(a!==!1,!0,!0)},toggleSelect:function(){return this.select(!this.bSelected)},isSelected:function(){return this.bSelected},isLazy:function(){return!!this.data.isLazy},_loadContent:function(){try{var a=this.tree.options;this.tree.logDebug("_loadContent: start - %o",this),this.setLazyNodeStatus(DTNodeStatus_Loading),!0===a.onLazyRead.call(this.tree,this)&&(this.setLazyNodeStatus(DTNodeStatus_Ok),this.tree.logDebug("_loadContent: succeeded - %o",this))}catch(b){this.tree.logWarning("_loadContent: failed - %o",b),this.setLazyNodeStatus(DTNodeStatus_Error,{tooltip:""+b})}},_expand:function(a,b){if(this.bExpanded===a){this.tree.logDebug("dtnode._expand(%o) IGNORED - %o",a,this);return}this.tree.logDebug("dtnode._expand(%o) - %o",a,this);var c=this.tree.options;if(!a&&this.getLevel()<c.minExpandLevel){this.tree.logDebug("dtnode._expand(%o) prevented collapse - %o",a,this);return}if(c.onQueryExpand&&c.onQueryExpand.call(this.tree,a,this)===!1)return;this.bExpanded=a,c.persist&&(a?this.tree.persistence.addExpand(this.data.key):this.tree.persistence.clearExpand(this.data.key));var d=(!this.data.isLazy||this.childList!==null)&&!this._isLoading&&!b;this.render(d);if(this.bExpanded&&this.parent&&c.autoCollapse){var e=this._parentList(!1,!0);for(var f=0,g=e.length;f<g;f++)e[f].collapseSiblings()}c.activeVisible&&this.tree.activeNode&&!this.tree.activeNode.isVisible()&&this.tree.activeNode.deactivate();if(a&&this.data.isLazy&&this.childList===null&&!this._isLoading){this._loadContent();return}c.onExpand&&c.onExpand.call(this.tree,a,this)},isExpanded:function(){return this.bExpanded},expand:function(a){a=a!==!1;if(!this.childList&&!this.data.isLazy&&a)return;if(this.parent===null&&!a)return;this._expand(a)},scheduleAction:function(a,b){this.tree.timer&&(clearTimeout(this.tree.timer),this.tree.logDebug("clearTimeout(%o)",this.tree.timer));var c=this;switch(a){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){c.tree.logDebug("setTimeout: trigger expand"),c.expand(!0)},b);break;case"activate":this.tree.timer=setTimeout(function(){c.tree.logDebug("setTimeout: trigger activate"),c.activate()},b);break;default:throw"Invalid mode "+a}this.tree.logDebug("setTimeout(%s, %s): %s",a,b,this.tree.timer)},toggleExpand:function(){this.expand(!this.bExpanded)},collapseSiblings:function(){if(this.parent===null)return;var a=this.parent.childList;for(var b=0,c=a.length;b<c;b++)a[b]!==this&&a[b].bExpanded&&a[b]._expand(!1)},_onClick:function(a){var b=this.getEventTargetType(a);if(b==="expander")this.toggleExpand(),this.focus();else if(b==="checkbox")this.toggleSelect(),this.focus();else{this._userActivate();var c=this.span.getElementsByTagName("a");if(c[0])$.browser.msie&&parseInt($.browser.version,10)<9||c[0].focus();else return!0}a.preventDefault()},_onDblClick:function(a){},_onKeydown:function(a){var b=!0,c;switch(a.which){case 107:case 187:this.bExpanded||this.toggleExpand();break;case 109:case 189:this.bExpanded&&this.toggleExpand();break;case 32:this._userActivate();break;case 8:this.parent&&this.parent.focus();break;case 37:this.bExpanded?(this.toggleExpand(),this.focus()):this.parent&&this.parent.parent&&this.parent.focus();break;case 39:!this.bExpanded&&(this.childList||this.data.isLazy)?(this.toggleExpand(),this.focus()):this.childList&&this.childList[0].focus();break;case 38:c=this.getPrevSibling();while(c&&c.bExpanded&&c.childList)c=c.childList[c.childList.length-1];!c&&this.parent&&this.parent.parent&&(c=this.parent),c&&c.focus();break;case 40:if(this.bExpanded&&this.childList)c=this.childList[0];else{var d=this._parentList(!1,!0);for(var e=d.length-1;e>=0;e--){c=d[e].getNextSibling();if(c)break}}c&&c.focus();break;default:b=!1}b&&a.preventDefault()},_onKeypress:function(a){},_onFocus:function(a){var b=this.tree.options;if(a.type=="blur"||a.type=="focusout")b.onBlur&&b.onBlur.call(this.tree,this),this.tree.tnFocused&&$(this.tree.tnFocused.span).removeClass(b.classNames.focused),this.tree.tnFocused=null,b.persist&&$.cookie(b.cookieId+"-focus","",b.cookie);else if(a.type=="focus"||a.type=="focusin")this.tree.tnFocused&&this.tree.tnFocused!==this&&(this.tree.logDebug("dtnode.onFocus: out of sync: curFocus: %o",this.tree.tnFocused),$(this.tree.tnFocused.span).removeClass(b.classNames.focused)),this.tree.tnFocused=this,b.onFocus&&b.onFocus.call(this.tree,this),$(this.tree.tnFocused.span).addClass(b.classNames.focused),b.persist&&$.cookie(b.cookieId+"-focus",this.data.key,b.cookie)},visit:function(a,b){var c=!0;if(b===!0){c=a(this);if(c===!1||c=="skip")return c}if(this.childList)for(var d=0,e=this.childList.length;d<e;d++){c=this.childList[d].visit(a,!0);if(c===!1)break}return c},visitParents:function(a,b){if(b&&a(this)===!1)return!1;var c=this.parent;while(c){if(a(c)===!1)return!1;c=c.parent}return!0},remove:function(){if(this===this.tree.root)throw"Cannot remove system root";return this.parent.removeChild(this)},removeChild:function(a){var b=this.childList;if(b.length==1){if(a!==b[0])throw"removeChild: invalid child";return this.removeChildren()}a===this.tree.activeNode&&a.deactivate(),this.tree.options.persist&&(a.bSelected&&this.tree.persistence.clearSelect(a.data.key),a.bExpanded&&this.tree.persistence.clearExpand(a.data.key)),a.removeChildren(!0),this.ul.removeChild(a.li);for(var c=0,d=b.length;c<d;c++)if(b[c]===a){this.childList.splice(c,1);break}},removeChildren:function(a,b){this.tree.logDebug("%s.removeChildren(%o)",this,a);var c=this.tree,d=this.childList;if(d){for(var e=0,f=d.length;e<f;e++){var g=d[e];g===c.activeNode&&!b&&g.deactivate(),this.tree.options.persist&&!b&&(g.bSelected&&this.tree.persistence.clearSelect(g.data.key),g.bExpanded&&this.tree.persistence.clearExpand(g.data.key)),g.removeChildren(!0,b),this.ul&&$("li",$(this.ul)).remove()}this.childList=null}a||(this._isLoading=!1,this.render())},setTitle:function(a){this.fromDict({title:a})},reload:function(a){throw"Use reloadChildren() instead"},reloadChildren:function(a){if(this.parent===null)throw"Use tree.reload() instead";if(!this.data.isLazy)throw"node.reloadChildren() requires lazy nodes.";if(a){var b=this,c="nodeLoaded.dynatree."+this.tree.$tree.attr("id")+"."+this.data.key;this.tree.$tree.bind(c,function(d,e,f){b.tree.$tree.unbind(c),b.tree.logDebug("loaded %o, %o, %o",d,e,f);if(e!==b)throw"got invalid load event";a.call(b.tree,e,f)})}this.removeChildren(),this._loadContent()},_loadKeyPath:function(a,b){var c=this.tree;c.logDebug("%s._loadKeyPath(%s)",this,a);if(a==="")throw"Key path must not be empty";var d=a.split(c.options.keyPathSeparator);if(d[0]==="")throw"Key path must be relative (don't start with '/')";var e=d.shift();if(this.childList)for(var f=0,g=this.childList.length;f<g;f++){var h=this.childList[f];if(h.data.key===e){if(d.length===0)b.call(c,h,"ok");else if(!h.data.isLazy||h.childList!==null&&h.childList!==undefined)b.call(c,h,"loaded"),h._loadKeyPath(d.join(c.options.keyPathSeparator),b);else{c.logDebug("%s._loadKeyPath(%s) -> reloading %s...",this,a,h);var i=this;h.reloadChildren(function(e,f){f?(c.logDebug("%s._loadKeyPath(%s) -> reloaded %s.",e,a,e),b.call(c,h,"loaded"),e._loadKeyPath(d.join(c.options.keyPathSeparator),b)):(c.logWarning("%s._loadKeyPath(%s) -> reloadChildren() failed.",i,a),b.call(c,h,"error"))})}return}}b.call(c,undefined,"notfound",e,d.length===0),c.logWarning("Node not found: "+e);return},resetLazy:function(){if(this.parent===null)throw"Use tree.reload() instead";if(!this.data.isLazy)throw"node.resetLazy() requires lazy nodes.";this.expand(!1),this.removeChildren()},_addChildNode:function(a,b){var c=this.tree,d=c.options,e=c.persistence;a.parent=this,this.childList===null?this.childList=[]:b||this.childList.length>0&&$(this.childList[this.childList.length-1].span).removeClass(d.classNames.lastsib);if(b){var f=$.inArray(b,this.childList);if(f<0)throw"<beforeNode> must be a child of <this>";this.childList.splice(f,0,a)}else this.childList.push(a);var g=c.isInitializing();d.persist&&e.cookiesFound&&g?(e.activeKey===a.data.key&&(c.activeNode=a),e.focusedKey===a.data.key&&(c.focusNode=a),a.bExpanded=$.inArray(a.data.key,e.expandedKeyList)>=0,a.bSelected=$.inArray(a.data.key,e.selectedKeyList)>=0):(a.data.activate&&(c.activeNode=a,d.persist&&(e.activeKey=a.data.key)),a.data.focus&&(c.focusNode=a,d.persist&&(e.focusedKey=a.data.key)),a.bExpanded=a.data.expand===!0,a.bExpanded&&d.persist&&e.addExpand(a.data.key),a.bSelected=a.data.select===!0,a.bSelected&&d.persist&&e.addSelect(a.data.key)),d.minExpandLevel>=a.getLevel()&&(this.bExpanded=!0);if(a.bSelected&&d.selectMode==3){var h=this;while(h)h.hasSubSel||h._setSubSel(!0),h=h.parent}return c.bEnableUpdate&&this.render(),a},addChild:function(a,b){if(typeof a=="string")throw"Invalid data type for "+a;if(!a||a.length===0)return;if(a instanceof DynaTreeNode)return this._addChildNode(a,b);a.length||(a=[a]);var c=this.tree.enableUpdate(!1),d=null;for(var e=0,f=a.length;e<f;e++){var g=a[e],h=this._addChildNode(new DynaTreeNode(this,this.tree,g),b);d||(d=h),g.children&&h.addChild(g.children,null)}return this.tree.enableUpdate(c),d},append:function(a){return this.tree.logWarning("node.append() is deprecated (use node.addChild() instead)."),this.addChild(a,null)},appendAjax:function(a){var b=this;this.removeChildren(!1,!0),this.setLazyNodeStatus(DTNodeStatus_Loading);if(a.debugLazyDelay){var c=a.debugLazyDelay;a.debugLazyDelay=0,this.tree.logInfo("appendAjax: waiting for debugLazyDelay "+c),setTimeout(function(){b.appendAjax(a)},c);return}var d=a.success,e=a.error,f="nodeLoaded.dynatree."+this.tree.$tree.attr("id")+"."+this.data.key,g=$.extend({},this.tree.options.ajaxDefaults,a,{success:function(a,c,e){var h=b.tree.phase;b.tree.phase="init",g.postProcess?a=g.postProcess.call(this,a,this.dataType):a&&a.hasOwnProperty("d")&&(a=typeof a.d=="string"?$.parseJSON(a.d):a.d),(!$.isArray(a)||a.length!==0)&&b.addChild(a,null),b.tree.phase="postInit",d&&d.call(g,b,a,c),b.tree.logDebug("trigger "+f),b.tree.$tree.trigger(f,[b,!0]),b.tree.phase=h,b.setLazyNodeStatus(DTNodeStatus_Ok),$.isArray(a)&&a.length===0&&(b.childList=[],b.render())},error:function(a,c,d){b.tree.logWarning("appendAjax failed:",c,":\n",a,"\n",d),e&&e.call(g,b,a,c,d),b.tree.$tree.trigger(f,[b,!1]),b.setLazyNodeStatus(DTNodeStatus_Error,{info:c,tooltip:""+d})}});$.ajax(g)},move:function(a,b){var c;if(this===a)return;if(!this.parent)throw"Cannot move system root";if(b===undefined||b=="over")b="child";var d=this.parent,e=b==="child"?a:a.parent;if(e.isDescendantOf(this))throw"Cannot move a node to it's own descendant";if(this.parent.childList.length==1)this.parent.childList=this.parent.data.isLazy?[]:null,this.parent.bExpanded=!1;else{c=$.inArray(this,this.parent.childList);if(c<0)throw"Internal error";this.parent.childList.splice(c,1)}this.parent.ul&&this.parent.ul.removeChild(this.li),this.parent=e;if(e.hasChildren())switch(b){case"child":e.childList.push(this);break;case"before":c=$.inArray(a,e.childList);if(c<0)throw"Internal error";e.childList.splice(c,0,this);break;case"after":c=$.inArray(a,e.childList);if(c<0)throw"Internal error";e.childList.splice(c+1,0,this);break;default:throw"Invalid mode "+b}else e.childList=[this];e.ul||(e.ul=document.createElement("ul"),e.ul.style.display="none",e.li.appendChild(e.ul)),this.li&&e.ul.appendChild(this.li);if(this.tree!==a.tree)throw this.visit(function(b){b.tree=a.tree},null,!0),"Not yet implemented.";d.isDescendantOf(e)||d.render(),e.isDescendantOf(d)||e.render()},lastentry:undefined};var DynaTreeStatus=Class.create();DynaTreeStatus._getTreePersistData=function(a,b){var c=new DynaTreeStatus(a,b);return c.read(),c.toDict()},getDynaTreePersistData=DynaTreeStatus._getTreePersistData,DynaTreeStatus.prototype={initialize:function(a,b){a===undefined&&(a=$.ui.dynatree.prototype.options.cookieId),b=$.extend({},$.ui.dynatree.prototype.options.cookie,b),this.cookieId=a,this.cookieOpts=b,this.cookiesFound=undefined,this.activeKey=null,this.focusedKey=null,this.expandedKeyList=null,this.selectedKeyList=null},_log:function(a){Array.prototype.unshift.apply(arguments,["debug"]),_log.apply(this,arguments)},read:function(){this.cookiesFound=!1;var a=$.cookie(this.cookieId+"-active");this.activeKey=a===null?"":a,a!==null&&(this.cookiesFound=!0),a=$.cookie(this.cookieId+"-focus"),this.focusedKey=a===null?"":a,a!==null&&(this.cookiesFound=!0),a=$.cookie(this.cookieId+"-expand"),this.expandedKeyList=a===null?[]:a.split(","),a!==null&&(this.cookiesFound=!0),a=$.cookie(this.cookieId+"-select"),this.selectedKeyList=a===null?[]:a.split(","),a!==null&&(this.cookiesFound=!0)},write:function(){$.cookie(this.cookieId+"-active",this.activeKey===null?"":this.activeKey,this.cookieOpts),$.cookie(this.cookieId+"-focus",this.focusedKey===null?"":this.focusedKey,this.cookieOpts),$.cookie(this.cookieId+"-expand",this.expandedKeyList===null?"":this.expandedKeyList.join(","),this.cookieOpts),$.cookie(this.cookieId+"-select",this.selectedKeyList===null?"":this.selectedKeyList.join(","),this.cookieOpts)},addExpand:function(a){$.inArray(a,this.expandedKeyList)<0&&(this.expandedKeyList.push(a),$.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts))},clearExpand:function(a){var b=$.inArray(a,this.expandedKeyList);b>=0&&(this.expandedKeyList.splice(b,1),$.cookie(this.cookieId+"-expand",this.expandedKeyList.join(","),this.cookieOpts))},addSelect:function(a){$.inArray(a,this.selectedKeyList)<0&&(this.selectedKeyList.push(a),$.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts))},clearSelect:function(a){var b=$.inArray(a,this.selectedKeyList);b>=0&&(this.selectedKeyList.splice(b,1),$.cookie(this.cookieId+"-select",this.selectedKeyList.join(","),this.cookieOpts))},isReloading:function(){return this.cookiesFound===!0},toDict:function(){return{cookiesFound:this.cookiesFound,activeKey:this.activeKey,focusedKey:this.activeKey,expandedKeyList:this.expandedKeyList,selectedKeyList:this.selectedKeyList}},lastentry:undefined};var DynaTree=Class.create();DynaTree.version="$Version:$",DynaTree.prototype={initialize:function(a){this.phase="init",this.$widget=a,this.options=a.options,this.$tree=a.element,this.timer=null,this.divTree=this.$tree.get(0),_initDragAndDrop(this)},_load:function(a){var b=this.$widget,c=this.options,d=this;this.bEnableUpdate=!0,this._nodeCount=1,this.activeNode=null,this.focusNode=null,c.rootVisible!==undefined&&this.logWarning("Option 'rootVisible' is no longer supported."),c.minExpandLevel<1&&(this.logWarning("Option 'minExpandLevel' must be >= 1."),c.minExpandLevel=1),c.classNames!==$.ui.dynatree.prototype.options.classNames&&(c.classNames=$.extend({},$.ui.dynatree.prototype.options.classNames,c.classNames)),c.ajaxDefaults!==$.ui.dynatree.prototype.options.ajaxDefaults&&(c.ajaxDefaults=$.extend({},$.ui.dynatree.prototype.options.ajaxDefaults,c.ajaxDefaults)),c.dnd!==$.ui.dynatree.prototype.options.dnd&&(c.dnd=$.extend({},$.ui.dynatree.prototype.options.dnd,c.dnd)),c.imagePath||$("script").each(function(){var a=/.*dynatree[^\/]*\.js$/i;if(this.src.search(a)>=0)return this.src.indexOf("/")>=0?c.imagePath=this.src.slice(0,this.src.lastIndexOf("/"))+"/skin/":c.imagePath="skin/",d.logDebug("Guessing imagePath from '%s': '%s'",this.src,c.imagePath),!1}),this.persistence=new DynaTreeStatus(c.cookieId,c.cookie),c.persist&&($.cookie||_log("warn","Please include jquery.cookie.js to use persistence."),this.persistence.read()),this.logDebug("DynaTree.persistence: %o",this.persistence.toDict()),this.cache={tagEmpty:"<span class='"+c.classNames.empty+"'></span>",tagVline:"<span class='"+c.classNames.vline+"'></span>",tagExpander:"<span class='"+c.classNames.expander+"'></span>",tagConnector:"<span class='"+c.classNames.connector+"'></span>",tagNodeIcon:"<span class='"+c.classNames.nodeIcon+"'></span>",tagCheckbox:"<span class='"+c.classNames.checkbox+"'></span>",lastentry:undefined},(c.children||c.initAjax&&c.initAjax.url||c.initId)&&$(this.divTree).empty();var e=this.$tree.find(">ul:first").hide();this.tnRoot=new DynaTreeNode(null,this,{}),this.tnRoot.bExpanded=!0,this.tnRoot.render(),this.divTree.appendChild(this.tnRoot.ul);var f=this.tnRoot,g=c.persist&&this.persistence.isReloading(),h=!1,i=this.enableUpdate(!1);this.logDebug("Dynatree._load(): read tree structure..."),c.children?f.addChild(c.children):c.initAjax&&c.initAjax.url?(h=!0,f.data.isLazy=!0,this._reloadAjax(a)):c.initId?this._createFromTag(f,$("#"+c.initId)):(this._createFromTag(f,e),e.remove()),this._checkConsistency(),!h&&c.selectMode==3&&f._updatePartSelectionState(),this.logDebug("Dynatree._load(): render nodes..."),this.enableUpdate(i),this.logDebug("Dynatree._load(): bind events..."),this.$widget.bind(),this.logDebug("Dynatree._load(): postInit..."),this.phase="postInit",c.persist&&this.persistence.write(),this.focusNode&&this.focusNode.isVisible()&&(this.logDebug("Focus on init: %o",this.focusNode),this.focusNode.focus()),h||(c.onPostInit&&c.onPostInit.call(this,g,!1),a&&a.call(this,"ok")),this.phase="idle"},_reloadAjax:function(a){var b=this.options;if(!b.initAjax||!b.initAjax.url)throw"tree.reload() requires 'initAjax' mode.";var c=this.persistence,d=$.extend({},b.initAjax);d.addActiveKey&&(d.data.activeKey=c.activeKey),d.addFocusedKey&&(d.data.focusedKey=c.focusedKey),d.addExpandedKeyList&&(d.data.expandedKeyList=c.expandedKeyList.join(",")),d.addSelectedKeyList&&(d.data.selectedKeyList=c.selectedKeyList.join(",")),d.success&&this.logWarning("initAjax: success callback is ignored; use onPostInit instead."),d.error&&this.logWarning("initAjax: error callback is ignored; use onPostInit instead.");var e=c.isReloading();d.success=function(c,d,f){b.selectMode==3&&c.tree.tnRoot._updatePartSelectionState(),b.onPostInit&&b.onPostInit.call(c.tree,e,!1),a&&a.call(c.tree,"ok")},d.error=function(c,d,f,g){b.onPostInit&&b.onPostInit.call(c.tree,e,!0,d,f,g),a&&a.call(c.tree,"error",d,f,g)},this.logDebug("Dynatree._init(): send Ajax request..."),this.tnRoot.appendAjax(d)},toString:function(){return"Dynatree '"+this.$tree.attr("id")+"'"},toDict:function(){return this.tnRoot.toDict(!0)},serializeArray:function(a){var b=this.getSelectedNodes(a),c=this.$tree.attr("name")||this.$tree.attr("id"),d=[];for(var e=0,f=b.length;e<f;e++)d.push({name:c,value:b[e].data.key});return d},getPersistData:function(){return this.persistence.toDict()},logDebug:function(a){this.options.debugLevel>=2&&(Array.prototype.unshift.apply(arguments,["debug"]),_log.apply(this,arguments))},logInfo:function(a){this.options.debugLevel>=1&&(Array.prototype.unshift.apply(arguments,["info"]),_log.apply(this,arguments))},logWarning:function(a){Array.prototype.unshift.apply(arguments,["warn"]),_log.apply(this,arguments)},isInitializing:function(){return this.phase=="init"||this.phase=="postInit"},isReloading:function(){return(this.phase=="init"||this.phase=="postInit")&&this.options.persist&&this.persistence.cookiesFound},isUserEvent:function(){return this.phase=="userEvent"},redraw:function(){this.tnRoot.render(!1,!1)},renderInvisibleNodes:function(){this.tnRoot.render(!1,!0)},reload:function(a){this._load(a)},getRoot:function(){return this.tnRoot},enable:function(){this.$widget.enable()},disable:function(){this.$widget.disable()},getNodeByKey:function(a){var b=document.getElementById(this.options.idPrefix+a);if(b)return b.dtnode?b.dtnode:null;var c=null;return this.visit(function(b){if(b.data.key==a)return c=b,!1},!0),c},getActiveNode:function(){return this.activeNode},reactivate:function(a){var b=this.activeNode;b&&(this.activeNode=null,b.activate(),a&&b.focus())},getSelectedNodes:function(a){var b=[];return this.tnRoot.visit(function(c){if(c.bSelected){b.push(c);if(a===!0)return"skip"}}),b},activateKey:function(a){var b=a===null?null:this.getNodeByKey(a);return b?(b.focus(),b.activate(),b):(this.activeNode&&this.activeNode.deactivate(),this.activeNode=null,null)},loadKeyPath:function(a,b){var c=a.split(this.options.keyPathSeparator);return c[0]===""&&c.shift(),c[0]==this.tnRoot.data.key&&(this.logDebug("Removed leading root key."),c.shift()),a=c.join(this.options.keyPathSeparator),this.tnRoot._loadKeyPath(a,b)},selectKey:function(a,b){var c=this.getNodeByKey(a);return c?(c.select(b),c):null},enableUpdate:function(a){return this.bEnableUpdate==a?a:(this.bEnableUpdate=a,a&&this.redraw(),!a)},count:function(){return this.tnRoot.countChildren()},visit:function(a,b){return this.tnRoot.visit(a,b)},_createFromTag:function(parentTreeNode,$ulParent){var self=this;$ulParent.find(">li").each(function(){var $li=$(this),$liSpan=$li.find(">span:first"),$liA=$li.find(">a:first"),title,href=null,target=null,tooltip;if($liSpan.length)title=$liSpan.html();else if($liA.length)title=$liA.html(),href=$liA.attr("href"),target=$liA.attr("target"),tooltip=$liA.attr("title");else{title=$li.html();var iPos=title.search(/<ul/i);iPos>=0?title=$.trim(title.substring(0,iPos)):title=$.trim(title)}var data={title:title,tooltip:tooltip,isFolder:$li.hasClass("folder"),isLazy:$li.hasClass("lazy"),expand:$li.hasClass("expanded"),select:$li.hasClass("selected"),activate:$li.hasClass("active"),focus:$li.hasClass("focused"),noLink:$li.hasClass("noLink")};href&&(data.href=href,data.target=target),$li.attr("title")&&(data.tooltip=$li.attr("title")),$li.attr("id")&&(data.key=$li.attr("id"));if($li.attr("data")){var dataAttr=$.trim($li.attr("data"));if(dataAttr){dataAttr.charAt(0)!="{"&&(dataAttr="{"+dataAttr+"}");try{$.extend(data,eval("("+dataAttr+")"))}catch(e){throw"Error parsing node data: "+e+"\ndata:\n'"+dataAttr+"'"}}}var childNode=parentTreeNode.addChild(data),$ul=$li.find(">ul:first");$ul.length&&self._createFromTag(childNode,$ul)})},_checkConsistency:function(){},_setDndStatus:function(a,b,c,d,e){var f=a?$(a.span):null,g=$(b.span);this.$dndMarker||(this.$dndMarker=$("<div id='dynatree-drop-marker'></div>").hide().css({"z-index":1e3}).prependTo($(this.divTree).parent()));if(d==="after"||d==="before"||d==="over"){var h="0 0";switch(d){case"before":this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-over"),this.$dndMarker.addClass("dynatree-drop-before"),h="0 -8";break;case"after":this.$dndMarker.removeClass("dynatree-drop-before dynatree-drop-over"),this.$dndMarker.addClass("dynatree-drop-after"),h="0 8";break;default:this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-before"),this.$dndMarker.addClass("dynatree-drop-over"),g.addClass("dynatree-drop-target"),h="8 0"}this.$dndMarker.show().position({my:"left top",at:"left top",of:g,offset:h})}else g.removeClass("dynatree-drop-target"),this.$dndMarker.hide();d==="after"?g.addClass("dynatree-drop-after"):g.removeClass("dynatree-drop-after"),d==="before"?g.addClass("dynatree-drop-before"):g.removeClass("dynatree-drop-before"),e===!0?(f&&f.addClass("dynatree-drop-accept"),g.addClass("dynatree-drop-accept"),c.addClass("dynatree-drop-accept")):(f&&f.removeClass("dynatree-drop-accept"),g.removeClass("dynatree-drop-accept"),c.removeClass("dynatree-drop-accept")),e===!1?(f&&f.addClass("dynatree-drop-reject"),g.addClass("dynatree-drop-reject"),c.addClass("dynatree-drop-reject")):(f&&f.removeClass("dynatree-drop-reject"),g.removeClass("dynatree-drop-reject"),c.removeClass("dynatree-drop-reject"))},_onDragEvent:function(a,b,c,d,e,f){var g=this.options,h=this.options.dnd,i=null,j=$(b.span),k,l;switch(a){case"helper":var m=$("<div class='dynatree-drag-helper'><span class='dynatree-drag-helper-img' /></div>").append($(d.target).closest("a").clone());$("ul.dynatree-container",b.tree.divTree).append(m),m.data("dtSourceNode",b),i=m;break;case"start":b.isStatusNode()?i=!1:h.onDragStart&&(i=h.onDragStart(b)),i===!1?(this.logDebug("tree.onDragStart() cancelled"),e.helper.trigger("mouseup"),e.helper.hide()):j.addClass("dynatree-drag-source");break;case"enter":i=h.onDragEnter?h.onDragEnter(b,c):null,i?i={over:i===!0||i==="over"||$.inArray("over",i)>=0,before:i===!0||i==="before"||$.inArray("before",i)>=0,after:i===!0||i==="after"||$.inArray("after",i)>=0}:i=!1,e.helper.data("enterResponse",i);break;case"over":l=e.helper.data("enterResponse"),k=null;if(l!==!1)if(typeof l=="string")k=l;else{var n=j.offset(),o={x:d.pageX-n.left,y:d.pageY-n.top},p={x:o.x/j.width(),y:o.y/j.height()};l.after&&p.y>.75?k="after":!l.over&&l.after&&p.y>.5?k="after":l.before&&p.y<=.25?k="before":!l.over&&l.before&&p.y<=.5?k="before":l.over&&(k="over"),h.preventVoidMoves&&(b===c?k=null:k==="before"&&c&&b===c.getNextSibling()?k=null:k==="after"&&c&&b===c.getPrevSibling()?k=null:k==="over"&&c&&c.parent===b&&c.isLastSibling()&&(k=null)),e.helper.data("hitMode",k)}k==="over"&&h.autoExpandMS&&b.hasChildren()!==!1&&!b.bExpanded&&b.scheduleAction("expand",h.autoExpandMS);if(k&&h.onDragOver){i=h.onDragOver(b,c,k);if(i==="over"||i==="before"||i==="after")k=i}this._setDndStatus(c,b,e.helper,k,i!==!1&&k!==null);break;case"drop":var q=e.helper.hasClass("dynatree-drop-reject");k=e.helper.data("hitMode"),k&&h.onDrop&&!q&&h.onDrop(b,c,k,e,f);break;case"leave":b.scheduleAction("cancel"),e.helper.data("enterResponse",null),e.helper.data("hitMode",null),this._setDndStatus(c,b,e.helper,"out",undefined),h.onDragLeave&&h.onDragLeave(b,c);break;case"stop":j.removeClass("dynatree-drag-source"),h.onDragStop&&h.onDragStop(b);break;default:throw"Unsupported drag event: "+a}return i},cancelDrag:function(){var a=$.ui.ddmanager.current;a&&a.cancel()},lastentry:undefined},$.widget("ui.dynatree",{_init:function(){if(parseFloat($.ui.version)<1.8)return this.options.debugLevel>=0&&_log("warn","ui.dynatree._init() was called; you should upgrade to jquery.ui.core.js v1.8 or higher."),this._create();this.options.debugLevel>=2&&_log("debug","ui.dynatree._init() was called; no current default functionality.")},_create:function(){var a=this.options;a.debugLevel>=1&&logMsg("Dynatree._create(): version='%s', debugLevel=%o.",$.ui.dynatree.version,this.options.debugLevel),this.options.event+=".dynatree";var b=this.element.get(0);this.tree=new DynaTree(this),this.tree._load(),this.tree.logDebug("Dynatree._init(): done.")},bind:function(){function b(a){a=$.event.fix(a||window.event);var b=$.ui.dynatree.getNode(a.target);return b?b._onFocus(a):!1}this.unbind();var a="click.dynatree dblclick.dynatree";this.options.keyboard&&(a+=" keypress.dynatree keydown.dynatree"),this.element.bind(a,function(a){var b=$.ui.dynatree.getNode(a.target);if(!b)return!0;var c=b.tree,d=c.options;c.logDebug("event(%s): dtnode: %s",a.type,b);var e=c.phase;c.phase="userEvent";try{switch(a.type){case"click":return d.onClick&&d.onClick.call(c,b,a)===!1?!1:b._onClick(a);case"dblclick":return d.onDblClick&&d.onDblClick.call(c,b,a)===!1?!1:b._onDblClick(a);case"keydown":return d.onKeydown&&d.onKeydown.call(c,b,a)===!1?!1:b._onKeydown(a);case"keypress":return d.onKeypress&&d.onKeypress.call(c,b,a)===!1?!1:b._onKeypress(a)}}catch(f){var g=null;c.logWarning("bind(%o): dtnode: %o, error: %o",a,b,f)}finally{c.phase=e}});var c=this.tree.divTree;c.addEventListener?(c.addEventListener("focus",b,!0),c.addEventListener("blur",b,!0)):c.onfocusin=c.onfocusout=b},unbind:function(){this.element.unbind(".dynatree")},enable:function(){this.bind(),$.Widget.prototype.enable.apply(this,arguments)},disable:function(){this.unbind(),$.Widget.prototype.disable.apply(this,arguments)},getTree:function(){return this.tree},getRoot:function(){return this.tree.getRoot()},getActiveNode:function(){return this.tree.getActiveNode()},getSelectedNodes:function(){return this.tree.getSelectedNodes()},lastentry:undefined}),parseFloat($.ui.version)<1.8&&($.ui.dynatree.getter="getTree getRoot getActiveNode getSelectedNodes"),$.ui.dynatree.version="$Version:$",$.ui.dynatree.getNode=function(a){if(a instanceof DynaTreeNode)return a;a.selector!==undefined&&(a=a[0]);while(a){if(a.dtnode)return a.dtnode;a=a.parentNode}return null},$.ui.dynatree.getPersistData=DynaTreeStatus._getTreePersistData,$.ui.dynatree.prototype.options={title:"Dynatree",minExpandLevel:1,imagePath:null,children:null,initId:null,initAjax:null,autoFocus:!0,keyboard:!0,persist:!1,autoCollapse:!1,clickFolderMode:3,activeVisible:!0,checkbox:!1,selectMode:2,fx:null,noLink:!1,onClick:null,onDblClick:null,onKeydown:null,onKeypress:null,onFocus:null,onBlur:null,onQueryActivate:null,onQuerySelect:null,onQueryExpand:null,onPostInit:null,onActivate:null,onDeactivate:null,onSelect:null,onExpand:null,onLazyRead:null,onCustomRender:null,onCreate:null,onRender:null,postProcess:null,dnd:{onDragStart:null,onDragStop:null,autoExpandMS:1e3,preventVoidMoves:!0,onDragEnter:null,onDragOver:null,onDrop:null,onDragLeave:null},ajaxDefaults:{cache:!1,timeout:0,dataType:"json"},strings:{loading:"Loading&#8230;",loadError:"Load error!"},generateIds:!1,idPrefix:"dynatree-id-",keyPathSeparator:"/",cookieId:"dynatree",cookie:{expires:null},classNames:{container:"dynatree-container",node:"dynatree-node",folder:"dynatree-folder",empty:"dynatree-empty",vline:"dynatree-vline",expander:"dynatree-expander",connector:"dynatree-connector",checkbox:"dynatree-checkbox",nodeIcon:"dynatree-icon",title:"dynatree-title",noConnector:"dynatree-no-connector",nodeError:"dynatree-statusnode-error",nodeWait:"dynatree-statusnode-wait",hidden:"dynatree-hidden",combinedExpanderPrefix:"dynatree-exp-",combinedIconPrefix:"dynatree-ico-",nodeLoading:"dynatree-loading",hasChildren:"dynatree-has-children",active:"dynatree-active",selected:"dynatree-selected",expanded:"dynatree-expanded",lazy:"dynatree-lazy",focused:"dynatree-focused",partsel:"dynatree-partsel",lastsib:"dynatree-lastsib"},debugLevel:2,lastentry:undefined},parseFloat($.ui.version)<1.8&&($.ui.dynatree.defaults=$.ui.dynatree.prototype.options),$.ui.dynatree.nodedatadefaults={title:null,key:null,isFolder:!1,isLazy:!1,tooltip:null,href:null,icon:null,addClass:null,noLink:!1,activate:!1,focus:!1,expand:!1,select:!1,hideCheckbox:!1,unselectable:!1,children:null,lastentry:undefined};var didRegisterDnd=!1,_registerDnd=function(){if(didRegisterDnd)return;$.ui.plugin.add("draggable","connectToDynatree",{start:function(a,b){var c=$(this).data("draggable"),d=b.helper.data("dtSourceNode")||null;if(d)return c.offset.click.top=-2,c.offset.click.left=16,d.tree._onDragEvent("start",d,null,a,b,c)},drag:function(a,b){var c=$(this).data("draggable"),d=b.helper.data("dtSourceNode")||null,e=b.helper.data("dtTargetNode")||null,f=$.ui.dynatree.getNode(a.target);if(a.target&&!f){var g=$(a.target).closest("div.dynatree-drag-helper,#dynatree-drop-marker").length>0;if(g)return}b.helper.data("dtTargetNode",f),e&&e!==f&&e.tree._onDragEvent("leave",e,d,a,b,c),f&&(!f.tree.options.dnd.onDrop||(f===e?f.tree._onDragEvent("over",f,d,a,b,c):f.tree._onDragEvent("enter",f,d,a,b,c)))},stop:function(a,b){var c=$(this).data("draggable"),d=b.helper.data("dtSourceNode")||null,e=b.helper.data("dtTargetNode")||null,f=c._mouseDownEvent,g=a.type,h=g=="mouseup"&&a.which==1;h||logMsg("Drag was cancelled"),e&&(h&&e.tree._onDragEvent("drop",e,d,a,b,c),e.tree._onDragEvent("leave",e,d,a,b,c)),d&&d.tree._onDragEvent("stop",d,null,a,b,c)}}),didRegisterDnd=!0}})(jQuery);
js/kd/jquery.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! jQuery v1.8.2 jquery.com | jquery.org/license */
2
+ (function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call(" ")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":(a+"").replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")||(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)f.indexOf(" "+b[g]+" ")<0&&(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=b+""}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&p.expr.match.needsContext.test(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=k.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<q;d++)l=o[d],m=l.selector,h[m]===b&&(h[m]=l.needsContext?p(m,this).index(f)>=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){i=u[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){l=i.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,g=((p.event.special[l.origType]||{}).handle||l.handler).apply(i.elem,r),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length===1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h<i;h++)if(f=a[h])if(!c||c(f,d,e))g.push(f),j&&b.push(h);return g}function bl(a,b,c,d,e,f){return d&&!d[o]&&(d=bl(d)),e&&!e[o]&&(e=bl(e,f)),z(function(f,g,h,i){if(f&&e)return;var j,k,l,m=[],n=[],o=g.length,p=f||bo(b||"*",h.nodeType?[h]:h,[],f),q=a&&(f||!b)?bk(p,m,a,h,i):p,r=c?e||(f?a:o||d)?[]:g:q;c&&c(q,r,h,i);if(d){l=bk(r,n),d(l,[],h,i),j=l.length;while(j--)if(k=l[j])r[n[j]]=!(q[n[j]]=k)}if(f){j=a&&r.length;while(j--)if(k=r[j])f[m[j]]=!(g[m[j]]=k)}else r=bk(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):w.apply(g,r)})}function bm(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],i=g?1:0,j=bi(function(a){return a===b},h,!0),k=bi(function(a){return y.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i<f;i++)if(c=e.relative[a[i].type])m=[bi(bj(m),c)];else{c=e.filter[a[i].type].apply(null,a[i].matches);if(c[o]){d=++i;for(;d<f;d++)if(e.relative[a[d].type])break;return bl(i>1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i<d&&bm(a.slice(i,d)),d<f&&bm(a=a.slice(d)),d<f&&a.join(""))}m.push(c)}return bj(m)}function bn(a,b){var d=b.length>0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j);if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)bc(a,b[e],c,d);return c}function bp(a,b,c,d,f){var g,h,j,k,l,m=bh(a),n=m.length;if(!d&&m.length===1){h=m[0]=m[0].slice(0);if(h.length>2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].indexOf||function(a){var b=0,c=this.length;for(;b<c;b++)if(this[b]===a)return b;return-1},z=function(a,b){return a[o]=b==null||b,a},A=function(){var a={},b=[];return z(function(c,d){return b.push(c)>e.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].slice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if(c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d<b;d+=2)a.push(d);return a}),odd:bf(function(a,b,c){for(var d=1;d<b;d+=2)a.push(d);return a}),lt:bf(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},j=s.compareDocumentPosition?function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bg(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.parentNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bg(e[j],f[j]);return j===c?bg(a,f[j],-1):bg(e[j],b,1)},[0,0].sort(j),m=!k,bc.uniqueSort=function(a){var b,c=1;k=m,a.sort(j);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},bc.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},i=bc.compile=function(a,b){var c,d=[],e=[],f=D[o][a];if(!f){b||(b=bh(a)),c=b.length;while(c--)f=bm(b[c]),f[o]?d.push(f):e.push(f);f=D(a,bn(e,d))}return f},r.querySelectorAll&&function(){var a,b=bp,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[":focus"],f=[":active",":focus"],h=s.matchesSelector||s.mozMatchesSelector||s.webkitMatchesSelector||s.oMatchesSelector||s.msMatchesSelector;X(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),X(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href}catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cZ.propHooks.scrollTop=cZ.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(c$(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bZ).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cW(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cR.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:c$("show"),slideUp:c$("hide"),slideToggle:c$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cZ.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cO&&(cO=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cO),cO=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c_=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j={top:0,left:0},k=this[0],l=k&&k.ownerDocument;if(!l)return;return(d=l.body)===k?p.offset.bodyOffset(k):(c=l.documentElement,p.contains(c,k)?(typeof k.getBoundingClientRect!="undefined"&&(j=k.getBoundingClientRect()),e=da(l),f=c.clientTop||d.clientTop||0,g=c.clientLeft||d.clientLeft||0,h=e.pageYOffset||c.scrollTop,i=e.pageXOffset||c.scrollLeft,{top:j.top+h-f,left:j.left+i-g}):j)},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
js/kd/ready.js ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var ready = (function(){
2
+
3
+ var readyList,
4
+ DOMContentLoaded,
5
+ class2type = {};
6
+ class2type["[object Boolean]"] = "boolean";
7
+ class2type["[object Number]"] = "number";
8
+ class2type["[object String]"] = "string";
9
+ class2type["[object Function]"] = "function";
10
+ class2type["[object Array]"] = "array";
11
+ class2type["[object Date]"] = "date";
12
+ class2type["[object RegExp]"] = "regexp";
13
+ class2type["[object Object]"] = "object";
14
+
15
+ var ReadyObj = {
16
+ // Is the DOM ready to be used? Set to true once it occurs.
17
+ isReady: false,
18
+ // A counter to track how many items to wait for before
19
+ // the ready event fires. See #6781
20
+ readyWait: 1,
21
+ // Hold (or release) the ready event
22
+ holdReady: function( hold ) {
23
+ if ( hold ) {
24
+ ReadyObj.readyWait++;
25
+ } else {
26
+ ReadyObj.ready( true );
27
+ }
28
+ },
29
+ // Handle when the DOM is ready
30
+ ready: function( wait ) {
31
+ // Either a released hold or an DOMready/load event and not yet ready
32
+ if ( (wait === true && !--ReadyObj.readyWait) || (wait !== true && !ReadyObj.isReady) ) {
33
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
34
+ if ( !document.body ) {
35
+ return setTimeout( ReadyObj.ready, 1 );
36
+ }
37
+
38
+ // Remember that the DOM is ready
39
+ ReadyObj.isReady = true;
40
+ // If a normal DOM Ready event fired, decrement, and wait if need be
41
+ if ( wait !== true && --ReadyObj.readyWait > 0 ) {
42
+ return;
43
+ }
44
+ // If there are functions bound, to execute
45
+ readyList.resolveWith( document, [ ReadyObj ] );
46
+
47
+ // Trigger any bound ready events
48
+ //if ( ReadyObj.fn.trigger ) {
49
+ // ReadyObj( document ).trigger( "ready" ).unbind( "ready" );
50
+ //}
51
+ }
52
+ },
53
+ bindReady: function() {
54
+ if ( readyList ) {
55
+ return;
56
+ }
57
+ readyList = ReadyObj._Deferred();
58
+
59
+ // Catch cases where $(document).ready() is called after the
60
+ // browser event has already occurred.
61
+ if ( document.readyState === "complete" ) {
62
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
63
+ return setTimeout( ReadyObj.ready, 1 );
64
+ }
65
+
66
+ // Mozilla, Opera and webkit nightlies currently support this event
67
+ if ( document.addEventListener ) {
68
+ // Use the handy event callback
69
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
70
+ // A fallback to window.onload, that will always work
71
+ window.addEventListener( "load", ReadyObj.ready, false );
72
+
73
+ // If IE event model is used
74
+ } else if ( document.attachEvent ) {
75
+ // ensure firing before onload,
76
+ // maybe late but safe also for iframes
77
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
78
+
79
+ // A fallback to window.onload, that will always work
80
+ window.attachEvent( "onload", ReadyObj.ready );
81
+
82
+ // If IE and not a frame
83
+ // continually check to see if the document is ready
84
+ var toplevel = false;
85
+
86
+ try {
87
+ toplevel = window.frameElement == null;
88
+ } catch(e) {}
89
+
90
+ if ( document.documentElement.doScroll && toplevel ) {
91
+ doScrollCheck();
92
+ }
93
+ }
94
+ },
95
+ _Deferred: function() {
96
+ var // callbacks list
97
+ callbacks = [],
98
+ // stored [ context , args ]
99
+ fired,
100
+ // to avoid firing when already doing so
101
+ firing,
102
+ // flag to know if the deferred has been cancelled
103
+ cancelled,
104
+ // the deferred itself
105
+ deferred = {
106
+
107
+ // done( f1, f2, ...)
108
+ done: function() {
109
+ if ( !cancelled ) {
110
+ var args = arguments,
111
+ i,
112
+ length,
113
+ elem,
114
+ type,
115
+ _fired;
116
+ if ( fired ) {
117
+ _fired = fired;
118
+ fired = 0;
119
+ }
120
+ for ( i = 0, length = args.length; i < length; i++ ) {
121
+ elem = args[ i ];
122
+ type = ReadyObj.type( elem );
123
+ if ( type === "array" ) {
124
+ deferred.done.apply( deferred, elem );
125
+ } else if ( type === "function" ) {
126
+ callbacks.push( elem );
127
+ }
128
+ }
129
+ if ( _fired ) {
130
+ deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
131
+ }
132
+ }
133
+ return this;
134
+ },
135
+
136
+ // resolve with given context and args
137
+ resolveWith: function( context, args ) {
138
+ if ( !cancelled && !fired && !firing ) {
139
+ // make sure args are available (#8421)
140
+ args = args || [];
141
+ firing = 1;
142
+ try {
143
+ while( callbacks[ 0 ] ) {
144
+ callbacks.shift().apply( context, args );//shifts a callback, and applies it to document
145
+ }
146
+ }
147
+ finally {
148
+ fired = [ context, args ];
149
+ firing = 0;
150
+ }
151
+ }
152
+ return this;
153
+ },
154
+
155
+ // resolve with this as context and given arguments
156
+ resolve: function() {
157
+ deferred.resolveWith( this, arguments );
158
+ return this;
159
+ },
160
+
161
+ // Has this deferred been resolved?
162
+ isResolved: function() {
163
+ return !!( firing || fired );
164
+ },
165
+
166
+ // Cancel
167
+ cancel: function() {
168
+ cancelled = 1;
169
+ callbacks = [];
170
+ return this;
171
+ }
172
+ };
173
+
174
+ return deferred;
175
+ },
176
+ type: function( obj ) {
177
+ return obj == null ?
178
+ String( obj ) :
179
+ class2type[ Object.prototype.toString.call(obj) ] || "object";
180
+ }
181
+ }
182
+ // The DOM ready check for Internet Explorer
183
+ function doScrollCheck() {
184
+ if ( ReadyObj.isReady ) {
185
+ return;
186
+ }
187
+
188
+ try {
189
+ // If IE is used, use the trick by Diego Perini
190
+ // http://javascript.nwbox.com/IEContentLoaded/
191
+ document.documentElement.doScroll("left");
192
+ } catch(e) {
193
+ setTimeout( doScrollCheck, 1 );
194
+ return;
195
+ }
196
+
197
+ // and execute any waiting functions
198
+ ReadyObj.ready();
199
+ }
200
+ // Cleanup functions for the document ready method
201
+ if ( document.addEventListener ) {
202
+ DOMContentLoaded = function() {
203
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
204
+ ReadyObj.ready();
205
+ };
206
+
207
+ } else if ( document.attachEvent ) {
208
+ DOMContentLoaded = function() {
209
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
210
+ if ( document.readyState === "complete" ) {
211
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
212
+ ReadyObj.ready();
213
+ }
214
+ };
215
+ }
216
+ function ready( fn ) {
217
+ // Attach the listeners
218
+ ReadyObj.bindReady();
219
+
220
+ var type = ReadyObj.type( fn );
221
+
222
+ // Add the callback
223
+ readyList.done( fn );//readyList is result of _Deferred()
224
+ }
225
+ return ready;
226
+ })();
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Autocomplete</name>
4
+ <version>0.1.2</version>
5
+ <stability>stable</stability>
6
+ <license>GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>An extension that autosuggests the name of the product in create product admin section. (Using Ebay APIs)</summary>
10
+ <description>A wonderful extension that helps you autosuggest names on create product in admin section using Ebay APIs. This will help you match your product name with matching ebay names, making them more likely to be looked up by search engines. In future, we want to use amazon APIs, and autofill options that will fill up product descriptions from these APIs.</description>
11
+ <notes>We have a github project that people can contribute to, and make it a better extension</notes>
12
+ <authors><author><name>Jay Patel</name><user>jaypatel512</user><email>japatel@paypal.com</email></author><author><name>Roman Arora</name><user>roman2k</user><email>roarora@paypal.com</email></author></authors>
13
+ <date>2012-11-16</date>
14
+ <time>15:50:14</time>
15
+ <contents><target name="magelocal"><dir name="KD"><dir name="Adminsuggest"><dir name="Model"><file name="Observer.php" hash="427fbc617d6a915c47ca067dd95ed73b"/></dir><dir name="controllers"><file name="IndexController.php" hash="279e285a2c504a2dba16e6075d11a4bd"/></dir><dir name="etc"><file name="config.xml" hash="c8a5027994461316405d96a1620985bc"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="adminsuggest.xml" hash="155b27d985572b6c7a7570f1fb5be3d1"/></dir><dir name="template"><dir name="kd"><file name="adminsuggest.phtml" hash="5323b1b52ac13fece9cc23e811506a29"/><file name="extensioncontent.phtml" hash="e027a4a07e1b88220f69d33ada42e160"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="kd"><file name="adminsuggest.js" hash="bad1c743075096db57d6b93fbe6f3e97"/><file name="extensioncontent.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="jquery-ui.custom.js" hash="681eddbef4269747ef169a0f57bbf4b4"/><file name="jquery-ui.js" hash="4d269a2eeb9b56123125de264004aa6b"/><file name="jquery.cookie.js" hash="621cb6fcf57c3e29f9f06b8b00b0c030"/><file name="jquery.dynatree.min.js" hash="3a27445c48fc59288726b72a66986a18"/><file name="jquery.js" hash="cfa9051cc0b05eb519f1e16b2a6645d7"/><file name="ready.js" hash="8a2058881d6db576e94f0cd38b1f7d34"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="adminsuggest.css" hash="5c20317fb0fc6e7091e86a1ad8dc196e"/><file name="jquery-ui.css" hash="442bbd256e4ad2dd9499f7cd455df1dd"/><dir name="images"><file name="ui-bg_flat_75_ffffff_40x100.png" hash="8692e6efddf882acbff144c38ea7dfdf"/><file name="ui-anim_basic_16x16.gif" hash="5a474bcbd8d2f2826f03d10ea44bf60e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="KD_Adminsuggest.xml" hash="8225d742cc180142aa25af27ea2d72f7"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/adminsuggest.css ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Theme Name: jqueryui-com
3
+ Template: jquery
4
+ */
5
+
6
+ input.input-text.ui-autocomplete-loading, textarea.ui-autocomplete-loading, select.ui-autocomplete-loading {
7
+ background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat;
8
+ }
9
+
10
+ html.jquery-ui, #container {
11
+ background: #BB6F04 url(../jquery/i/bg-body-ui.jpg) no-repeat center -20px;
12
+ }
13
+
14
+ h1.site-title a {
15
+ background: url(../jquery/i/logo-ui.png) no-repeat;
16
+ width: 275px;
17
+ height: 72px;
18
+ left: -14px;
19
+ position: relative;
20
+ }
21
+
22
+ .border, #site-footer {
23
+ border-color: #d69a06;
24
+ }
25
+
26
+ a, .title {
27
+ color: #BB6F04;
28
+ }
29
+
30
+ a:hover {
31
+ color: #333;
32
+ }
33
+
34
+ #container header nav {
35
+ border-top: solid 1px rgba(236,195,8,0.4);
36
+ background: rgba(187,111,4,0.5);
37
+ -webkit-box-shadow: rgba(255,255,255,0.1) 0 1px 0,
38
+ rgba(0,0,0,0.2) 0 -1px 0,
39
+ inset rgba(137,81,6,0.5) 0 -3px 5px;
40
+ box-shadow: rgba(255,255,255,0.1) 0 1px 0,
41
+ rgba(0,0,0,0.2) 0 -1px 0,
42
+ inset rgba(137,81,6,0.5) 0 -3px 5px;
43
+ }
44
+
45
+ .intro {
46
+ font-size: 24px;
47
+ line-height: 32px;
48
+ margin-top: 0;
49
+ float: left;
50
+ width: 55%;
51
+ text-shadow: #000 1px 1px;
52
+ }
53
+
54
+ .download-box {
55
+ border: 1px solid #aaa;
56
+ background: #333;
57
+ background: -moz-linear-gradient(left, #333 0%, #444 100%);
58
+ background: -webkit-linear-gradient(left, #333 0%, #444 100%);
59
+ background: -o-linear-gradient(left, #333 0%, #444 100%);
60
+ background: linear-gradient(to right, #333 0%, #444 100%);
61
+ float: right;
62
+ width: 40%;
63
+ text-align: center;
64
+ font-size: 20px;
65
+ padding: 10px;
66
+ border-radius: 5px;
67
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
68
+ }
69
+
70
+ #banner .download-box h2 {
71
+ font: bold 23px/23px "proxima-nova", "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
72
+ }
73
+
74
+ .download-box .btn {
75
+ margin: 0;
76
+ float: none;
77
+ font-weight: bold;
78
+ }
79
+
80
+ .download-option {
81
+ width: 45%;
82
+ float: left;
83
+ font-size: 16px;
84
+ }
85
+
86
+ .download-legacy {
87
+ float: right;
88
+ }
89
+
90
+ .download-option span {
91
+ display: block;
92
+ font-size: 14px;
93
+ color: #71D1FF;
94
+ }
95
+
96
+ .dev-links {
97
+ float: right;
98
+ width: 30%;
99
+ margin: -15px -25px .5em 1em;
100
+ padding: 1em;
101
+ border: 1px solid #666;
102
+ border-width: 0 0 1px 1px;
103
+ border-radius: 0 0 0 5px;
104
+ box-shadow: -2px 2px 10px -2px #666;
105
+ }
106
+
107
+ .dev-links ul {
108
+ list-style: none;
109
+ margin: 0;
110
+ }
111
+
112
+ .dev-links li {
113
+ padding: 0;
114
+ margin: .25em 0 .25em 1em;
115
+ }
116
+
117
+ .demo-list {
118
+ float: right;
119
+ width: 25%;
120
+ }
121
+
122
+ .demo-list h2 {
123
+ font-weight: normal;
124
+ margin-bottom: 0;
125
+ }
126
+
127
+ .demo-list ul {
128
+ width: 100%;
129
+ list-style: none;
130
+ border-top: 1px solid #ccc;
131
+ }
132
+
133
+ .demo-list li {
134
+ border-bottom: 1px solid #ccc;
135
+ margin: 0;
136
+ background-color: #eee;
137
+ }
138
+
139
+ .demo-list .active {
140
+ background-color: #fff;
141
+ }
142
+
143
+ .demo-list a {
144
+ text-decoration: none;
145
+ display: block;
146
+ font-weight: bold;
147
+ font-size: 13px;
148
+ color: #3f3f3f;
149
+ text-shadow: 1px 1px #fff;
150
+ padding: 2% 4%;
151
+ }
152
+
153
+ .demo-frame {
154
+ width: 70%;
155
+ height: 350px;
156
+ }
157
+
158
+ .view-source a {
159
+ cursor: pointer;
160
+ }
161
+
162
+ .view-source pre {
163
+ overflow: hidden;
164
+ display: none;
165
+ }
skin/adminhtml/default/default/images/ui-anim_basic_16x16.gif ADDED
Binary file
skin/adminhtml/default/default/images/ui-bg_flat_75_ffffff_40x100.png ADDED
Binary file
skin/adminhtml/default/default/jquery-ui.css ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.9.0 - 2012-10-05
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
4
+ * Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ /* Layout helpers
7
+ ----------------------------------*/
8
+ .ui-helper-hidden { display: none; }
9
+ .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
10
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
11
+ .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
12
+ .ui-helper-clearfix:after { clear: both; }
13
+ .ui-helper-clearfix { zoom: 1; }
14
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
15
+
16
+
17
+ /* Interaction Cues
18
+ ----------------------------------*/
19
+ .ui-state-disabled { cursor: default !important; }
20
+
21
+
22
+ /* Icons
23
+ ----------------------------------*/
24
+
25
+ /* states and images */
26
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
27
+
28
+
29
+ /* Misc visuals
30
+ ----------------------------------*/
31
+
32
+ /* Overlays */
33
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
34
+
35
+ .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
36
+ .ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
37
+ .ui-accordion .ui-accordion-noicons { padding-left: .7em; }
38
+ .ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
39
+ .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
40
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
41
+
42
+ .ui-autocomplete { position: absolute; cursor: default; }
43
+
44
+ /* workarounds */
45
+ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
46
+
47
+ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
48
+ .ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
49
+ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
50
+ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
51
+ .ui-button-icons-only { width: 3.4em; }
52
+ button.ui-button-icons-only { width: 3.7em; }
53
+
54
+ /*button text element */
55
+ .ui-button .ui-button-text { display: block; line-height: 1.4; }
56
+ .ui-button-text-only .ui-button-text { padding: .4em 1em; }
57
+ .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
58
+ .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
59
+ .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
60
+ .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
61
+ /* no icon support for input elements, provide padding by default */
62
+ input.ui-button { padding: .4em 1em; }
63
+
64
+ /*button icon element(s) */
65
+ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
66
+ .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
67
+ .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
68
+ .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
69
+ .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
70
+
71
+ /*button sets*/
72
+ .ui-buttonset { margin-right: 7px; }
73
+ .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
74
+
75
+ /* workarounds */
76
+ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
77
+
78
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
79
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
80
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
81
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
82
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
83
+ .ui-datepicker .ui-datepicker-next { right:2px; }
84
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
85
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
86
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
87
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
88
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
89
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
90
+ .ui-datepicker select.ui-datepicker-month,
91
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
92
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
93
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
94
+ .ui-datepicker td { border: 0; padding: 1px; }
95
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
96
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
97
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
98
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
99
+
100
+ /* with multiple calendars */
101
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
102
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
103
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
104
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
105
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
106
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
107
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
108
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
109
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
110
+ .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
111
+
112
+ /* RTL support */
113
+ .ui-datepicker-rtl { direction: rtl; }
114
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
115
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
116
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
117
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
118
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
119
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
120
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
121
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
122
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
123
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
124
+
125
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
126
+ .ui-datepicker-cover {
127
+ position: absolute; /*must have*/
128
+ z-index: -1; /*must have*/
129
+ filter: mask(); /*must have*/
130
+ top: -4px; /*must have*/
131
+ left: -4px; /*must have*/
132
+ width: 200px; /*must have*/
133
+ height: 200px; /*must have*/
134
+ }
135
+ .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
136
+ .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
137
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
138
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
139
+ .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
140
+ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
141
+ .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
142
+ .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
143
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
144
+ .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
145
+ .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
146
+ .ui-draggable .ui-dialog-titlebar { cursor: move; }
147
+
148
+ .ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
149
+ .ui-menu .ui-menu { margin-top: -3px; position: absolute; }
150
+ .ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
151
+ .ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
152
+ .ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
153
+ .ui-menu .ui-menu-item a.ui-state-focus,
154
+ .ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
155
+
156
+ .ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
157
+ .ui-menu .ui-state-disabled a { cursor: default; }
158
+
159
+ /* icon support */
160
+ .ui-menu-icons { position: relative; }
161
+ .ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
162
+
163
+ /* left-aligned */
164
+ .ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
165
+
166
+ /* right-aligned */
167
+ .ui-menu .ui-menu-icon { position: static; float: right; }
168
+
169
+ .ui-progressbar { height:2em; text-align: left; overflow: hidden; }
170
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
171
+ .ui-resizable { position: relative;}
172
+ .ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
173
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
174
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
175
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
176
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
177
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
178
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
179
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
180
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
181
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
182
+ .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
183
+
184
+ .ui-slider { position: relative; text-align: left; }
185
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
186
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
187
+
188
+ .ui-slider-horizontal { height: .8em; }
189
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
190
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
191
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
192
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
193
+
194
+ .ui-slider-vertical { width: .8em; height: 100px; }
195
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
196
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
197
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
198
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }
199
+ .ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
200
+ .ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
201
+ .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; z-index: 100; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
202
+ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
203
+ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
204
+ .ui-spinner-up { top: 0; }
205
+ .ui-spinner-down { bottom: 0; }
206
+
207
+ /* TR overrides */
208
+ span.ui-spinner { background: none; }
209
+ .ui-spinner .ui-icon-triangle-1-s {
210
+ /* need to fix icons sprite */
211
+ background-position:-65px -16px;
212
+ }
213
+
214
+ .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
215
+ .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
216
+ .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
217
+ .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
218
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
219
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
220
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
221
+ .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
222
+
223
+ .ui-tooltip {
224
+ padding:8px;
225
+ position:absolute;
226
+ z-index:9999;
227
+ -o-box-shadow: 0 0 5px #aaa;
228
+ -moz-box-shadow: 0 0 5px #aaa;
229
+ -webkit-box-shadow: 0 0 5px #aaa;
230
+ box-shadow: 0 0 5px #aaa;
231
+ }
232
+ /* Fades and background-images don't work well together in IE6, drop the image */
233
+ * html .ui-tooltip {
234
+ background-image: none;
235
+ }
236
+ body .ui-tooltip { border-width:2px; }
237
+
238
+ /* Component containers
239
+ ----------------------------------*/
240
+ .ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
241
+ .ui-widget .ui-widget { font-size: 1em; }
242
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
243
+ .ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
244
+ .ui-widget-content a { color: #222222/*{fcContent}*/; }
245
+ .ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
246
+ .ui-widget-header a { color: #222222/*{fcHeader}*/; }
247
+
248
+ /* Interaction states
249
+ ----------------------------------*/
250
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
251
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
252
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
253
+ .ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }
254
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
255
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
256
+
257
+ /* Interaction Cues
258
+ ----------------------------------*/
259
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
260
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
261
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
262
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
263
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
264
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
265
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
266
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
267
+
268
+ /* Icons
269
+ ----------------------------------*/
270
+
271
+ /* states and images */
272
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
273
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
274
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
275
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
276
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
277
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
278
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
279
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
280
+
281
+ /* positioning */
282
+ .ui-icon-carat-1-n { background-position: 0 0; }
283
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
284
+ .ui-icon-carat-1-e { background-position: -32px 0; }
285
+ .ui-icon-carat-1-se { background-position: -48px 0; }
286
+ .ui-icon-carat-1-s { background-position: -64px 0; }
287
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
288
+ .ui-icon-carat-1-w { background-position: -96px 0; }
289
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
290
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
291
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
292
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
293
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
294
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
295
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
296
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
297
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
298
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
299
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
300
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
301
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
302
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
303
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
304
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
305
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
306
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
307
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
308
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
309
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
310
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
311
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
312
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
313
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
314
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
315
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
316
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
317
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
318
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
319
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
320
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
321
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
322
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
323
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
324
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
325
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
326
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
327
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
328
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
329
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
330
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
331
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
332
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
333
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
334
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
335
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
336
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
337
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
338
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
339
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
340
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
341
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
342
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
343
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
344
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
345
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
346
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
347
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
348
+ .ui-icon-extlink { background-position: -32px -80px; }
349
+ .ui-icon-newwin { background-position: -48px -80px; }
350
+ .ui-icon-refresh { background-position: -64px -80px; }
351
+ .ui-icon-shuffle { background-position: -80px -80px; }
352
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
353
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
354
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
355
+ .ui-icon-folder-open { background-position: -16px -96px; }
356
+ .ui-icon-document { background-position: -32px -96px; }
357
+ .ui-icon-document-b { background-position: -48px -96px; }
358
+ .ui-icon-note { background-position: -64px -96px; }
359
+ .ui-icon-mail-closed { background-position: -80px -96px; }
360
+ .ui-icon-mail-open { background-position: -96px -96px; }
361
+ .ui-icon-suitcase { background-position: -112px -96px; }
362
+ .ui-icon-comment { background-position: -128px -96px; }
363
+ .ui-icon-person { background-position: -144px -96px; }
364
+ .ui-icon-print { background-position: -160px -96px; }
365
+ .ui-icon-trash { background-position: -176px -96px; }
366
+ .ui-icon-locked { background-position: -192px -96px; }
367
+ .ui-icon-unlocked { background-position: -208px -96px; }
368
+ .ui-icon-bookmark { background-position: -224px -96px; }
369
+ .ui-icon-tag { background-position: -240px -96px; }
370
+ .ui-icon-home { background-position: 0 -112px; }
371
+ .ui-icon-flag { background-position: -16px -112px; }
372
+ .ui-icon-calendar { background-position: -32px -112px; }
373
+ .ui-icon-cart { background-position: -48px -112px; }
374
+ .ui-icon-pencil { background-position: -64px -112px; }
375
+ .ui-icon-clock { background-position: -80px -112px; }
376
+ .ui-icon-disk { background-position: -96px -112px; }
377
+ .ui-icon-calculator { background-position: -112px -112px; }
378
+ .ui-icon-zoomin { background-position: -128px -112px; }
379
+ .ui-icon-zoomout { background-position: -144px -112px; }
380
+ .ui-icon-search { background-position: -160px -112px; }
381
+ .ui-icon-wrench { background-position: -176px -112px; }
382
+ .ui-icon-gear { background-position: -192px -112px; }
383
+ .ui-icon-heart { background-position: -208px -112px; }
384
+ .ui-icon-star { background-position: -224px -112px; }
385
+ .ui-icon-link { background-position: -240px -112px; }
386
+ .ui-icon-cancel { background-position: 0 -128px; }
387
+ .ui-icon-plus { background-position: -16px -128px; }
388
+ .ui-icon-plusthick { background-position: -32px -128px; }
389
+ .ui-icon-minus { background-position: -48px -128px; }
390
+ .ui-icon-minusthick { background-position: -64px -128px; }
391
+ .ui-icon-close { background-position: -80px -128px; }
392
+ .ui-icon-closethick { background-position: -96px -128px; }
393
+ .ui-icon-key { background-position: -112px -128px; }
394
+ .ui-icon-lightbulb { background-position: -128px -128px; }
395
+ .ui-icon-scissors { background-position: -144px -128px; }
396
+ .ui-icon-clipboard { background-position: -160px -128px; }
397
+ .ui-icon-copy { background-position: -176px -128px; }
398
+ .ui-icon-contact { background-position: -192px -128px; }
399
+ .ui-icon-image { background-position: -208px -128px; }
400
+ .ui-icon-video { background-position: -224px -128px; }
401
+ .ui-icon-script { background-position: -240px -128px; }
402
+ .ui-icon-alert { background-position: 0 -144px; }
403
+ .ui-icon-info { background-position: -16px -144px; }
404
+ .ui-icon-notice { background-position: -32px -144px; }
405
+ .ui-icon-help { background-position: -48px -144px; }
406
+ .ui-icon-check { background-position: -64px -144px; }
407
+ .ui-icon-bullet { background-position: -80px -144px; }
408
+ .ui-icon-radio-on { background-position: -96px -144px; }
409
+ .ui-icon-radio-off { background-position: -112px -144px; }
410
+ .ui-icon-pin-w { background-position: -128px -144px; }
411
+ .ui-icon-pin-s { background-position: -144px -144px; }
412
+ .ui-icon-play { background-position: 0 -160px; }
413
+ .ui-icon-pause { background-position: -16px -160px; }
414
+ .ui-icon-seek-next { background-position: -32px -160px; }
415
+ .ui-icon-seek-prev { background-position: -48px -160px; }
416
+ .ui-icon-seek-end { background-position: -64px -160px; }
417
+ .ui-icon-seek-start { background-position: -80px -160px; }
418
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
419
+ .ui-icon-seek-first { background-position: -80px -160px; }
420
+ .ui-icon-stop { background-position: -96px -160px; }
421
+ .ui-icon-eject { background-position: -112px -160px; }
422
+ .ui-icon-volume-off { background-position: -128px -160px; }
423
+ .ui-icon-volume-on { background-position: -144px -160px; }
424
+ .ui-icon-power { background-position: 0 -176px; }
425
+ .ui-icon-signal-diag { background-position: -16px -176px; }
426
+ .ui-icon-signal { background-position: -32px -176px; }
427
+ .ui-icon-battery-0 { background-position: -48px -176px; }
428
+ .ui-icon-battery-1 { background-position: -64px -176px; }
429
+ .ui-icon-battery-2 { background-position: -80px -176px; }
430
+ .ui-icon-battery-3 { background-position: -96px -176px; }
431
+ .ui-icon-circle-plus { background-position: 0 -192px; }
432
+ .ui-icon-circle-minus { background-position: -16px -192px; }
433
+ .ui-icon-circle-close { background-position: -32px -192px; }
434
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
435
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
436
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
437
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
438
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
439
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
440
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
441
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
442
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
443
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
444
+ .ui-icon-circle-check { background-position: -208px -192px; }
445
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
446
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
447
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
448
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
449
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
450
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
451
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
452
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
453
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
454
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
455
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
456
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
457
+
458
+
459
+ /* Misc visuals
460
+ ----------------------------------*/
461
+
462
+ /* Corner radius */
463
+ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
464
+ .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
465
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
466
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
467
+
468
+ /* Overlays */
469
+ .ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
470
+ .ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }