$(document).ready(function(){
	
	$(document).pngFix();

	$('h1.logo').click(function(){
		
		window.location = '/';
	});

	$('#body-copy tr:first').addClass('head');
	
	$("a[href*=.doc]").before('<img class="icon" src="/_ui/images/icon_DOC_big.gif" />');

	$("a[href*=.doc]").click(function(){
		window.open(this.href);
		return false;
	});

	$("a[href*=.pdf]").before('<img class="icon" src="/_ui/images/icon_PDF_big.gif" />');

	$("a[href*=.pdf]").click(function(){
		window.open(this.href);
		return false;
	});

	$("a[href*=.doc], a[href*=.pdf]").closest('p').addClass('w-icon');

	if ($('#images-cont').length > 0){
	
		$('#images-cont').cycle({ 
			fx:     'scrollHorz', 
			next:   '#next', 
			prev:   '#prev',
			speed:  500, 
			timeout: 0
		});
	}

	$('#body-copy p').each(function(){
		
		if ($(this).find('img').length > 3){
			
			$(this).find('br').remove();

			$(this)

				.before('<div id="img-nav-wrap"><a id="img-prev">Prev</a><div id="img-nav"></div><a id="img-next">Next</a></div>')
				.addClass('slides')
				.cycle({ 
					fx:			'fade', 
					speed:		'fast', 
					timeout:	0, 
					pager:		'#img-nav',
					next:		'#img-next', 
					prev:		'#img-prev',
					after:		function(){
						
						$('.slides').blur();
					}
			});
		}
	});

});