$(document).ready(function () {
	$(window).resize(function () {
		$('#wrap').removeAttr('style');
		heightFix();
	});

	$('.border-s a').hover(
		function () {
			$(this).parent().addClass('hover');
		},
		function () {
			$(this).parent().removeClass('hover');
		}
	);
	
	$('a[href*=#]').click(function () {
		if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']');
			if ($target.length) {
				var targetOffset = $target.offset().top-15;
				$('html,body').animate({ scrollTop: targetOffset }, 1000);
				return false;
			}
		}
    });

    heightFix();
});

function heightFix() {
    if ($('#wrap').height() < $(document).height())
        $('#wrap').height($(document).height());
}
