// Dynamically updates the fancybox width
function setFancyboxWidth(width) {
	$("#fancybox-content").width(width);
	$("#fancybox-wrap").width(width);
	$("#fancybox-outer").width(width);
	if ($.browser.msie && $.browser.version.substr(0, 1) == 6) {

	}
	
	$.fancybox.center();	
}

function resizeFallback() {
	var width = $(window).width();
	var height = (406*width)/720;
	if (height< $(window).height()){
		height = $(window).height();
		width = (720*height)/406;
	}
	$('#fallback').height(height);
	$('#fallback').width(width);	
}

$(document).ready(function(){
	//Email replacement (helps fight spam)
	$('a.email').each(function(){ //Finds links with the email class and replaces the text with the email address - helps prevent spam
		
		var link = $(this).html();  //Links should be formatted just like this: name AT domain DOT com
		link = link.replace(/ AT /, '@'); //Place the text for the link in the title attribute
		link = link.replace(/ DOT /, '.');
		var linktitle = $(this).attr('title');
		
		if (linktitle != '') {
			$(this).html(linktitle);
		}
		else {
			$(this).html(link);
		}
		
		$(this).attr('href', 'mailto:' + link);
	});
	
	resizeFallback();

	//IE7 <hr> hack
	if ($.browser.msie && $.browser.version.substr(0, 1) == 7) {
		$("hr").replaceWith('<div class="hr changingbg changingtext"></div>');
	}
});

$(window).resize(function() {
	resizeFallback();
});

