/*
 * jQuery RollEm Plugin for light-weight slideshows
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2008 M. Alsup
 * Version: 2.10 (02/10/2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.1.3.1 or later
 *

 */
 	
	var $imgCnt = 1;
	var fwd = true;
	var speed = 3000;			  
	
	
	$.fn.rollem = function(cont) {
	
		$imgCnt = 1;
		var $displayCnt = 7;
		var $totImages = $(cont + " li").size();
	
		$("#chgRight").click(function(){
			$("#galleryPics").css("padding-right",175-$("#galleryPics div").first().width());
			$("#galleryPics div").css("float","right");
			fwd ? fwd=false : fwd=true;		
		});		
	
		$("#galleryPics").append("<div><span class='galleryCaption'>blank</span></div>");
		
		for ($imgCnt=1;$imgCnt<=$displayCnt;$imgCnt++){
			$nextLi = $(cont + " li:nth-child(" + $imgCnt + ")");
			$("#galleryPics").append($nextLi.html());
		};
		$imgCnt++;
		$("#galleryPics").picflowleft($imgCnt-1,cont);
    };


	$.fn.picflowleft = function(imgCnt,cont) { // <===	
		var $container = $(this);
		var $firstPic = $("#galleryPics div").first();
		$firstPic.animate({ 
			width: "1"
		}, speed, 'linear',function(){
			if (imgRoll){
				$nextLi = $(cont + " li:nth-child(" + imgCnt + ")");
				$container.append($nextLi.html());
				$("#galleryPics div").first().remove();
				if ($imgCnt > $(cont + " li").size()) $imgCnt = 1;
			}
			$container.picflowleft($imgCnt++,cont);
		});
    };
	


