$(document).ready(function(){
	
	resizeObjects();
	
	$(function () {
	    var tabContainers = $('.tabs > div');
	    
	    $('.tabs ul#comment-tabs a').click(function () {
	        tabContainers.hide().filter(this.hash).show();	        
	        $('.tabs ul#comment-tabs a').removeClass('selected');
	        $(this).addClass('selected');
	        
	        return false;
	    }).filter(':first').click();
	});
	/* Resize object/embed tags to allow for responsive layout adaption */
	
	function resizeObjects() {
		// Get dimensions of object. Based on hardcoded attribute to play nice with IE
		var objH = $('object').attr('height');
		var objW = $('object').attr('width');
		
		// Get aspect ratio of object
		
		var objRatio = objH / objW;
	 	
	 	// Create wrapper element and set height based on aspect ratio	 	
		$('.flexbox object').wrap('<div class="objectwrapper">');
		$('.flexbox .objectwrapper').height(objW * objRatio);
		
		//	Set widths to 100% of new wrapper element
		$('.flexbox object').height('100%');
		$('.flexbox object').width('100%');
		$('.flexbox embed').height('100%');
		$('.flexbox embed').width('100%');		
		
	}
});
