// HTV JS @2011

jQuery(document).ready(function(){

	jQuery("#right-accordion-content").accordion({
		//active: 2,
		 create: function(event, ui) {
			jQuery('.ui-accordion-content').css('height','auto');
		 }
	});


	// Partners Slider
	jQuery("#bxSlider").bxSlider({
		auto:true,
		mode: 'horizontal',
		pause:5000,
		speed: 2000,
		displaySlideQty:6,
		moveSlideQty:6 ,
		prevText: '',
		nextText: ''
	}); 

	// Single Post Bottom navigation
	vAlignNextPrevPostImg(jQuery('.nav-next .wp-post-image'));
	vAlignNextPrevPostImg(jQuery('.nav-previous .wp-post-image'));
	
	
	// Partners Slider Greyscale
	var i = 1;
	jQuery('#bxSlider LI A IMG').each(function() {
		imgH = Math.round(jQuery(this).height()/2);
		jQuery(this).css('margin-top',-imgH);
		jQuery(this).parent().css('height',imgH);
		i++;	
	});
	$('#bxSlider IMG').bind('mouseover',function() { jQuery(this).css('margin-top',0); });
	$('#bxSlider IMG').bind('mouseout',function() { jQuery(this).css('margin-top',-$(this).height()/2); });
	

	
});

function postSlider(val) {
	jQuery("#news > div").hide('fade', function() {
	
	});
	jQuery("#news > div:eq("+val+")").show('slide');
};
	
function vAlignNextPrevPostImg(target) {
		var maxHeight = 60;
		var height = target.height();
		if(height < maxHeight) {
			var newMargin = (maxHeight - height)/2;
			target.css('padding-top',newMargin);
			target.css('padding-bottom',newMargin);
		}
};
