I'm having a problem displaying accordion sections based on an Array value.

Once the items are dropped to the left column, and hit the button, this show the dropped id's in accordion. The tricky bit is that when i remove any of the item from left column back to the right one and hit the button again, accordion sections are NOT being removed.

Can anyone help please?

Here's the code:

HTML Code:
<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Sortable - Handle empty lists</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <style>
  #sortable1, #sortable2, #sortable3 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 143px;}
  #sortable1 li, #sortable2 li, #sortable3 li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; }

  #sec1, #sec2,#sec3,#sec4,#sec5,#accordion {display: none;}

    #sec1, #sec2,#sec3,#sec4,#sec5
  </style>
  <script>
  $(function() {
    $( "ul.droptrue" ).sortable({
      connectWith: "ul"
    });

    $( "ul.dropfalse" ).sortable({
      connectWith: "ul"

    });

    $( "#sortable1, #sortable2, #sortable3" ).disableSelection();


    $('#btn-get').click(function(){
        //alert(getItems('#left'));
        //$("#results").html(getItems('#left'));
        getItems('#left');
    });


    // Get items
    function getItems(exampleNr)
    {
        var sortedIDs = [];

        for(var i=0; i<=sortedIDs.length;i++){

            $(exampleNr + ' ul.droptrue').each(function(){
                sortedIDs = $(this).sortable( "toArray" );              
            });


        //console.log(sortedIDs[i]);

        if (sortedIDs.length>0){
            //alert(sortedIDs);
            $('#accordion').fadeIn();
            $('#sec'+sortedIDs[i]).show();
            //showAccordion(sortedIDs[i]);

        }else{
            alert("Choose at least one service");

        }
            /*if(sortedIDs[i]){ 
                $('#sec'+sortedIDs[i]).fadeIn();
            }else{
                $('#sec'+sortedIDs[i]).fadeOut();
            }*/     

        }

        /*if (sortedIDs.length>0){

            $('#accordion').fadeIn();

        }else{
            alert("Choose at least one service");
            $('#accordion').fadeOut();
            $('#sec'+sortedIDs[i]).fadeOut();
        }*/




        //alert(sortedIDs);
        //console.log(sortedIDs);
        //alert(sortedIDs[0])          
        return sortedIDs;
    }

    function showAccordion(section){

        $('#sec'+section).css({"display" :"none"});


    }

  });
  </script>
  <script>
  $(function() {
    $( "#accordion" ).accordion();
  });
  </script>
</head>
<body>
<div id="left">
<ul id="sortable1" class="droptrue">

</ul>
 </div>
<div id="right"> 
<ul id="sortable2" class="dropfalse">
  <li class="ui-state-default" id="1">Can be dropped..</li>
  <li class="ui-state-default" id="2">..on an empty list</li>
  <li class="ui-state-default" id="3">Item 3</li>
  <li class="ui-state-default" id="4">Item 4</li>
  <li class="ui-state-default" id="5">Item 5</li>
  <li class="ui-state-highlight" id="6">Cannot be dropped..</li>
  <li class="ui-state-highlight" id="7">..on an empty list</li>
  <li class="ui-state-highlight" id="8">Item 3</li>
  <li class="ui-state-highlight" id="9">Item 4</li>
  <li class="ui-state-highlight" id="10">Item 5</li>
</ul>
</div>


<br style="clear: both;" />
 <p><input type="submit" class="input-button" id="btn-get" value="Get items" /></p>
 <div id="results"></div>

<div id="accordion">
  <h3 id="sec1">Section 1</h3>
  <div>
    <p>
    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
    ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
    amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
    </p>
  </div>
  <h3 id="sec2">Section 2</h3>
  <div>
    <p>
    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
    purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
    velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
    suscipit faucibus urna.
    </p>
  </div>
  <h3 id="sec3">Section 3</h3>
  <div>
    <p>
    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
    Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
    ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
    lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
    </p>
    <ul>
      <li>List item one</li>
      <li>List item two</li>
      <li>List item three</li>
    </ul>
  </div>
  <h3 id="sec4">Section 4</h3>
  <div>
    <p>
    Cras dictum. Pellentesque habitant morbi tristique senectus et netus
    et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
    faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
    mauris vel est.
    </p>
    <p>
    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
    Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
    inceptos himenaeos.
    </p>
  </div>
   <h3 id="sec5">Section 5</h3>
  <div>
    <p>
    Cras dictum. Pellentesque habitant morbi tristique senectus et netus
    et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
    faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
    mauris vel est.
    </p>
    <p>
    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
    Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
    inceptos himenaeos.
    </p>
  </div>
</div> 

</body>
</html>