$j = jQuery.noConflict();

$j(document).ready(function() {	
	$j('.main-menu ul li').mouseenter(function() { $j(this).addClass('hover'); });
	$j('.main-menu ul li').mouseleave(function() { $j(this).removeClass('hover'); });

	Cufon.set('fontFamily', 'Arial Black').replace('h1 span', { color: '-linear-gradient(#980B0B, #670A0A)', fontSize: '24px' }).replace('.heading h2, .sponsors h2');

	if( $j('.photo-gallery').length > 0 ) {
		$j('.photo-gallery').each(function(i, gallery) {
			$j(gallery).find('a.btn-view').click(function() {
				$j(gallery).find('.ngg-gallery-thumbnail a:first').click();
				return false;
			});
		});
		
		$j('.ngg-gallery-thumbnail').hide();
	}


	if( $j('.sponsors .logos').length > 0 ) {
		var baloon = $j('<strong class="logo-hint"></strong>').appendTo('#footer');
		
		$j('.sponsors .logos').scrollable({ circular: true, speed: 1000 }).autoscroll({ autoplay: true, autopause: true });
		
		$j('.sponsors .logos a, .sponsors .logos span').mouseover(function() {
			$j(baloon).html($j(this).attr('title')).show();
			$j(baloon).css({top: 130 - $j(baloon).outerHeight(), left: $j(this).offset().left - ($j(this).width() / 4) });
		});
		
		$j('.sponsors .logos a, .sponsors .logos span').mouseleave(function() {
			$j(baloon).html('').hide();
		});
	}

	if( $j('.awa-slider').length > 0 ) {
		$j('.awa-slider').scrollable({ circular: true }).autoscroll({ autoplay: true });
	}
	
	if( $j('#intro-video').length > 0 ) {
		var so = new SWFObject('public/swf/intro.swf', '', '100%', '100%','9');
	    so.addParam('allowfullscreen', 'false');
	    so.addParam('bgcolor','#000000');
	    so.addParam('wmode','opaque');
	    so.write('intro-video');
	}
	
	if( $j('#slider').length > 0 ) {
		$j('#slider .items').tabs('.items > .slide', {
			effect: 'fade',
			fadeOutSpeed: 'fast',
			rotate: true
		}).slideshow({
			autoplay: true,
			interval: 10000
		});
		
		$j('#slider .items .slide a.slide-url').each(function(i, el) {
			if( $j(el).attr('href') != '' ) {
				$j(el).parent().addClass('clickable');
				$j(el).parent().click(function() {
					window.open($j(el).attr('href'));
				});
			}
		});
	}
}); 