var Rsc = function(){
	var _ww, _tc, _t1, _t2;
	return {
		init: function(){
			_ww = $(window).width();
		},
		
		adjustScrollables: function(){
			var _scrollables = $(".edibles-scrollable");
			_scrollables.each(function(i){
				if ($(this).find("li").length < 4) {
					$(this).siblings(".edibles-rbox-prev").css("background", "none").addClass("disabled");
					$(this).siblings(".edibles-rbox-next").css("background", "none").addClass("disabled");			
				}
			});			
		},
		
		//dynamically resize width of right tomato div based on browser viewport width
		adjustRightTomatoWidth: function(){
						
			var _rs = function(){
				_vw = 1216; //viewport window
				_ww = $(window).width(); //browser viewable window
				_tbw = 284; //tomato right base width
				
				if (_ww > _vw) {
					
					//resize width of tomato right div if width goes above _vw
					$(".abs2").width((_ww-_vw)/2+_tbw);
					
					// if it tries to get less than the right edge, then stop it and keep it at 284
					if($(".abs2").width() < _tbw){
						$(".abs2").width(_tbw);	
					}
					//$(".abs2").width(572);
					//$(".abs2").css("border","solid 2px #ff0000");
				}else{
					$(".abs2").width(_tbw);
					//$(".abs2").css("border","solid 2px #0000ff");
				}
				
			};
			_rs();
			
			$(window).resize(function() {
			  _rs();
			});

		}
	}
}();

$(function(){
	Rsc.init();
	Rsc.adjustScrollables();
	Rsc.adjustRightTomatoWidth();
});

