jQuery(document).ready(function($)
{
	jQuery('a[rel="tip"]').click(function(e){
		e.preventDefault();
		
		jQuery.facebox({'ajax':'/wp-content/themes/pk_v2/widgets/tip_form/markup.php'});
	});
	
   	AudioPlayer.setup("/backstage/includes/audio-player/player.swf", {  
    	width: 290  
    }); 	
	
	jQuery('a[href$=".mp3"]').each(function(index){
		jQuery(this).attr('id', 'audioplayer_'+index);
		href = jQuery(this).attr('href');
		title = jQuery(this).text();
		var js = jQuery(this).before('<div><script type="text/javascript">AudioPlayer.embed("audioplayer_'+index+'", { soundFile: "'+href+'", transparentpagebg: "yes", titles: "'+title.replace(/\"/g,'\\"')+'" });</script></div>');
	});
});

function resize_images(column_id)
{
	// Get the width of the column
	var width = jQuery('div#'+column_id).width();
	
	// Resize the images
	jQuery('#'+column_id+' img').each(function(i){
		if(jQuery(this).width() > width)
		{
			$(this).attr('startwidth', $(this).width())
				.attr('startheight', $(this).height())
				.css('max-width', $(this).attr('startwidth')+"px");
			
			jQuery(this).width('100%').each(function()
			{
				jQuery(this).height(Math.round(jQuery(this).attr('startheight')*($(this).width()/$(this).attr('startwidth'))));
			});			
		}
	});
}

