Question: I have a table column which stores xml chunks like 

```
<Text>hello, world</Text></Image id="100">

```

or plain text without tags. How can I generate xml out of tagged column values without escaped symbols.

here is an example of the statement:

```
select xmlelement("Proposal", xmlforest(1 as "ProposalType"
                                   ,to_char(sysdate, 'dd.mm.yyyy') as "CreateDate"
                                   ,'title1' as "Title"
                                   ,'<Text>hello, world</Text></Image id="100">' as "InfoBlock"))
  from dual;

```

and resulting xml looks like this:

```
<Proposal>
    <ProposalType>1</ProposalType>
    <CreateDate>31.10.2012</CreateDate>
    <Title>title1</Title>
   <InfoBlock2>&lt;Text&gt;hello, world&lt;/Text&gt;&lt;/Image id=&quot;100&quot;&gt;</InfoBlock2>
</Proposal>

```

but I need xml like this:

```
<Proposal>
    <ProposalType>1</ProposalType>
    <CreateDate>31.10.2012</CreateDate>
    <Title>title1</Title>
    <InfoBlock2>
        <Text>hello, world</Text><Image id="100"/>
    </InfoBlock2>
</Proposal>

```

Answer: 
**[jsBin demo](http://jsbin.com/agibud/1/edit)**

```
pagesN = $('.pages').length;
var c = 0;

function anim(){
  c = c===-1 ? pagesN-1 : c%pagesN;
  $('.pageContainer').stop().animate({left: -422*c }); 
}

$('.previous, .next').click(function(){
  var myClass = $(this).hasClass('next') ? ++c : --c;
  anim();
});

```

On click increase or decrease var `c`.
Than inside animate there's a ternary operator that will prevent `c` to go to `-1` (prev) and maintain it always in the max range (next) thanks to the modulo operator:

`c = c===-1 ? pagesN-1 : c%pagesN;`
What about incrementing a variable by 1 when animation is completed or decreasing accordingly? And when this variable is at the 3rd step you hide the buttons, otherwise you show them.
Something like

```
var counter = 1;
$('.next').click(function() {
  $('.pageContainer').animate({
    "left": "-=422px"
  }, 1000, function() {
    counter++;
    if(counter >= 3){ // or panels.length
      // hide button "next"
    }
  });
});

```