/*
* Copyright (C) 2009 Joel Sutherland
* Licenced under the MIT license
* http://www.newmediacampaigns.com/page/jcaption-a-jquery-plugin-for-simple-image-captions
*/

(function($){$.fn.jcaption=function(settings){settings=$.extend({wrapperElement:'div',wrapperClass:'caption',captionElement:'p',imageAttr:'alt',requireText:true,copyStyle:false,removeStyle:true,removeAlign:true,copyAlignmentToClass:false,copyFloatToClass:true,autoWidth:true,animate:false,show:{opacity:'show'},showDuration:200,hide:{opacity:'hide'},hideDuration:200},settings);return $(this).each(function(){$(this).bind('load',function(){if($(this).data('loaded'))return false;$(this).data('loaded',true);var image=$(this);if(image.attr(settings.imageAttr).length>0||!settings.requireText){image.wrap("<"+settings.wrapperElement+" class='"+settings.wrapperClass+"'></"+settings.wrapperElement+">");var imageFloat=image.css('float')
var imageStyle=image.attr('style');if(settings.removeStyle)image.removeAttr('style');var imageAlign=image.attr('align');if(settings.removeAlign)image.removeAttr('align');var div=$(this).parent().append('<'+settings.captionElement+'>'+image.attr(settings.imageAttr)+'</'+settings.captionElement+'>');if(settings.animate){$(this).next().hide();$(this).parent().hover(function(){$(this).find('p').animate(settings.show,settings.showDuration);},function(){$(this).find('p').animate(settings.hide,settings.hideDuration);});}
if(settings.copyStyle)div.attr('style',imageStyle);if(settings.copyAlignmentToClass)div.addClass(imageAlign);if(settings.copyFloatToClass)div.addClass(imageFloat);if(settings.autoWidth)div.width(image.width());}});if(this.complete||this.naturalWidth>0){$(this).trigger('load');}});}})(jQuery);;
(function ($) {
	 $().ready(function(){
			
			$('#block-locale-language .en span.locale-untranslated').wrap("<a href='/'></a>");
			$('#block-locale-language .es span.locale-untranslated').wrap("<a href='/es'></a>");
			
			if ($('body').hasClass('front')) {
				$('.flexslider').flexslider({
				      animation: "slide",
				    });
			}
			
			$("#main").fitVids();
			$("#sidebar-second").fitVids();
			
			$('#main img').jcaption({
				//Element to wrap the image and caption in
				wrapperElement: 'div',

				//Class for wrapper element
				wrapperClass: 'with-caption',

				//Caption Element
				captionElement: 'p',

				//Attribute of image to use as caption source
				imageAttr: 'title',

				//If true, it checks to make sure there is caption copy before running on each image
				requireText: true,

				//Should inline style be copied from img element to wrapper
				copyStyle: false,

				//Strip inline style from image
				removeStyle: true,

				//Strip align attribute from image
				removeAlign: true,

				//Assign the value of the image's align attribute as a class to the wrapper
				copyAlignmentToClass: false,

				//Assign the value of the image's float value as a class to the wrapper
				copyFloatToClass: true,

				//Assign a width to the wrapper that matches the image
				autoWidth: false,

				//Animate on hover over the image
				animate: false,	
			});
	
	
	 });	
})(jQuery);;

