window.onload = function() {
	//GETS ALL THE VIDEOS AND FITS THEM PROPORTIONALLY TO THEIR CONTAINERS
	$('.video_container object, .video_container embed').each(function(){
		var data = $(this).attr('data');
		if ($(this).attr('width') && $(this).attr('height')){
			var vidWidth = eval($(this).attr('width'));
			var vidHeight = eval($(this).attr('height'));
			var aspect = vidWidth/vidHeight;
		} else {
			//average of most popular players minus a bit more (top and bottom borders look better than side ones)
			var vidWidth = 429;
			var vidHeight = 300;
			var aspect = 1.23;
		}
		var tempWidth = Math.round(vidWidth/10);
		var tempHeight = Math.round(vidHeight/10);
		var maxWidth = 480;
		$(this).attr({width:tempWidth,height:tempHeight});
		if ($.browser.msie && $.browser.version == 6)
			var desWidth = $(this).parent().width();
		else
			var desWidth = $(this).parent().parent().width();
		//if it is inside a thickbox
		if ($(this).parents('body#attachments').length>0)
			desWidth = 434;
		if (desWidth > maxWidth)
			desWidth = maxWidth;
		var desHeight = $(this).parents().hasClass('embed_audio') ? vidHeight : Math.round(desWidth/aspect);
		$(this).css({width:desWidth, height:desHeight});
	});
}
