$jq(document).ready(function(){

	/* Slideshow */
	$jq('#slideshow').nivoSlider({
		effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
		animSpeed:500, //Slide transition speed
		pauseTime:5000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		keyboardNav:false, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	
	$jq('.node-slideshow').nivoSlider({
    effect:'random', //Specify sets like: 'fold,fade,sliceDown'
    slices:15,
    animSpeed:1000, //Slide transition speed
    pauseTime:5000,
    startSlide:0, //Set starting Slide (0 index)
    directionNav:false, //Next & Prev
    directionNavHide:true, //Only show on hover
    controlNav:false, //1,2,3...
    controlNavThumbs:false, //Use thumbnails for Control Nav
    controlNavThumbsFromRel:false, //Use image rel for thumbs
    //controlNavThumbsSearch: '.jpg', //Replace this with...
    //controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
    keyboardNav:false, //Use left & right arrows
    pauseOnHover:true, //Stop animation while hovering
    manualAdvance:false, //Force manual transitions
    captionOpacity:0.8, //Universal caption opacity
    beforeChange: function(){},
    afterChange: function(){},
    slideshowEnd: function(){} //Triggers after all slides have been shown
	});

	$(".fancy-video").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'title'			: this.title,
			'width'			: 640,
			'height'		: 385,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			  : {
				'wmode'				: 'transparent',
				'allowfullscreen'	: 'true'
			},
			'opacity' : 0,
			'overlayShow' : 1,
			'overlayColor' : '',
			'overlayOpacity' : .35,
			'hideOnOverlayClick' : 1,
			'easingIn' : 'swing',
			'easingOut' : 'swing',
			'transitionIn' : 'fade',
			'speedIn' : 300,
			'transitionOut' : 'fade',
			'speedOut' : 300
		});
		return false;
	});

	$(".fancy-link").click(function() {
		var linkSrc = $(this).attr('href');
		$.fancybox({
			'padding'		: 0,
			'autoScale'	: false,
			'width'			: '85%',
			'height'		: '85%',
			'type'			: 'iframe',
			'href'	 		: linkSrc,
			'opacity' 	: 0,
			'overlayShow' : 1,
			'overlayColor' : '',
			'overlayOpacity' : 1,
			'hideOnOverlayClick' : 1,
			'hideOnContentClick' : false,
			'easingIn' : 'swing',
			'easingOut' : 'swing',
			'transitionIn' : 'fade',
			'speedIn' : 300,
			'transitionOut' : 'fade',
			'speedOut' : 300
		});
		return false;
	});
	
	// Hide table borders that CKEditor may have added.
	$('#content .inner table').each(function() {
	  $(this).attr('border', '0');
	});
	
	// Add table header backgrounds for browsers that don't support nth-child.
  $("body.node-type-page #content .inner table tr:nth-child(1)").css({"background-color":"#b42d1e"});
  $("body.node-type-page #content .inner table tr:nth-child(1)").css({"color":"#fff"});
  $("body.node-type-page #content .inner table tr:nth-child(even)").css({"background-color":"#daeffa"});
  $("body.node-type-page #content #attachments table tr:nth-child(1)").css({"background-color":"#fff"});
  
  // Silly method of increasing all of the "register here" links site-wide.
  $('td a').each(function() {
    if ($(this).html() == 'Register Here' || $(this).html() == 'Register') {
      $(this).css('display', 'block');
      $(this).css('width', '100px');
      $(this).css('font-weight', 'bold');
      $(this).css('text-transform', 'uppercase');
    }
  });

});
