

$(document).ready(function() {

	$("#content div.entry div.wp-caption a").hover(
	  function () {
		$(this).parent().css('border-color', '#eb0000')
	  }, 
	  function () {
		$(this).parent().css('border-color', '#d0cfce')
	  }
	);

	$('#content p.switch').next('ul').hide();
	$('#content p.switch').click(function() {
		$(this).next('ul').toggle();
	});

	$('#content div.viewport').css('min-height', $(window).height()-250 + 'px');

	var myFile = document.location.toString();
	if (myFile.match('#')) { // the URL contains an anchor
	  // focus the navigation item corresponding to the anchor
	  var myAnchor = '#' + myFile.split('#')[1];
	  $('#navmain a[href*="' + myAnchor + '"]').focus();
	} else {
	  // click the first navigation item
	  // $('#navmain li:first a').focus();
	}	

/*
	$.localScroll({
		stop: true,
		hash: true,
		easing: "linear"
	});
/*
	$(function() {
		$(window).bind('resize', function() {
	$('#content div.viewport').css('min-height', $(window).height() + 'px'); 
		}).trigger('resize');
	});*/


	$(window).scroll(function(){ 
        $("#content h2:in-viewport").each(function() {
        	linktext = $(this).parents('.viewport').attr("id");
			$('#navmain a[href*="'+linktext+'"]').focus();
        });
	}); 
	
});














