/* 7 day calendar */
		/* We use the initCallback callback to assign functionality to the controls */
		function mycarousel_initCallback(carousel) {
		    jQuery('.widget.sevenday .jcarousel-control li').bind('click', function() {
		        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).children('.count').text()));
				jQuery(this).addClass("selected");
				jQuery(this).children(".weekday, .monthday").hide();
				jQuery(this).children(".weekday, .monthday").fadeIn();
				jQuery(this).siblings().removeClass("selected");
	        return false;
		    });
		};
		
		jQuery(document).ready(function() {
			
			// Recommended Events - Seven Day
			if( jQuery('.widget.sevenday .carousel').length>0 ) {
				    jQuery(".widget.sevenday .carousel").jcarousel({
				        scroll: 1,
				        initCallback: mycarousel_initCallback,
				        buttonNextHTML: null,
				        buttonPrevHTML: null
				    });
			}

			// Going		
			id = '{/literal}{$profile->encryptedId}{literal}';
			function setGoing(add,event_id){
				if(id != ''){
					$.ajax({
						type: "POST",
						url: '/api?method=Favorite.SetFavorite&moduleId='+event_id+'&moduleTypeId=21&e_id={/literal}{$profile->encryptedId}{literal}&add='+add,
						dataType: "json",
						success:function(response){
							if(response.success == 1){
								if(add == 1) $("span[rel='"+event_id+"']").text("YOU ARE GOING").addClass('isGoing');
								if(add == 0) $("span[rel='"+event_id+"']").text("I'M GOING").removeClass('isGoing');
							}
						}
					});
				} else {
					alert('Please log in first');
				}
			}
			
			$('.going').toggle(function(){
				setGoing(1,$(this).attr('rel'));
				return false;
			},function(){
				setGoing(0,$(this).attr('rel'));
				return false;
			});
		});



/* Article List Widget - detail_articles.tpl  //commenting yahoo stuff
	$(document).ready(function(){
		$("#articles a").click(function(){  
			ywa_onclick("Articles: " + $(this).attr('title'), "{$wimgoSection|capitalize}", "INTERNAL_SEARCH");
		});
	});
*/

/* widgets/business_filters/display.tpl */
	$(document).ready(function(){
		$('.show-more-link').click(function(){
			$('.read-more-box',$(this).parent()).toggle(2000);
			if($(this).html()=="Show More...") { $(this).html("Show Less...") } else { $(this).html("Show More...") };
			return false;
			
		});
	});
				
				
				
				
/* from widgets/html_list - should be updated for every place that html_list/display.tpl is called, i just know of these 2 */
/*//comenting yahoo stuff
$(document).ready(function(){ 
	$("#1-click-search a").click(function(){  
		ywa_onclick("Quick Search: " + $(this).text(), "Events", "INTERNAL_SEARCH");
	});
	$("#districts a").click(function(){  
		ywa_onclick("Districts: " + $(this).text(), "Events", "INTERNAL_SEARCH");
	});
});

*/

/* from widgets/review_list/display.tpl */
/*//comenting yahoo stuff
$(document).ready(function(){ 

	$(".comment-list a.author").click(function(){  
		ywa_onclick("Recent Reviews: Profile: " + $(this).attr('title'), "{$wimgoSection|capitalize}", "INTERNAL_SEARCH");
	});

	$(".comment-list a.venue-title").click(function(){  
		ywa_onclick("Recent Reviews: Venue: " + $(this).attr('title'), "{$wimgoSection|capitalize}", "INTERNAL_SEARCH");
	});

	$(".comment-list a.more,.comment-list a.report").click(function(){  
		ywa_onclick("Recent Reviews: " + $(this).attr('title'), "{$wimgoSection|capitalize}", "INTERNAL_SEARCH");
	});

});


*/
function toggleReplies(id) {
    var me = document.getElementById(id);
    me.className = (me.className != "repliesButton open" ? "repliesButton open" : "repliesButton");
}


// from widgets/widgets/movie_reviews.tpl
/*//comenting yahoo stuff
$(document).ready(function(){ 
 
	$(".comment-list a.author").click(function(){  
		ywa_onclick("Movies Reviews: Profile: " + $(this).attr('title'), "Movies", "INTERNAL_SEARCH");
	});
 
	$(".comment-list a.movie-title").click(function(){  
		ywa_onclick("Movies Reviews: Movies: " + $(this).attr('title'), "Movies", "INTERNAL_SEARCH");
	});
 
	$(".comment-list a.more,.comment-list a.report").click(function(){  
		ywa_onclick("Movies Reviews: " + $(this).attr('title'), "Movies", "INTERNAL_SEARCH");
	});
 
});
*/
//blog carousel on homepage
function blogcarousel_initCallback(carousel) {
		jQuery('.blog-carousel-numbers-box a').bind('click', function() {
			carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			return false;
		}); 
	    jQuery('.blog-carousel-next').bind('click', function() {
	        carousel.next();
	        return false;
	    });
	 
	    jQuery('.blog-carousel-prev').bind('click', function() {
	        carousel.prev();
	        return false;
	    });
	}
	function blogcarousel_itemLastInCallback(carousel, item, idx, state) {
		var numberLinkStatusClass= ".blog-carousel-numbers-box a#number-link-" + idx;
		$('.blog-carousel-numbers-box a').removeClass('current-carousel-link');
		$(numberLinkStatusClass).addClass('current-carousel-link');
	};


jQuery(document).ready(function() {

		var rs=$('#blog-carousel > li').size();
		if ( $('#blogwidgetcountlist').html('<li>Loading...</li>') ) {
			$('#blogwidgetcountlist').html("");
		}
		if (rs>0) {
			for(var rc=1; rc<=rs; rc=rc+1) {
				$('#blogwidgetcountlist').append('<li><a id="number-link-' + rc + '" class="carouselCounter" href="#"><span>' + rc + '</span>.</a></li>');
			}
			$('#blogscontainer').removeClass("hide");
			$('#blog-carousel').removeClass("hide").jcarousel({ visible:1,scroll:1,initCallback: blogcarousel_initCallback, buttonNextHTML: null, buttonPrevHTML: null, itemLastInCallback: blogcarousel_itemLastInCallback});
			
		} 
			

});
