$().ready(function() {

    $('ul.sf-menu').superfish({ 
        delay:       100,
        animation:   {opacity:'show'},
        speed:       250,
        autoArrows:  false,
        dropShadows: false
    });
    
	$.preload([ 'btn_search_hover', 'tt_profile', 'tt_message', 'tooltip'], {
	    base:'/assets/images/',
	    ext:'.png'
	});
	$("#friendsThumbs li a").attr('title', '');

	$("#navigation li:not(.joinnow)").hover(
		function() {
			$(this).find(':first-child').addClass('over');
		},
		function() {
			$(this).find(':first-child').removeClass('over');
		}
	);

	$("#topbar input[type='image']").hover(
		function() {
			$(this).attr('src', '/assets/images/btn_search_hover.png');
		},
		function() {
			$(this).attr('src', '/assets/images/btn_search.png');
		}
	);
	$("#keywords").focus(function() {
		var value = $(this).getValue();
		if (value == "Search") {
			$(this).setValue('');
		}
	});
	$("#keywords").blur(function() {
		var value = $(this).getValue();
		if (value == '') {
			$(this).setValue('Search');
		}
	});
	$("#footer .donate").hover(
		function() {
			$(this).find('p strong a').addClass('active');
		}, 
		function() {
			$(this).find('p strong a').removeClass('active');
		}
	);		
	$("#eventEntries li:last").css({
		'border':'none'
	});
	var defaultGalleryImage = $("#galleryThumbnails .gi1 .thumbEnlarged").html();
	$("#galleryThumbnails .gi1 a").addClass('active');
	$("#gallery .photo div").html(defaultGalleryImage);
	$("#galleryThumbnails a").click(function() {
		$("#galleryThumbnails a[class='active']").removeClass('active');
		var imgToShow = $(this).next().html();
		$("#gallery .photo div").empty().hide().html(imgToShow).fadeIn(250);
		$(this).addClass('active');
	});
	$("#statusWindowClose").click(function() {
		$(this).parent().hide(500);
	});
	$("#friendsThumbs > ul > li > a").tooltip({
	    tip: '.tooltip',
        offset: [10, 0],
        relative: true,
        delay: 300,
        predelay: 300
	});

	
});