// JavaScript Document
$(document).ready(function() {
													 
	// add a class to the main navigation links based upon the link name											 
	$('#access li a').each(function() {	
		var classname = $(this).text();
		classname = classname.toLowerCase().replace(/ /g, '-');
		$(this).addClass( classname );
	}); 
	
	// To add an additional layout in order to hook the CSS to and attached a quote icon
	$('#leftheaderContent .rand-testimonial a p').each(function() {
				$(this).replaceWith('<span class="quote">' + $(this).text() + '</span>');													
	});  
	
	// This is a work-around in order to anchor the CTAs to the bottom, but to stop the main content from overlapping on longer pages.
	// If the CTAs are present, I just add a margin-bottom to the main content to the value of the height of the CTAs
	if ($('#footer-ctas').length) {
		var ctas_height = $('#footer-ctas').css('height');
		$('#mainWrapperInner').css('margin-bottom', ctas_height);
	}
	
	// Gain control of the submit buttons by giving them a constant class that we know
	if ($(':submit').length) {
		$(':submit').each(function() {		
			$(this).addClass('submitButton');																												
		});  
	}
		
	// Where an overriding 'no-border' class is manually added to an image, and a caption is used, the caption div needs to lose its border too.
	$('#content div.wp-caption img').each(function() {
		if ($(this).hasClass('no-border')) {
			$(this).parent().addClass('no-border');
		}											
	}); 
	
	// The Follow Button on the Twitter Widget Pro is too wide, so this will link the header instead	
	$('h2.widgettitle span.twitterwidget-title').each(function() {
		twitTitle = $(this).text();
		$(this).wrapAll('<a title="Follow ' + twitTitle + ' on Twitter" target="_blank" href="http://twitter.com/' + twitTitle + '" />');		
	});
	
});			
		
			

