var single_image_width = 247;
var single_page_width = 741;
var current_width = 0;
var total_width;

//Get the total width after the document is loaded
jQuery(document).ready(function(){
	total_width = jQuery("#pkgslidesub").width()-single_page_width;
});

//Function to slide to the previous set of images
function movePrev(){
	if(current_width <= 0){
		if((current_width + single_page_width) <= 0 ){
			current_width = current_width + single_page_width;
		}else{
			current_width = 0;
		}
		jQuery("#pkgslidesub").animate({"left": current_width+"px"}, 300, "swing");
	}
	setImage();
}

//Function to slide to the next set of images
function moveNext(){
	if(current_width > -total_width){
		if((current_width - single_page_width) > -total_width) {
			current_width = current_width - single_page_width;
		}else{
			current_width = -total_width;
		}
		jQuery("#pkgslidesub").animate({"left": current_width+"px"}, 300, "swing");
	}
	setImage();
}

function setImage(){
	if(current_width < 0){
		jQuery(".pkgtopprev").show();
	}
	else if(current_width == 0){
        jQuery(".pkgtopprev").hide(); 
	}
	if(current_width > -total_width){
        jQuery(".pkgtopnxt").show(); 
	}else{
		jQuery(".pkgtopnxt").hide();
	}
}
