﻿$(document).ready(function () {
	positionNavigation();
	$(window).resize(positionNavigation);
	//$("#pdfLink")[0].href = location.pathname.substr(location.pathname.lastIndexOf('/') + 1, location.pathname.length).replace('.aspx', '.pdf');
	$("a.inline").fancybox();
});

function positionNavigation() {
	if ($("#navigation").position().top + $("#navigation").height() > $(window).height()) {
		if ($(window).height() - $("#siteContainer").position().top - $("#navigation").height() > 180) {
			$("#navigation").css("top", $(window).height() - $("#navigation").height() - $("#siteContainer").position().top);
		} else {
			$("#navigation").css("top", 150);
		}
	} else {
		if ($(window).height() - $("#navigation").height() - $("#siteContainer").position().top < 340) {
			if ($(window).height() - $("#siteContainer").position().top - $("#navigation").height() > 180) {
				$("#navigation").css("top", $(window).height() - $("#navigation").height() - $("#siteContainer").position().top);
			} else {
				$("#navigation").css("top", 150);
			}
		} else {
			$("#navigation").css("top", 340);
		}
	}
}

