/* 	Written by Joseph Hinson of Out:think Group (outthinkgroup.com) 
::::This slider is designed to slide based on the amount of uls with the class .slide.
*/

var slides=0;
var slideWidth=0;
jQuery(document).ready(function() {
    jQuery('.next').click(function() {
        changeSlideRight()
    });
    jQuery('.previous').click(function() {
        changeSlideLeft()
    })
	slides = jQuery('ul.slide').size();
	slideWidth = jQuery('ul.slide').width();
});
var curLocation = 0;
var curSlide = 0;
function changeSlideRight() {
		if(curSlide >= 0) {
			jQuery('.previous').fadeIn();
		}
        curSlide++;
		curLocation = curLocation - slideWidth;
        jQuery('#slide-wrap').animate({
            "left": curLocation
        },
        1200);
		if(slides == (curSlide + 1 )) {
			jQuery('.next').fadeOut();
		}
}
function changeSlideLeft() {
    curSlide--;
	curLocation = curLocation + slideWidth;
    jQuery('#slide-wrap').animate({
        "left": curLocation
    },
    1200);
	if(curSlide == 0) {
		jQuery('.previous').fadeOut();
	}
	if(curSlide >= 0) {
		jQuery('.next').fadeIn();
	}
}
