jQuery(document).ready(function(){ 
	jQuery(document).pngFix();
	jQuery('.scroll-pane').jScrollPane({
		dragMaxHeight: 88,
		dragMinHeight: 88
	});
	
	// custom verticle alignment
	
	jQuery(".valign-middle").each( function() {
		jQuery(this).css("vertical-align", "top");
		var height = jQuery(this).innerHeight();
		jQuery(this).children().each( function() {
			if (!jQuery(this).hasClass("valign-top") && !jQuery(this).hasClass("valign-bottom")) {	
				var newTop = Math.round(height/2) - Math.round(jQuery(this).innerHeight() / 2);
				jQuery(this).css("margin-top",newTop+"px");
			}
		});	
	});
	

}); 

function swapImage(link, imageFrame) {
	if ( jQuery(link).hasClass("selected") ) return false;	// return if already selected
	jQuery("#swap-image-thumbs a").removeClass("selected");
	jQuery(link).addClass("selected");
	jQuery("#swap-images .shown").fadeOut(500, function(){ jQuery(this).removeClass("shown"); } ); 
	jQuery("#"+imageFrame).fadeIn(500, function(){ 
		jQuery(this).addClass("shown"); 
		jQuery("#swap-images .image-item").not("#"+imageFrame).removeClass("shown");
		jQuery("#swap-images .image-item").not("#"+imageFrame).fadeOut(0); 
		jQuery("#"+imageFrame).fadeIn(0);
	});
	return false;
}
