jQuery(function($) {
	Cufon.replace('#navigation ul li a, h2,h3,h4,h5,h6, .blog-item-meta, .cufon-replace, .article h1', {
		fontFamily: 'TradeGothic',
		hover: true
	});

	Cufon.replace('.cufon-bold', {
		fontFamily: 'Agency Bold',
		hover: true
	});

	$('.blink')
		.focus(function(){
			if( $(this).attr('value') == $(this).attr('title') ) {
				$(this).attr({ 'value': '' });
			}
		})
		.blur(function(){
			if( $(this).attr('value') == '' ) {
				$(this).attr({ 'value': $(this).attr('title') })
			}
		});

	$('#sidebar .our-videos .our-videos-nav p a:eq(0)').addClass('active');
	$('.footer-links-col:last').addClass('last-col');
	$('.our-videos .video-item:eq(0)').show();
	
	function change_video(idx) {
		var active = $('.our-videos-nav p a').index($('.our-videos-nav p a.active'));
		if($('.our-videos .video-item:animated').length == 0 && idx != active) {
			$('.our-videos .video-item:visible').fadeOut();
			$('.our-videos .video-item:eq(' + idx + ')').fadeIn();
			$('.our-videos-nav p a:eq(' + active + ')').removeClass('active');
			$('.our-videos-nav p a:eq(' + idx + ')').addClass('active');
		}
	}
	
	$('.our-videos-nav p a').click(function() {
		var idx = $('.our-videos-nav p a').index($(this));
		change_video(idx);
		return false;
	});
	
	$('#navigation > ul > li').hover(
		function() {
			if($(this).find('.subnav').length > 0) {
				$(this).addClass('hover');
				$(this).find('.subnav:eq(0)').show();
			}
		},
		function() {
			if($(this).find('.subnav').length > 0) {
				$(this).removeClass('hover');
				$(this).find('.subnav:eq(0)').hide();
			}			
		}
	);
	
	$('.now-playing-thumb').hover(
		function() {
			$(this).find('a.play-button').show();	
		},
		function() {
			$(this).find('a.play-button').hide();
		}
	);
	
	$('.inner #content-inner').each(function() {
		if($(this).parent().height() < $('#sidebar').height()) {
			$(this).height($('#sidebar').height() - $('#bottom-image').height());
		}
	});
	
	
	$('.qtip').qtip({
	   show: 'mouseover',
	   hide: 'mouseout',
	   position: {
	      corner: {
	         target: 'topLeft',
	         tooltip: 'bottomLeft'
	      }
	   },
	   style: { 
	      width: 250,
	      padding: 2,
	      background: '#a27535',
	      color: '#f7f7ef',
	      textAlign: 'center',
	      border: {
	         width: 2,
	         radius: 5,
	         color: '#a27535'
	      },
	      tip: 'bottomMiddle',
	   },
	})
	
	//show hide videos
	$("#show-hide-more").hide();
	$("#show-hide-more-button").click(function () {
		$("#show-hide-more").toggle("slow");
		$("#show-hide-more-button").replaceWith('');
	});
	
});
