$(document).ready(function(){
		$('li.headlink').hover(
			function() { $('ul', this).css('display', 'block'); },
			function() { $('ul', this).css('display', 'none');  });
	
	
	/*
	//carousel fun
	jQuery('#mycarousel').jcarousel({
    	wrap: 'both'
    });

	

 
	$('#ags_carousel').load('/events/carousel');
	*/

$( "#tabs" ).tabs({
			ajaxOptions: {
				error: function( xhr, status, index, anchor ) {
					$( anchor.hash ).html(
						"Couldn't load this tab. We'll try to fix this as soon as possible. " +
						"If this wouldn't be a demo." );
				}
			}
		});

	$("#tabs-vertical").tabs().addClass('ui-tabs-vertical ui-helper-clearfix');
	$("#tabs-vertical li").removeClass('ui-corner-top').addClass('ui-corner-left');
		
		
	
	
	// sorting carousel
$("ul.carouselSorter li.all a").addClass("active");
	
	$("ul.carouselSorter li.all a").click(
			function() { 
				$("ul.carouselSorter li a").removeClass("active");
				$("ul.carouselSorter li.all a").addClass("active");
				$('#ags_carousel').load('/events/carousel');
			}
		);
	
	$("ul.carouselSorter li.ags a").click(
			function() { 
				$("ul.carouselSorter li a").removeClass("active");
				$("ul.carouselSorter li.ags a").addClass("active");
				$('#ags_carousel').load('/events/carousel/1');
			}
		);
	
	$("ul.carouselSorter li.cs a").click(
			function() { 
				$("ul.carouselSorter li a").removeClass("active");
				$("ul.carouselSorter li.cs a").addClass("active");
				$('#ags_carousel').load('/events/carousel/2');
			}
		);
		
	$("ul.carouselSorter li.social a").click(
			function() { 
				$("ul.carouselSorter li a").removeClass("active");
				$("ul.carouselSorter li.social a").addClass("active");
				$('#ags_carousel').load('/events/carousel/5');
			}
		);
	
		$("ul.carouselSorter li.meeting a").click(
			function() { 
				$("ul.carouselSorter li a").removeClass("active");
				$("ul.carouselSorter li.meeting a").addClass("active");
				$('#ags_carousel').load('/events/carousel/3');
			}
		);
		
		
		$("ul.carouselSorter li.other a").click(
			function() { 
				$("ul.carouselSorter li a").removeClass("active");
				$("ul.carouselSorter li.other a").addClass("active");
				$('#ags_carousel').load('/events/carousel/4');
			}
		);
		
		
	// sliding top bar fun
 $("span.login_button").click(
        function(){
				$(".topbar").animate({ height: "45px" }).animate({height: "82px" }, "fast"); 
				$("span.login_button").toggle();
				$("#top_content").show();
			}); 
			$("span#hide_button").click(function(){
				$(".topbar").animate({height: "0px"}, "fast");
				$("#top_content").hide();
      });
	  
	  	// sliding top bar fun
 $("span.panel_button").click(
        function(){
				$(".topbar").animate({ height: "45px" }).animate({height: "36px" }, "fast"); 
				$("span.panel_button").toggle();
				$("#top_content").show();
			}); 
			$("span#hide_button").click(function(){
				$(".topbar").animate({height: "0px"}, "fast");
				$("#top_content").hide();
      });
	  
	  
	
	  
	});
	
	
$(function() {
		  $('a[rel*=facebox]').click(function() {
					var url = this.href;
					var dialog = $('<div style="display:hidden"></div>').appendTo('body');
					// load remote content
					dialog.load(
						url, 
						{},
						function (responseText, textStatus, XMLHttpRequest) {
							dialog.dialog();
						}
					);
					return false;
				});
});

    $(document).ready(function(){
        $(".tweet").tweet({
            username: "agspcc",
            join_text: "auto",
            avatar_size: 32,
            count: 5,
            auto_join_text_default: "we said,", 
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied to",
            auto_join_text_url: "we were informing about",
            loading_text: "loading tweets..."
        });
    });
	
$(function() { 
	
        $(".dropdown").each( function() {
            $(this).hover(function(){
				var term = $(this).children("a").attr("name");
				
                $(this).addClass('active').append('<div class="menu"></div>');
                $(this).children(".menu").hide().load("/main/menu/" + term).delay(200).slideDown('fast');
				$(".active .arrow").html("&#9660");
            },function(){
				$(".active .arrow").html("&#9654");
                $(this).removeClass('active').children(".menu").remove();
            });
        }); 

	
	
	
});
