$j=jQuery.noConflict();

$j(document).ready(function() 
{ 
	$j('<div class="blockquote-bottom"></div>') .insertAfter('blockquote');
	$j('#main-nav > li > a') .addClass('nicefont');
	$j('.children li:odd') .addClass('no-right-margin');
	$j('.teaser:nth-child(5)') .addClass('no-right-margin');
	$j('.gallery li:nth-child(5n)') .addClass('no-right-margin');
	$j('.textonly-post:nth-child(4)') .addClass('no-right-margin');
	var captionHeight = $j('p.image-caption') .height();
	$j('.story-portrait') .css('margin-bottom',captionHeight + 10 +'px');
	var newCaptionHeight = captionHeight + 465;
	$j('.portrait-storyheader') .css('margin-top','-'+newCaptionHeight+'px');
	if($j.browser.msie7)
	{
		$j('.portrait-storyheader') .css('margin-top',0+'px');
	}
	var headerHeight = $j('h1.portrait-storyheader') .height();

	$j('.portrait-storyheader + .entry-meta') .css('padding-top',headerHeight+20+'px');
	
	var mozillaHeight = newCaptionHeight - headerHeight - 30;
	
	if ($j.browser.mozilla)
	{
		$j('.portrait-storyheader + div + .entry-meta') .css('margin-top','-'+mozillaHeight+'px');
	}
	
	$j('.entry-text > p:nth-child(1)') .fancyletter();
	$j('p:last-child') .addClass('no-bottom-margin');
	$j('#footer ul li:first-child') .addClass('no-left-padding');
	$j('#footer ul li:last-child') .addClass('no-border');
	$j('.equalheight') .equalHeights();
	$j('#secondary .widget-container:last-child') .addClass('no-bottom-margin');
	$j('td') .removeAttr('valign');
	$j('td.tickets a') .text('Tickets');
	$j('td.map a') .text('Map');
	$j('#search-results li:even') .addClass('even');
	
	// Stuff for the Gigs Calendar
	
	$j('.musictype') .click(function()
	{
		$j('.gigs-calendar li.gc-music') .show('fast');
		$j('.gigs-calendar li:not(.gc-music)') .hide('fast');
	});
	
	$j('.comedytype') .click(function()
	{
		$j('.gigs-calendar li.gc-comedy') .show('fast');
		$j('.gigs-calendar li:not(.gc-comedy)') .hide('fast');
	});
	
	$j('.theatretype') .click(function()
	{
		$j('.gigs-calendar li.gc-theatre') .show('fast');
		$j('.gigs-calendar li:not(.gc-theatre)') .hide('fast');
	});	
	
	$j('.exhibittype') .click(function()
	{
		$j('.gigs-calendar li.gc-exhibit') .show('fast');
		$j('.gigs-calendar li:not(.gc-exhibit)') .hide('fast');
	});
	
	$j('.familytype') .click(function()
	{
		$j('.gigs-calendar li.gc-family') .show('fast');
		$j('.gigs-calendar li:not(.gc-family)') .hide('fast');
	});	
	
	$j('.othertype') .click(function()
	{
		$j('.gigs-calendar li.gc-other') .show('fast');
		$j('.gigs-calendar li:not(.gc-other)') .hide('fast');
	});
	
	$j('.alltype') .click(function()
	{
		$j('.gigs-calendar li') .show('fast');
	});
	
});
