$(function() {
    // run the code in the markup!
    $('pre code').each(function() {
        eval($(this).text());
    });
});

$(document).ready(function () {

	//General function for rollover images
	$(".rollover").hover(
		function () {
			if ($(this).attr("src").indexOf("_over") == -1) {
				var newSrc = $(this).attr("src").replace(".gif", "_over.gif#hover");
				$(this).attr("src", newSrc);
			}
		},
		function () {
			if ($(this).attr("src").indexOf("_over.gif#hover") != -1) {
				var oldSrc = $(this).attr("src").replace("_over.gif#hover", ".gif");
				$(this).attr("src", oldSrc);
			}
		}
	);

	//Make certain links open in a new window
	$(".new").attr("target", "_blank");

	$(".print").click(
		function () {
			window.print();
			return false;
		}
	);



	// Reset Font Size
	var originalFontSize = $('html').css("font-size");
	$(".resetFont").click(function () {
		$("html").css("font-size", originalFontSize);
	});
	// Increase Font Size
	$(".increaseFont").click(function () {
		var currentFontSize = $("html").css("font-size");
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum * 1.2;
		$("html").css("font-size", newFontSize);
		return false;
	});
	// Decrease Font Size
	$(".decreaseFont").click(function () {
		var currentFontSize = $("html").css("font-size");
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum * 0.8;
		$("html").css("font-size", newFontSize);
		return false;
	});



	$('#app_1_11b').click(function () {
		alert('In order to submit your application, you must give your permission to UCAS to release your data to the Foyer Federation.');
	});
	$('#app_1_12b').click(function () {
		alert('In order to submit your application, you must give your permission to the Foyer Federation to contact your college/university.');
	});




});
