$(document).ready(function() {
	$('#gallery').prepend('<ul class="pagie"> <li class="pPrev">Previous</li> <li class="pNext">Next</li> </ul>');
	$('#allComps li').addClass('offCharts');
	$('#allComps li').last().addClass('pLast');
	$('#allComps li').first().removeClass('offCharts').addClass('pFirst').addClass('pShown');
	$('.pPrev').click(function() {
		var currentlySeen = $('.pShown')
		if (currentlySeen.hasClass('pFirst')) {
			currentlySeen.removeClass('pShown').addClass('offCharts');
			$('.pLast').addClass('pShown').removeClass('offCharts');
			return false;
		} else {
			currentlySeen.removeClass('pShown').addClass('offCharts').prev('.offCharts').addClass('pShown').removeClass('offCharts');
		}
	});
	$('.pNext').click(function() {
		var currentlySeen = $('.pShown')
		if (currentlySeen.hasClass('pLast')) {
			currentlySeen.removeClass('pShown').addClass('offCharts');
			$('.pFirst').addClass('pShown').removeClass('offCharts');
			return false;
		} else {
			currentlySeen.removeClass('pShown').addClass('offCharts').next('.offCharts').addClass('pShown').removeClass('offCharts');
		}
	});
	$('#nav li.current_page_item').append('<span id="currentSection"></span>');
	$('#section #smallComps li:last-child').addClass('last-child');
	$('#section #smallComps li a').hover(
	  function () {
		var hoveredSRC = $(this).attr("href");
		$('#largeComp img').attr('src', hoveredSRC)
	  }
	);
	$('#section #smallComps li a').hover(
	  function () {
		var hoveredSRC = $(this).attr("href");
		$('#largeComp img').attr('src', hoveredSRC)
	  }
	);
	$('#section #smallComps li a').click(function() {
		return false;
	});
    $('a.button').wrapInner('<i />')
    $('input.button').wrap('<span class="inputButtonWrap" />')
    $('input.button.secondary').parent().addClass('secondaryWrap')
    $('input.button.disabled').parent().addClass('disabledWrap')
    $('input.button.alt').parent().addClass('altWrap')
	
    $('#footer').addClass('minHeightened')
	var primaryHeight = $('#primary').css('height')
	$('#aside').css('min-height', primaryHeight)
	adjH = function() {
	var wHeight = $(window).height(); 
	$('#surround').css('min-height', wHeight+"px");
	};
	adjH();
	$(window).resize(function() { adjH(); }); 
});

