/* Author: 

*/

$.extend($.easing, {
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	}
});

$(document).ready(function(){
    $.ajax({
        url:'./xml/content_slider.asp',
        dataType: 'xml',
        success: function(xml){
            $('content_slider item', xml).each(function(){
                 var html = '<li> \
                             <article class="clearfix"> \
                             <a href="'+$(this).attr('book')+'"><img src="'+$(this).attr('image')+'" height="139" /></a> \
                             <h1>'+$(this).attr('title')+'</h1> \
                             <h2>'+$(this).attr('author')+'</h2><br /> \
                             <p>Por: <strong>'+$(this).attr('promotional_price')+'</strong></p> \
                             </article> \
                             </li>';
                 $(html).appendTo('#content_slider_x');
            });
            
            $('#content_slider_x').content_slider({
                direction: 'x',
                easing: 'easeInOutExpo',
                speed: 700, 
                timeout: 10000, 
                index: 0,
                next:   '#container_slider_x .next', 
                prev:   '#container_slider_x .prev'  
            });
        }
        
    })
    
});
