                DnDApp = function() {
                    return {
                            init: function() {
                                var box = YAHOO.util.Dom.getElementsByClassName( 'sortList', 'li', document.getElementById( 'sidebarGroup' ) );
                                for( i = 0; i < box.length; i ++ ) {
                                        new DnDList( box[i].id );
                                }
				//new DnDListBoundary( "hiddenBottom" );
				//new DnDListBoundary( "hiddenTop" );
                           }
                        };
                } ();

                // YAHOO.util.DDM.useCache = false;
                YAHOO.util.Event.addListener( window, 'load', sidebar_init );
		
                function sidebar_init() {
			var sidebarGroup = document.getElementById( 'sidebarGroup' );
                        var locked_box = YAHOO.util.Dom.getElementsByClassName( 'locked', 'li', sidebarGroup );
                        var sidebarGroupLocked = document.getElementById( 'sidebarGroupLocked' );
                        for( i = 0; i < locked_box.length; i ++ ) {
                                sidebarGroup.removeChild( locked_box[i] );
                                sidebarGroupLocked.appendChild( locked_box[i] );
                        }
			
			var sidebarBoxes = YAHOO.util.Dom.getElementsByClassName( 'sortList', 'li', sidebarGroup );
			for( i = 0; i < sidebarBoxes.length; i ++ ) {
				var link = YAHOO.util.Dom.getElementsByClassName( 'toggle_link', 'a', sidebarBoxes[i] );
				if( link && link[0] && link[0].innerHTML == '<img src="/wp-content/themes/2yellows.template/images/plus.gif">' ) {
					var sidebar_box = YAHOO.util.Dom.getElementsByClassName( 'sidebar_inner_block', 'div', sidebarBoxes[i] );
					if( sidebar_box && sidebar_box[0] ) {
						sidebar_box[0].style.height = '0px';
					}
				}
			}
			
                        DnDApp.init();
                }

		function toggleBox( box ) {
                        var li = box.parentNode.parentNode;
                        if( li ) {
                                var sidebar_box = YAHOO.util.Dom.getElementsByClassName( 'sidebar_inner_block', 'div', li );
                                if( sidebar_box[0] ) {
                                        YAHOO.util.Dom.generateId( sidebar_box[0] );

					var attributes;
					var state = '';

                                        if( box.innerHTML == '<img src="/wp-content/themes/2yellows.template/images/min.gif">' ) {
						attributes = {
                                                        height: { to: 0 }
                                                };
						//sidebar_box[0].style.height = '0px';
                                                box.innerHTML = '<img src="/wp-content/themes/2yellows.template/images/plus.gif">';
						state = 'closed'
                                        }
                                        else {
						attributes = {
                                                        height: { to: '100', unit: '%' }
                                                };
						//sidebar_box[0].style.height = '100%';
						state = 'open';
                                                box.innerHTML = '<img src="/wp-content/themes/2yellows.template/images/min.gif">';
                                        }
					//alert( "id: " + sidebar_box[0].id );
					YAHOO.util.Connect.asyncRequest( 'GET', '/wp-content/themes/2yellows.template/set_sidebar_box.php?id=' + li.id + "&state=" + state, callback, null );
					//alert( 'url: ' + '/wp-content/themes/2yellows.template/set_sidebar_box.php?id=' + li.id + "&state=" + state );
                                        var anim = new YAHOO.util.Anim( sidebar_box[0].id, attributes, 0.5, YAHOO.util.Easing.elasticBoth );
                                        anim.animate();
                                }
                        }
                }

		var callback = {
		        timeout: 50000
		};
			
