var listPage = false;
function centerPartnerImage(img){
		var pHeight = $(img).height();
		var pWidth = $(img).width();
		var leftMar = 141 - pWidth/2;
		var topMar = 66 - pHeight/2;
		var widthRatio = 282/pWidth;
		$(img).css({marginTop: topMar, marginLeft: leftMar/widthRatio});
}
function removeSubnav(){
	$('#navBarSub').children().remove();
}
function bindAdvance(){
	//if(imageCount > 1){
  	  $('.mainAdvance').bind('mouseover', function(){
  	  	$('.arrowBar').fadeTo(250, arrowBarLow);
  	  }).bind('mouseout', function(){
  	  	$('.arrowBar').fadeTo(250, arrowBarHigh);
  	  }).bind('click', function(){
  	  	$(this).blur();
  	  	advanceMain();
  	  });
	//} 
}
$(
	function(){
		//	removes minimum height 'crutch' in left side text element, if text forces element higher than 324
		$('.shadeLeft').height() > 324 ? $('#minHeightShade').remove() : void(0);
		//	removes subnav links, if there is only one, as page loads initial link anyway.
		if($('#navBarSub').children().length <= 1 || listPage == true){
			removeSubnav();
		}
		function winHeight(){
			return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight;
		}
		function makeScroll(){
			$(".scrollMaker").height(winHeight()+1);
		}
		if($(".mainContainer").height() > 800){
			$("#bottomBar").height(100);
		}
		window.onresize = makeScroll;
		makeScroll();
		$('.navOn').not('#projects').attr('href', 'javascript:void(0);').bind('click', function(){$(this).blur()});
		bindAdvance();
		$(".projectLeftBG").height($(".mainContainer").height() - 250).css('opacity', .3);
  	  	$('.arrowBar').fadeTo(250, arrowBarHigh);
	}
);
$(document).ready(function() {
	//centerPartnerImage();
});
//	adds bold to main and sub nav links for on-state if called from bottom of index page
function pageOnMain(mainRef){
		$('#navBarMain .mainNavItem a:contains("'+mainRef.toUpperCase()+'")').addClass('navOn');
}
function pageOnSub(subRef){
		$('#navBarSub .subNavItem a:contains("'+subRef+'")').addClass('navOn');
		var subReg = new RegExp(subRef);
		$('#navBarSub .subNavItem a').each(function(){
			if(subReg.exec($(this).attr('href'))){
				$(this).addClass('navOn');
			}
		});
}
function listItemOn(obj){
	$(obj).addClass('listItemOn');
}
function listItemOff(obj){
	$(obj).removeClass('listItemOn');
}
