(function($){
    $.fn.extend({
        card:function(value){
            var card = $(this)
                .addClass('card');
            $('<span/>').addClass('number')
                .appendTo(card)
                .text(value);
            var size = $('.card').size();
            card
                .addClass(size % 2 == 0 ? 'even':'odd')
                .addClass('card-' + size);
            card.get(0).addEventListener('touchstart', function(){
                card.trigger('click');
            });
            card.click(function(){
                if(card.is('.disabled')) return;
                card.addClass('disabled');
                var style = (function(b, co, c){
                    return {
                        left:c.left - co.left - 10,
                        top:c.top - b.top
                    }

                })($('body').offset(), $('#content').offset(), card.offset());
                var selected = card.clone()
                    .insertAfter(card)
                    .addClass('selected')
                    .css(style)
                    .animate({
                        left:0,
                        top:0,
                        width:'100%',
                        height:'100%',
                        'font-size':'200px',
                        'line-height':'380px',
                        margin:0,
                        'border-radius':20
                    }, 500, null, function(){
                        selected
                            .click(function(){
                                if(closeBtn.is(':visible')){
                                    closeBtn.hide();
                                } else {
                                    closeBtn.show();
                                }
                            })
                            .dblclick(function(){
                                closeBtn.trigger('click');
                            });
                    });
                var closeBtn = $('<a/>')
                    .addClass('close-btn')
                    .appendTo(selected)
                    .text('×').one('click', function(){
                        selected.fadeOut(300, function(){
                            selected.remove();
                        })
                    }).hide();
                    card.removeClass('disabled');
            });
            return card;
        },
        cardChoiceSection:function(){
            var section = $(this);
            var numbers = [0, 1];
            while(numbers[1] < 13){
                var number = numbers.shift() + numbers[0];
                $('<div/>').card(number)
                    .appendTo(section);
                numbers.push(number);
            }
            $('<br/>').addClass('clear').appendTo(section);
            return section;
        }
    });
    $(function(){
        $('#card-choice-section').cardChoiceSection() ;
    });
})(jQuery);


@@ -25,16 +25,240 @@
 xtend(%7B%0A
+        clickOnTouchStart:function()%7B%0A            var elm = $(this);%0A            elm.get(0).addEventListener('touchstart', function()%7B%0A                elm.trigger('click');%0A            %7D);%0A            return elm;%0A        %7D,%0A
         
@@ -629,130 +629,62 @@
 card
-.get(0).addEventListener('touchstart', function()%7B%0A                card.trigger('click');%0A            %7D);%0A            card
+%0A                .clickOnTouchStart()%0A                
 .cli
@@ -984,17 +984,16 @@
       %7D%0A
-%0A
         
@@ -1063,16 +1063,17 @@
 set());%0A
+%0A
         
@@ -1640,16 +1640,65 @@
 elected%0A
+                            .clickOnTouchStart()%0A
         
@@ -2142,32 +2142,289 @@
             %7D);%0A
+                        selected.get(0).addEventListener('touchstart', function(e)%7B%0A                            if(e.touches.length %3E 1)%7B%0A                                selected.trigger('dblclick');%0A                            %7D%0A                        %7D)%0A
                 
@@ -2585,16 +2585,78 @@
 ext('%C3%97')
+%0A                    .clickOnTouchStart()%0A                    
 .one('cl
@@ -2774,24 +2774,77 @@
 d.remove();%0A
+                            $('.selected').remove();%0A
             

add touch events