$(function () {
	if(window.location.hash != '')
	{
		$.scrollTo(window.location.hash, 500, {easing: 'easeOutBack'});
	}
	
	//$('a[href*="#"]').smoothScroll({easing: 'easeOutBack', speed: 500});
	
	//$('#subscribebox').defaultValues();
	
	if($('#frontslideshow').length)
	{
		$('#frontslideshow').cycle({
			fx: 'fade',
			speed: 500,
			timeout: 10000,
			pager:  '#frontslideshownav ul',
			pagerAnchorBuilder: function(idx, slide) { 
	        // return selector string for existing anchor 
				return '<li><a href="#">' + (idx + 1) + '</a></li>'; 
	    	} 
		});
	}
	
	if($('#testimonials').length)
	{
		$('#testimonials').click(function () {
			window.location = 'http://www.moneyandstuff.info/testimonials.html';
		});
		$('#testimonials').cycle({
			fx: 'scrollUp',
			speed: 500,
			timeout: 10000,
			easing: 'easeOutBack',
			random: 1
		});
	}
	
	if($('.tabbedcontent').length)
	{
			$('.tabbedcontent').cycle({
				fx: 'scrollHorz',
				speed: 200,
				timeout: 0,
				pager: '#fronttabbedcontent_tabs',
				startingSlide: 0,
				pagerAnchorBuilder: function(idx, slide) {
					return '#fronttabbedcontent_tabs li:eq(' + idx + ') a';
				}
			});
	}
	
	if($('#tabbedlessons').length)
	{
			$('#tabbedlessons').cycle({
				fx: 'scrollHorz',
				speed: 200,
				timeout: 0,
				pager: '#lessontabs',
				startingSlide: 0,
				pagerAnchorBuilder: function(idx, slide) {
					return '#lessontabs li:eq(' + idx + ') a';
				}
			});
	}
	
	$.fn.media.defaults.flvPlayer = '2009 Website/videos/mediaplayer.swf';
	
	if($('.sidebarbox .media').length)
	{
		$('.sidebarbox .media').media({
			width: 189,
			height: 130,
			flashvars: {
				autostart: 'true'
			}
		});
	}
	
	if($('#content .media').length)
	{
		$('#content .media').media({
			width: 250,
			height: 225,
			flashvars: {
				height: '225',
				controlbar: 'none',
				resizing: 'false',
				stretching: 'uniform',
				screencolor: '#fff'
			}
		});
	}
	
	if(window.print)
	{
		$('<p><a href="javascript:window.print()"><img src="2009 Website/images/printicon.gif" width="16" height="16" alt="" /> Print this page</a></p>').appendTo('div.printpage');
	}
	
	
	
	$('a[href^="http"]:not([href*="' + document.domain + '"])').click(function () {
		pageTracker._trackPageview('/outgoing/' + jQuery(this).attr('href'));
	});
});