var velo_fade = 200;
var intervaloSlide = 2000;
var indexAtual = 0;
var totalWidth = null;
var deslocamento = null;
var slideOrientacao =  'next';

// INCIO: Resoluo para bug -10000 do jquery
$.fx.prototype.cur = function(){ 
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}
// FIM: Resoluo para bug -10000 do jquery


function trocaSlide(){
	var slides = $('.slide-show > ul > li');
	var qtd_slides = slides.size();
	
	
	
	deslocamento = slides.eq(indexAtual).outerWidth(true)*indexAtual;
    
    
    //deslocamento = slides.eq(indexAtual).outerWidth(true) * 2;
    //deslocamento = 307;
    
    
    
    
    
    /*
    
    if(slideOrientacao == 'next'){  
    
     $('.slide-show > ul').animate({left:deslocamento * (-1)},
     	function(){
     		for(i=0;i<indexAtual;i++){
		    	slides.eq(i-1).remove();    
		    }     
     	});
	    
	    
	    
	    
	    
    }
    if(slideOrientacao == 'prev'){
    	slides.eq(indexAtual-1).show();
    	deslocamento = deslocamento / 2;  	    	    
    }
    
    */
    
    $('.slide-show > ul').animate({left:-deslocamento});
    
    
    
    
    
        
}
function ajusteSlide(){	
	if(indexAtual >= ($('.slide-show > ul > li').size()-1)){
		indexAtual = $('.slide-show > ul > li').size()-1;
		$('._next').animate({opacity:0.25},500);
	}else{
		$('._next').animate({opacity:1},500);
	}
	if(indexAtual <= 0){
		indexAtual =0;
		$('._prev').animate({opacity:0.25},500);
	}else{$('._prev').animate({opacity:1},500);}
}
function slideShow(){
	var intervalo = setInterval('indexAtual = indexAtual + 1; ajusteSlide(); trocaSlide()',2000);
}
$(document).ready(function(){	
	$('.slide-show > ul > li').each(function(){totalWidth = totalWidth + $(this).width();}); // tamanho total do slider
	$('.slide-show > ul').width(totalWidth);
	ajusteSlide(); // link prev
	$('._next').click(function(){slideOrientacao ='next'; indexAtual = indexAtual + 1; ajusteSlide(); trocaSlide();});
	$('._prev').click(function(){slideOrientacao ='prev'; indexAtual = indexAtual - 1; ajusteSlide(); trocaSlide();});
});



/*
31 - 9517
32 - 9824
33 - 10131
34 - 10438
*/
