		function rotateMain(){
			var theWidth = 1000;
			var theCount = 6;

				var currentLi = $("#homeBanner li.active").index();
				if(currentLi < theCount -1){
					var nextLi = currentLi + 1;
				}else{
					var nextLi = 0;
				}
				var thePage = nextLi + 1;

			goToPageHome(thePage);	
		
		}
		
		function goToPageHome(thePage){
			var nextPos = (thePage-1) * -1000;
			$("#homeBanner").animate({
				marginLeft:nextPos
			},"slow",function(){
			//alert(thePage);
				$("#homeBanner li.active").removeClass("active");
				$("#homeBanner li:nth-child(" + thePage + ")").addClass("active");
				$("#headerMarker li.active").removeClass("active").addClass("gry");
				$("#headerMarker li:nth-child(" + thePage + ")").addClass("active").removeClass("gry");
			});
		}
		
		function showFPThmbs(index){
			$("#planThmbs li.active").fadeOut("fast",function(){
				$(this).removeClass("active");
				$("#planThmbs li:nth-child(" + (index +1) + ")").fadeIn("fast",function(){
					$(this).addClass("active");
				});
			});
		}
		
		function goToPage(thePage){
			var theOffset = $("#banMark").offset().left;
			var nextPos = theOffset - (3 + (thePage -1) * ($("#galleryPhotos ul li").width() + 6));
			$("#galleryPhotos ul").animate({
				marginLeft:nextPos
			},"slow",function(){
			//alert(thePage);
				$("#galleryPhotos ul li.active").removeClass("active");
				$("#galleryPhotos ul li:nth-child(" + thePage + ")").addClass("active");
				$("#thmbs li.active").removeClass("active");
				$("#thmbs li:nth-child(" + thePage + ")").addClass("active");
			});
		}
		
		function fixGalleryPosition(){
			var theOffset = $("#banMark").offset().left;
			var theIndex = $("#galleryPhotos ul li.active").index();
			var fixedOffset = theOffset - (3 + theIndex * ($("#galleryPhotos ul li").width() + 6));
			
			$("#galleryPhotos ul").css("marginLeft",fixedOffset);
		}
		
function zeroPad(num, places) {
  var zero = places - num.toString().length + 1;
  return Array(+(zero > 0 && zero)).join("0") + num;
}

function getCounterNumbers(){
	$("#counterNumbers li").html("<img src='http://venueonguadalupe.com/assets/images/counter_nbr_blr.png'>");
	$.ajax({
		url:"/counter/getCount.php?s=fd",
		dataType: "json",
		success:function(data){
			var theCountPadded = zeroPad(data.count, 3);
			$("#counterNumbers li:nth-child(1)").html(theCountPadded.substring(0,1));
			$("#counterNumbers li:nth-child(2)").html(theCountPadded.substring(1,2));
			$("#counterNumbers li:nth-child(3)").html(theCountPadded.substring(2,3));
			$("#counterDate").html("(As of " + data.date + ")");
		}
	});
}
