// Mailmask
$.fn.noSpam=function(){at='@';return this.each(function(){e=null;$(this).find('span').replaceWith(at);e=$(this).text();$(this).attr('href','mailto:'+e);});};

// Cufon
Cufon.replace('h2, h3, h4', {fontFamily: 'Avantage-Bold'});
Cufon.replace('#newsticker h3', {fontFamily: 'AvantageCondensed-Bold'});

// jQuery functions
$(document).ready(function() {
	
	// Fancybox
	$('a[rel=lightbox]').fancybox({
		'overlayColor'		: '#000000',
		'overlayOpacity'	:  0.5,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'speedIn'			:  300,
		'speedOut'			:  300,
		'titlePosition'		: 'inside'
	});
	
	$('a[rel=iframe]').fancybox({
		'overlayColor'		: '#000000',
		'overlayOpacity'	:  0.5,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'speedIn'			:  300,
		'speedOut'			:  300,
		'titlePosition'		: 'inside',
		'width'				: 600,
		'height'			: 700,
		'type'				: 'iframe'
	});
	
	// Slider
	$('#slider').cycle({ 
		fx:			'scrollHorz', 
		speed:		800, 
		timeout:	4000, 
		pause:		'true', 
		prev:		'#prevSlide',
		next:		'#nextSlide'
	});
	
	// Accordion
	$('#accordion').accordion({autoHeight: false});
	
	// Mailmask
	$('a.escape').noSpam();
	
	// External links
	$('a.external').click(function(){
		$(this).attr('target','_blank');
	});
	
	// Smooth scroll to the Top
	$('a[href*=#top]').click(function(){
		$('html, body').animate({scrollTop: 0}, 'slow');
		return false;
	});
	
});

