$(function(){
		
		$('#s4') 
		.cycle({ 
			fx:     'fade',
			speed:  1000, 
			timeout: 0, 
			pager:  '#cycle-nav'
		});		

		$("a[rel=fancybox]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over'
				}
			);
			
	$(".fancyvideo").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 800,
			'height'		: 470,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'			: 'swf'
		});

		return false;
	});
	
	$(".newsletter").click(function() {
	$.fancybox( {
         'width' : 350,
		 'height' : 470,
         'autoScale' : true,
         'autoDimensions'	: true,
         'transitionIn' : 'none',
         'transitionOut' : 'none',
         'type' : 'iframe',
         'href' : '/newsletter/signup.php',
         'modal' : true,
         'overlayColor' : '#000',
         'overlayOpacity' : 0.9,
         'padding' : 0
     } );
		 
		 return false;
	});

	});
	function _closeFancybox() {
		$.fancybox.close();
	}
	
	function _resizeFancybox( h ) {
		$( '#fancybox-content' ).height( h );
		$.fancybox.center();
	}

function highlightMenu()
{
	var d = window.location.protocol + '//' + window.location.host;
	var uriparts = window.location.pathname;
	var nav = jQuery( '.header .main-nav' );
	jQuery( 'a', nav ).each( function() {
		var h = jQuery( this ).attr( 'href' );
		var h = h.replace( d, "" );
		if( uriparts.match( h ) )
		{
			jQuery( this ).parent().addClass( 'current' );
			return true;
		}
	} );
}		
