Changeset 17417


Ignore:
Timestamp:
2008/07/10 18:57:26 (15 years ago)
Author:
pineray
Message:

レイアウト編集のjavascriptをjquery UIを用いて全面的に書き直し

Location:
branches/comu-ver2
Files:
2 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/Smarty/templates/default/admin/design/index.tpl

    r17407 r17417  
    1010} 
    1111 
    12 // 初期処理 
    13 function init () { 
    14     document.body.ondrag = function () { return false; }; 
    15     document.body.onselectstart = function () { return false; }; 
    16  
    17     // ウィンドウサイズを取得 
    18   scrX = GetWindowSize("width"); 
    19   scrY = GetWindowSize("height"); 
    20  
    21   // ウィンドウサイズ変更イベントに関連付け 
    22     window.onresize = fnMoveObject; 
    23  
    24   // divタグを取得 
    25   all_elms = document.getElementsByTagName ( 'div' ); 
    26  
    27   all_dragged = $(".dragged-elm"); 
    28   all_target = $(".drop-target"); 
    29  
    30   // 配列作成 
    31   fnCreateArr(0); 
    32  
    33   // alerttest(0); 
    34  
    35     // 並び替え 
    36   fnMoveObject(); 
    37  
    38   <!--{$complate_msg}--> 
    39 } 
    40  
    4112</script> 
    4213 
     14<script type="text/javascript" src="<!--{$TPL_DIR}-->js/ui.core.js"></script> 
     15<script type="text/javascript" src="<!--{$TPL_DIR}-->js/ui.sortable.js"></script> 
    4316<script type="text/javascript" src="<!--{$TPL_DIR}-->js/layout_design.js"></script> 
    4417 
     
    6841            <!--{* 左ナビテーブルここから *}--> 
    6942            <td rowspan="3" id="layout-left"> 
    70               <div tid="LeftNavi" class="drop-target" id="t1" style="width: 145px; height: 100px;"></div> 
     43              <div id="LeftNavi" class="ui-sortable" style="position: relative; width: 145px; height: 100px;"> 
     44                <!--{assign var="firstflg" value=false}--> 
     45                <!--{foreach key=key item=item from=$tpl_arrBloc name="bloc_loop"}--> 
     46                <!--{if $item.target_id == "LeftNavi"}--> 
     47                <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> 
     48                  <!--{$item.name}--> 
     49                  <input type="hidden" class="name" name="name_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.name}-->" /> 
     50                  <input type="hidden" class="id" name="id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_id}-->" /> 
     51                  <input type="hidden" class="target-id" name="target_id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.target_id}-->" /> 
     52                  <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 
     53                </div> 
     54                <!--{assign var="firstflg" value=true}--> 
     55                <!--{/if}--> 
     56                <!--{/foreach}--> 
     57              </div> 
    7158            </td> 
    7259            <!--{* 左ナビテーブルここまで *}--> 
    7360            <!--{* メイン上部テーブルここから *}--> 
    7461            <td id="layout-main-head"> 
    75               <div tid="MainHead" class="drop-target" id="t2" style="width: 145px; height: 100px;"></div> 
     62              <div id="MainHead" class="ui-sortable" style="position: relative; width: 145px; height: 100px;"> 
     63                <!--{assign var="firstflg" value=false}--> 
     64                <!--{foreach key=key item=item from=$tpl_arrBloc name="bloc_loop"}--> 
     65                <!--{if $item.target_id == "MainHead"}--> 
     66                <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> 
     67                  <!--{$item.name}--> 
     68                  <input type="hidden" class="name" name="name_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.name}-->" /> 
     69                  <input type="hidden" class="id" name="id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_id}-->" /> 
     70                  <input type="hidden" class="target-id" name="target_id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.target_id}-->" /> 
     71                  <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 
     72                </div> 
     73                <!--{assign var="firstflg" value=true}--> 
     74                <!--{/if}--> 
     75                <!--{/foreach}--> 
     76              </div> 
    7677            </td> 
    7778            <!--{* メイン上部テーブルここまで *}--> 
    7879            <!--{* 右ナビここから *}--> 
    7980            <td rowspan="3" id="layout-right"> 
    80               <div tid="RightNavi" class="drop-target" id="t3" style="width: 145px; height: 100px;"></div> 
     81              <div id="RightNavi" class="ui-sortable" style="position: relative; width: 145px; height: 100px;"> 
     82                <!--{assign var="firstflg" value=false}--> 
     83                <!--{foreach key=key item=item from=$tpl_arrBloc name="bloc_loop"}--> 
     84                <!--{if $item.target_id == "RightNavi"}--> 
     85                <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> 
     86                  <!--{$item.name}--> 
     87                  <input type="hidden" class="name" name="name_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.name}-->" /> 
     88                  <input type="hidden" class="id" name="id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_id}-->" /> 
     89                  <input type="hidden" class="target-id" name="target_id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.target_id}-->" /> 
     90                  <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 
     91                </div> 
     92                <!--{assign var="firstflg" value=true}--> 
     93                <!--{/if}--> 
     94                <!--{/foreach}--> 
     95              </div> 
    8196            </td> 
    8297            <!--{* 右ナビここまで *}--> 
     
    90105          <tr> 
    91106            <td id="layout-main-foot"> 
    92               <div tid="MainFoot" class="drop-target" id="t4" style="width: 145px; height: 100px;"></div> 
     107              <div id="MainFoot" class="ui-sortable" style="position: relative; width: 145px; height: 100px;"> 
     108                <!--{assign var="firstflg" value=false}--> 
     109                <!--{foreach key=key item=item from=$tpl_arrBloc name="bloc_loop"}--> 
     110                <!--{if $item.target_id == "MainFoot"}--> 
     111                <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> 
     112                  <!--{$item.name}--> 
     113                  <input type="hidden" class="name" name="name_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.name}-->" /> 
     114                  <input type="hidden" class="id" name="id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_id}-->" /> 
     115                  <input type="hidden" class="target-id" name="target_id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.target_id}-->" /> 
     116                  <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 
     117                </div> 
     118                <!--{assign var="firstflg" value=true}--> 
     119                <!--{/if}--> 
     120                <!--{/foreach}--> 
     121              </div> 
    93122            </td> 
    94123          </tr> 
     
    103132      <!--{* ▼未使用ブロックここから *}--> 
    104133      <td> 
    105         <div tid="Unused" class="drop-target" id="t5" style="width: 160px; height: 500px;"></div> 
     134        <div id="Unused" class="ui-sortable" style="position: relative; width: 145px; height: 500px;"> 
     135          <!--{assign var="firstflg" value=false}--> 
     136          <!--{foreach key=key item=item from=$tpl_arrBloc name="bloc_loop"}--> 
     137          <!--{if $item.target_id == "Unused"}--> 
     138          <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> 
     139            <!--{$item.name}--> 
     140            <input type="hidden" class="name" name="name_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.name}-->" /> 
     141            <input type="hidden" class="id" name="id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_id}-->" /> 
     142            <input type="hidden" class="target-id" name="target_id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.target_id}-->" /> 
     143            <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 
     144          </div> 
     145          <!--{assign var="firstflg" value=true}--> 
     146          <!--{/if}--> 
     147          <!--{/foreach}--> 
     148        </div> 
    106149        <div class="btn"><button type='button' onclick="fnTargetSelf(); fnFormModeSubmit('form1','new_bloc','','');"><span>新規ブロック作成</span></button></div> 
    107150      </td> 
     
    119162  <!--▼ページ一覧 ここから--> 
    120163  <h2>編集可能ページ</h2> 
    121  
    122164  <table class="list center"> 
    123165  <!--{foreach key=key item=item from=$arrEditPage}--> 
     
    141183  </div> 
    142184  <!--▲ページ一覧 ここまで--> 
    143  
    144  
    145  
    146 <!--{foreach key=key item=item from=$tpl_arrBloc name="bloc_loop"}--> 
    147 <div target_id="<!--{$item.target_id}-->" did="<!--{$smarty.foreach.bloc_loop.iteration}-->" class="dragged-elm" style="left:350px; top:0px; filter: alpha(opacity=100); opacity: 1;width: 120px;"> 
    148    <!--{$item.name}--> 
    149 </div> 
    150 <input type="hidden" name="name_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.name}-->" /> 
    151 <input type="hidden" name="id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_id}-->" /> 
    152 <input type="hidden" name="target_id_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.target_id}-->" /> 
    153 <input type="hidden" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 
    154 <!--{/foreach}--> 
    155185</div> 
    156186</form> 
  • branches/comu-ver2/html/user_data/packages/default/css/admin_contents.css

    r17407 r17417  
    368368----------------------------------------------- */ 
    369369/* レイアウト管理 */ 
    370 div.dragged-elm { 
    371     position:   absolute; 
     370div.sort { 
    372371    border:     1px solid black; 
    373372    background: rgb(195,217,255); 
    374373    color:      #333; 
    375     cursor:     move; 
    376374    padding:    5px 2px; 
     375    margin:     5px 0px; 
    377376    font-size:  10pt; 
    378377    text-align: center; 
    379 } 
    380 div.drop-target { 
    381     border:      0px solid gray; 
    382     position:    relative; 
    383     text-align:  center; 
    384     color:       #333; 
    385 } 
     378    width:      140px; 
     379} 
     380.placeholder { border:1px dashed #AAA; } 
     381 
    386382#design-layout-body { 
    387383    width: 450px; 
    388384    margin: 0 auto; 
    389385} 
    390 #design-layout-wrap-unused {width:164px;} 
    391 #layout-left, #layout-right { 
    392     width: 150px; 
     386#design-layout-body td { 
     387    width: 145px; 
     388    vertical-align: top; 
     389    text-align: center; 
     390} 
     391#design-layout-wrap-unused {width:145px;} 
     392#LeftNavi, #RightNavi { 
     393    width: 140px; 
     394    min-height: 400px; 
     395    height: auto !important; 
    393396    height: 400px; 
    394397    vertical-align: top; 
    395398} 
    396 #layout-main-head, #layout-main-foot { vertical-align: top; } 
    397 #layout-header, #layout-footer, #layout-main { text-align: center; } 
     399#design-layout-body #MainHead, #design-layout-body #MainFoot { 
     400    min-height: 100px; 
     401    height: auto !important; 
     402    height: 100px; 
     403} 
     404#design-layout-body td#layout-main {vertical-align: middle;} 
    398405 
    399406 
  • branches/comu-ver2/html/user_data/packages/default/js/jquery.js

    r16708 r17417  
    11(function(){ 
    22/* 
    3  * jQuery 1.2 - New Wave Javascript 
     3 * jQuery 1.2.6 - New Wave Javascript 
    44 * 
    5  * Copyright (c) 2007 John Resig (jquery.com) 
     5 * Copyright (c) 2008 John Resig (jquery.com) 
    66 * Dual licensed under the MIT (MIT-LICENSE.txt) 
    77 * and GPL (GPL-LICENSE.txt) licenses. 
    88 * 
    9  * $Date: 2007-09-10 15:45:49 -0400 (Mon, 10 Sep 2007) $ 
    10  * $Rev: 3219 $ 
     9 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ 
     10 * $Rev: 5685 $ 
    1111 */ 
    1212 
    1313// Map over jQuery in case of overwrite 
    14 if ( typeof jQuery != "undefined" ) 
    15     var _jQuery = jQuery; 
    16  
    17 var jQuery = window.jQuery = function(a,c) { 
    18     // If the context is global, return a new object 
    19     if ( window == this || !this.init ) 
    20         return new jQuery(a,c); 
    21      
    22     return this.init(a,c); 
     14var _jQuery = window.jQuery, 
     15// Map over the $ in case of overwrite 
     16    _$ = window.$; 
     17 
     18var jQuery = window.jQuery = window.$ = function( selector, context ) { 
     19    // The jQuery object is actually just the init constructor 'enhanced' 
     20    return new jQuery.fn.init( selector, context ); 
    2321}; 
    2422 
    25 // Map over the $ in case of overwrite 
    26 if ( typeof $ != "undefined" ) 
    27     var _$ = $; 
    28      
    29 // Map the jQuery namespace to the '$' one 
    30 window.$ = jQuery; 
    31  
    32 var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; 
     23// A simple way to check for HTML strings or ID strings 
     24// (both of which we optimize for) 
     25var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, 
     26 
     27// Is it a simple selector 
     28    isSimple = /^.[^:#\[\.]*$/, 
     29 
     30// Will speed up references to undefined, and allows munging its name. 
     31    undefined; 
    3332 
    3433jQuery.fn = jQuery.prototype = { 
    35     init: function(a,c) { 
     34    init: function( selector, context ) { 
    3635        // Make sure that a selection was provided 
    37         a = a || document; 
    38  
     36        selector = selector || document; 
     37 
     38        // Handle $(DOMElement) 
     39        if ( selector.nodeType ) { 
     40            this[0] = selector; 
     41            this.length = 1; 
     42            return this; 
     43        } 
    3944        // Handle HTML strings 
    40         if ( typeof a  == "string" ) { 
    41             var m = quickExpr.exec(a); 
    42             if ( m && (m[1] || !c) ) { 
     45        if ( typeof selector == "string" ) { 
     46            // Are we dealing with HTML string or an ID? 
     47            var match = quickExpr.exec( selector ); 
     48 
     49            // Verify a match, and that no context was specified for #id 
     50            if ( match && (match[1] || !context) ) { 
     51 
    4352                // HANDLE: $(html) -> $(array) 
    44                 if ( m[1] ) 
    45                     a = jQuery.clean( [ m[1] ], c ); 
     53                if ( match[1] ) 
     54                    selector = jQuery.clean( [ match[1] ], context ); 
    4655 
    4756                // HANDLE: $("#id") 
    4857                else { 
    49                     var tmp = document.getElementById( m[3] ); 
    50                     if ( tmp ) 
     58                    var elem = document.getElementById( match[3] ); 
     59 
     60                    // Make sure an element was located 
     61                    if ( elem ){ 
    5162                        // Handle the case where IE and Opera return items 
    5263                        // by name instead of ID 
    53                         if ( tmp.id != m[3] ) 
    54                             return jQuery().find( a ); 
    55                         else { 
    56                             this[0] = tmp; 
    57                             this.length = 1; 
    58                             return this; 
    59                         } 
    60                     else 
    61                         a = []; 
     64                        if ( elem.id != match[3] ) 
     65                            return jQuery().find( selector ); 
     66 
     67                        // Otherwise, we inject the element directly into the jQuery object 
     68                        return jQuery( elem ); 
     69                    } 
     70                    selector = []; 
    6271                } 
    6372 
    64             // HANDLE: $(expr) 
     73            // HANDLE: $(expr, [context]) 
     74            // (which is just equivalent to: $(content).find(expr) 
    6575            } else 
    66                 return new jQuery( c ).find( a ); 
     76                return jQuery( context ).find( selector ); 
    6777 
    6878        // HANDLE: $(function) 
    6979        // Shortcut for document ready 
    70         } else if ( jQuery.isFunction(a) ) 
    71             return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a ); 
    72  
    73         return this.setArray( 
    74             // HANDLE: $(array) 
    75             a.constructor == Array && a || 
    76  
    77             // HANDLE: $(arraylike) 
    78             // Watch for when an array-like object is passed as the selector 
    79             (a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) || 
    80  
    81             // HANDLE: $(*) 
    82             [ a ] ); 
    83     }, 
    84      
    85     jquery: "1.2", 
    86  
     80        } else if ( jQuery.isFunction( selector ) ) 
     81            return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); 
     82 
     83        return this.setArray(jQuery.makeArray(selector)); 
     84    }, 
     85 
     86    // The current version of jQuery being used 
     87    jquery: "1.2.6", 
     88 
     89    // The number of elements contained in the matched element set 
    8790    size: function() { 
    8891        return this.length; 
    8992    }, 
    90      
     93 
     94    // The number of elements contained in the matched element set 
    9195    length: 0, 
    9296 
     97    // Get the Nth element in the matched element set OR 
     98    // Get the whole matched element set as a clean array 
    9399    get: function( num ) { 
    94100        return num == undefined ? 
     
    98104 
    99105            // Return just the object 
    100             this[num]; 
    101     }, 
    102      
    103     pushStack: function( a ) { 
    104         var ret = jQuery(a); 
     106            this[ num ]; 
     107    }, 
     108 
     109    // Take an array of elements and push it onto the stack 
     110    // (returning the new matched element set) 
     111    pushStack: function( elems ) { 
     112        // Build a new jQuery matched element set 
     113        var ret = jQuery( elems ); 
     114 
     115        // Add the old object onto the stack (as a reference) 
    105116        ret.prevObject = this; 
     117 
     118        // Return the newly-formed element set 
    106119        return ret; 
    107120    }, 
    108      
    109     setArray: function( a ) { 
     121 
     122    // Force the current matched set of elements to become 
     123    // the specified array of elements (destroying the stack in the process) 
     124    // You should use pushStack() in order to do this, but maintain the stack 
     125    setArray: function( elems ) { 
     126        // Resetting the length to 0, then using the native Array push 
     127        // is a super-fast way to populate an object with array-like properties 
    110128        this.length = 0; 
    111         Array.prototype.push.apply( this, a ); 
     129        Array.prototype.push.apply( this, elems ); 
     130 
    112131        return this; 
    113132    }, 
    114133 
    115     each: function( fn, args ) { 
    116         return jQuery.each( this, fn, args ); 
    117     }, 
    118  
    119     index: function( obj ) { 
    120         var pos = -1; 
    121         this.each(function(i){ 
    122             if ( this == obj ) pos = i; 
    123         }); 
    124         return pos; 
    125     }, 
    126  
    127     attr: function( key, value, type ) { 
    128         var obj = key; 
    129          
     134    // Execute a callback for every element in the matched set. 
     135    // (You can seed the arguments with an array of args, but this is 
     136    // only used internally.) 
     137    each: function( callback, args ) { 
     138        return jQuery.each( this, callback, args ); 
     139    }, 
     140 
     141    // Determine the position of an element within 
     142    // the matched set of elements 
     143    index: function( elem ) { 
     144        var ret = -1; 
     145 
     146        // Locate the position of the desired element 
     147        return jQuery.inArray( 
     148            // If it receives a jQuery object, the first element is used 
     149            elem && elem.jquery ? elem[0] : elem 
     150        , this ); 
     151    }, 
     152 
     153    attr: function( name, value, type ) { 
     154        var options = name; 
     155 
    130156        // Look for the case where we're accessing a style value 
    131         if ( key.constructor == String ) 
    132             if ( value == undefined ) 
    133                 return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined; 
     157        if ( name.constructor == String ) 
     158            if ( value === undefined ) 
     159                return this[0] && jQuery[ type || "attr" ]( this[0], name ); 
     160 
    134161            else { 
    135                 obj = {}; 
    136                 obj[ key ] = value; 
    137             } 
    138          
     162                options = {}; 
     163                options[ name ] = value; 
     164            } 
     165 
    139166        // Check to see if we're setting style values 
    140         return this.each(function(index){ 
     167        return this.each(function(i){ 
    141168            // Set all the styles 
    142             for ( var prop in obj ) 
     169            for ( name in options ) 
    143170                jQuery.attr( 
    144                     type ? this.style : this, 
    145                     prop, jQuery.prop(this, obj[prop], type, index, prop) 
     171                    type ? 
     172                        this.style : 
     173                        this, 
     174                    name, jQuery.prop( this, options[ name ], type, i, name ) 
    146175                ); 
    147176        }); 
     
    149178 
    150179    css: function( key, value ) { 
     180        // ignore negative width and height values 
     181        if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) 
     182            value = undefined; 
    151183        return this.attr( key, value, "curCSS" ); 
    152184    }, 
    153185 
    154     text: function(e) { 
    155         if ( typeof e != "object" && e != null ) 
    156             return this.empty().append( document.createTextNode( e ) ); 
    157  
    158         var t = ""; 
    159         jQuery.each( e || this, function(){ 
     186    text: function( text ) { 
     187        if ( typeof text != "object" && text != null ) 
     188            return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 
     189 
     190        var ret = ""; 
     191 
     192        jQuery.each( text || this, function(){ 
    160193            jQuery.each( this.childNodes, function(){ 
    161194                if ( this.nodeType != 8 ) 
    162                     t += this.nodeType != 1 ? 
    163                         this.nodeValue : jQuery.fn.text([ this ]); 
     195                    ret += this.nodeType != 1 ? 
     196                        this.nodeValue : 
     197                        jQuery.fn.text( [ this ] ); 
    164198            }); 
    165199        }); 
    166         return t; 
    167     }, 
    168  
    169     wrapAll: function(html) { 
     200 
     201        return ret; 
     202    }, 
     203 
     204    wrapAll: function( html ) { 
    170205        if ( this[0] ) 
    171206            // The elements to wrap the target around 
    172             jQuery(html, this[0].ownerDocument) 
     207            jQuery( html, this[0].ownerDocument ) 
    173208                .clone() 
    174                 .insertBefore(this[0]) 
     209                .insertBefore( this[0] ) 
    175210                .map(function(){ 
    176211                    var elem = this; 
     212 
    177213                    while ( elem.firstChild ) 
    178214                        elem = elem.firstChild; 
     215 
    179216                    return elem; 
    180217                }) 
     
    184221    }, 
    185222 
    186     wrapInner: function(html) { 
     223    wrapInner: function( html ) { 
    187224        return this.each(function(){ 
    188             jQuery(this).contents().wrapAll(html); 
     225            jQuery( this ).contents().wrapAll( html ); 
    189226        }); 
    190227    }, 
    191228 
    192     wrap: function(html) { 
     229    wrap: function( html ) { 
    193230        return this.each(function(){ 
    194             jQuery(this).wrapAll(html); 
     231            jQuery( this ).wrapAll( html ); 
    195232        }); 
    196233    }, 
    197234 
    198235    append: function() { 
    199         return this.domManip(arguments, true, 1, function(a){ 
    200             this.appendChild( a ); 
     236        return this.domManip(arguments, true, false, function(elem){ 
     237            if (this.nodeType == 1) 
     238                this.appendChild( elem ); 
    201239        }); 
    202240    }, 
    203241 
    204242    prepend: function() { 
    205         return this.domManip(arguments, true, -1, function(a){ 
    206             this.insertBefore( a, this.firstChild ); 
     243        return this.domManip(arguments, true, true, function(elem){ 
     244            if (this.nodeType == 1) 
     245                this.insertBefore( elem, this.firstChild ); 
    207246        }); 
    208247    }, 
    209      
     248 
    210249    before: function() { 
    211         return this.domManip(arguments, false, 1, function(a){ 
    212             this.parentNode.insertBefore( a, this ); 
     250        return this.domManip(arguments, false, false, function(elem){ 
     251            this.parentNode.insertBefore( elem, this ); 
    213252        }); 
    214253    }, 
    215254 
    216255    after: function() { 
    217         return this.domManip(arguments, false, -1, function(a){ 
    218             this.parentNode.insertBefore( a, this.nextSibling ); 
     256        return this.domManip(arguments, false, true, function(elem){ 
     257            this.parentNode.insertBefore( elem, this.nextSibling ); 
    219258        }); 
    220259    }, 
    221260 
    222261    end: function() { 
    223         return this.prevObject || jQuery([]); 
    224     }, 
    225  
    226     find: function(t) { 
    227         var data = jQuery.map(this, function(a){ return jQuery.find(t,a); }); 
    228         return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ? 
    229             jQuery.unique( data ) : data ); 
    230     }, 
    231  
    232     clone: function(events) { 
     262        return this.prevObject || jQuery( [] ); 
     263    }, 
     264 
     265    find: function( selector ) { 
     266        var elems = jQuery.map(this, function(elem){ 
     267            return jQuery.find( selector, elem ); 
     268        }); 
     269 
     270        return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? 
     271            jQuery.unique( elems ) : 
     272            elems ); 
     273    }, 
     274 
     275    clone: function( events ) { 
    233276        // Do the clone 
    234277        var ret = this.map(function(){ 
    235             return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true); 
     278            if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { 
     279                // IE copies events bound via attachEvent when 
     280                // using cloneNode. Calling detachEvent on the 
     281                // clone will also remove the events from the orignal 
     282                // In order to get around this, we use innerHTML. 
     283                // Unfortunately, this means some modifications to 
     284                // attributes in IE that are actually only stored 
     285                // as properties will not be copied (such as the 
     286                // the name attribute on an input). 
     287                var clone = this.cloneNode(true), 
     288                    container = document.createElement("div"); 
     289                container.appendChild(clone); 
     290                return jQuery.clean([container.innerHTML])[0]; 
     291            } else 
     292                return this.cloneNode(true); 
    236293        }); 
    237          
    238         if (events === true) { 
    239             var clone = ret.find("*").andSelf(); 
    240  
    241             this.find("*").andSelf().each(function(i) { 
    242                 var events = jQuery.data(this, "events"); 
     294 
     295        // Need to set the expando to null on the cloned set if it exists 
     296        // removeData doesn't work here, IE removes it from the original as well 
     297        // this is primarily for IE but the data expando shouldn't be copied over in any browser 
     298        var clone = ret.find("*").andSelf().each(function(){ 
     299            if ( this[ expando ] != undefined ) 
     300                this[ expando ] = null; 
     301        }); 
     302 
     303        // Copy the events from the original to the clone 
     304        if ( events === true ) 
     305            this.find("*").andSelf().each(function(i){ 
     306                if (this.nodeType == 3) 
     307                    return; 
     308                var events = jQuery.data( this, "events" ); 
     309 
    243310                for ( var type in events ) 
    244                     for ( var handler in events[type] ) 
    245                         jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data); 
     311                    for ( var handler in events[ type ] ) 
     312                        jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); 
    246313            }); 
    247         } 
    248314 
    249315        // Return the cloned set 
     
    251317    }, 
    252318 
    253     filter: function(t) { 
     319    filter: function( selector ) { 
    254320        return this.pushStack( 
    255             jQuery.isFunction( t ) && 
    256             jQuery.grep(this, function(el, index){ 
    257                 return t.apply(el, [index]); 
     321            jQuery.isFunction( selector ) && 
     322            jQuery.grep(this, function(elem, i){ 
     323                return selector.call( elem, i ); 
    258324            }) || 
    259325 
    260             jQuery.multiFilter(t,this) ); 
    261     }, 
    262  
    263     not: function(t) { 
    264         return this.pushStack( 
    265             t.constructor == String && 
    266             jQuery.multiFilter(t, this, true) || 
    267  
    268             jQuery.grep(this, function(a) { 
    269                 return ( t.constructor == Array || t.jquery ) 
    270                     ? jQuery.inArray( a, t ) < 0 
    271                     : a != t; 
    272             }) 
    273         ); 
    274     }, 
    275  
    276     add: function(t) { 
    277         return this.pushStack( jQuery.merge( 
     326            jQuery.multiFilter( selector, this ) ); 
     327    }, 
     328 
     329    not: function( selector ) { 
     330        if ( selector.constructor == String ) 
     331            // test special case where just one selector is passed in 
     332            if ( isSimple.test( selector ) ) 
     333                return this.pushStack( jQuery.multiFilter( selector, this, true ) ); 
     334            else 
     335                selector = jQuery.multiFilter( selector, this ); 
     336 
     337        var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; 
     338        return this.filter(function() { 
     339            return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; 
     340        }); 
     341    }, 
     342 
     343    add: function( selector ) { 
     344        return this.pushStack( jQuery.unique( jQuery.merge( 
    278345            this.get(), 
    279             t.constructor == String ? 
    280                 jQuery(t).get() : 
    281                 t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ? 
    282                     t : [t] ) 
    283         ); 
    284     }, 
    285  
    286     is: function(expr) { 
    287         return expr ? jQuery.multiFilter(expr,this).length > 0 : false; 
    288     }, 
    289  
    290     hasClass: function(expr) { 
    291         return this.is("." + expr); 
    292     }, 
    293      
    294     val: function( val ) { 
    295         if ( val == undefined ) { 
     346            typeof selector == 'string' ? 
     347                jQuery( selector ) : 
     348                jQuery.makeArray( selector ) 
     349        ))); 
     350    }, 
     351 
     352    is: function( selector ) { 
     353        return !!selector && jQuery.multiFilter( selector, this ).length > 0; 
     354    }, 
     355 
     356    hasClass: function( selector ) { 
     357        return this.is( "." + selector ); 
     358    }, 
     359 
     360    val: function( value ) { 
     361        if ( value == undefined ) { 
     362 
    296363            if ( this.length ) { 
    297364                var elem = this[0]; 
    298                  
     365 
    299366                // We need to handle select boxes special 
    300                 if ( jQuery.nodeName(elem, "select") ) { 
     367                if ( jQuery.nodeName( elem, "select" ) ) { 
    301368                    var index = elem.selectedIndex, 
    302                         a = [], 
     369                        values = [], 
    303370                        options = elem.options, 
    304371                        one = elem.type == "select-one"; 
    305                      
     372 
    306373                    // Nothing was selected 
    307374                    if ( index < 0 ) 
     
    310377                    // Loop through all the selected options 
    311378                    for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { 
    312                         var option = options[i]; 
     379                        var option = options[ i ]; 
     380 
    313381                        if ( option.selected ) { 
    314382                            // Get the specifc value for the option 
    315                             var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value; 
    316                              
     383                            value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; 
     384 
    317385                            // We don't need an array for one selects 
    318386                            if ( one ) 
    319                                 return val; 
    320                              
     387                                return value; 
     388 
    321389                            // Multi-Selects return an array 
    322                             a.push(val); 
     390                            values.push( value ); 
    323391                        } 
    324392                    } 
    325                      
    326                     return a; 
    327                      
     393 
     394                    return values; 
     395 
    328396                // Everything else, we just grab the value 
    329397                } else 
    330                     return this[0].value.replace(/\r/g, ""); 
    331             } 
    332         } else 
    333             return this.each(function(){ 
    334                 if ( val.constructor == Array && /radio|checkbox/.test(this.type) ) 
    335                     this.checked = (jQuery.inArray(this.value, val) >= 0 || 
    336                         jQuery.inArray(this.name, val) >= 0); 
    337                 else if ( jQuery.nodeName(this, "select") ) { 
    338                     var tmp = val.constructor == Array ? val : [val]; 
    339  
    340                     jQuery("option", this).each(function(){ 
    341                         this.selected = (jQuery.inArray(this.value, tmp) >= 0 || 
    342                         jQuery.inArray(this.text, tmp) >= 0); 
    343                     }); 
    344  
    345                     if ( !tmp.length ) 
    346                         this.selectedIndex = -1; 
    347                 } else 
    348                     this.value = val; 
    349             }); 
    350     }, 
    351      
    352     html: function( val ) { 
    353         return val == undefined ? 
    354             ( this.length ? this[0].innerHTML : null ) : 
    355             this.empty().append( val ); 
    356     }, 
    357  
    358     replaceWith: function( val ) { 
    359         return this.after( val ).remove(); 
     398                    return (this[0].value || "").replace(/\r/g, ""); 
     399 
     400            } 
     401 
     402            return undefined; 
     403        } 
     404 
     405        if( value.constructor == Number ) 
     406            value += ''; 
     407 
     408        return this.each(function(){ 
     409            if ( this.nodeType != 1 ) 
     410                return; 
     411 
     412            if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 
     413                this.checked = (jQuery.inArray(this.value, value) >= 0 || 
     414                    jQuery.inArray(this.name, value) >= 0); 
     415 
     416            else if ( jQuery.nodeName( this, "select" ) ) { 
     417                var values = jQuery.makeArray(value); 
     418 
     419                jQuery( "option", this ).each(function(){ 
     420                    this.selected = (jQuery.inArray( this.value, values ) >= 0 || 
     421                        jQuery.inArray( this.text, values ) >= 0); 
     422                }); 
     423 
     424                if ( !values.length ) 
     425                    this.selectedIndex = -1; 
     426 
     427            } else 
     428                this.value = value; 
     429        }); 
     430    }, 
     431 
     432    html: function( value ) { 
     433        return value == undefined ? 
     434            (this[0] ? 
     435                this[0].innerHTML : 
     436                null) : 
     437            this.empty().append( value ); 
     438    }, 
     439 
     440    replaceWith: function( value ) { 
     441        return this.after( value ).remove(); 
     442    }, 
     443 
     444    eq: function( i ) { 
     445        return this.slice( i, i + 1 ); 
    360446    }, 
    361447 
     
    364450    }, 
    365451 
    366     map: function(fn) { 
    367         return this.pushStack(jQuery.map( this, function(elem,i){ 
    368             return fn.call( elem, i, elem ); 
     452    map: function( callback ) { 
     453        return this.pushStack( jQuery.map(this, function(elem, i){ 
     454            return callback.call( elem, i, elem ); 
    369455        })); 
    370456    }, 
     
    373459        return this.add( this.prevObject ); 
    374460    }, 
    375      
    376     domManip: function(args, table, dir, fn) { 
    377         var clone = this.length > 1, a;  
    378  
     461 
     462    data: function( key, value ){ 
     463        var parts = key.split("."); 
     464        parts[1] = parts[1] ? "." + parts[1] : ""; 
     465 
     466        if ( value === undefined ) { 
     467            var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); 
     468 
     469            if ( data === undefined && this.length ) 
     470                data = jQuery.data( this[0], key ); 
     471 
     472            return data === undefined && parts[1] ? 
     473                this.data( parts[0] ) : 
     474                data; 
     475        } else 
     476            return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ 
     477                jQuery.data( this, key, value ); 
     478            }); 
     479    }, 
     480 
     481    removeData: function( key ){ 
    379482        return this.each(function(){ 
    380             if ( !a ) { 
    381                 a = jQuery.clean(args, this.ownerDocument); 
    382                 if ( dir < 0 ) 
    383                     a.reverse(); 
     483            jQuery.removeData( this, key ); 
     484        }); 
     485    }, 
     486 
     487    domManip: function( args, table, reverse, callback ) { 
     488        var clone = this.length > 1, elems; 
     489 
     490        return this.each(function(){ 
     491            if ( !elems ) { 
     492                elems = jQuery.clean( args, this.ownerDocument ); 
     493 
     494                if ( reverse ) 
     495                    elems.reverse(); 
    384496            } 
    385497 
    386498            var obj = this; 
    387499 
    388             if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") ) 
    389                 obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody")); 
    390  
    391             jQuery.each( a, function(){ 
    392                 if ( jQuery.nodeName(this, "script") ) { 
    393                     if ( this.src ) 
    394                         jQuery.ajax({ url: this.src, async: false, dataType: "script" }); 
    395                     else 
    396                         jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" ); 
    397                 } else 
    398                     fn.apply( obj, [ clone ? this.cloneNode(true) : this ] ); 
     500            if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) 
     501                obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); 
     502 
     503            var scripts = jQuery( [] ); 
     504 
     505            jQuery.each(elems, function(){ 
     506                var elem = clone ? 
     507                    jQuery( this ).clone( true )[0] : 
     508                    this; 
     509 
     510                // execute all scripts after the elements have been injected 
     511                if ( jQuery.nodeName( elem, "script" ) ) 
     512                    scripts = scripts.add( elem ); 
     513                else { 
     514                    // Remove any inner scripts for later evaluation 
     515                    if ( elem.nodeType == 1 ) 
     516                        scripts = scripts.add( jQuery( "script", elem ).remove() ); 
     517 
     518                    // Inject the elements into the document 
     519                    callback.call( obj, elem ); 
     520                } 
    399521            }); 
     522 
     523            scripts.each( evalScript ); 
    400524        }); 
    401525    } 
    402526}; 
    403527 
     528// Give the init function the jQuery prototype for later instantiation 
     529jQuery.fn.init.prototype = jQuery.fn; 
     530 
     531function evalScript( i, elem ) { 
     532    if ( elem.src ) 
     533        jQuery.ajax({ 
     534            url: elem.src, 
     535            async: false, 
     536            dataType: "script" 
     537        }); 
     538 
     539    else 
     540        jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 
     541 
     542    if ( elem.parentNode ) 
     543        elem.parentNode.removeChild( elem ); 
     544} 
     545 
     546function now(){ 
     547    return +new Date; 
     548} 
     549 
    404550jQuery.extend = jQuery.fn.extend = function() { 
    405551    // copy reference to target object 
    406     var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false; 
     552    var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; 
    407553 
    408554    // Handle a deep copy situation 
     
    410556        deep = target; 
    411557        target = arguments[1] || {}; 
     558        // skip the boolean and the target 
     559        i = 2; 
    412560    } 
    413561 
     562    // Handle case when target is a string or something (possible in deep copy) 
     563    if ( typeof target != "object" && typeof target != "function" ) 
     564        target = {}; 
     565 
    414566    // extend jQuery itself if only one argument is passed 
    415     if ( al == 1 ) { 
     567    if ( length == i ) { 
    416568        target = this; 
    417         a = 0; 
     569        --i; 
    418570    } 
    419571 
    420     var prop; 
    421  
    422     for ( ; a < al; a++ ) 
     572    for ( ; i < length; i++ ) 
    423573        // Only deal with non-null/undefined values 
    424         if ( (prop = arguments[a]) != null ) 
     574        if ( (options = arguments[ i ]) != null ) 
    425575            // Extend the base object 
    426             for ( var i in prop ) { 
     576            for ( var name in options ) { 
     577                var src = target[ name ], copy = options[ name ]; 
     578 
    427579                // Prevent never-ending loop 
    428                 if ( target == prop[i] ) 
     580                if ( target === copy ) 
    429581                    continue; 
    430582 
    431583                // Recurse if we're merging object values 
    432                 if ( deep && typeof prop[i] == 'object' && target[i] ) 
    433                     jQuery.extend( target[i], prop[i] ); 
     584                if ( deep && copy && typeof copy == "object" && !copy.nodeType ) 
     585                    target[ name ] = jQuery.extend( deep,  
     586                        // Never move original objects, clone them 
     587                        src || ( copy.length != null ? [ ] : { } ) 
     588                    , copy ); 
    434589 
    435590                // Don't bring in undefined values 
    436                 else if ( prop[i] != undefined ) 
    437                     target[i] = prop[i]; 
     591                else if ( copy !== undefined ) 
     592                    target[ name ] = copy; 
     593 
    438594            } 
    439595 
     
    442598}; 
    443599 
    444 var expando = "jQuery" + (new Date()).getTime(), uuid = 0, win = {}; 
     600var expando = "jQuery" + now(), uuid = 0, windowData = {}, 
     601    // exclude the following css properties to add px 
     602    exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, 
     603    // cache defaultView 
     604    defaultView = document.defaultView || {}; 
    445605 
    446606jQuery.extend({ 
    447     noConflict: function(deep) { 
     607    noConflict: function( deep ) { 
    448608        window.$ = _$; 
     609 
    449610        if ( deep ) 
    450611            window.jQuery = _jQuery; 
     612 
    451613        return jQuery; 
    452614    }, 
    453615 
    454     // This may seem like some crazy code, but trust me when I say that this 
    455     // is the only cross-browser way to do this. --John 
     616    // See test/unit/core.js for details concerning this function. 
    456617    isFunction: function( fn ) { 
    457         return !!fn && typeof fn != "string" && !fn.nodeName &&  
    458             fn.constructor != Array && /function/i.test( fn + "" ); 
    459     }, 
    460      
    461     // check if an element is in a XML document 
    462     isXMLDoc: function(elem) { 
     618        return !!fn && typeof fn != "string" && !fn.nodeName && 
     619            fn.constructor != Array && /^[\s[]?function/.test( fn + "" ); 
     620    }, 
     621 
     622    // check if an element is in a (or is an) XML document 
     623    isXMLDoc: function( elem ) { 
    463624        return elem.documentElement && !elem.body || 
    464625            elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; 
     
    466627 
    467628    // Evalulates a script in a global context 
    468     // Evaluates Async. in Safari 2 :-( 
    469629    globalEval: function( data ) { 
    470630        data = jQuery.trim( data ); 
     631 
    471632        if ( data ) { 
    472             if ( window.execScript ) 
    473                 window.execScript( data ); 
    474             else if ( jQuery.browser.safari ) 
    475                 // safari doesn't provide a synchronous global eval 
    476                 window.setTimeout( data, 0 ); 
     633            // Inspired by code by Andrea Giammarchi 
     634            // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html 
     635            var head = document.getElementsByTagName("head")[0] || document.documentElement, 
     636                script = document.createElement("script"); 
     637 
     638            script.type = "text/javascript"; 
     639            if ( jQuery.browser.msie ) 
     640                script.text = data; 
    477641            else 
    478                 eval.call( window, data ); 
     642                script.appendChild( document.createTextNode( data ) ); 
     643 
     644            // Use insertBefore instead of appendChild  to circumvent an IE6 bug. 
     645            // This arises when a base node is used (#2709). 
     646            head.insertBefore( script, head.firstChild ); 
     647            head.removeChild( script ); 
    479648        } 
    480649    }, 
     
    483652        return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); 
    484653    }, 
    485      
     654 
    486655    cache: {}, 
    487      
     656 
    488657    data: function( elem, name, data ) { 
    489         elem = elem == window ? win : elem; 
     658        elem = elem == window ? 
     659            windowData : 
     660            elem; 
    490661 
    491662        var id = elem[ expando ]; 
    492663 
    493664        // Compute a unique ID for the element 
    494         if ( !id )  
     665        if ( !id ) 
    495666            id = elem[ expando ] = ++uuid; 
    496667 
     
    499670        if ( name && !jQuery.cache[ id ] ) 
    500671            jQuery.cache[ id ] = {}; 
    501          
     672 
    502673        // Prevent overriding the named cache with undefined values 
    503         if ( data != undefined ) 
     674        if ( data !== undefined ) 
    504675            jQuery.cache[ id ][ name ] = data; 
    505          
    506         // Return the named cache data, or the ID for the element    
    507         return name ? jQuery.cache[ id ][ name ] : id; 
    508     }, 
    509      
     676 
     677        // Return the named cache data, or the ID for the element 
     678        return name ? 
     679            jQuery.cache[ id ][ name ] : 
     680            id; 
     681    }, 
     682 
    510683    removeData: function( elem, name ) { 
    511         elem = elem == window ? win : elem; 
     684        elem = elem == window ? 
     685            windowData : 
     686            elem; 
    512687 
    513688        var id = elem[ expando ]; 
     
    521696                // If we've removed all the data, remove the element's cache 
    522697                name = ""; 
    523                 for ( name in jQuery.cache[ id ] ) break; 
     698 
     699                for ( name in jQuery.cache[ id ] ) 
     700                    break; 
     701 
    524702                if ( !name ) 
    525703                    jQuery.removeData( elem ); 
     
    544722 
    545723    // args is for internal usage only 
    546     each: function( obj, fn, args ) { 
     724    each: function( object, callback, args ) { 
     725        var name, i = 0, length = object.length; 
     726 
    547727        if ( args ) { 
    548             if ( obj.length == undefined ) 
    549                 for ( var i in obj ) 
    550                     fn.apply( obj[i], args ); 
    551             else 
    552                 for ( var i = 0, ol = obj.length; i < ol; i++ ) 
    553                     if ( fn.apply( obj[i], args ) === false ) break; 
     728            if ( length == undefined ) { 
     729                for ( name in object ) 
     730                    if ( callback.apply( object[ name ], args ) === false ) 
     731                        break; 
     732            } else 
     733                for ( ; i < length; ) 
     734                    if ( callback.apply( object[ i++ ], args ) === false ) 
     735                        break; 
    554736 
    555737        // A special, fast, case for the most common use of each 
    556738        } else { 
    557             if ( obj.length == undefined ) 
    558                 for ( var i in obj ) 
    559                     fn.call( obj[i], i, obj[i] ); 
    560             else 
    561                 for ( var i = 0, ol = obj.length, val = obj[0];  
    562                     i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){} 
    563         } 
    564  
    565         return obj; 
    566     }, 
    567      
    568     prop: function(elem, value, type, index, prop){ 
    569             // Handle executable functions 
    570             if ( jQuery.isFunction( value ) ) 
    571                 value = value.call( elem, [index] ); 
    572                  
    573             // exclude the following css properties to add px 
    574             var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; 
    575  
    576             // Handle passing in a number to a CSS property 
    577             return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ? 
    578                 value + "px" : 
    579                 value; 
     739            if ( length == undefined ) { 
     740                for ( name in object ) 
     741                    if ( callback.call( object[ name ], name, object[ name ] ) === false ) 
     742                        break; 
     743            } else 
     744                for ( var value = object[0]; 
     745                    i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} 
     746        } 
     747 
     748        return object; 
     749    }, 
     750 
     751    prop: function( elem, value, type, i, name ) { 
     752        // Handle executable functions 
     753        if ( jQuery.isFunction( value ) ) 
     754            value = value.call( elem, i ); 
     755 
     756        // Handle passing in a number to a CSS property 
     757        return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? 
     758            value + "px" : 
     759            value; 
    580760    }, 
    581761 
    582762    className: { 
    583763        // internal only, use addClass("class") 
    584         add: function( elem, c ){ 
    585             jQuery.each( (c || "").split(/\s+/), function(i, cur){ 
    586                 if ( !jQuery.className.has( elem.className, cur ) ) 
    587                     elem.className += ( elem.className ? " " : "" ) + cur; 
     764        add: function( elem, classNames ) { 
     765            jQuery.each((classNames || "").split(/\s+/), function(i, className){ 
     766                if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) 
     767                    elem.className += (elem.className ? " " : "") + className; 
    588768            }); 
    589769        }, 
    590770 
    591771        // internal only, use removeClass("class") 
    592         remove: function( elem, c ){ 
    593             elem.className = c != undefined ? 
    594                 jQuery.grep( elem.className.split(/\s+/), function(cur){ 
    595                     return !jQuery.className.has( c, cur );  
    596                 }).join(" ") : ""; 
     772        remove: function( elem, classNames ) { 
     773            if (elem.nodeType == 1) 
     774                elem.className = classNames != undefined ? 
     775                    jQuery.grep(elem.className.split(/\s+/), function(className){ 
     776                        return !jQuery.className.has( classNames, className ); 
     777                    }).join(" ") : 
     778                    ""; 
    597779        }, 
    598780 
    599         // internal only, use is(".class") 
    600         has: function( t, c ) { 
    601             return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1; 
    602         } 
    603     }, 
    604  
    605     swap: function(e,o,f) { 
    606         for ( var i in o ) { 
    607             e.style["old"+i] = e.style[i]; 
    608             e.style[i] = o[i]; 
    609         } 
    610         f.apply( e, [] ); 
    611         for ( var i in o ) 
    612             e.style[i] = e.style["old"+i]; 
    613     }, 
    614  
    615     css: function(e,p) { 
    616         if ( p == "height" || p == "width" ) { 
    617             var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"]; 
    618  
    619             jQuery.each( d, function(){ 
    620                 old["padding" + this] = 0; 
    621                 old["border" + this + "Width"] = 0; 
    622             }); 
    623  
    624             jQuery.swap( e, old, function() { 
    625                 if ( jQuery(e).is(':visible') ) { 
    626                     oHeight = e.offsetHeight; 
    627                     oWidth = e.offsetWidth; 
    628                 } else { 
    629                     e = jQuery(e.cloneNode(true)) 
    630                         .find(":radio").removeAttr("checked").end() 
    631                         .css({ 
    632                             visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0" 
    633                         }).appendTo(e.parentNode)[0]; 
    634  
    635                     var parPos = jQuery.css(e.parentNode,"position") || "static"; 
    636                     if ( parPos == "static" ) 
    637                         e.parentNode.style.position = "relative"; 
    638  
    639                     oHeight = e.clientHeight; 
    640                     oWidth = e.clientWidth; 
    641  
    642                     if ( parPos == "static" ) 
    643                         e.parentNode.style.position = "static"; 
    644  
    645                     e.parentNode.removeChild(e); 
    646                 } 
    647             }); 
    648  
    649             return p == "height" ? oHeight : oWidth; 
    650         } 
    651  
    652         return jQuery.curCSS( e, p ); 
    653     }, 
    654  
    655     curCSS: function(elem, prop, force) { 
    656         var ret, stack = [], swap = []; 
     781        // internal only, use hasClass("class") 
     782        has: function( elem, className ) { 
     783            return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; 
     784        } 
     785    }, 
     786 
     787    // A method for quickly swapping in/out CSS properties to get correct calculations 
     788    swap: function( elem, options, callback ) { 
     789        var old = {}; 
     790        // Remember the old values, and insert the new ones 
     791        for ( var name in options ) { 
     792            old[ name ] = elem.style[ name ]; 
     793            elem.style[ name ] = options[ name ]; 
     794        } 
     795 
     796        callback.call( elem ); 
     797 
     798        // Revert the old values 
     799        for ( var name in options ) 
     800            elem.style[ name ] = old[ name ]; 
     801    }, 
     802 
     803    css: function( elem, name, force ) { 
     804        if ( name == "width" || name == "height" ) { 
     805            var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; 
     806 
     807            function getWH() { 
     808                val = name == "width" ? elem.offsetWidth : elem.offsetHeight; 
     809                var padding = 0, border = 0; 
     810                jQuery.each( which, function() { 
     811                    padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; 
     812                    border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; 
     813                }); 
     814                val -= Math.round(padding + border); 
     815            } 
     816 
     817            if ( jQuery(elem).is(":visible") ) 
     818                getWH(); 
     819            else 
     820                jQuery.swap( elem, props, getWH ); 
     821 
     822            return Math.max(0, val); 
     823        } 
     824 
     825        return jQuery.curCSS( elem, name, force ); 
     826    }, 
     827 
     828    curCSS: function( elem, name, force ) { 
     829        var ret, style = elem.style; 
    657830 
    658831        // A helper method for determining if an element's values are broken 
    659         function color(a){ 
     832        function color( elem ) { 
    660833            if ( !jQuery.browser.safari ) 
    661834                return false; 
    662835 
    663             var ret = document.defaultView.getComputedStyle(a,null); 
     836            // defaultView is cached 
     837            var ret = defaultView.getComputedStyle( elem, null ); 
    664838            return !ret || ret.getPropertyValue("color") == ""; 
    665839        } 
    666840 
    667         if (prop == "opacity" && jQuery.browser.msie) { 
    668             ret = jQuery.attr(elem.style, "opacity"); 
    669             return ret == "" ? "1" : ret; 
    670         } 
    671          
    672         if (prop.match(/float/i)) 
    673             prop = styleFloat; 
    674  
    675         if (!force && elem.style[prop]) 
    676             ret = elem.style[prop]; 
    677  
    678         else if (document.defaultView && document.defaultView.getComputedStyle) { 
    679  
    680             if (prop.match(/float/i)) 
    681                 prop = "float"; 
    682  
    683             prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase(); 
    684             var cur = document.defaultView.getComputedStyle(elem, null); 
    685  
    686             if ( cur && !color(elem) ) 
    687                 ret = cur.getPropertyValue(prop); 
     841        // We need to handle opacity special in IE 
     842        if ( name == "opacity" && jQuery.browser.msie ) { 
     843            ret = jQuery.attr( style, "opacity" ); 
     844 
     845            return ret == "" ? 
     846                "1" : 
     847                ret; 
     848        } 
     849        // Opera sometimes will give the wrong display answer, this fixes it, see #2037 
     850        if ( jQuery.browser.opera && name == "display" ) { 
     851            var save = style.outline; 
     852            style.outline = "0 solid black"; 
     853            style.outline = save; 
     854        } 
     855 
     856        // Make sure we're using the right name for getting the float value 
     857        if ( name.match( /float/i ) ) 
     858            name = styleFloat; 
     859 
     860        if ( !force && style && style[ name ] ) 
     861            ret = style[ name ]; 
     862 
     863        else if ( defaultView.getComputedStyle ) { 
     864 
     865            // Only "float" is needed here 
     866            if ( name.match( /float/i ) ) 
     867                name = "float"; 
     868 
     869            name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); 
     870 
     871            var computedStyle = defaultView.getComputedStyle( elem, null ); 
     872 
     873            if ( computedStyle && !color( elem ) ) 
     874                ret = computedStyle.getPropertyValue( name ); 
    688875 
    689876            // If the element isn't reporting its values properly in Safari 
    690877            // then some display: none elements are involved 
    691878            else { 
     879                var swap = [], stack = [], a = elem, i = 0; 
     880 
    692881                // Locate all of the parent display: none elements 
    693                 for ( var a = elem; a && color(a); a = a.parentNode ) 
     882                for ( ; a && color(a); a = a.parentNode ) 
    694883                    stack.unshift(a); 
    695884 
    696885                // Go through and make them visible, but in reverse 
    697886                // (It would be better if we knew the exact display type that they had) 
    698                 for ( a = 0; a < stack.length; a++ ) 
    699                     if ( color(stack[a]) ) { 
    700                         swap[a] = stack[a].style.display; 
    701                         stack[a].style.display = "block"; 
     887                for ( ; i < stack.length; i++ ) 
     888                    if ( color( stack[ i ] ) ) { 
     889                        swap[ i ] = stack[ i ].style.display; 
     890                        stack[ i ].style.display = "block"; 
    702891                    } 
    703892 
    704893                // Since we flip the display style, we have to handle that 
    705894                // one special, otherwise get the value 
    706                 ret = prop == "display" && swap[stack.length-1] != null ? 
     895                ret = name == "display" && swap[ stack.length - 1 ] != null ? 
    707896                    "none" : 
    708                     document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || ""; 
     897                    ( computedStyle && computedStyle.getPropertyValue( name ) ) || ""; 
    709898 
    710899                // Finally, revert the display styles back 
    711                 for ( a = 0; a < swap.length; a++ ) 
    712                     if ( swap[a] != null ) 
    713                         stack[a].style.display = swap[a]; 
    714             } 
    715  
    716             if ( prop == "opacity" && ret == "" ) 
     900                for ( i = 0; i < swap.length; i++ ) 
     901                    if ( swap[ i ] != null ) 
     902                        stack[ i ].style.display = swap[ i ]; 
     903            } 
     904 
     905            // We should always get a number back from opacity 
     906            if ( name == "opacity" && ret == "" ) 
    717907                ret = "1"; 
    718908 
    719         } else if (elem.currentStyle) { 
    720             var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();}); 
    721             ret = elem.currentStyle[prop] || elem.currentStyle[newProp]; 
     909        } else if ( elem.currentStyle ) { 
     910            var camelCase = name.replace(/\-(\w)/g, function(all, letter){ 
     911                return letter.toUpperCase(); 
     912            }); 
     913 
     914            ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; 
    722915 
    723916            // From the awesome hack by Dean Edwards 
     
    726919            // If we're not dealing with a regular pixel number 
    727920            // but a number that has a weird ending, we need to convert it to pixels 
    728             if ( !/^\d+(px)?$/i.test(ret) && /^\d/.test(ret) ) { 
    729                 var style = elem.style.left; 
    730                 var runtimeStyle = elem.runtimeStyle.left; 
     921            if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { 
     922                // Remember the original values 
     923                var left = style.left, rsLeft = elem.runtimeStyle.left; 
     924 
     925                // Put in the new values to get a computed value out 
    731926                elem.runtimeStyle.left = elem.currentStyle.left; 
    732                 elem.style.left = ret || 0; 
    733                 ret = elem.style.pixelLeft + "px"; 
    734                 elem.style.left = style; 
    735                 elem.runtimeStyle.left = runtimeStyle; 
     927                style.left = ret || 0; 
     928                ret = style.pixelLeft + "px"; 
     929 
     930                // Revert the changed values 
     931                style.left = left; 
     932                elem.runtimeStyle.left = rsLeft; 
    736933            } 
    737934        } 
     
    739936        return ret; 
    740937    }, 
    741      
    742     clean: function(a, doc) { 
    743         var r = []; 
    744         doc = doc || document; 
    745  
    746         jQuery.each( a, function(i,arg){ 
    747             if ( !arg ) return; 
    748  
    749             if ( arg.constructor == Number ) 
    750                 arg = arg.toString(); 
    751              
     938 
     939    clean: function( elems, context ) { 
     940        var ret = []; 
     941        context = context || document; 
     942        // !context.createElement fails in IE with an error but returns typeof 'object' 
     943        if (typeof context.createElement == 'undefined') 
     944            context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 
     945 
     946        jQuery.each(elems, function(i, elem){ 
     947            if ( !elem ) 
     948                return; 
     949 
     950            if ( elem.constructor == Number ) 
     951                elem += ''; 
     952 
    752953            // Convert html string into DOM nodes 
    753             if ( typeof arg == "string" ) { 
     954            if ( typeof elem == "string" ) { 
    754955                // Fix "XHTML"-style tags in all browsers 
    755                 arg = arg.replace(/(<(\w+)[^>]*?)\/>/g, function(m, all, tag){ 
    756                     return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i)? m : all+"></"+tag+">"; 
     956                elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ 
     957                    return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? 
     958                        all : 
     959                        front + "></" + tag + ">"; 
    757960                }); 
    758961 
    759962                // Trim whitespace, otherwise indexOf won't work as expected 
    760                 var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = []; 
     963                var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); 
    761964 
    762965                var wrap = 
    763966                    // option or optgroup 
    764                     !s.indexOf("<opt") && 
    765                     [1, "<select>", "</select>"] || 
    766                      
    767                     !s.indexOf("<leg") && 
    768                     [1, "<fieldset>", "</fieldset>"] || 
    769                      
    770                     s.match(/^<(thead|tbody|tfoot|colg|cap)/) && 
    771                     [1, "<table>", "</table>"] || 
    772                      
    773                     !s.indexOf("<tr") && 
    774                     [2, "<table><tbody>", "</tbody></table>"] || 
    775                      
     967                    !tags.indexOf("<opt") && 
     968                    [ 1, "<select multiple='multiple'>", "</select>" ] || 
     969 
     970                    !tags.indexOf("<leg") && 
     971                    [ 1, "<fieldset>", "</fieldset>" ] || 
     972 
     973                    tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && 
     974                    [ 1, "<table>", "</table>" ] || 
     975 
     976                    !tags.indexOf("<tr") && 
     977                    [ 2, "<table><tbody>", "</tbody></table>" ] || 
     978 
    776979                    // <thead> matched above 
    777                     (!s.indexOf("<td") || !s.indexOf("<th")) && 
    778                     [3, "<table><tbody><tr>", "</tr></tbody></table>"] || 
    779                      
    780                     !s.indexOf("<col") && 
    781                     [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] || 
     980                    (!tags.indexOf("<td") || !tags.indexOf("<th")) && 
     981                    [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || 
     982 
     983                    !tags.indexOf("<col") && 
     984                    [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || 
    782985 
    783986                    // IE can't serialize <link> and <script> tags normally 
    784987                    jQuery.browser.msie && 
    785                     [1, "div<div>", "</div>"] || 
    786                      
    787                     [0,"",""]; 
     988                    [ 1, "div<div>", "</div>" ] || 
     989 
     990                    [ 0, "", "" ]; 
    788991 
    789992                // Go to html and back, then peel off extra wrappers 
    790                 div.innerHTML = wrap[1] + arg + wrap[2]; 
    791                  
     993                div.innerHTML = wrap[1] + elem + wrap[2]; 
     994 
    792995                // Move to the right depth 
    793996                while ( wrap[0]-- ) 
    794997                    div = div.lastChild; 
    795                  
     998 
    796999                // Remove IE's autoinserted <tbody> from table fragments 
    7971000                if ( jQuery.browser.msie ) { 
    798                      
     1001 
    7991002                    // String was a <table>, *may* have spurious <tbody> 
    800                     if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 )  
    801                         tb = div.firstChild && div.firstChild.childNodes; 
    802                          
    803                     // String was a bare <thead> or <tfoot> 
    804                     else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 ) 
    805                         tb = div.childNodes; 
    806  
    807                     for ( var n = tb.length-1; n >= 0 ; --n ) 
    808                         if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length ) 
    809                             tb[n].parentNode.removeChild(tb[n]); 
    810      
    811                     // IE completely kills leading whitespace when innerHTML is used     
    812                     if ( /^\s/.test(arg) )   
    813                         div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild ); 
     1003                    var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? 
     1004                        div.firstChild && div.firstChild.childNodes : 
     1005 
     1006                        // String was a bare <thead> or <tfoot> 
     1007                        wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? 
     1008                            div.childNodes : 
     1009                            []; 
     1010 
     1011                    for ( var j = tbody.length - 1; j >= 0 ; --j ) 
     1012                        if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) 
     1013                            tbody[ j ].parentNode.removeChild( tbody[ j ] ); 
     1014 
     1015                    // IE completely kills leading whitespace when innerHTML is used 
     1016                    if ( /^\s/.test( elem ) ) 
     1017                        div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); 
    8141018 
    8151019                } 
    816                  
    817                 arg = jQuery.makeArray( div.childNodes ); 
    818             } 
    819  
    820             if ( 0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select")) ) 
     1020 
     1021                elem = jQuery.makeArray( div.childNodes ); 
     1022            } 
     1023 
     1024            if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) ) 
    8211025                return; 
    8221026 
    823             if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options ) 
    824                 r.push( arg ); 
     1027            if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options ) 
     1028                ret.push( elem ); 
     1029 
    8251030            else 
    826                 r = jQuery.merge( r, arg ); 
     1031                ret = jQuery.merge( ret, elem ); 
    8271032 
    8281033        }); 
    8291034 
    830         return r; 
    831     }, 
    832      
    833     attr: function(elem, name, value){ 
    834         var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props; 
    835  
    836         // Safari mis-reports the default selected property of a hidden option 
    837         // Accessing the parent's selectedIndex property fixes it 
    838         if ( name == "selected" && jQuery.browser.safari ) 
    839             elem.parentNode.selectedIndex; 
    840          
    841         // Certain attributes only work when accessed via the old DOM 0 way 
    842         if ( fix[name] ) { 
    843             if ( value != undefined ) elem[fix[name]] = value; 
    844             return elem[fix[name]]; 
    845         } else if ( jQuery.browser.msie && name == "style" ) 
    846             return jQuery.attr( elem.style, "cssText", value ); 
    847  
    848         else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") ) 
    849             return elem.getAttributeNode(name).nodeValue; 
    850  
     1035        return ret; 
     1036    }, 
     1037 
     1038    attr: function( elem, name, value ) { 
     1039        // don't set attributes on text and comment nodes 
     1040        if (!elem || elem.nodeType == 3 || elem.nodeType == 8) 
     1041            return undefined; 
     1042 
     1043        var notxml = !jQuery.isXMLDoc( elem ), 
     1044            // Whether we are setting (or getting) 
     1045            set = value !== undefined, 
     1046            msie = jQuery.browser.msie; 
     1047 
     1048        // Try to normalize/fix the name 
     1049        name = notxml && jQuery.props[ name ] || name; 
     1050 
     1051        // Only do all the following if this is a node (faster for style) 
    8511052        // IE elem.getAttribute passes even for style 
    852         else if ( elem.tagName ) { 
    853  
    854             if ( value != undefined ) { 
    855                 if ( name == "type" && jQuery.nodeName(elem,"input") && elem.parentNode ) 
    856                     throw "type property can't be changed"; 
    857                 elem.setAttribute( name, value ); 
    858             } 
    859  
    860             if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )  
    861                 return elem.getAttribute( name, 2 ); 
    862  
    863             return elem.getAttribute( name ); 
     1053        if ( elem.tagName ) { 
     1054 
     1055            // These attributes require special treatment 
     1056            var special = /href|src|style/.test( name ); 
     1057 
     1058            // Safari mis-reports the default selected property of a hidden option 
     1059            // Accessing the parent's selectedIndex property fixes it 
     1060            if ( name == "selected" && jQuery.browser.safari ) 
     1061                elem.parentNode.selectedIndex; 
     1062 
     1063            // If applicable, access the attribute via the DOM 0 way 
     1064            if ( name in elem && notxml && !special ) { 
     1065                if ( set ){ 
     1066                    // We can't allow the type property to be changed (since it causes problems in IE) 
     1067                    if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) 
     1068                        throw "type property can't be changed"; 
     1069 
     1070                    elem[ name ] = value; 
     1071                } 
     1072 
     1073                // browsers index elements by id/name on forms, give priority to attributes. 
     1074                if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) 
     1075                    return elem.getAttributeNode( name ).nodeValue; 
     1076 
     1077                return elem[ name ]; 
     1078            } 
     1079 
     1080            if ( msie && notxml &&  name == "style" ) 
     1081                return jQuery.attr( elem.style, "cssText", value ); 
     1082 
     1083            if ( set ) 
     1084                // convert the value to a string (all browsers do this but IE) see #1070 
     1085                elem.setAttribute( name, "" + value ); 
     1086 
     1087            var attr = msie && notxml && special 
     1088                    // Some attributes require a special call on IE 
     1089                    ? elem.getAttribute( name, 2 ) 
     1090                    : elem.getAttribute( name ); 
     1091 
     1092            // Non-existent attributes return null, we normalize to undefined 
     1093            return attr === null ? undefined : attr; 
     1094        } 
    8641095 
    8651096        // elem is actually elem.style ... set the style 
    866         } else { 
    867             // IE actually uses filters for opacity 
    868             if ( name == "opacity" && jQuery.browser.msie ) { 
    869                 if ( value != undefined ) { 
    870                     // IE has trouble with opacity if it does not have layout 
    871                     // Force it by setting the zoom level 
    872                     elem.zoom = 1;  
    873      
    874                     // Set the alpha filter to set the opacity 
    875                     elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") + 
    876                         (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); 
    877                 } 
    878      
    879                 return elem.filter ?  
    880                     (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : ""; 
    881             } 
    882             name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();}); 
    883             if ( value != undefined ) elem[name] = value; 
    884             return elem[name]; 
    885         } 
    886     }, 
    887      
    888     trim: function(t){ 
    889         return (t||"").replace(/^\s+|\s+$/g, ""); 
    890     }, 
    891  
    892     makeArray: function( a ) { 
    893         var r = []; 
    894  
    895         // Need to use typeof to fight Safari childNodes crashes 
    896         if ( typeof a != "array" ) 
    897             for ( var i = 0, al = a.length; i < al; i++ ) 
    898                 r.push( a[i] ); 
    899         else 
    900             r = a.slice( 0 ); 
    901  
    902         return r; 
    903     }, 
    904  
    905     inArray: function( b, a ) { 
    906         for ( var i = 0, al = a.length; i < al; i++ ) 
    907             if ( a[i] == b ) 
     1097 
     1098        // IE uses filters for opacity 
     1099        if ( msie && name == "opacity" ) { 
     1100            if ( set ) { 
     1101                // IE has trouble with opacity if it does not have layout 
     1102                // Force it by setting the zoom level 
     1103                elem.zoom = 1; 
     1104 
     1105                // Set the alpha filter to set the opacity 
     1106                elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + 
     1107                    (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); 
     1108            } 
     1109 
     1110            return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? 
     1111                (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': 
     1112                ""; 
     1113        } 
     1114 
     1115        name = name.replace(/-([a-z])/ig, function(all, letter){ 
     1116            return letter.toUpperCase(); 
     1117        }); 
     1118 
     1119        if ( set ) 
     1120            elem[ name ] = value; 
     1121 
     1122        return elem[ name ]; 
     1123    }, 
     1124 
     1125    trim: function( text ) { 
     1126        return (text || "").replace( /^\s+|\s+$/g, "" ); 
     1127    }, 
     1128 
     1129    makeArray: function( array ) { 
     1130        var ret = []; 
     1131 
     1132        if( array != null ){ 
     1133            var i = array.length; 
     1134            //the window, strings and functions also have 'length' 
     1135            if( i == null || array.split || array.setInterval || array.call ) 
     1136                ret[0] = array; 
     1137            else 
     1138                while( i ) 
     1139                    ret[--i] = array[i]; 
     1140        } 
     1141 
     1142        return ret; 
     1143    }, 
     1144 
     1145    inArray: function( elem, array ) { 
     1146        for ( var i = 0, length = array.length; i < length; i++ ) 
     1147        // Use === because on IE, window == document 
     1148            if ( array[ i ] === elem ) 
    9081149                return i; 
     1150 
    9091151        return -1; 
    9101152    }, 
    9111153 
    912     merge: function(first, second) { 
     1154    merge: function( first, second ) { 
    9131155        // We have to loop this way because IE & Opera overwrite the length 
    9141156        // expando of getElementsByTagName 
    915  
     1157        var i = 0, elem, pos = first.length; 
    9161158        // Also, we need to make sure that the correct elements are being returned 
    9171159        // (IE returns comment nodes in a '*' query) 
    9181160        if ( jQuery.browser.msie ) { 
    919             for ( var i = 0; second[i]; i++ ) 
    920                 if ( second[i].nodeType != 8 ) 
    921                     first.push(second[i]); 
     1161            while ( elem = second[ i++ ] ) 
     1162                if ( elem.nodeType != 8 ) 
     1163                    first[ pos++ ] = elem; 
     1164 
    9221165        } else 
    923             for ( var i = 0; second[i]; i++ ) 
    924                 first.push(second[i]); 
     1166            while ( elem = second[ i++ ] ) 
     1167                first[ pos++ ] = elem; 
    9251168 
    9261169        return first; 
    9271170    }, 
    9281171 
    929     unique: function(first) { 
    930         var r = [], done = {}; 
     1172    unique: function( array ) { 
     1173        var ret = [], done = {}; 
    9311174 
    9321175        try { 
    933             for ( var i = 0, fl = first.length; i < fl; i++ ) { 
    934                 var id = jQuery.data(first[i]); 
    935                 if ( !done[id] ) { 
    936                     done[id] = true; 
    937                     r.push(first[i]); 
     1176 
     1177            for ( var i = 0, length = array.length; i < length; i++ ) { 
     1178                var id = jQuery.data( array[ i ] ); 
     1179 
     1180                if ( !done[ id ] ) { 
     1181                    done[ id ] = true; 
     1182                    ret.push( array[ i ] ); 
    9381183                } 
    9391184            } 
    940         } catch(e) { 
    941             r = first; 
    942         } 
    943  
    944         return r; 
    945     }, 
    946  
    947     grep: function(elems, fn, inv) { 
    948         // If a string is passed in for the function, make a function 
    949         // for it (a handy shortcut) 
    950         if ( typeof fn == "string" ) 
    951             fn = eval("false||function(a,i){return " + fn + "}"); 
    952  
    953         var result = []; 
     1185 
     1186        } catch( e ) { 
     1187            ret = array; 
     1188        } 
     1189 
     1190        return ret; 
     1191    }, 
     1192 
     1193    grep: function( elems, callback, inv ) { 
     1194        var ret = []; 
    9541195 
    9551196        // Go through the array, only saving the items 
    9561197        // that pass the validator function 
    957         for ( var i = 0, el = elems.length; i < el; i++ ) 
    958             if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) ) 
    959                 result.push( elems[i] ); 
    960  
    961         return result; 
    962     }, 
    963  
    964     map: function(elems, fn) { 
    965         // If a string is passed in for the function, make a function 
    966         // for it (a handy shortcut) 
    967         if ( typeof fn == "string" ) 
    968             fn = eval("false||function(a){return " + fn + "}"); 
    969  
    970         var result = []; 
     1198        for ( var i = 0, length = elems.length; i < length; i++ ) 
     1199            if ( !inv != !callback( elems[ i ], i ) ) 
     1200                ret.push( elems[ i ] ); 
     1201 
     1202        return ret; 
     1203    }, 
     1204 
     1205    map: function( elems, callback ) { 
     1206        var ret = []; 
    9711207 
    9721208        // Go through the array, translating each of the items to their 
    9731209        // new value (or values). 
    974         for ( var i = 0, el = elems.length; i < el; i++ ) { 
    975             var val = fn(elems[i],i); 
    976  
    977             if ( val !== null && val != undefined ) { 
    978                 if ( val.constructor != Array ) val = [val]; 
    979                 result = result.concat( val ); 
    980             } 
    981         } 
    982  
    983         return result; 
     1210        for ( var i = 0, length = elems.length; i < length; i++ ) { 
     1211            var value = callback( elems[ i ], i ); 
     1212 
     1213            if ( value != null ) 
     1214                ret[ ret.length ] = value; 
     1215        } 
     1216 
     1217        return ret.concat.apply( [], ret ); 
    9841218    } 
    9851219}); 
     
    9891223// Figure out what browser is being used 
    9901224jQuery.browser = { 
    991     version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], 
    992     safari: /webkit/.test(userAgent), 
    993     opera: /opera/.test(userAgent), 
    994     msie: /msie/.test(userAgent) && !/opera/.test(userAgent), 
    995     mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) 
     1225    version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], 
     1226    safari: /webkit/.test( userAgent ), 
     1227    opera: /opera/.test( userAgent ), 
     1228    msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), 
     1229    mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) 
    9961230}; 
    9971231 
    998 var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat"; 
    999      
     1232var styleFloat = jQuery.browser.msie ? 
     1233    "styleFloat" : 
     1234    "cssFloat"; 
     1235 
    10001236jQuery.extend({ 
    10011237    // Check to see if the W3C box model is being used 
    10021238    boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat", 
    1003      
    1004     styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat", 
    1005      
     1239 
    10061240    props: { 
    10071241        "for": "htmlFor", 
     
    10101244        cssFloat: styleFloat, 
    10111245        styleFloat: styleFloat, 
    1012         innerHTML: "innerHTML", 
    1013         className: "className", 
    1014         value: "value", 
    1015         disabled: "disabled", 
    1016         checked: "checked", 
    10171246        readonly: "readOnly", 
    1018         selected: "selected", 
    1019         maxlength: "maxLength" 
     1247        maxlength: "maxLength", 
     1248        cellspacing: "cellSpacing" 
    10201249    } 
    10211250}); 
    10221251 
    10231252jQuery.each({ 
    1024     parent: "a.parentNode", 
    1025     parents: "jQuery.dir(a,'parentNode')", 
    1026     next: "jQuery.nth(a,2,'nextSibling')", 
    1027     prev: "jQuery.nth(a,2,'previousSibling')", 
    1028     nextAll: "jQuery.dir(a,'nextSibling')", 
    1029     prevAll: "jQuery.dir(a,'previousSibling')", 
    1030     siblings: "jQuery.sibling(a.parentNode.firstChild,a)", 
    1031     children: "jQuery.sibling(a.firstChild)", 
    1032     contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)" 
    1033 }, function(i,n){ 
    1034     jQuery.fn[ i ] = function(a) { 
    1035         var ret = jQuery.map(this,n); 
    1036         if ( a && typeof a == "string" ) 
    1037             ret = jQuery.multiFilter(a,ret); 
    1038         return this.pushStack( jQuery.unique(ret) ); 
     1253    parent: function(elem){return elem.parentNode;}, 
     1254    parents: function(elem){return jQuery.dir(elem,"parentNode");}, 
     1255    next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, 
     1256    prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, 
     1257    nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, 
     1258    prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, 
     1259    siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, 
     1260    children: function(elem){return jQuery.sibling(elem.firstChild);}, 
     1261    contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} 
     1262}, function(name, fn){ 
     1263    jQuery.fn[ name ] = function( selector ) { 
     1264        var ret = jQuery.map( this, fn ); 
     1265 
     1266        if ( selector && typeof selector == "string" ) 
     1267            ret = jQuery.multiFilter( selector, ret ); 
     1268 
     1269        return this.pushStack( jQuery.unique( ret ) ); 
    10391270    }; 
    10401271}); 
     
    10461277    insertAfter: "after", 
    10471278    replaceAll: "replaceWith" 
    1048 }, function(i,n){ 
    1049     jQuery.fn[ i ] = function(){ 
    1050         var a = arguments; 
     1279}, function(name, original){ 
     1280    jQuery.fn[ name ] = function() { 
     1281        var args = arguments; 
     1282 
    10511283        return this.each(function(){ 
    1052             for ( var j = 0, al = a.length; j < al; j++ ) 
    1053                 jQuery(a[j])[n]( this ); 
     1284            for ( var i = 0, length = args.length; i < length; i++ ) 
     1285                jQuery( args[ i ] )[ original ]( this ); 
    10541286        }); 
    10551287    }; 
    10561288}); 
    10571289 
    1058 jQuery.each( { 
    1059     removeAttr: function( key ) { 
    1060         jQuery.attr( this, key, "" ); 
    1061         this.removeAttribute( key ); 
    1062     }, 
    1063     addClass: function(c){ 
    1064         jQuery.className.add(this,c); 
    1065     }, 
    1066     removeClass: function(c){ 
    1067         jQuery.className.remove(this,c); 
    1068     }, 
    1069     toggleClass: function( c ){ 
    1070         jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c); 
    1071     }, 
    1072     remove: function(a){ 
    1073         if ( !a || jQuery.filter( a, [this] ).r.length ) { 
    1074             jQuery.removeData( this ); 
    1075             this.parentNode.removeChild( this ); 
    1076         } 
    1077     }, 
     1290jQuery.each({ 
     1291    removeAttr: function( name ) { 
     1292        jQuery.attr( this, name, "" ); 
     1293        if (this.nodeType == 1) 
     1294            this.removeAttribute( name ); 
     1295    }, 
     1296 
     1297    addClass: function( classNames ) { 
     1298        jQuery.className.add( this, classNames ); 
     1299    }, 
     1300 
     1301    removeClass: function( classNames ) { 
     1302        jQuery.className.remove( this, classNames ); 
     1303    }, 
     1304 
     1305    toggleClass: function( classNames ) { 
     1306        jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames ); 
     1307    }, 
     1308 
     1309    remove: function( selector ) { 
     1310        if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { 
     1311            // Prevent memory leaks 
     1312            jQuery( "*", this ).add(this).each(function(){ 
     1313                jQuery.event.remove(this); 
     1314                jQuery.removeData(this); 
     1315            }); 
     1316            if (this.parentNode) 
     1317                this.parentNode.removeChild( this ); 
     1318        } 
     1319    }, 
     1320 
    10781321    empty: function() { 
    1079         // Clean up the cache 
    1080         jQuery("*", this).each(function(){ jQuery.removeData(this); }); 
    1081  
     1322        // Remove element nodes and prevent memory leaks 
     1323        jQuery( ">*", this ).remove(); 
     1324 
     1325        // Remove any remaining nodes 
    10821326        while ( this.firstChild ) 
    10831327            this.removeChild( this.firstChild ); 
    10841328    } 
    1085 }, function(i,n){ 
    1086     jQuery.fn[ i ] = function() { 
    1087         return this.each( n, arguments ); 
     1329}, function(name, fn){ 
     1330    jQuery.fn[ name ] = function(){ 
     1331        return this.each( fn, arguments ); 
    10881332    }; 
    10891333}); 
    10901334 
    1091 jQuery.each( [ "Height", "Width" ], function(i,name){ 
    1092     var n = name.toLowerCase(); 
    1093      
    1094     jQuery.fn[ n ] = function(h) { 
     1335jQuery.each([ "Height", "Width" ], function(i, name){ 
     1336    var type = name.toLowerCase(); 
     1337 
     1338    jQuery.fn[ type ] = function( size ) { 
     1339        // Get window width or height 
    10951340        return this[0] == window ? 
    1096             jQuery.browser.safari && self["inner" + name] || 
    1097             jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) || 
    1098             document.body["client" + name] : 
    1099          
     1341            // Opera reports document.body.client[Width/Height] properly in both quirks and standards 
     1342            jQuery.browser.opera && document.body[ "client" + name ] || 
     1343 
     1344            // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths) 
     1345            jQuery.browser.safari && window[ "inner" + name ] || 
     1346 
     1347            // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode 
     1348            document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : 
     1349 
     1350            // Get document width or height 
    11001351            this[0] == document ? 
    1101                 Math.max( document.body["scroll" + name], document.body["offset" + name] ) : 
    1102          
    1103                 h == undefined ? 
    1104                     ( this.length ? jQuery.css( this[0], n ) : null ) : 
    1105                     this.css( n, h.constructor == String ? h : h + "px" ); 
     1352                // Either scroll[Width/Height] or offset[Width/Height], whichever is greater 
     1353                Math.max( 
     1354                    Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), 
     1355                    Math.max(document.body["offset" + name], document.documentElement["offset" + name]) 
     1356                ) : 
     1357 
     1358                // Get or set width or height on the element 
     1359                size == undefined ? 
     1360                    // Get width or height on the element 
     1361                    (this.length ? jQuery.css( this[0], type ) : null) : 
     1362 
     1363                    // Set the width or height on the element (default to pixels if value is unitless) 
     1364                    this.css( type, size.constructor == String ? size : size + "px" ); 
    11061365    }; 
    11071366}); 
    11081367 
    1109 var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? 
     1368// Helper function used by the dimensions and offset modules 
     1369function num(elem, prop) { 
     1370    return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; 
     1371}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? 
    11101372        "(?:[\\w*_-]|\\\\.)" : 
    11111373        "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)", 
     
    11161378jQuery.extend({ 
    11171379    expr: { 
    1118         "": "m[2]=='*'||jQuery.nodeName(a,m[2])", 
    1119         "#": "a.getAttribute('id')==m[2]", 
     1380        "": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);}, 
     1381        "#": function(a,i,m){return a.getAttribute("id")==m[2];}, 
    11201382        ":": { 
    11211383            // Position Checks 
    1122             lt: "i<m[3]-0", 
    1123             gt: "i>m[3]-0", 
    1124             nth: "m[3]-0==i", 
    1125             eq: "m[3]-0==i", 
    1126             first: "i==0", 
    1127             last: "i==r.length-1", 
    1128             even: "i%2==0", 
    1129             odd: "i%2", 
     1384            lt: function(a,i,m){return i<m[3]-0;}, 
     1385            gt: function(a,i,m){return i>m[3]-0;}, 
     1386            nth: function(a,i,m){return m[3]-0==i;}, 
     1387            eq: function(a,i,m){return m[3]-0==i;}, 
     1388            first: function(a,i){return i==0;}, 
     1389            last: function(a,i,m,r){return i==r.length-1;}, 
     1390            even: function(a,i){return i%2==0;}, 
     1391            odd: function(a,i){return i%2;}, 
    11301392 
    11311393            // Child Checks 
    1132             "first-child": "a.parentNode.getElementsByTagName('*')[0]==a", 
    1133             "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a", 
    1134             "only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')", 
     1394            "first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;}, 
     1395            "last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;}, 
     1396            "only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");}, 
    11351397 
    11361398            // Parent Checks 
    1137             parent: "a.firstChild", 
    1138             empty: "!a.firstChild", 
     1399            parent: function(a){return a.firstChild;}, 
     1400            empty: function(a){return !a.firstChild;}, 
    11391401 
    11401402            // Text Check 
    1141             contains: "(a.textContent||a.innerText||'').indexOf(m[3])>=0", 
     1403            contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;}, 
    11421404 
    11431405            // Visibility 
    1144             visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"', 
    1145             hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"', 
     1406            visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";}, 
     1407            hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";}, 
    11461408 
    11471409            // Form attributes 
    1148             enabled: "!a.disabled", 
    1149             disabled: "a.disabled", 
    1150             checked: "a.checked", 
    1151             selected: "a.selected||jQuery.attr(a,'selected')", 
     1410            enabled: function(a){return !a.disabled;}, 
     1411            disabled: function(a){return a.disabled;}, 
     1412            checked: function(a){return a.checked;}, 
     1413            selected: function(a){return a.selected||jQuery.attr(a,"selected");}, 
    11521414 
    11531415            // Form elements 
    1154             text: "'text'==a.type", 
    1155             radio: "'radio'==a.type", 
    1156             checkbox: "'checkbox'==a.type", 
    1157             file: "'file'==a.type", 
    1158             password: "'password'==a.type", 
    1159             submit: "'submit'==a.type", 
    1160             image: "'image'==a.type", 
    1161             reset: "'reset'==a.type", 
    1162             button: '"button"==a.type||jQuery.nodeName(a,"button")', 
    1163             input: "/input|select|textarea|button/i.test(a.nodeName)", 
     1416            text: function(a){return "text"==a.type;}, 
     1417            radio: function(a){return "radio"==a.type;}, 
     1418            checkbox: function(a){return "checkbox"==a.type;}, 
     1419            file: function(a){return "file"==a.type;}, 
     1420            password: function(a){return "password"==a.type;}, 
     1421            submit: function(a){return "submit"==a.type;}, 
     1422            image: function(a){return "image"==a.type;}, 
     1423            reset: function(a){return "reset"==a.type;}, 
     1424            button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");}, 
     1425            input: function(a){return /input|select|textarea|button/i.test(a.nodeName);}, 
    11641426 
    11651427            // :has() 
    1166             has: "jQuery.find(m[3],a).length", 
     1428            has: function(a,i,m){return jQuery.find(m[3],a).length;}, 
    11671429 
    11681430            // :header 
    1169             header: "/h\\d/i.test(a.nodeName)", 
     1431            header: function(a){return /h\d/i.test(a.nodeName);}, 
    11701432 
    11711433            // :animated 
    1172             animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length" 
    1173         } 
    1174     }, 
    1175      
     1434            animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;} 
     1435        } 
     1436    }, 
     1437 
    11761438    // The regular expressions that power the parsing engine 
    11771439    parse: [ 
     
    11821444        /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, 
    11831445 
    1184         // Match: :even, :last-chlid, #id, .class 
     1446        // Match: :even, :last-child, #id, .class 
    11851447        new RegExp("^([:.#]*)(" + chars + "+)") 
    11861448    ], 
     
    12041466            return [ t ]; 
    12051467 
    1206         // Make sure that the context is a DOM Element 
    1207         if ( context && !context.nodeType ) 
    1208             context = null; 
     1468        // check to make sure context is a DOM element or a document 
     1469        if ( context && context.nodeType != 1 && context.nodeType != 9) 
     1470            return [ ]; 
    12091471 
    12101472        // Set the correct context (if none is provided) 
     
    12121474 
    12131475        // Initialize the search 
    1214         var ret = [context], done = [], last; 
     1476        var ret = [context], done = [], last, nodeName; 
    12151477 
    12161478        // Continue while a selector expression exists, and while 
     
    12221484            t = jQuery.trim(t); 
    12231485 
    1224             var foundToken = false; 
     1486            var foundToken = false, 
    12251487 
    12261488            // An attempt at speeding up child selectors that 
    12271489            // point to a specific element tag 
    1228             var re = quickChild; 
    1229             var m = re.exec(t); 
     1490                re = quickChild, 
     1491 
     1492                m = re.exec(t); 
    12301493 
    12311494            if ( m ) { 
    1232                 var nodeName = m[1].toUpperCase(); 
     1495                nodeName = m[1].toUpperCase(); 
    12331496 
    12341497                // Perform our own iteration and filter 
    12351498                for ( var i = 0; ret[i]; i++ ) 
    12361499                    for ( var c = ret[i].firstChild; c; c = c.nextSibling ) 
    1237                         if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName.toUpperCase()) ) 
     1500                        if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) ) 
    12381501                            r.push( c ); 
    12391502 
     
    12481511                    r = []; 
    12491512 
    1250                     var nodeName = m[2], merge = {}; 
     1513                    var merge = {}; 
     1514                    nodeName = m[2].toUpperCase(); 
    12511515                    m = m[1]; 
    12521516 
     
    12581522 
    12591523                                if ( m == "~" && merge[id] ) break; 
    1260                                  
    1261                                 if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase() ) { 
     1524 
     1525                                if (!nodeName || n.nodeName.toUpperCase() == nodeName ) { 
    12621526                                    if ( m == "~" ) merge[id] = true; 
    12631527                                    r.push( n ); 
    12641528                                } 
    1265                                  
     1529 
    12661530                                if ( m == "+" ) break; 
    12671531                            } 
     
    12971561                    var re2 = quickID; 
    12981562                    var m = re2.exec(t); 
    1299                      
     1563 
    13001564                    // Re-organize the results, so that they're consistent 
    13011565                    if ( m ) { 
    1302                        m = [ 0, m[2], m[3], m[1] ]; 
     1566                        m = [ 0, m[2], m[3], m[1] ]; 
    13031567 
    13041568                    } else { 
     
    13171581                        // Optimization for HTML document case 
    13181582                        var oid = elem.getElementById(m[2]); 
    1319                          
     1583 
    13201584                        // Do a quick check for the existence of the actual ID attribute 
    13211585                        // to avoid selecting by the name attribute in IE 
     
    14051669 
    14061670        // Look for common filter expressions 
    1407         while ( t  && t != last ) { 
     1671        while ( t && t != last ) { 
    14081672            last = t; 
    14091673 
     
    14281692            // keeping it out of the expression list 
    14291693            if ( m[1] == ":" && m[2] == "not" ) 
    1430                 r = jQuery.filter(m[3], r, true).r; 
     1694                // optimize if only one selector found (most common case) 
     1695                r = isSimple.test( m[3] ) ? 
     1696                    jQuery.filter(m[3], r, true).r : 
     1697                    jQuery( r ).not( m[3] ); 
    14311698 
    14321699            // We can get a big speed boost by filtering by class here 
     
    14361703            else if ( m[1] == "[" ) { 
    14371704                var tmp = [], type = m[3]; 
    1438                  
     1705 
    14391706                for ( var i = 0, rl = r.length; i < rl; i++ ) { 
    14401707                    var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ]; 
    1441                      
     1708 
    14421709                    if ( z == null || /href|src|selected/.test(m[2]) ) 
    14431710                        z = jQuery.attr(a,m[2]) || ''; 
     
    14511718                            tmp.push( a ); 
    14521719                } 
    1453                  
     1720 
    14541721                r = tmp; 
    14551722 
     
    14571724            } else if ( m[1] == ":" && m[2] == "nth-child" ) { 
    14581725                var merge = {}, tmp = [], 
    1459                     test = /(\d*)n\+?(\d*)/.exec( 
     1726                    // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' 
     1727                    test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( 
    14601728                        m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || 
    1461                         !/\D/.test(m[3]) && "n+" + m[3] || m[3]), 
    1462                     first = (test[1] || 1) - 0, last = test[2] - 0; 
    1463  
     1729                        !/\D/.test(m[3]) && "0n+" + m[3] || m[3]), 
     1730                    // calculate the numbers (first)n+(last) including if they are negative 
     1731                    first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0; 
     1732 
     1733                // loop through all the elements left in the jQuery object 
    14641734                for ( var i = 0, rl = r.length; i < rl; i++ ) { 
    14651735                    var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode); 
     
    14771747                    var add = false; 
    14781748 
    1479                     if ( first == 1 ) { 
    1480                         if ( last == 0 || node.nodeIndex == last ) 
     1749                    if ( first == 0 ) { 
     1750                        if ( node.nodeIndex == last ) 
    14811751                            add = true; 
    1482                     } else if ( (node.nodeIndex + last) % first == 0 ) 
     1752                    } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 ) 
    14831753                        add = true; 
    14841754 
     
    14911761            // Otherwise, find the expression to execute 
    14921762            } else { 
    1493                 var f = jQuery.expr[m[1]]; 
    1494                 if ( typeof f != "string" ) 
    1495                     f = jQuery.expr[m[1]][m[2]]; 
    1496  
    1497                 // Build a custom macro to enclose it 
    1498                 f = eval("false||function(a,i){return " + f + "}"); 
     1763                var fn = jQuery.expr[ m[1] ]; 
     1764                if ( typeof fn == "object" ) 
     1765                    fn = fn[ m[2] ]; 
     1766 
     1767                if ( typeof fn == "string" ) 
     1768                    fn = eval("false||function(a,i){return " + fn + ";}"); 
    14991769 
    15001770                // Execute it against the current filter 
    1501                 r = jQuery.grep( r, f, not ); 
     1771                r = jQuery.grep( r, function(elem, i){ 
     1772                    return fn(elem, i, m, r); 
     1773                }, not ); 
    15021774            } 
    15031775        } 
     
    15091781 
    15101782    dir: function( elem, dir ){ 
    1511         var matched = []; 
    1512         var cur = elem[dir]; 
     1783        var matched = [], 
     1784            cur = elem[dir]; 
    15131785        while ( cur && cur != document ) { 
    15141786            if ( cur.nodeType == 1 ) 
     
    15181790        return matched; 
    15191791    }, 
    1520      
     1792 
    15211793    nth: function(cur,result,dir,elem){ 
    15221794        result = result || 1; 
     
    15291801        return cur; 
    15301802    }, 
    1531      
     1803 
    15321804    sibling: function( n, elem ) { 
    15331805        var r = []; 
    15341806 
    15351807        for ( ; n; n = n.nextSibling ) { 
    1536             if ( n.nodeType == 1 && (!elem || n != elem) ) 
     1808            if ( n.nodeType == 1 && n != elem ) 
    15371809                r.push( n ); 
    15381810        } 
     
    15431815/* 
    15441816 * A number of helper functions used for managing events. 
    1545  * Many of the ideas behind this code orignated from  
     1817 * Many of the ideas behind this code orignated from 
    15461818 * Dean Edwards' addEvent library. 
    15471819 */ 
     
    15501822    // Bind an event to an element 
    15511823    // Original by Dean Edwards 
    1552     add: function(element, type, handler, data) { 
     1824    add: function(elem, types, handler, data) { 
     1825        if ( elem.nodeType == 3 || elem.nodeType == 8 ) 
     1826            return; 
     1827 
    15531828        // For whatever reason, IE has trouble passing the window object 
    15541829        // around, causing it to be cloned in the process 
    1555         if ( jQuery.browser.msie && element.setInterval != undefined ) 
    1556             element = window; 
     1830        if ( jQuery.browser.msie && elem.setInterval ) 
     1831            elem = window; 
    15571832 
    15581833        // Make sure that the function being executed has a unique ID 
    15591834        if ( !handler.guid ) 
    15601835            handler.guid = this.guid++; 
    1561              
    1562         // if data is passed, bind to handler  
    1563         if( data != undefined ) {  
    1564                 // Create temporary function pointer to original handler  
    1565             var fn = handler;  
    1566  
    1567             // Create unique handler function, wrapped around original handler  
    1568             handler = function() {  
    1569                 // Pass arguments and context to original handler  
    1570                 return fn.apply(this, arguments);  
    1571             }; 
    1572  
    1573             // Store data in unique handler  
     1836 
     1837        // if data is passed, bind to handler 
     1838        if( data != undefined ) { 
     1839            // Create temporary function pointer to original handler 
     1840            var fn = handler; 
     1841 
     1842            // Create unique handler function, wrapped around original handler 
     1843            handler = this.proxy( fn, function() { 
     1844                // Pass arguments and context to original handler 
     1845                return fn.apply(this, arguments); 
     1846            }); 
     1847 
     1848            // Store data in unique handler 
    15741849            handler.data = data; 
    1575  
    1576             // Set the guid of unique handler to the same of original handler, so it can be removed  
    1577             handler.guid = fn.guid; 
    1578         } 
    1579  
    1580         // Namespaced event handlers 
    1581         var parts = type.split("."); 
    1582         type = parts[0]; 
    1583         handler.type = parts[1]; 
     1850        } 
    15841851 
    15851852        // Init the element's event structure 
    1586         var events = jQuery.data(element, "events") || jQuery.data(element, "events", {}); 
    1587          
    1588         var handle = jQuery.data(element, "handle", function(){ 
    1589             // returned undefined or false 
    1590             var val; 
    1591  
    1592             // Handle the second event of a trigger and when 
    1593             // an event is called after a page has unloaded 
    1594             if ( typeof jQuery == "undefined" || jQuery.event.triggered ) 
    1595                 return val; 
    1596              
    1597             val = jQuery.event.handle.apply(element, arguments); 
    1598              
    1599             return val; 
     1853        var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), 
     1854            handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ 
     1855                // Handle the second event of a trigger and when 
     1856                // an event is called after a page has unloaded 
     1857                if ( typeof jQuery != "undefined" && !jQuery.event.triggered ) 
     1858                    return jQuery.event.handle.apply(arguments.callee.elem, arguments); 
     1859            }); 
     1860        // Add elem as a property of the handle function 
     1861        // This is to prevent a memory leak with non-native 
     1862        // event in IE. 
     1863        handle.elem = elem; 
     1864 
     1865        // Handle multiple events separated by a space 
     1866        // jQuery(...).bind("mouseover mouseout", fn); 
     1867        jQuery.each(types.split(/\s+/), function(index, type) { 
     1868            // Namespaced event handlers 
     1869            var parts = type.split("."); 
     1870            type = parts[0]; 
     1871            handler.type = parts[1]; 
     1872 
     1873            // Get the current list of functions bound to this event 
     1874            var handlers = events[type]; 
     1875 
     1876            // Init the event handler queue 
     1877            if (!handlers) { 
     1878                handlers = events[type] = {}; 
     1879 
     1880                // Check for a special event handler 
     1881                // Only use addEventListener/attachEvent if the special 
     1882                // events handler returns false 
     1883                if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) { 
     1884                    // Bind the global event handler to the element 
     1885                    if (elem.addEventListener) 
     1886                        elem.addEventListener(type, handle, false); 
     1887                    else if (elem.attachEvent) 
     1888                        elem.attachEvent("on" + type, handle); 
     1889                } 
     1890            } 
     1891 
     1892            // Add the function to the element's handler list 
     1893            handlers[handler.guid] = handler; 
     1894 
     1895            // Keep track of which events have been used, for global triggering 
     1896            jQuery.event.global[type] = true; 
    16001897        }); 
    16011898 
    1602         // Get the current list of functions bound to this event 
    1603         var handlers = events[type]; 
    1604  
    1605         // Init the event handler queue 
    1606         if (!handlers) { 
    1607             handlers = events[type] = {};    
    1608              
    1609             // And bind the global event handler to the element 
    1610             if (element.addEventListener) 
    1611                 element.addEventListener(type, handle, false); 
    1612             else 
    1613                 element.attachEvent("on" + type, handle); 
    1614         } 
    1615  
    1616         // Add the function to the element's handler list 
    1617         handlers[handler.guid] = handler; 
    1618  
    1619         // Keep track of which events have been used, for global triggering 
    1620         this.global[type] = true; 
     1899        // Nullify elem to prevent memory leaks in IE 
     1900        elem = null; 
    16211901    }, 
    16221902 
     
    16251905 
    16261906    // Detach an event or set of events from an element 
    1627     remove: function(element, type, handler) { 
    1628         var events = jQuery.data(element, "events"), ret, index; 
    1629  
    1630         // Namespaced event handlers 
    1631         if ( typeof type == "string" ) { 
    1632             var parts = type.split("."); 
    1633             type = parts[0]; 
    1634         } 
     1907    remove: function(elem, types, handler) { 
     1908        // don't do events on text and comment nodes 
     1909        if ( elem.nodeType == 3 || elem.nodeType == 8 ) 
     1910            return; 
     1911 
     1912        var events = jQuery.data(elem, "events"), ret, index; 
    16351913 
    16361914        if ( events ) { 
    1637             // type is actually an event object here 
    1638             if ( type && type.type ) { 
    1639                 handler = type.handler; 
    1640                 type = type.type; 
    1641             } 
    1642              
    1643             if ( !type ) { 
    1644                 for ( type in events ) 
    1645                     this.remove( element, type ); 
    1646  
    1647             } else if ( events[type] ) { 
    1648                 // remove the given handler for the given type 
    1649                 if ( handler ) 
    1650                     delete events[type][handler.guid]; 
    1651                  
    1652                 // remove all handlers for the given type 
    1653                 else 
    1654                     for ( handler in events[type] ) 
    1655                         // Handle the removal of namespaced events 
    1656                         if ( !parts[1] || events[type][handler].type == parts[1] ) 
    1657                             delete events[type][handler]; 
    1658  
    1659                 // remove generic event handler if no more handlers exist 
    1660                 for ( ret in events[type] ) break; 
    1661                 if ( !ret ) { 
    1662                     if (element.removeEventListener) 
    1663                         element.removeEventListener(type, jQuery.data(element, "handle"), false); 
    1664                     else 
    1665                         element.detachEvent("on" + type, jQuery.data(element, "handle")); 
    1666                     ret = null; 
    1667                     delete events[type]; 
     1915            // Unbind all events for the element 
     1916            if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") ) 
     1917                for ( var type in events ) 
     1918                    this.remove( elem, type + (types || "") ); 
     1919            else { 
     1920                // types is actually an event object here 
     1921                if ( types.type ) { 
     1922                    handler = types.handler; 
     1923                    types = types.type; 
    16681924                } 
     1925 
     1926                // Handle multiple events seperated by a space 
     1927                // jQuery(...).unbind("mouseover mouseout", fn); 
     1928                jQuery.each(types.split(/\s+/), function(index, type){ 
     1929                    // Namespaced event handlers 
     1930                    var parts = type.split("."); 
     1931                    type = parts[0]; 
     1932 
     1933                    if ( events[type] ) { 
     1934                        // remove the given handler for the given type 
     1935                        if ( handler ) 
     1936                            delete events[type][handler.guid]; 
     1937 
     1938                        // remove all handlers for the given type 
     1939                        else 
     1940                            for ( handler in events[type] ) 
     1941                                // Handle the removal of namespaced events 
     1942                                if ( !parts[1] || events[type][handler].type == parts[1] ) 
     1943                                    delete events[type][handler]; 
     1944 
     1945                        // remove generic event handler if no more handlers exist 
     1946                        for ( ret in events[type] ) break; 
     1947                        if ( !ret ) { 
     1948                            if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) { 
     1949                                if (elem.removeEventListener) 
     1950                                    elem.removeEventListener(type, jQuery.data(elem, "handle"), false); 
     1951                                else if (elem.detachEvent) 
     1952                                    elem.detachEvent("on" + type, jQuery.data(elem, "handle")); 
     1953                            } 
     1954                            ret = null; 
     1955                            delete events[type]; 
     1956                        } 
     1957                    } 
     1958                }); 
    16691959            } 
    16701960 
     
    16721962            for ( ret in events ) break; 
    16731963            if ( !ret ) { 
    1674                 jQuery.removeData( element, "events" ); 
    1675                 jQuery.removeData( element, "handle" ); 
    1676             } 
    1677         } 
    1678     }, 
    1679  
    1680     trigger: function(type, data, element, donative, extra) { 
     1964                var handle = jQuery.data( elem, "handle" ); 
     1965                if ( handle ) handle.elem = null; 
     1966                jQuery.removeData( elem, "events" ); 
     1967                jQuery.removeData( elem, "handle" ); 
     1968            } 
     1969        } 
     1970    }, 
     1971 
     1972    trigger: function(type, data, elem, donative, extra) { 
    16811973        // Clone the incoming data, if any 
    1682         data = jQuery.makeArray(data || []); 
     1974        data = jQuery.makeArray(data); 
     1975 
     1976        if ( type.indexOf("!") >= 0 ) { 
     1977            type = type.slice(0, -1); 
     1978            var exclusive = true; 
     1979        } 
    16831980 
    16841981        // Handle a global trigger 
    1685         if ( !element ) { 
     1982        if ( !elem ) { 
    16861983            // Only trigger if we've ever bound an event for it 
    16871984            if ( this.global[type] ) 
     
    16901987        // Handle triggering a single element 
    16911988        } else { 
    1692             var val, ret, fn = jQuery.isFunction( element[ type ] || null ), 
     1989            // don't do events on text and comment nodes 
     1990            if ( elem.nodeType == 3 || elem.nodeType == 8 ) 
     1991                return undefined; 
     1992 
     1993            var val, ret, fn = jQuery.isFunction( elem[ type ] || null ), 
    16931994                // Check to see if we need to provide a fake event, or not 
    1694                 evt = !data[0] || !data[0].preventDefault; 
    1695              
     1995                event = !data[0] || !data[0].preventDefault; 
     1996 
    16961997            // Pass along a fake event 
    1697             if ( evt ) 
    1698                 data.unshift( this.fix({ type: type, target: element }) ); 
    1699  
    1700             // Trigger the event 
    1701             if ( jQuery.isFunction( jQuery.data(element, "handle") ) ) 
    1702                 val = jQuery.data(element, "handle").apply( element, data ); 
    1703  
    1704             // Handle triggering native .onfoo handlers 
    1705             if ( !fn && element["on"+type] && element["on"+type].apply( element, data ) === false ) 
     1998            if ( event ) { 
     1999                data.unshift({ 
     2000                    type: type, 
     2001                    target: elem, 
     2002                    preventDefault: function(){}, 
     2003                    stopPropagation: function(){}, 
     2004                    timeStamp: now() 
     2005                }); 
     2006                data[0][expando] = true; // no need to fix fake event 
     2007            } 
     2008 
     2009            // Enforce the right trigger type 
     2010            data[0].type = type; 
     2011            if ( exclusive ) 
     2012                data[0].exclusive = true; 
     2013 
     2014            // Trigger the event, it is assumed that "handle" is a function 
     2015            var handle = jQuery.data(elem, "handle"); 
     2016            if ( handle ) 
     2017                val = handle.apply( elem, data ); 
     2018 
     2019            // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) 
     2020            if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) 
    17062021                val = false; 
    17072022 
    17082023            // Extra functions don't get the custom event object 
    1709             if ( evt ) 
     2024            if ( event ) 
    17102025                data.shift(); 
    17112026 
    17122027            // Handle triggering of extra function 
    1713             if ( extra && extra.apply( element, data ) === false ) 
    1714                 val = false; 
     2028            if ( extra && jQuery.isFunction( extra ) ) { 
     2029                // call the extra function and tack the current return value on the end for possible inspection 
     2030                ret = extra.apply( elem, val == null ? data : data.concat( val ) ); 
     2031                // if anything is returned, give it precedence and have it overwrite the previous value 
     2032                if (ret !== undefined) 
     2033                    val = ret; 
     2034            } 
    17152035 
    17162036            // Trigger the native events (except for clicks on links) 
    1717             if ( fn && donative !== false && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) { 
     2037            if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) { 
    17182038                this.triggered = true; 
    1719                 element[ type ](); 
     2039                try { 
     2040                    elem[ type ](); 
     2041                // prevent IE from throwing an error for some hidden elements 
     2042                } catch (e) {} 
    17202043            } 
    17212044 
     
    17282051    handle: function(event) { 
    17292052        // returned undefined or false 
    1730         var val; 
    1731  
    1732         // Empty object is for triggered events with no data 
    1733         event = jQuery.event.fix( event || window.event || {} );  
     2053        var val, ret, namespace, all, handlers; 
     2054 
     2055        event = arguments[0] = jQuery.event.fix( event || window.event ); 
    17342056 
    17352057        // Namespaced event handlers 
    1736         var parts = event.type.split("."); 
    1737         event.type = parts[0]; 
    1738  
    1739         var c = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 ); 
    1740         args.unshift( event ); 
    1741  
    1742         for ( var j in c ) { 
    1743             // Pass in a reference to the handler function itself 
    1744             // So that we can later remove it 
    1745             args[0].handler = c[j]; 
    1746             args[0].data = c[j].data; 
     2058        namespace = event.type.split("."); 
     2059        event.type = namespace[0]; 
     2060        namespace = namespace[1]; 
     2061        // Cache this now, all = true means, any handler 
     2062        all = !namespace && !event.exclusive; 
     2063 
     2064        handlers = ( jQuery.data(this, "events") || {} )[event.type]; 
     2065 
     2066        for ( var j in handlers ) { 
     2067            var handler = handlers[j]; 
    17472068 
    17482069            // Filter the functions by class 
    1749             if ( !parts[1] || c[j].type == parts[1] ) { 
    1750                 var tmp = c[j].apply( this, args ); 
     2070            if ( all || handler.type == namespace ) { 
     2071                // Pass in a reference to the handler function itself 
     2072                // So that we can later remove it 
     2073                event.handler = handler; 
     2074                event.data = handler.data; 
     2075 
     2076                ret = handler.apply( this, arguments ); 
    17512077 
    17522078                if ( val !== false ) 
    1753                     val = tmp; 
    1754  
    1755                 if ( tmp === false ) { 
     2079                    val = ret; 
     2080 
     2081                if ( ret === false ) { 
    17562082                    event.preventDefault(); 
    17572083                    event.stopPropagation(); 
     
    17602086        } 
    17612087 
    1762         // Clean up added properties in IE to prevent memory leak 
    1763         if (jQuery.browser.msie) 
    1764             event.target = event.preventDefault = event.stopPropagation = 
    1765                 event.handler = event.data = null; 
    1766  
    17672088        return val; 
    17682089    }, 
    17692090 
    17702091    fix: function(event) { 
    1771         // store a copy of the original event object  
    1772         // and clone to set read-only properties 
     2092        if ( event[expando] == true ) 
     2093            return event; 
     2094 
     2095        // store a copy of the original event object 
     2096        // and "clone" to set read-only properties 
    17732097        var originalEvent = event; 
    1774         event = jQuery.extend({}, originalEvent); 
    1775          
    1776         // add preventDefault and stopPropagation since  
     2098        event = { originalEvent: originalEvent }; 
     2099        var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" "); 
     2100        for ( var i=props.length; i; i-- ) 
     2101            event[ props[i] ] = originalEvent[ props[i] ]; 
     2102 
     2103        // Mark it as fixed 
     2104        event[expando] = true; 
     2105 
     2106        // add preventDefault and stopPropagation since 
    17772107        // they will not work on the clone 
    17782108        event.preventDefault = function() { 
     
    17902120            originalEvent.cancelBubble = true; 
    17912121        }; 
    1792          
     2122 
     2123        // Fix timeStamp 
     2124        event.timeStamp = event.timeStamp || now(); 
     2125 
    17932126        // Fix target property, if necessary 
    1794         if ( !event.target && event.srcElement ) 
    1795             event.target = event.srcElement; 
    1796                  
     2127        if ( !event.target ) 
     2128            event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either 
     2129 
    17972130        // check if target is a textnode (safari) 
    1798         if (jQuery.browser.safari && event.target.nodeType == 3) 
    1799             event.target = originalEvent.target.parentNode; 
     2131        if ( event.target.nodeType == 3 ) 
     2132            event.target = event.target.parentNode; 
    18002133 
    18012134        // Add relatedTarget, if necessary 
     
    18052138        // Calculate pageX/Y if missing and clientX/Y available 
    18062139        if ( event.pageX == null && event.clientX != null ) { 
    1807             var e = document.documentElement, b = document.body; 
    1808             event.pageX = event.clientX + (e && e.scrollLeft || b.scrollLeft || 0); 
    1809             event.pageY = event.clientY + (e && e.scrollTop || b.scrollTop || 0); 
    1810         } 
    1811              
     2140            var doc = document.documentElement, body = document.body; 
     2141            event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); 
     2142            event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); 
     2143        } 
     2144 
    18122145        // Add which for key events 
    1813         if ( !event.which && (event.charCode || event.keyCode) ) 
     2146        if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) 
    18142147            event.which = event.charCode || event.keyCode; 
    1815          
     2148 
    18162149        // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) 
    18172150        if ( !event.metaKey && event.ctrlKey ) 
     
    18222155        if ( !event.which && event.button ) 
    18232156            event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); 
    1824              
     2157 
    18252158        return event; 
     2159    }, 
     2160 
     2161    proxy: function( fn, proxy ){ 
     2162        // Set the guid of unique handler to the same of original handler, so it can be removed 
     2163        proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; 
     2164        // So proxy can be declared as an argument 
     2165        return proxy; 
     2166    }, 
     2167 
     2168    special: { 
     2169        ready: { 
     2170            setup: function() { 
     2171                // Make sure the ready event is setup 
     2172                bindReady(); 
     2173                return; 
     2174            }, 
     2175 
     2176            teardown: function() { return; } 
     2177        }, 
     2178 
     2179        mouseenter: { 
     2180            setup: function() { 
     2181                if ( jQuery.browser.msie ) return false; 
     2182                jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler); 
     2183                return true; 
     2184            }, 
     2185 
     2186            teardown: function() { 
     2187                if ( jQuery.browser.msie ) return false; 
     2188                jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler); 
     2189                return true; 
     2190            }, 
     2191 
     2192            handler: function(event) { 
     2193                // If we actually just moused on to a sub-element, ignore it 
     2194                if ( withinElement(event, this) ) return true; 
     2195                // Execute the right handlers by setting the event type to mouseenter 
     2196                event.type = "mouseenter"; 
     2197                return jQuery.event.handle.apply(this, arguments); 
     2198            } 
     2199        }, 
     2200 
     2201        mouseleave: { 
     2202            setup: function() { 
     2203                if ( jQuery.browser.msie ) return false; 
     2204                jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler); 
     2205                return true; 
     2206            }, 
     2207 
     2208            teardown: function() { 
     2209                if ( jQuery.browser.msie ) return false; 
     2210                jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler); 
     2211                return true; 
     2212            }, 
     2213 
     2214            handler: function(event) { 
     2215                // If we actually just moused on to a sub-element, ignore it 
     2216                if ( withinElement(event, this) ) return true; 
     2217                // Execute the right handlers by setting the event type to mouseleave 
     2218                event.type = "mouseleave"; 
     2219                return jQuery.event.handle.apply(this, arguments); 
     2220            } 
     2221        } 
    18262222    } 
    18272223}; 
     
    18332229        }); 
    18342230    }, 
    1835      
     2231 
    18362232    one: function( type, data, fn ) { 
     2233        var one = jQuery.event.proxy( fn || data, function(event) { 
     2234            jQuery(this).unbind(event, one); 
     2235            return (fn || data).apply( this, arguments ); 
     2236        }); 
    18372237        return this.each(function(){ 
    1838             jQuery.event.add( this, type, function(event) { 
    1839                 jQuery(this).unbind(event); 
    1840                 return (fn || data).apply( this, arguments); 
    1841             }, fn && data); 
     2238            jQuery.event.add( this, type, one, fn && data); 
    18422239        }); 
    18432240    }, 
     
    18562253 
    18572254    triggerHandler: function( type, data, fn ) { 
    1858         if ( this[0] ) 
    1859             return jQuery.event.trigger( type, data, this[0], false, fn ); 
    1860     }, 
    1861  
    1862     toggle: function() { 
     2255        return this[0] && jQuery.event.trigger( type, data, this[0], false, fn ); 
     2256    }, 
     2257 
     2258    toggle: function( fn ) { 
    18632259        // Save reference to arguments for access in closure 
    1864         var a = arguments; 
    1865  
    1866         return this.click(function(e) { 
     2260        var args = arguments, i = 1; 
     2261 
     2262        // link all the functions, so any of them can unbind this click handler 
     2263        while( i < args.length ) 
     2264            jQuery.event.proxy( fn, args[i++] ); 
     2265 
     2266        return this.click( jQuery.event.proxy( fn, function(event) { 
    18672267            // Figure out which function to execute 
    1868             this.lastToggle = 0 == this.lastToggle ? 1 : 0; 
    1869              
     2268            this.lastToggle = ( this.lastToggle || 0 ) % i; 
     2269 
    18702270            // Make sure that clicks stop 
    1871             e.preventDefault(); 
    1872              
     2271            event.preventDefault(); 
     2272 
    18732273            // and execute the function 
    1874             return a[this.lastToggle].apply( this, [e] ) || false; 
    1875         }); 
    1876     }, 
    1877  
    1878     hover: function(f,g) { 
    1879          
    1880         // A private function for handling mouse 'hovering' 
    1881         function handleHover(e) { 
    1882             // Check if mouse(over|out) are still within the same parent element 
    1883             var p = e.relatedTarget; 
    1884      
    1885             // Traverse up the tree 
    1886             while ( p && p != this ) try { p = p.parentNode; } catch(e) { p = this; }; 
    1887              
    1888             // If we actually just moused on to a sub-element, ignore it 
    1889             if ( p == this ) return false; 
    1890              
    1891             // Execute the right function 
    1892             return (e.type == "mouseover" ? f : g).apply(this, [e]); 
    1893         } 
    1894          
    1895         // Bind the function to the two event listeners 
    1896         return this.mouseover(handleHover).mouseout(handleHover); 
    1897     }, 
    1898      
    1899     ready: function(f) { 
     2274            return args[ this.lastToggle++ ].apply( this, arguments ) || false; 
     2275        })); 
     2276    }, 
     2277 
     2278    hover: function(fnOver, fnOut) { 
     2279        return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); 
     2280    }, 
     2281 
     2282    ready: function(fn) { 
    19002283        // Attach the listeners 
    19012284        bindReady(); 
     
    19042287        if ( jQuery.isReady ) 
    19052288            // Execute the function immediately 
    1906             f.apply( document, [jQuery] ); 
    1907              
     2289            fn.call( document, jQuery ); 
     2290 
    19082291        // Otherwise, remember the function for later 
    19092292        else 
    19102293            // Add the function to the wait list 
    1911             jQuery.readyList.push( function() { return f.apply(this, [jQuery]); } ); 
    1912      
     2294            jQuery.readyList.push( function() { return fn.call(this, jQuery); } ); 
     2295 
    19132296        return this; 
    19142297    } 
     
    19162299 
    19172300jQuery.extend({ 
    1918     /* 
    1919      * All the code that makes DOM Ready work nicely. 
    1920      */ 
    19212301    isReady: false, 
    19222302    readyList: [], 
    1923      
    19242303    // Handle when the DOM is ready 
    19252304    ready: function() { 
     
    19282307            // Remember that the DOM is ready 
    19292308            jQuery.isReady = true; 
    1930              
     2309 
    19312310            // If there are functions bound, to execute 
    19322311            if ( jQuery.readyList ) { 
    19332312                // Execute all of them 
    19342313                jQuery.each( jQuery.readyList, function(){ 
    1935                     this.apply( document ); 
     2314                    this.call( document ); 
    19362315                }); 
    1937                  
     2316 
    19382317                // Reset the list of functions 
    19392318                jQuery.readyList = null; 
    19402319            } 
    1941             // Remove event listener to avoid memory leak 
    1942             if ( jQuery.browser.mozilla || jQuery.browser.opera ) 
    1943                 document.removeEventListener( "DOMContentLoaded", jQuery.ready, false ); 
    1944              
    1945             // Remove script element used by IE hack 
    1946             if( !window.frames.length ) // don't remove if frames are present (#1187) 
    1947                 jQuery(window).load(function(){ jQuery("#__ie_init").remove(); }); 
     2320 
     2321            // Trigger any bound ready events 
     2322            jQuery(document).triggerHandler("ready"); 
    19482323        } 
    19492324    } 
    1950 }); 
    1951  
    1952 jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + 
    1953     "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +  
    1954     "submit,keydown,keypress,keyup,error").split(","), function(i,o){ 
    1955      
    1956     // Handle event binding 
    1957     jQuery.fn[o] = function(f){ 
    1958         return f ? this.bind(o, f) : this.trigger(o); 
    1959     }; 
    19602325}); 
    19612326 
     
    19662331    readyBound = true; 
    19672332 
    1968     // If Mozilla is used 
    1969     if ( jQuery.browser.mozilla || jQuery.browser.opera ) 
     2333    // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event 
     2334    if ( document.addEventListener && !jQuery.browser.opera) 
    19702335        // Use the handy event callback 
    19712336        document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); 
    1972      
    1973     // If IE is used, use the excellent hack by Matthias Miller 
    1974     // http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited 
    1975     else if ( jQuery.browser.msie ) { 
    1976      
    1977         // Only works if you document.write() it 
    1978         document.write("<scr" + "ipt id=__ie_init defer=true " +  
    1979             "src=//:><\/script>"); 
    1980      
    1981         // Use the defer script hack 
    1982         var script = document.getElementById("__ie_init"); 
    1983          
    1984         // script does not exist if jQuery is loaded dynamically 
    1985         if ( script )  
    1986             script.onreadystatechange = function() { 
    1987                 if ( this.readyState != "complete" ) return; 
    1988                 jQuery.ready(); 
    1989             }; 
    1990      
    1991         // Clear from memory 
    1992         script = null; 
    1993      
    1994     // If Safari  is used 
    1995     } else if ( jQuery.browser.safari ) 
    1996         // Continually check to see if the document.readyState is valid 
    1997         jQuery.safariTimer = setInterval(function(){ 
    1998             // loaded and complete are both valid states 
    1999             if ( document.readyState == "loaded" ||  
    2000                 document.readyState == "complete" ) { 
    2001      
    2002                 // If either one are found, remove the timer 
    2003                 clearInterval( jQuery.safariTimer ); 
    2004                 jQuery.safariTimer = null; 
    2005      
    2006                 // and execute any waiting functions 
    2007                 jQuery.ready(); 
    2008             } 
    2009         }, 10);  
     2337 
     2338    // If IE is used and is not in a frame 
     2339    // Continually check to see if the document is ready 
     2340    if ( jQuery.browser.msie && window == top ) (function(){ 
     2341        if (jQuery.isReady) return; 
     2342        try { 
     2343            // If IE is used, use the trick by Diego Perini 
     2344            // http://javascript.nwbox.com/IEContentLoaded/ 
     2345            document.documentElement.doScroll("left"); 
     2346        } catch( error ) { 
     2347            setTimeout( arguments.callee, 0 ); 
     2348            return; 
     2349        } 
     2350        // and execute any waiting functions 
     2351        jQuery.ready(); 
     2352    })(); 
     2353 
     2354    if ( jQuery.browser.opera ) 
     2355        document.addEventListener( "DOMContentLoaded", function () { 
     2356            if (jQuery.isReady) return; 
     2357            for (var i = 0; i < document.styleSheets.length; i++) 
     2358                if (document.styleSheets[i].disabled) { 
     2359                    setTimeout( arguments.callee, 0 ); 
     2360                    return; 
     2361                } 
     2362            // and execute any waiting functions 
     2363            jQuery.ready(); 
     2364        }, false); 
     2365 
     2366    if ( jQuery.browser.safari ) { 
     2367        var numStyles; 
     2368        (function(){ 
     2369            if (jQuery.isReady) return; 
     2370            if ( document.readyState != "loaded" && document.readyState != "complete" ) { 
     2371                setTimeout( arguments.callee, 0 ); 
     2372                return; 
     2373            } 
     2374            if ( numStyles === undefined ) 
     2375                numStyles = jQuery("style, link[rel=stylesheet]").length; 
     2376            if ( document.styleSheets.length != numStyles ) { 
     2377                setTimeout( arguments.callee, 0 ); 
     2378                return; 
     2379            } 
     2380            // and execute any waiting functions 
     2381            jQuery.ready(); 
     2382        })(); 
     2383    } 
    20102384 
    20112385    // A fallback to window.onload, that will always work 
    20122386    jQuery.event.add( window, "load", jQuery.ready ); 
    20132387} 
     2388 
     2389jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + 
     2390    "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + 
     2391    "submit,keydown,keypress,keyup,error").split(","), function(i, name){ 
     2392 
     2393    // Handle event binding 
     2394    jQuery.fn[name] = function(fn){ 
     2395        return fn ? this.bind(name, fn) : this.trigger(name); 
     2396    }; 
     2397}); 
     2398 
     2399// Checks if an event happened on an element within another element 
     2400// Used in jQuery.event.special.mouseenter and mouseleave handlers 
     2401var withinElement = function(event, elem) { 
     2402    // Check if mouse(over|out) are still within the same parent element 
     2403    var parent = event.relatedTarget; 
     2404    // Traverse up the tree 
     2405    while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; } 
     2406    // Return true if we actually just moused on to a sub-element 
     2407    return parent == elem; 
     2408}; 
     2409 
     2410// Prevent memory leaks in IE 
     2411// And prevent errors on refresh with events like mouseover in other browsers 
     2412// Window isn't included so as not to unbind existing unload events 
     2413jQuery(window).bind("unload", function() { 
     2414    jQuery("*").add(document).unbind(); 
     2415}); 
    20142416jQuery.fn.extend({ 
     2417    // Keep a copy of the old load 
     2418    _load: jQuery.fn.load, 
     2419 
    20152420    load: function( url, params, callback ) { 
    2016         if ( jQuery.isFunction( url ) ) 
    2017             return this.bind("load", url); 
     2421        if ( typeof url != 'string' ) 
     2422            return this._load( url ); 
    20182423 
    20192424        var off = url.indexOf(" "); 
     
    20482453            url: url, 
    20492454            type: type, 
     2455            dataType: "html", 
    20502456            data: params, 
    20512457            complete: function(res, status){ 
     
    20662472                        res.responseText ); 
    20672473 
    2068                 // Add delay to account for Safari's delay in globalEval 
    2069                 setTimeout(function(){ 
    2070                     self.each( callback, [res.responseText, status, res] ); 
    2071                 }, 13); 
     2474                self.each( callback, [res.responseText, status, res] ); 
    20722475            } 
    20732476        }); 
     
    20842487        }) 
    20852488        .filter(function(){ 
    2086             return this.name && !this.disabled &&  
    2087                 (this.checked || /select|textarea/i.test(this.nodeName) ||  
     2489            return this.name && !this.disabled && 
     2490                (this.checked || /select|textarea/i.test(this.nodeName) || 
    20882491                    /text|hidden|password/i.test(this.type)); 
    20892492        }) 
     
    20922495            return val == null ? null : 
    20932496                val.constructor == Array ? 
    2094                     jQuery.map( val, function(i, val){ 
     2497                    jQuery.map( val, function(val, i){ 
    20952498                        return {name: elem.name, value: val}; 
    20962499                    }) : 
     
    21072510}); 
    21082511 
    2109 var jsc = (new Date).getTime(); 
     2512var jsc = now(); 
    21102513 
    21112514jQuery.extend({ 
     
    21162519            data = null; 
    21172520        } 
    2118          
     2521 
    21192522        return jQuery.ajax({ 
    21202523            type: "GET", 
     
    21542557 
    21552558    ajaxSettings: { 
     2559        url: location.href, 
    21562560        global: true, 
    21572561        type: "GET", 
     
    21602564        processData: true, 
    21612565        async: true, 
    2162         data: null 
    2163     }, 
    2164      
     2566        data: null, 
     2567        username: null, 
     2568        password: null, 
     2569        accepts: { 
     2570            xml: "application/xml, text/xml", 
     2571            html: "text/html", 
     2572            script: "text/javascript, application/javascript", 
     2573            json: "application/json, text/javascript", 
     2574            text: "text/plain", 
     2575            _default: "*/*" 
     2576        } 
     2577    }, 
     2578 
    21652579    // Last-Modified header cache for next request 
    21662580    lastModified: {}, 
    21672581 
    21682582    ajax: function( s ) { 
    2169         var jsonp, jsre = /=(\?|%3F)/g, status, data; 
    2170  
    21712583        // Extend the settings, but re-extend 's' so that it can be 
    21722584        // checked again later (in the test suite, specifically) 
    21732585        s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); 
    21742586 
     2587        var jsonp, jsre = /=\?(&|$)/g, status, data, 
     2588            type = s.type.toUpperCase(); 
     2589 
    21752590        // convert data if not already a string 
    21762591        if ( s.data && s.processData && typeof s.data != "string" ) 
    21772592            s.data = jQuery.param(s.data); 
    21782593 
    2179         // Break the data into one single string 
    2180         var q = s.url.indexOf("?"); 
    2181         if ( q > -1 ) { 
    2182             s.data = (s.data ? s.data + "&" : "") + s.url.slice(q + 1); 
    2183             s.url = s.url.slice(0, q); 
    2184         } 
    2185  
    21862594        // Handle JSONP Parameter Callbacks 
    21872595        if ( s.dataType == "jsonp" ) { 
    2188             if ( !s.data || !s.data.match(jsre) ) 
     2596            if ( type == "GET" ) { 
     2597                if ( !s.url.match(jsre) ) 
     2598                    s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; 
     2599            } else if ( !s.data || !s.data.match(jsre) ) 
    21892600                s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; 
    21902601            s.dataType = "json"; 
     
    21922603 
    21932604        // Build temporary JSONP function 
    2194         if ( s.dataType == "json" && s.data && s.data.match(jsre) ) { 
     2605        if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { 
    21952606            jsonp = "jsonp" + jsc++; 
    2196             s.data = s.data.replace(jsre, "=" + jsonp); 
     2607 
     2608            // Replace the =? sequence both in the query string and the data 
     2609            if ( s.data ) 
     2610                s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); 
     2611            s.url = s.url.replace(jsre, "=" + jsonp + "$1"); 
    21972612 
    21982613            // We need to make sure 
     
    22042619                data = tmp; 
    22052620                success(); 
     2621                complete(); 
    22062622                // Garbage collect 
    22072623                window[ jsonp ] = undefined; 
    22082624                try{ delete window[ jsonp ]; } catch(e){} 
     2625                if ( head ) 
     2626                    head.removeChild( script ); 
    22092627            }; 
    22102628        } 
     
    22132631            s.cache = false; 
    22142632 
    2215         if ( s.cache === false && s.type.toLowerCase() == "get" ) 
    2216             s.data = (s.data ? s.data + "&" : "") + "_=" + (new Date()).getTime(); 
     2633        if ( s.cache === false && type == "GET" ) { 
     2634            var ts = now(); 
     2635            // try replacing _= if it is there 
     2636            var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); 
     2637            // if nothing was replaced, add timestamp to the end 
     2638            s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); 
     2639        } 
    22172640 
    22182641        // If data is available, append data to url for get requests 
    2219         if ( s.data && s.type.toLowerCase() == "get" ) { 
    2220             s.url += "?" + s.data; 
     2642        if ( s.data && type == "GET" ) { 
     2643            s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; 
    22212644 
    22222645            // IE likes to send both get and post data, prevent this 
     
    22282651            jQuery.event.trigger( "ajaxStart" ); 
    22292652 
     2653        // Matches an absolute URL, and saves the domain 
     2654        var remote = /^(?:\w+:)?\/\/([^\/?#]+)/; 
     2655 
    22302656        // If we're requesting a remote document 
    2231         // and trying to load JSON or Script 
    2232         if ( !s.url.indexOf("http") && s.dataType == "script" ) { 
     2657        // and trying to load JSON or Script with a GET 
     2658        if ( s.dataType == "script" && type == "GET" 
     2659                && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){ 
    22332660            var head = document.getElementsByTagName("head")[0]; 
    22342661            var script = document.createElement("script"); 
    22352662            script.src = s.url; 
     2663            if (s.scriptCharset) 
     2664                script.charset = s.scriptCharset; 
    22362665 
    22372666            // Handle Script loading 
    2238             if ( !jsonp && (s.success || s.complete) ) { 
     2667            if ( !jsonp ) { 
    22392668                var done = false; 
    22402669 
    22412670                // Attach handlers for all browsers 
    22422671                script.onload = script.onreadystatechange = function(){ 
    2243                     if ( !done && (!this.readyState ||  
     2672                    if ( !done && (!this.readyState || 
    22442673                            this.readyState == "loaded" || this.readyState == "complete") ) { 
    22452674                        done = true; 
     
    22542683 
    22552684            // We handle everything using the script element injection 
    2256             return; 
     2685            return undefined; 
    22572686        } 
    22582687 
     
    22612690        // Create the request object; Microsoft failed to properly 
    22622691        // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available 
    2263         var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); 
     2692        var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); 
    22642693 
    22652694        // Open the socket 
    2266         xml.open(s.type, s.url, s.async); 
    2267  
    2268         // Set the correct header, if data is being sent 
    2269         if ( s.data ) 
    2270             xml.setRequestHeader("Content-Type", s.contentType); 
    2271  
    2272         // Set the If-Modified-Since header, if ifModified mode. 
    2273         if ( s.ifModified ) 
    2274             xml.setRequestHeader("If-Modified-Since", 
    2275                 jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); 
    2276  
    2277         // Set header so the called script knows that it's an XMLHttpRequest 
    2278         xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 
     2695        // Passing null username, generates a login popup on Opera (#2865) 
     2696        if( s.username ) 
     2697            xhr.open(type, s.url, s.async, s.username, s.password); 
     2698        else 
     2699            xhr.open(type, s.url, s.async); 
     2700 
     2701        // Need an extra try/catch for cross domain requests in Firefox 3 
     2702        try { 
     2703            // Set the correct header, if data is being sent 
     2704            if ( s.data ) 
     2705                xhr.setRequestHeader("Content-Type", s.contentType); 
     2706 
     2707            // Set the If-Modified-Since header, if ifModified mode. 
     2708            if ( s.ifModified ) 
     2709                xhr.setRequestHeader("If-Modified-Since", 
     2710                    jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); 
     2711 
     2712            // Set header so the called script knows that it's an XMLHttpRequest 
     2713            xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 
     2714 
     2715            // Set the Accepts header for the server, depending on the dataType 
     2716            xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? 
     2717                s.accepts[ s.dataType ] + ", */*" : 
     2718                s.accepts._default ); 
     2719        } catch(e){} 
    22792720 
    22802721        // Allow custom headers/mimetypes 
    2281         if ( s.beforeSend ) 
    2282             s.beforeSend(xml); 
    2283              
     2722        if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { 
     2723            // cleanup active request counter 
     2724            s.global && jQuery.active--; 
     2725            // close opended socket 
     2726            xhr.abort(); 
     2727            return false; 
     2728        } 
     2729 
    22842730        if ( s.global ) 
    2285             jQuery.event.trigger("ajaxSend", [xml, s]); 
     2731            jQuery.event.trigger("ajaxSend", [xhr, s]); 
    22862732 
    22872733        // Wait for a response to come back 
    22882734        var onreadystatechange = function(isTimeout){ 
    22892735            // The transfer is complete and the data is available, or the request timed out 
    2290             if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) { 
     2736            if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { 
    22912737                requestDone = true; 
    2292                  
     2738 
    22932739                // clear poll interval 
    22942740                if (ival) { 
     
    22962742                    ival = null; 
    22972743                } 
    2298                  
     2744 
    22992745                status = isTimeout == "timeout" && "timeout" || 
    2300                     !jQuery.httpSuccess( xml ) && "error" || 
    2301                     s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" || 
     2746                    !jQuery.httpSuccess( xhr ) && "error" || 
     2747                    s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" || 
    23022748                    "success"; 
    23032749 
     
    23062752                    try { 
    23072753                        // process the data (runs the xml through httpData regardless of callback) 
    2308                         data = jQuery.httpData( xml, s.dataType ); 
     2754                        data = jQuery.httpData( xhr, s.dataType, s.dataFilter ); 
    23092755                    } catch(e) { 
    23102756                        status = "parsererror"; 
     
    23172763                    var modRes; 
    23182764                    try { 
    2319                         modRes = xml.getResponseHeader("Last-Modified"); 
     2765                        modRes = xhr.getResponseHeader("Last-Modified"); 
    23202766                    } catch(e) {} // swallow exception thrown by FF if header is not available 
    2321      
     2767 
    23222768                    if ( s.ifModified && modRes ) 
    23232769                        jQuery.lastModified[s.url] = modRes; 
     
    23252771                    // JSONP handles its own success callback 
    23262772                    if ( !jsonp ) 
    2327                         success();   
     2773                        success(); 
    23282774                } else 
    2329                     jQuery.handleError(s, xml, status); 
     2775                    jQuery.handleError(s, xhr, status); 
    23302776 
    23312777                // Fire the complete handlers 
     
    23342780                // Stop memory leaks 
    23352781                if ( s.async ) 
    2336                     xml = null; 
     2782                    xhr = null; 
    23372783            } 
    23382784        }; 
    2339          
     2785 
    23402786        if ( s.async ) { 
    23412787            // don't attach the handler to the request, just poll it instead 
    2342             var ival = setInterval(onreadystatechange, 13);  
     2788            var ival = setInterval(onreadystatechange, 13); 
    23432789 
    23442790            // Timeout checker 
     
    23462792                setTimeout(function(){ 
    23472793                    // Check to see if the request is still happening 
    2348                     if ( xml ) { 
     2794                    if ( xhr ) { 
    23492795                        // Cancel the request 
    2350                         xml.abort(); 
    2351      
     2796                        xhr.abort(); 
     2797 
    23522798                        if( !requestDone ) 
    23532799                            onreadystatechange( "timeout" ); 
     
    23552801                }, s.timeout); 
    23562802        } 
    2357              
     2803 
    23582804        // Send the data 
    23592805        try { 
    2360             xml.send(s.data); 
     2806            xhr.send(s.data); 
    23612807        } catch(e) { 
    2362             jQuery.handleError(s, xml, null, e); 
    2363         } 
    2364          
     2808            jQuery.handleError(s, xhr, null, e); 
     2809        } 
     2810 
    23652811        // firefox 1.5 doesn't fire statechange for sync requests 
    23662812        if ( !s.async ) 
    23672813            onreadystatechange(); 
    2368          
    2369         // return XMLHttpRequest to allow aborting the request etc. 
    2370         return xml; 
    23712814 
    23722815        function success(){ 
     
    23772820            // Fire the global callback 
    23782821            if ( s.global ) 
    2379                 jQuery.event.trigger( "ajaxSuccess", [xml, s] ); 
     2822                jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); 
    23802823        } 
    23812824 
     
    23832826            // Process result 
    23842827            if ( s.complete ) 
    2385                 s.complete(xml, status); 
     2828                s.complete(xhr, status); 
    23862829 
    23872830            // The request was completed 
    23882831            if ( s.global ) 
    2389                 jQuery.event.trigger( "ajaxComplete", [xml, s] ); 
     2832                jQuery.event.trigger( "ajaxComplete", [xhr, s] ); 
    23902833 
    23912834            // Handle the global AJAX counter 
     
    23932836                jQuery.event.trigger( "ajaxStop" ); 
    23942837        } 
    2395     }, 
    2396  
    2397     handleError: function( s, xml, status, e ) { 
     2838 
     2839        // return XMLHttpRequest to allow aborting the request etc. 
     2840        return xhr; 
     2841    }, 
     2842 
     2843    handleError: function( s, xhr, status, e ) { 
    23982844        // If a local callback was specified, fire it 
    2399         if ( s.error ) s.error( xml, status, e ); 
     2845        if ( s.error ) s.error( xhr, status, e ); 
    24002846 
    24012847        // Fire the global callback 
    24022848        if ( s.global ) 
    2403             jQuery.event.trigger( "ajaxError", [xml, s, e] ); 
     2849            jQuery.event.trigger( "ajaxError", [xhr, s, e] ); 
    24042850    }, 
    24052851 
     
    24082854 
    24092855    // Determines if an XMLHttpRequest was successful or not 
    2410     httpSuccess: function( r ) { 
     2856    httpSuccess: function( xhr ) { 
    24112857        try { 
    2412             return !r.status && location.protocol == "file:" || 
    2413                 ( r.status >= 200 && r.status < 300 ) || r.status == 304 || 
    2414                 jQuery.browser.safari && r.status == undefined; 
     2858            // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 
     2859            return !xhr.status && location.protocol == "file:" || 
     2860                ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 || 
     2861                jQuery.browser.safari && xhr.status == undefined; 
    24152862        } catch(e){} 
    24162863        return false; 
     
    24182865 
    24192866    // Determines if an XMLHttpRequest returns NotModified 
    2420     httpNotModified: function( xml, url ) { 
     2867    httpNotModified: function( xhr, url ) { 
    24212868        try { 
    2422             var xmlRes = xml.getResponseHeader("Last-Modified"); 
     2869            var xhrRes = xhr.getResponseHeader("Last-Modified"); 
    24232870 
    24242871            // Firefox always returns 200. check Last-Modified date 
    2425             return xml.status == 304 || xmlRes == jQuery.lastModified[url] || 
    2426                 jQuery.browser.safari && xml.status == undefined; 
     2872            return xhr.status == 304 || xhrRes == jQuery.lastModified[url] || 
     2873                jQuery.browser.safari && xhr.status == undefined; 
    24272874        } catch(e){} 
    24282875        return false; 
    24292876    }, 
    24302877 
    2431     httpData: function( r, type ) { 
    2432         var ct = r.getResponseHeader("content-type"); 
    2433         var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0; 
    2434         var data = xml ? r.responseXML : r.responseText; 
     2878    httpData: function( xhr, type, filter ) { 
     2879        var ct = xhr.getResponseHeader("content-type"), 
     2880            xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, 
     2881            data = xml ? xhr.responseXML : xhr.responseText; 
    24352882 
    24362883        if ( xml && data.documentElement.tagName == "parsererror" ) 
    24372884            throw "parsererror"; 
     2885             
     2886        // Allow a pre-filtering function to sanitize the response 
     2887        if( filter ) 
     2888            data = filter( data, type ); 
    24382889 
    24392890        // If the type is "script", eval it in global context 
     
    24712922                    }); 
    24722923                else 
    2473                     s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) ); 
     2924                    s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) ); 
    24742925 
    24752926        // Return the resulting serialization 
     
    24842935                height: "show", width: "show", opacity: "show" 
    24852936            }, speed, callback) : 
    2486              
     2937 
    24872938            this.filter(":hidden").each(function(){ 
    2488                 this.style.display = this.oldblock ? this.oldblock : ""; 
    2489                 if ( jQuery.css(this,"display") == "none" ) 
    2490                     this.style.display = "block"; 
     2939                this.style.display = this.oldblock || ""; 
     2940                if ( jQuery.css(this,"display") == "none" ) { 
     2941                    var elem = jQuery("<" + this.tagName + " />").appendTo("body"); 
     2942                    this.style.display = elem.css("display"); 
     2943                    // handle an edge condition where css is - div { display:none; } or similar 
     2944                    if (this.style.display == "none") 
     2945                        this.style.display = "block"; 
     2946                    elem.remove(); 
     2947                } 
    24912948            }).end(); 
    24922949    }, 
    2493      
     2950 
    24942951    hide: function(speed,callback){ 
    24952952        return speed ? 
     
    24972954                height: "hide", width: "hide", opacity: "hide" 
    24982955            }, speed, callback) : 
    2499              
     2956 
    25002957            this.filter(":visible").each(function(){ 
    25012958                this.oldblock = this.oldblock || jQuery.css(this,"display"); 
    2502                 if ( this.oldblock == "none" ) 
    2503                     this.oldblock = "block"; 
    25042959                this.style.display = "none"; 
    25052960            }).end(); 
     
    25082963    // Save the old toggle function 
    25092964    _toggle: jQuery.fn.toggle, 
    2510      
     2965 
    25112966    toggle: function( fn, fn2 ){ 
    25122967        return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? 
    2513             this._toggle( fn, fn2 ) : 
     2968            this._toggle.apply( this, arguments ) : 
    25142969            fn ? 
    25152970                this.animate({ 
     
    25202975                }); 
    25212976    }, 
    2522      
     2977 
    25232978    slideDown: function(speed,callback){ 
    25242979        return this.animate({height: "show"}, speed, callback); 
    25252980    }, 
    2526      
     2981 
    25272982    slideUp: function(speed,callback){ 
    25282983        return this.animate({height: "hide"}, speed, callback); 
     
    25322987        return this.animate({height: "toggle"}, speed, callback); 
    25332988    }, 
    2534      
     2989 
    25352990    fadeIn: function(speed, callback){ 
    25362991        return this.animate({opacity: "show"}, speed, callback); 
    25372992    }, 
    2538      
     2993 
    25392994    fadeOut: function(speed, callback){ 
    25402995        return this.animate({opacity: "hide"}, speed, callback); 
    25412996    }, 
    2542      
     2997 
    25432998    fadeTo: function(speed,to,callback){ 
    25442999        return this.animate({opacity: to}, speed, callback); 
    25453000    }, 
    2546      
     3001 
    25473002    animate: function( prop, speed, easing, callback ) { 
    2548         var opt = jQuery.speed(speed, easing, callback); 
    2549  
    2550         return this[ opt.queue === false ? "each" : "queue" ](function(){ 
    2551             opt = jQuery.extend({}, opt); 
    2552             var hidden = jQuery(this).is(":hidden"), self = this; 
    2553              
    2554             for ( var p in prop ) { 
     3003        var optall = jQuery.speed(speed, easing, callback); 
     3004 
     3005        return this[ optall.queue === false ? "each" : "queue" ](function(){ 
     3006            if ( this.nodeType != 1) 
     3007                return false; 
     3008 
     3009            var opt = jQuery.extend({}, optall), p, 
     3010                hidden = jQuery(this).is(":hidden"), self = this; 
     3011 
     3012            for ( p in prop ) { 
    25553013                if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) 
    2556                     return jQuery.isFunction(opt.complete) && opt.complete.apply(this); 
     3014                    return opt.complete.call(this); 
    25573015 
    25583016                if ( p == "height" || p == "width" ) { 
     
    25693027 
    25703028            opt.curAnim = jQuery.extend({}, prop); 
    2571              
     3029 
    25723030            jQuery.each( prop, function(name, val){ 
    25733031                var e = new jQuery.fx( self, opt, name ); 
     
    25763034                    e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); 
    25773035                else { 
    2578                     var parts = val.toString().match(/^([+-]?)([\d.]+)(.*)$/), 
     3036                    var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), 
    25793037                        start = e.cur(true) || 0; 
    25803038 
    25813039                    if ( parts ) { 
    2582                         end = parseFloat(parts[2]), 
    2583                         unit = parts[3] || "px"; 
     3040                        var end = parseFloat(parts[2]), 
     3041                            unit = parts[3] || "px"; 
    25843042 
    25853043                        // We need to compute starting value 
    25863044                        if ( unit != "px" ) { 
    2587                             self.style[ name ] = end + unit; 
    2588                             start = (end / e.cur(true)) * start; 
     3045                            self.style[ name ] = (end || 1) + unit; 
     3046                            start = ((end || 1) / e.cur(true)) * start; 
    25893047                            self.style[ name ] = start + unit; 
    25903048                        } 
    25913049 
    2592                         // If a +/- token was provided, we're doing a relative animation 
     3050                        // If a +=/-= token was provided, we're doing a relative animation 
    25933051                        if ( parts[1] ) 
    2594                             end = ((parts[1] == "-" ? -1 : 1) * end) + start; 
     3052                            end = ((parts[1] == "-=" ? -1 : 1) * end) + start; 
    25953053 
    25963054                        e.custom( start, end, unit ); 
     
    26043062        }); 
    26053063    }, 
    2606      
     3064 
    26073065    queue: function(type, fn){ 
    2608         if ( !fn ) { 
     3066        if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) { 
    26093067            fn = type; 
    26103068            type = "fx"; 
    26113069        } 
    26123070 
    2613         if ( !arguments.length ) 
     3071        if ( !type || (typeof type == "string" && !fn) ) 
    26143072            return queue( this[0], type ); 
    26153073 
     
    26193077            else { 
    26203078                queue(this, type).push( fn ); 
    2621              
     3079 
    26223080                if ( queue(this, type).length == 1 ) 
    2623                     fn.apply(this); 
     3081                    fn.call(this); 
    26243082            } 
    26253083        }); 
    26263084    }, 
    26273085 
    2628     stop: function(){ 
     3086    stop: function(clearQueue, gotoEnd){ 
    26293087        var timers = jQuery.timers; 
    26303088 
    2631         return this.each(function(){ 
    2632             for ( var i = 0; i < timers.length; i++ ) 
    2633                 if ( timers[i].elem == this ) 
    2634                     timers.splice(i--, 1); 
    2635         }).dequeue(); 
     3089        if (clearQueue) 
     3090            this.queue([]); 
     3091 
     3092        this.each(function(){ 
     3093            // go in reverse order so anything added to the queue during the loop is ignored 
     3094            for ( var i = timers.length - 1; i >= 0; i-- ) 
     3095                if ( timers[i].elem == this ) { 
     3096                    if (gotoEnd) 
     3097                        // force the next step to be the last 
     3098                        timers[i](true); 
     3099                    timers.splice(i, 1); 
     3100                } 
     3101        }); 
     3102 
     3103        // start the next in the queue if the last step wasn't forced 
     3104        if (!gotoEnd) 
     3105            this.dequeue(); 
     3106 
     3107        return this; 
    26363108    } 
    26373109 
     
    26393111 
    26403112var queue = function( elem, type, array ) { 
    2641     if ( !elem ) 
    2642         return; 
    2643  
    2644     var q = jQuery.data( elem, type + "queue" ); 
    2645  
    2646     if ( !q || array ) 
    2647         q = jQuery.data( elem, type + "queue",  
    2648             array ? jQuery.makeArray(array) : [] ); 
    2649  
     3113    if ( elem ){ 
     3114 
     3115        type = type || "fx"; 
     3116 
     3117        var q = jQuery.data( elem, type + "queue" ); 
     3118 
     3119        if ( !q || array ) 
     3120            q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) ); 
     3121 
     3122    } 
    26503123    return q; 
    26513124}; 
     
    26603133 
    26613134        if ( q.length ) 
    2662             q[0].apply( this ); 
     3135            q[0].call( this ); 
    26633136    }); 
    26643137}; 
    26653138 
    26663139jQuery.extend({ 
    2667      
     3140 
    26683141    speed: function(speed, easing, fn) { 
    26693142        var opt = speed && speed.constructor == Object ? speed : { 
    2670             complete: fn || !fn && easing ||  
     3143            complete: fn || !fn && easing || 
    26713144                jQuery.isFunction( speed ) && speed, 
    26723145            duration: speed, 
     
    26743147        }; 
    26753148 
    2676         opt.duration = (opt.duration && opt.duration.constructor == Number ?  
    2677             opt.duration :  
    2678             { slow: 600, fast: 200 }[opt.duration]) || 400; 
    2679      
     3149        opt.duration = (opt.duration && opt.duration.constructor == Number ? 
     3150            opt.duration : 
     3151            jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def; 
     3152 
    26803153        // Queueing 
    26813154        opt.old = opt.complete; 
    26823155        opt.complete = function(){ 
    2683             jQuery(this).dequeue(); 
     3156            if ( opt.queue !== false ) 
     3157                jQuery(this).dequeue(); 
    26843158            if ( jQuery.isFunction( opt.old ) ) 
    2685                 opt.old.apply( this ); 
     3159                opt.old.call( this ); 
    26863160        }; 
    2687      
     3161 
    26883162        return opt; 
    26893163    }, 
    2690      
     3164 
    26913165    easing: { 
    26923166        linear: function( p, n, firstNum, diff ) { 
     
    26973171        } 
    26983172    }, 
    2699      
     3173 
    27003174    timers: [], 
     3175    timerId: null, 
    27013176 
    27023177    fx: function( elem, options, prop ){ 
     
    27163191    update: function(){ 
    27173192        if ( this.options.step ) 
    2718             this.options.step.apply( this.elem, [ this.now, this ] ); 
     3193            this.options.step.call( this.elem, this.now, this ); 
    27193194 
    27203195        (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); 
     
    27303205            return this.elem[ this.prop ]; 
    27313206 
    2732         var r = parseFloat(jQuery.curCSS(this.elem, this.prop, force)); 
    2733         return r && r > -10000 ? r : parseFloat(jQuery.css(this.elem, this.prop)) || 0; 
     3207        var r = parseFloat(jQuery.css(this.elem, this.prop, force)); 
     3208        return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; 
    27343209    }, 
    27353210 
    27363211    // Start an animation from one number to another 
    27373212    custom: function(from, to, unit){ 
    2738         this.startTime = (new Date()).getTime(); 
     3213        this.startTime = now(); 
    27393214        this.start = from; 
    27403215        this.end = to; 
     
    27453220 
    27463221        var self = this; 
    2747         function t(){ 
    2748             return self.step(); 
     3222        function t(gotoEnd){ 
     3223            return self.step(gotoEnd); 
    27493224        } 
    27503225 
     
    27533228        jQuery.timers.push(t); 
    27543229 
    2755         if ( jQuery.timers.length == 1 ) { 
    2756             var timer = setInterval(function(){ 
     3230        if ( jQuery.timerId == null ) { 
     3231            jQuery.timerId = setInterval(function(){ 
    27573232                var timers = jQuery.timers; 
    2758                  
     3233 
    27593234                for ( var i = 0; i < timers.length; i++ ) 
    27603235                    if ( !timers[i]() ) 
    27613236                        timers.splice(i--, 1); 
    27623237 
    2763                 if ( !timers.length ) 
    2764                     clearInterval( timer ); 
     3238                if ( !timers.length ) { 
     3239                    clearInterval( jQuery.timerId ); 
     3240                    jQuery.timerId = null; 
     3241                } 
    27653242            }, 13); 
    27663243        } 
     
    27803257        if ( this.prop == "width" || this.prop == "height" ) 
    27813258            this.elem.style[this.prop] = "1px"; 
    2782          
     3259 
    27833260        // Start by showing the element 
    27843261        jQuery(this.elem).show(); 
     
    27963273 
    27973274    // Each step of an animation 
    2798     step: function(){ 
    2799         var t = (new Date()).getTime(); 
    2800  
    2801         if ( t > this.options.duration + this.startTime ) { 
     3275    step: function(gotoEnd){ 
     3276        var t = now(); 
     3277 
     3278        if ( gotoEnd || t > this.options.duration + this.startTime ) { 
    28023279            this.now = this.end; 
    28033280            this.pos = this.state = 1; 
     
    28153292                    // Reset the overflow 
    28163293                    this.elem.style.overflow = this.options.overflow; 
    2817                  
     3294 
    28183295                    // Reset the display 
    28193296                    this.elem.style.display = this.options.display; 
     
    28323309            } 
    28333310 
    2834             // If a callback was provided, execute it 
    2835             if ( done && jQuery.isFunction( this.options.complete ) ) 
     3311            if ( done ) 
    28363312                // Execute the complete function 
    2837                 this.options.complete.apply( this.elem ); 
     3313                this.options.complete.call( this.elem ); 
    28383314 
    28393315            return false; 
     
    28553331}; 
    28563332 
    2857 jQuery.fx.step = { 
    2858     scrollLeft: function(fx){ 
    2859         fx.elem.scrollLeft = fx.now; 
    2860     }, 
    2861  
    2862     scrollTop: function(fx){ 
    2863         fx.elem.scrollTop = fx.now; 
    2864     }, 
    2865  
    2866     opacity: function(fx){ 
    2867         jQuery.attr(fx.elem.style, "opacity", fx.now); 
    2868     }, 
    2869  
    2870     _default: function(fx){ 
    2871         fx.elem.style[ fx.prop ] = fx.now + fx.unit; 
     3333jQuery.extend( jQuery.fx, { 
     3334    speeds:{ 
     3335        slow: 600, 
     3336        fast: 200, 
     3337        // Default speed 
     3338        def: 400 
     3339    }, 
     3340    step: { 
     3341        scrollLeft: function(fx){ 
     3342            fx.elem.scrollLeft = fx.now; 
     3343        }, 
     3344 
     3345        scrollTop: function(fx){ 
     3346            fx.elem.scrollTop = fx.now; 
     3347        }, 
     3348 
     3349        opacity: function(fx){ 
     3350            jQuery.attr(fx.elem.style, "opacity", fx.now); 
     3351        }, 
     3352 
     3353        _default: function(fx){ 
     3354            fx.elem.style[ fx.prop ] = fx.now + fx.unit; 
     3355        } 
    28723356    } 
    2873 }; 
     3357}); 
    28743358// The Offset Method 
    28753359// Originally By Brandon Aaron, part of the Dimension Plugin 
     
    28773361jQuery.fn.offset = function() { 
    28783362    var left = 0, top = 0, elem = this[0], results; 
    2879      
     3363 
    28803364    if ( elem ) with ( jQuery.browser ) { 
    2881         var absolute    = jQuery.css(elem, "position") == "absolute",  
    2882                 parent      = elem.parentNode,  
    2883                 offsetParent    = elem.offsetParent,  
    2884                 doc     = elem.ownerDocument, 
    2885             safari2     = safari && !absolute && parseInt(version) < 522; 
    2886      
     3365        var parent       = elem.parentNode, 
     3366            offsetChild  = elem, 
     3367            offsetParent = elem.offsetParent, 
     3368            doc          = elem.ownerDocument, 
     3369            safari2      = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent), 
     3370            css          = jQuery.curCSS, 
     3371            fixed        = css(elem, "position") == "fixed"; 
     3372 
    28873373        // Use getBoundingClientRect if available 
    28883374        if ( elem.getBoundingClientRect ) { 
    2889             box = elem.getBoundingClientRect(); 
    2890          
     3375            var box = elem.getBoundingClientRect(); 
     3376 
    28913377            // Add the document scroll offsets 
    2892             add( 
    2893                 box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), 
    2894                 box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop) 
    2895             ); 
    2896          
     3378            add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), 
     3379                box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop)); 
     3380 
    28973381            // IE adds the HTML element's border, by default it is medium which is 2px 
    2898             // IE 6 and IE 7 quirks mode the border width is overwritable by the following css html { border: 0; } 
     3382            // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; } 
    28993383            // IE 7 standards mode, the border is always 2px 
    2900             if ( msie ) { 
    2901                 var border = jQuery("html").css("borderWidth"); 
    2902                 border = (border == "medium" || jQuery.boxModel && parseInt(version) >= 7) && 2 || border; 
    2903                 add( -border, -border ); 
    2904             } 
    2905      
     3384            // This border/offset is typically represented by the clientLeft and clientTop properties 
     3385            // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS 
     3386            // Therefore this method will be off by 2px in IE while in quirksmode 
     3387            add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop ); 
     3388 
    29063389        // Otherwise loop through the offsetParents and parentNodes 
    29073390        } else { 
    2908          
     3391 
    29093392            // Initial element offsets 
    29103393            add( elem.offsetLeft, elem.offsetTop ); 
    2911          
     3394 
    29123395            // Get parent offsets 
    29133396            while ( offsetParent ) { 
    29143397                // Add offsetParent offsets 
    29153398                add( offsetParent.offsetLeft, offsetParent.offsetTop ); 
    2916              
     3399 
    29173400                // Mozilla and Safari > 2 does not include the border on offset parents 
    2918                 // However Mozilla adds the border for table cells 
    2919                 if ( mozilla && /^t[d|h]$/i.test(parent.tagName) || !safari2 ) 
     3401                // However Mozilla adds the border for table or table cells 
     3402                if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 ) 
    29203403                    border( offsetParent ); 
    2921                  
    2922                 // Safari <= 2 doubles body offsets with an absolutely positioned element or parent 
    2923                 if ( safari2 && !absolute && jQuery.css(offsetParent, "position") == "absolute" ) 
    2924                     absolute = true; 
    2925              
     3404 
     3405                // Add the document scroll offsets if position is fixed on any offsetParent 
     3406                if ( !fixed && css(offsetParent, "position") == "fixed" ) 
     3407                    fixed = true; 
     3408 
     3409                // Set offsetChild to previous offsetParent unless it is the body element 
     3410                offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent; 
    29263411                // Get next offsetParent 
    29273412                offsetParent = offsetParent.offsetParent; 
    29283413            } 
    2929          
     3414 
    29303415            // Get parent scroll offsets 
    2931             while ( parent.tagName && /^body|html$/i.test(parent.tagName) ) { 
    2932                 // Work around opera inline/table scrollLeft/Top bug 
    2933                 if ( /^inline|table-row.*$/i.test(jQuery.css(parent, "display")) ) 
     3416            while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { 
     3417                // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug 
     3418                if ( !/^inline|table.*$/i.test(css(parent, "display")) ) 
    29343419                    // Subtract parent scroll offsets 
    29353420                    add( -parent.scrollLeft, -parent.scrollTop ); 
    2936              
     3421 
    29373422                // Mozilla does not add the border for a parent that has overflow != visible 
    2938                 if ( mozilla && jQuery.css(parent, "overflow") != "visible" ) 
     3423                if ( mozilla && css(parent, "overflow") != "visible" ) 
    29393424                    border( parent ); 
    2940              
     3425 
    29413426                // Get next parent 
    29423427                parent = parent.parentNode; 
    29433428            } 
    2944          
    2945             // Safari doubles body offsets with an absolutely positioned element or parent 
    2946             if ( safari && absolute ) 
    2947                 add( -doc.body.offsetLeft, -doc.body.offsetTop ); 
     3429 
     3430            // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild 
     3431            // Mozilla doubles body offsets with a non-absolutely positioned offsetChild 
     3432            if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) || 
     3433                (mozilla && css(offsetChild, "position") != "absolute") ) 
     3434                    add( -doc.body.offsetLeft, -doc.body.offsetTop ); 
     3435 
     3436            // Add the document scroll offsets if position is fixed 
     3437            if ( fixed ) 
     3438                add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), 
     3439                    Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop)); 
    29483440        } 
    29493441 
     
    29523444    } 
    29533445 
     3446    function border(elem) { 
     3447        add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) ); 
     3448    } 
     3449 
     3450    function add(l, t) { 
     3451        left += parseInt(l, 10) || 0; 
     3452        top += parseInt(t, 10) || 0; 
     3453    } 
     3454 
    29543455    return results; 
    2955  
    2956     function border(elem) { 
    2957         add( jQuery.css(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth") ); 
     3456}; 
     3457 
     3458 
     3459jQuery.fn.extend({ 
     3460    position: function() { 
     3461        var left = 0, top = 0, results; 
     3462 
     3463        if ( this[0] ) { 
     3464            // Get *real* offsetParent 
     3465            var offsetParent = this.offsetParent(), 
     3466 
     3467            // Get correct offsets 
     3468            offset       = this.offset(), 
     3469            parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); 
     3470 
     3471            // Subtract element margins 
     3472            // note: when an element has margin: auto the offsetLeft and marginLeft  
     3473            // are the same in Safari causing offset.left to incorrectly be 0 
     3474            offset.top  -= num( this, 'marginTop' ); 
     3475            offset.left -= num( this, 'marginLeft' ); 
     3476 
     3477            // Add offsetParent borders 
     3478            parentOffset.top  += num( offsetParent, 'borderTopWidth' ); 
     3479            parentOffset.left += num( offsetParent, 'borderLeftWidth' ); 
     3480 
     3481            // Subtract the two offsets 
     3482            results = { 
     3483                top:  offset.top  - parentOffset.top, 
     3484                left: offset.left - parentOffset.left 
     3485            }; 
     3486        } 
     3487 
     3488        return results; 
     3489    }, 
     3490 
     3491    offsetParent: function() { 
     3492        var offsetParent = this[0].offsetParent; 
     3493        while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) 
     3494            offsetParent = offsetParent.offsetParent; 
     3495        return jQuery(offsetParent); 
    29583496    } 
    2959  
    2960     function add(l, t) { 
    2961         left += parseInt(l) || 0; 
    2962         top += parseInt(t) || 0; 
    2963     } 
    2964 }; 
    2965 })(); 
     3497}); 
     3498 
     3499 
     3500// Create scrollLeft and scrollTop methods 
     3501jQuery.each( ['Left', 'Top'], function(i, name) { 
     3502    var method = 'scroll' + name; 
     3503     
     3504    jQuery.fn[ method ] = function(val) { 
     3505        if (!this[0]) return; 
     3506 
     3507        return val != undefined ? 
     3508 
     3509            // Set the scroll offset 
     3510            this.each(function() { 
     3511                this == window || this == document ? 
     3512                    window.scrollTo( 
     3513                        !i ? val : jQuery(window).scrollLeft(), 
     3514                         i ? val : jQuery(window).scrollTop() 
     3515                    ) : 
     3516                    this[ method ] = val; 
     3517            }) : 
     3518 
     3519            // Return the scroll offset 
     3520            this[0] == window || this[0] == document ? 
     3521                self[ i ? 'pageYOffset' : 'pageXOffset' ] || 
     3522                    jQuery.boxModel && document.documentElement[ method ] || 
     3523                    document.body[ method ] : 
     3524                this[0][ method ]; 
     3525    }; 
     3526}); 
     3527// Create innerHeight, innerWidth, outerHeight and outerWidth methods 
     3528jQuery.each([ "Height", "Width" ], function(i, name){ 
     3529 
     3530    var tl = i ? "Left"  : "Top",  // top or left 
     3531        br = i ? "Right" : "Bottom"; // bottom or right 
     3532 
     3533    // innerHeight and innerWidth 
     3534    jQuery.fn["inner" + name] = function(){ 
     3535        return this[ name.toLowerCase() ]() + 
     3536            num(this, "padding" + tl) + 
     3537            num(this, "padding" + br); 
     3538    }; 
     3539 
     3540    // outerHeight and outerWidth 
     3541    jQuery.fn["outer" + name] = function(margin) { 
     3542        return this["inner" + name]() + 
     3543            num(this, "border" + tl + "Width") + 
     3544            num(this, "border" + br + "Width") + 
     3545            (margin ? 
     3546                num(this, "margin" + tl) + num(this, "margin" + br) : 0); 
     3547    }; 
     3548 
     3549});})(); 
  • branches/comu-ver2/html/user_data/packages/default/js/layout_design.js

    r17407 r17417  
    22 * This file is part of EC-CUBE 
    33 * 
    4  * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
     4 * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved. 
    55 * 
    66 * http://www.lockon.co.jp/ 
     
    2020 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    2121 */ 
    22 // サイズ管理クラスの定義 
    23 function SC_Size() { 
    24     this.id = '';               // ID 
    25     this.left = 0;              // 配置するY軸座標 
    26     this.top = 0;               // 配置するX軸座標 
    27     this.width = 0;             // オブジェクトの幅 
    28     this.height = 0;            // オブジェクトの高さ 
    29     this.target_id = '';        // 配置場所(左ナビとか) 
    30     this.margin = 10;           // 上のオブジェクトとの幅 
    31     this.obj; 
    32 }; 
    33  
    34 // 変数宣言 
    35 var defUnused = 500;    // 未使用領域のデフォルトの高さ 
    36 var defNavi   = 400;    // 左右ナビのデフォルトの高さ 
    37 var defMainNavi  = 100; // メイン上下のデフォルトの高さ 
    38 var defMain   = 200;    // メインのデフォルトの高さ 
    39  
    40 var NowMaxHeight = 0;       // 現在の最大の高さ 
    41 var MainHeight = 200; 
    42  
    43 var marginUnused    = 688;  // 未使用領域の左マージン 
    44 var marginLeftNavi  = 180;  // 左ナビの左マージン 
    45 var marginRightNavi = 512;  // 右ナビの左マージン 
    46 var marginMain      = 348;  // メイン上下の左マージン 
    47 var marginMainFootTop= 595; // メイン下の上マージン 
    48  
    49 var gDragged = "";          // ドラッグ中オブジェクト 
    50 var gDropTarget = "";       // ドラッグ開始時のDropTarget 
    51  
    52 var arrObj = new Object();  // ブロックオブジェクト格納用 
    53  
    54 var mouseFlg = false; 
    55  
    56 var all_elms;               // divタグオブジェクト格納用 
    57  
    58 // ウィンドウサイズ 
    59 var scrX; 
    60 var scrY; 
    61  
    62 // イベントの関連付けを行う 
    63 function addEvent( elm, evtType, fn, useCapture) { 
    64  
    65     if (elm.addEventListener) { 
    66         elm.addEventListener(evtType, fn, useCapture); 
    67         return true; 
    68  
    69     } 
    70     else if (elm.attachEvent) { 
    71  
    72         var r = elm.attachEvent('on' + evtType, fn); 
    73         return r; 
    74  
    75     } 
    76     else { 
    77         elm['on'+evtType] = fn; 
    78  
    79     } 
     22(function($){ 
     23    var updateUpDown = function(sortable){ 
     24        $('div:not(.ui-sortable-helper)', sortable) 
     25            .removeClass('first') 
     26            .filter(':first').addClass('first').end() 
     27            .children('input.target-id').val(sortable.id).end() 
     28            .each(function(){ 
     29                var top = $(this).prevAll().length + 1; 
     30                $(this).children('input.top').val(top); 
     31            }); 
     32    }; 
    8033     
    81 } 
    82  
    83  
    84 // イベントの関連付けを解除 
    85 function removeEvent( elm, evtType, fn, useCapture) { 
    86  
    87     if (elm.removeEventListener) { 
    88  
    89         elm.removeEventListener(evtType, fn, useCapture); 
    90         return true; 
    91  
    92     } 
    93     else if (elm.detachEvent) { 
    94  
    95         var r = elm.detachEvent('on' + evtType, fn); 
    96         return r; 
    97  
    98     } 
    99     else { 
    100  
    101         elm['on'+evtType] = fn; 
    102  
    103     } 
    104     
    105 } 
    106  
    107 // マウスカーソルを変更 
    108 function setCursor ( elm, curtype ) { 
    109     elm.style.cursor = curtype; 
    110 } 
    111  
    112 // オブジェクトの透明度を変更    
    113 function setOpacity(node,val) { 
    114  
    115     if (node.filters) { 
    116         node.filters["alpha"].opacity = val*100; 
    117     } else if (node.style.opacity) { 
    118         node.style.opacity = val; 
    119     } 
    120 } 
    121  
    122 // Zindexを変更する(前面表示切替) 
    123 function setZindex(node, val) { 
    124     node.style.zIndex = val; 
    125 //  alert(val); 
    126 } 
    127  
    128 // 値を取得 
    129 function getAttrValue ( elm, attrname ) { 
    130  
    131     if (typeof(elm.attributes[ attrname ]) != 'undefined') { 
    132         return elm.attributes[ attrname ].nodeValue; 
    133     } 
    134  
    135 /* 
    136 //  if (typeof(elm.attributes.getNamedItem(attrname)) != 'object'){ 
    137         val = ""; 
    138         if((typeof ScriptEngineMajorVersion)=='function') 
    139         { 
    140             if( Math.floor(ScriptEngineMajorVersion()) == 5 && 
    141                 navigator.userAgent.indexOf("Win")!=-1) //win-e5対応 
    142                 { 
    143                 val = elm.attributes.item(attrname) 
    144                 } 
    145             else 
    146             { 
    147                 val = elm.attributes.getNamedItem(attrname) 
    148             } 
    149         } else { 
    150             val = elm.attributes.getNamedItem(attrname) 
    151         } 
    152          
    153         alert(val.value); 
    154          
    155         return val.value; 
    156 //  } 
    157 */ 
    158 } 
    159  
    160 // 値をセット 
    161 function setAttrValue ( elm, attrname, val ) { 
    162     elm.attributes[ attrname ].nodeValue = val; 
    163 } 
    164  
    165 // オブジェクトのX座標を取得 
    166 function getX ( elm ) { 
    167 //   return parseInt(elm.style.left); 
    168     return parseInt(elm.offsetLeft); 
    169 } 
    170  
    171 // オブジェクトのY座標を取得 
    172 function getY ( elm ) { 
    173     return parseInt(elm.offsetTop); 
    174 //    return parseInt(elm.style.top); 
    175 } 
    176  
    177 // X座標を取得 
    178 function getEventX ( evt ) { 
    179     return evt.clientX ? evt.clientX : evt.pageX; 
    180 } 
    181  
    182 // Y座標を取得 
    183 function getEventY ( evt ) { 
    184     return evt.clientY ? evt.clientY : evt.pageY; 
    185 } 
    186  
    187 // オブジェクトの幅を取得 
    188 function getWidth ( elm ) { 
    189     return parseInt( elm.style.width ); 
    190 } 
    191  
    192 // オブジェクトの高さを取得 
    193 function getHeight ( elm ) { 
    194 //    return parseInt( elm.style.height ); 
    195     return parseInt( elm.offsetHeight ); 
    196 } 
    197  
    198 // ページの可視領域のX座標を取得する 
    199 function getPageScrollX() 
    200 { 
    201     var x = 0; 
    202  
    203     if (document.body && document.body.scrollLeft != null) { 
    204         x = document.body.scrollLeft; 
    205     } else if (document.documentElement && document.documentElement.scrollLeft != null) { 
    206         x = document.documentElement.scrollLeft; 
    207     } else if (window.scrollX != null) { 
    208         x = window.scrollX; 
    209     } else if (window.pageXOffset != null) { 
    210         x = window.pageXOffset; 
    211     } 
    212      
    213     return x; 
    214 } 
    215  
    216 // ページの可視領域のY座標を取得する 
    217 function getPageScrollY() 
    218 { 
    219     var y = 0; 
    220      
    221     if (document.body && document.body.scrollTop != null) { 
    222         y = document.body.scrollTop; 
    223     } else if (document.documentElement && document.documentElement.scrollTop != null) { 
    224         y = document.documentElement.scrollTop; 
    225     } else if (window.scrollY != null) { 
    226         y = window.scrollY; 
    227     } else if (window.pageYOffset != null) { 
    228         y = window.pageYOffset; 
    229     } 
    230      
    231     return y; 
    232 } 
    233  
    234  
    235 // オブジェクトの座標をセット 
    236 function moveElm ( elm, x, y ) { 
    237     elm.style.left = x + 'px'; 
    238     elm.style.top = y + 'px'; 
    239 } 
    240  
    241 // マウスダウンイベント 
    242 function onMouseDown (evt) { 
    243  
    244     var target = evt.target ? evt.target : evt.srcElement; 
    245     var x = getEventX ( evt ); 
    246     var y = getEventY ( evt ); 
    247  
    248     // 
    249     // Save Information to Globals 
    250     // 
    251     if (mouseFlg == false) { 
     34    var sortableUpdate = function(e, ui){ 
     35        updateUpDown(ui.element[0]); 
     36        if(ui.sender) 
     37            updateUpDown(ui.sender[0]); 
     38    }; 
    25239     
    253         gDragged = target; 
    254      
    255         gDeltaX = x - getX(gDragged); 
    256         gDeltaY = y - getY(gDragged); 
    257      
    258         gDraggedId = getAttrValue ( gDragged, 'did' ); 
    259         setCursor ( gDragged, 'move' ); 
    260      
    261         gOrgX = getX ( gDragged ); 
    262         gOrgY = getY ( gDragged ); 
    263         gtarget_id = getAttrValue ( gDragged, 'target_id' ); 
    264      
    265         // 
    266         // Set 
    267         // 
    268         
    269         // ドラッグ中は半透明 
    270         setOpacity ( gDragged, 0.6 ); 
    271      
    272         // ドラッグ中は最前面表示 
    273         setZindex ( gDragged , 2); 
    274          
    275         addEvent ( document, 'mousemove', onMouseMove, false ); 
    276         addEvent ( document, 'mouseup', onMouseUp, false ); 
    277  
    278         // ドラッグを開始したときは高さを一度初期化する。 
    279         NowMaxHeight = defNavi; 
    280                  
    281         mouseFlg = true; 
    282     } 
    283 } 
    284  
    285  
    286 // マウスムーブイベント 
    287 function onMouseMove(evt) { 
    288  
    289     // 現在の座標を取得 
    290     var x = getEventX ( evt ) + document.body.scrollLeft;                   // マウス座標 X 
    291     var y = getEventY ( evt ) + document.body.scrollTop;                    // マウス座標 Y 
    292     var nowleft = getEventX ( evt ) - gDeltaX;  // オブジェクト座標 LEFT 
    293     var nowtop = getEventY ( evt ) - gDeltaY;   // オブジェクト座標 TOP 
    294  
    295     // オブジェクトを移動 
    296     moveElm ( gDragged, nowleft, nowtop ); 
    297      
    298     for ( var i = 0; i < all_elms.length; i++ ) { 
    299         // drop-target上にきた場合にのみ処理を行う 
    300         if ( isEventOnElm ( evt, all_elms[i].id ) ) { 
    301             if ( all_elms[i].attributes['tid'] ) { 
    302                 var tid = getAttrValue ( all_elms[i], 'tid' ); 
    303                  
    304                 // 背景色の変更 未使用領域は変更しない 
    305                 all_elms[i].style.background="#ffffdd"; 
    306                  
    307                 // target_id の書き換え 
    308                 setAttrValue ( gDragged, 'target_id', tid ); 
    309  
    310                 //objCheckLine.style.top = parseInt(nowtop) + parseInt(gDragged.style.height) / 2 + 'px'; 
    311                 //objCheckLine.style.top = y; 
    312  
    313                 // 配列の再作成 
    314                 fnCreateArr(1, y, x); 
    315                 // 配列の並び替え 
    316                 fnChangeObj(tid); 
    317             } 
    318         }else{ 
    319             if ( all_elms[i].attributes['tid'] && all_elms[i].style.background!="#ffffff") { 
    320                 // 背景色の変更 
    321                 all_elms[i].style.background="#ffffff"; 
    322             } 
    323         } 
    324     } 
    325 } 
    326  
    327 // マウスアップイベント        
    328 function onMouseUp(evt) { 
    329     // イベントの関連付け解除 
    330     if (mouseFlg == true) { 
    331         removeEvent ( document, 'mousemove', onMouseMove, false ); 
    332         removeEvent ( document, 'mouseup', onMouseUp, false ); 
    333         mouseFlg = false; 
    334     } 
    335  
    336     if ( !isOnDropTarget (evt) ) { 
    337         // 元の位置に戻す 
    338         moveElm ( gDragged, gOrgX, gOrgY ); 
    339         setAttrValue ( gDragged, 'target_id', gtarget_id ); 
    340  
    341         // 配列の再作成 
    342         fnCreateArr(1, gOrgY, gOrgX); 
    343     } 
     40    $(document).ready(function(){ 
     41        var els = ['#MainHead', '#MainFoot', '#LeftNavi', '#RightNavi', '#Unused']; 
     42        var $els = $(els.toString()); 
     43         
     44        $els.each(function(){ 
     45            updateUpDown(this); 
     46        }); 
     47         
     48        $els.sortable({ 
     49            items: '> div', 
     50            //handle: 'dt', 
     51            cursor: 'move', 
     52            //cursorAt: { top: 2, left: 2 }, 
     53            //opacity: 0.8, 
     54            //helper: 'clone', 
     55            appendTo: 'body', 
     56            placeholder: 'clone', 
     57            placeholder: 'placeholder', 
     58            connectWith: els, 
     59            start: function(e,ui) { 
     60                ui.helper.css("width", ui.item.width()); 
     61            }, 
     62            //change: sortableChange, 
     63            update: sortableUpdate 
     64        }); 
     65    }); 
    34466     
    345     // hidden要素の書き換え 
    346     var did = getAttrValue( gDragged, 'did' ); 
    347     var target_id = "target_id_"+did; 
    348     document.form1[target_id].value = getAttrValue( gDragged, 'target_id' ); 
    349      
    350     // 半透明、マウスポインタ、最前面処理を戻す 
    351     setOpacity( gDragged, 1); 
    352     setCursor ( gDragged, 'move' ); 
    353     setZindex ( gDragged , 1); 
    354      
    355     // 並び替え 
    356     fnSortObj(); 
    357      
    358     // 背景色を戻す 
    359     for ( var i = 0; i < all_elms.length; i++ ) { 
    360         // drop-target上にきた場合にのみ処理を行う 
    361         if ( isEventOnElm ( evt, all_elms[i].id ) && all_elms[i].attributes['tid']) { 
    362             // 背景色の変更 
    363             all_elms[i].style.background="#ffffff"; 
    364         } 
    365     } 
    366 } 
    367  
    368 // DropTarget上にオブジェクトが来たかを判断する 
    369 function isOnDropTarget ( evt ) { 
    370     
    371     for ( var i=0; i<all_elms.length; i++ ) { 
    372         if ( isEventOnElm ( evt, all_elms[i].id ) ) { 
    373             if ( all_elms[i].attributes['tid'] ) { 
    374                 return true; 
    375             } 
    376         } 
    377     } 
    378     return false; 
    379 } 
    380 function isEventOnElm (evt, drop_target_id) { 
    381  
    382     if (drop_target_id == '') { 
    383         return ''; 
    384     } 
    385  
    386     var evtX = getEventX(evt) + getPageScrollX(); 
    387     var evtY = getEventY(evt) + getPageScrollY(); 
    388      
    389     var drop_target = $("#" + drop_target_id ); 
    390  
    391     var offset = drop_target.offset(); 
    392     var x = offset.left; 
    393     var y = offset.top; 
    394  
    395     var width = drop_target.width(); 
    396     var height = drop_target.height(); 
    397      
    398 //  alert(evtX +" / "+ x +" / "+ evtY +" / "+ y +" / "+ width +" / "+ height); 
    399  
    400     return evtX > x && evtY > y && evtX < x + width && evtY < y + height; 
    401 } 
    402  
    403 // オブジェクトの並び替えを行う 
    404 function fnSortObj(){ 
    405     fnSetTargetHeight(); 
    406     for ( var cnt = 0; cnt < all_elms.length; cnt++ ) { 
    407  
    408         // classが drop-target の場合のみ処理を行う 
    409         if ( getAttrValue ( all_elms[cnt], 'class' ) == 'drop-target' ) { 
    410             var tid = getAttrValue ( all_elms[cnt], 'tid' ); 
    411              
    412             // 配列の並び替え 
    413             fnChangeObj(tid); 
    414              
    415             // 配置 
    416             fnSetObj( tid, cnt ); 
    417         } 
    418     } 
    419 } 
    420  
    421 function alerttest(msg, x, y){ 
    422     alert(msg); 
    423 } 
    424  
    425 // 配列の作成 
    426 function fnCreateArr( addEvt , top , left ){ 
    427  
    428     var arrObjtmp = new Object(); 
    429     arrObjtmp['LeftNavi'] = Array(); 
    430     arrObjtmp['RightNavi'] = Array(); 
    431     arrObjtmp['MainHead'] = Array(); 
    432     arrObjtmp['MainFoot'] = Array(); 
    433     arrObjtmp['Unused'] = Array(); 
    434  
    435     for ( var i = 1; i < all_elms.length; i++ ) { 
    436         // classが dragged-elm の場合のみ処理を行う 
    437         if ( getAttrValue ( all_elms[i], 'class' ) == "dragged-elm" ) { 
    438          
    439             // マウスダウンイベントと関連付けを行う 
    440             if (addEvt == 0) { 
    441                 addEvent ( all_elms[i], 'mousedown', onMouseDown, false ); 
    442             } 
    443  
    444             var target_id = getAttrValue ( all_elms[i], 'target_id' );   
    445             var len = arrObjtmp[target_id].length; 
    446             var did = getAttrValue ( all_elms[i], 'did' ); 
    447              
    448             arrObjtmp[target_id][len] = new SC_Size(); 
    449             arrObjtmp[target_id][len].id = did; 
    450             arrObjtmp[target_id][len].obj = all_elms[i]; 
    451             arrObjtmp[target_id][len].width = getWidth( all_elms[i] ); 
    452             arrObjtmp[target_id][len].height = getHeight( all_elms[i] ); 
    453  
    454             // ドラッグ中のオブジェクトが存在すれば、そのオブジェクトだけマウスポインタの座標を指定する。 
    455             if (gDragged != "") { 
    456                 if (did != getAttrValue ( gDragged, 'did' )) { 
    457                     // top は常にオブジェクトの中心を取得するようにする 
    458                     arrObjtmp[target_id][len].top = (parseInt(getY( all_elms[i] )) + arrObjtmp[target_id][len].height / 2 ); 
    459                     arrObjtmp[target_id][len].left = getX( all_elms[i] ); 
    460                 }else { 
    461                     arrObjtmp[target_id][len].top = top; 
    462                     arrObjtmp[target_id][len].left = left; 
    463                 } 
    464             } else { 
    465                 // top は常にオブジェクトの中心を取得するようにする 
    466                 arrObjtmp[target_id][len].top = i; 
    467                 arrObjtmp[target_id][len].left = getX( all_elms[i] ); 
    468             } 
    469         } 
    470     } 
    471      
    472     arrObj = arrObjtmp; 
    473 } 
    474  
    475 // 配列の並び替え (バブルソートで並び替えを行う)  
    476 function fnChangeObj( tid ){ 
    477     for ( var i = 0; i < arrObj[tid].length-1; i++ ) { 
    478         for ( var j = arrObj[tid].length-1; j > i; j-- ) { 
    479             if ( arrObj[tid][j].top < arrObj[tid][i].top ) { 
    480                 var arrTemp = new Array(); 
    481                 arrTemp = arrObj[tid][j]; 
    482                 arrObj[tid][j] = arrObj[tid][i]; 
    483                 arrObj[tid][i] = arrTemp; 
    484             } 
    485         } 
    486     } 
    487 } 
    488  
    489 // 配置 
    490 function fnSetObj( tid, cnt ){ 
    491     var target_height = 0; 
    492      
    493     drp_left = getX(all_elms[cnt]); //all_elms[cnt].offsetLeft; 
    494     drp_top = getY(all_elms[cnt]); //all_elms[cnt].offsetTop; 
    495  
    496     for ( var j = 0; j < arrObj[tid].length; j++ ) { 
    497         // 配置する座標の取得 
    498         var left = parseInt(drp_left) + parseInt(all_elms[cnt].style.width) / 2 - parseInt(arrObj[tid][j].width) / 2; 
    499         if (j == 0){ 
    500             var top = drp_top + arrObj[tid][j].margin; 
    501         }else{ 
    502             var top = arrObj[tid][j-1].top + arrObj[tid][j].margin + arrObj[tid][j-1].height 
    503         } 
    504  
    505         // 座標を保持 
    506         arrObj[tid][j].top = top; 
    507         arrObj[tid][j].left = left; 
    508  
    509         // 配置を行う 
    510         moveElm ( arrObj[tid][j].obj, left ,top); 
    511  
    512         // 高さ計算 
    513         target_height = target_height + arrObj[tid][j].margin + arrObj[tid][j].height; 
    514  
    515         // hiddenの値を書き換え 
    516         var top_id = "top_" + arrObj[tid][j].id; 
    517         document.form1[top_id].value = top; 
    518  
    519     } 
    520 } 
    521  
    522 // ドロップターゲットの高さ調整 
    523 function fnSetTargetHeight(){ 
    524  
    525     var NaviHeight = defNavi; 
    526     var MainHeadHeight = defMainNavi; 
    527     var MainFootHeight = defMainNavi; 
    528     var UnusedHeight = defUnused; 
    529  
    530     // 高さ計算 
    531     $(".drop-target").each(function(){ 
    532         var target_height = 0; 
    533         var tid = $(this).attr("tid"); 
    534  
    535         for ( var j = 0; j < arrObj[tid].length; j++ ) { 
    536             target_height = target_height + arrObj[tid][j].margin + arrObj[tid][j].height; 
    537         } 
    538  
    539         // 下の幅 
    540         target_height = target_height + 20; 
    541  
    542         // 左右ナビ、未使用領域の高さを保持 
    543         if (tid == 'LeftNavi' || tid == 'RightNavi' || tid == 'Unused') { 
    544             if (NaviHeight < target_height) { 
    545                 NaviHeight = target_height; 
    546             } 
    547         } 
    548  
    549         // メイン上部領域の高さを保持 
    550         if (tid == 'MainHead') { 
    551             if (target_height > defMainNavi) { 
    552                 MainHeadHeight = target_height; 
    553             } 
    554         } 
    555  
    556         // メイン下部領域の高さを保持 
    557         if (tid == 'MainFoot') { 
    558             if (target_height > defMainNavi) { 
    559                 MainFootHeight = target_height; 
    560             } 
    561         } 
     67    $(window).bind('load',function(){ 
     68        setTimeout(function(){ 
     69            $('#overlay').fadeOut(function(){ 
     70                $('body').css('overflow', 'auto'); 
     71            }); 
     72        }, 750); 
    56273    }); 
    563  
    564     // メイン領域の高さを保持 
    565 //  alert(NaviHeight+"/"+MainHeadHeight+"/"+MainFootHeight); 
    566     MainHeight = NaviHeight - ( MainHeadHeight + MainFootHeight ); 
    567     if (MainHeight < defMain) { 
    568         MainHeight = defMain; 
    569     } 
    570  
    571     // メイン部分のほうが大きい場合には左右ナビも大きくする 
    572     if (NaviHeight < MainHeadHeight + MainFootHeight + MainHeight) { 
    573         NaviHeight = MainHeadHeight + MainFootHeight + MainHeight;   
    574     } 
    575     // 変更 
    576     $(".drop-target").each(function(){ 
    577         var tid = $(this).attr("tid"); 
    578  
    579         // tidによって処理を分ける 
    580         if (tid == 'LeftNavi' || tid == 'RightNavi') { 
    581             $(this).height(NaviHeight); 
    582         }else if (tid == 'MainHead' ) { 
    583             $(this).height(MainHeadHeight); 
    584         }else if (tid == 'MainFoot') { 
    585             $(this).height(MainFootHeight); 
    586         }else if (tid == 'Unused'){ 
    587             $(this).height(NaviHeight+100); 
    588         } 
    589     }); 
    590      
    591     // メインテーブルの高さも変更 
    592     $("#layout-main").height(MainHeight-2); 
    593 } 
    594  
    595 //ウインドウサイズ取得 
    596 function GetWindowSize(type){ 
    597     var ua = navigator.userAgent;                                               // ユーザーエージェント 
    598     var nWidth, nHeight;                                                        // サイズ 
    599     var nHit = ua.indexOf("MSIE");                                              // 合致した部分の先頭文字の添え字 
    600     var bIE = (nHit >=  0);                                                     // IE かどうか 
    601     var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");                           // バージョンが 6 かどうか 
    602     var bStd = (document.compatMode && document.compatMode=="CSS1Compat");      // 標準モードかどうか 
    603  
    604     switch(type){ 
    605         case "width": 
    606             if(bIE){ 
    607                 if (bVer6 && bStd) { 
    608                     return document.documentElement.clientWidth; 
    609                 } else { 
    610                     return document.body.clientWidth; 
    611                 } 
    612             }else if(document.layers){ 
    613                 return(innerWidth); 
    614             }else{ 
    615                 return(-1); 
    616             } 
    617         break; 
    618         case "height": 
    619             if(bIE){ 
    620                 if (bVer6 && bStd) { 
    621                     return document.documentElement.clientHeight; 
    622                 } else { 
    623                     return document.body.clientHeight; 
    624                 } 
    625                 return(document.body.clientHeight); 
    626             }else if(document.layers){ 
    627                 return(innerHeight); 
    628             }else{ 
    629                 return(-1); 
    630             } 
    631         break; 
    632         default: 
    633             return(-1); 
    634         break; 
    635     } 
    636 } 
    637  
    638 // ウィンドウサイズが変更になったときは全てのオブジェクトも移動する 
    639 function fnMoveObject() { 
    640  
    641     // ウィンドウの幅変更比率を取得 
    642     var moveX = GetWindowSize("width") - scrX; 
    643     var BlankX = ( GetWindowSize("width") - 878 ) / 2 
    644  
    645     $(".drop-target").each(function(){ 
    646         if ($(this).css("left") == "") { 
    647             var tid = $(this).attr('tid'); 
    648  
    649             if (tid == 'LeftNavi') { 
    650                 LeftMargin = marginLeftNavi; 
    651             }else if (tid == 'RightNavi') { 
    652                 LeftMargin = marginRightNavi; 
    653             }else if (tid == 'MainHead' || tid == 'MainFoot') { 
    654                 LeftMargin = marginMain; 
    655             }else{ 
    656                 LeftMargin = marginUnused; 
    657             } 
    658  
    659             if (BlankX > 0) { 
    660                 $(this).css("left", BlankX + LeftMargin + 'px'); 
    661             }else{ 
    662                 $(this).css("left", LeftMargin + 'px'); 
    663             } 
    664         } 
    665     }); 
    666      
    667     scrX = GetWindowSize("width"); 
    668     scrY = GetWindowSize("height"); 
    669      
    670     fnSortObj(); 
    671 } 
    672 // 画面のロードイベントに関連付け 
    673 addEvent ( window, 'load', init, false ); 
     74})(jQuery); 
Note: See TracChangeset for help on using the changeset viewer.