//Cufon.replace('h1');


jQuery.noConflict();


jQuery(document).ready(function($){
	
	/*
	* Get rid of typographic orphans
	*/
	$.jqwidont.auto(false);	
	$('p, #gallery_list .p, #gallery_list .h3, .image_grid li a').widont();

	/*
	* Unobtrusively enable AJAX for image changes
	*/
	$('.thumbs_list a').ajaxify({
		target:'#largeImage',
		tagToload:'#largeImage>*',
        animateOut:{opacity:'0'},
        animateOutSpeed:500,
        animateIn:{opacity:'1'},
        animateInSpeed:500,
        loading_img:false,
        loading_txt:'Loading...'
	});
	
	/*
	* Make up for lack of hard-coded .selected class
	*/
	$('.thumbs_list a').click(function(){
		$('.thumbs_list li.selected').removeClass('selected');
		$(this).blur()./*closest('li')*/parent().addClass('selected');
	});
	
	/*
	* It's nicer if all links dont have a dotted line around them when clicked
	*/
	$('a').click(function(){
		$(this).blur();
	});
	
	var i=0.5;
	setInterval(function(){
		$('.veryfirst a').not(':hover').stop().find('.icon').animate({opacity:i},2000);
		i = i==0.5?1:0.5;
		},2000);
	$('.veryfirst a').mouseover(function(){
		$(this).find('.icon').stop().animate({opacity:1},100);
		});
	
	/*
	* Preload portfolio images
	*/

	$('.thumbs_list a img')
	.each(function(){
		$.preloadImages.add($(this).attr('src').replace('/thumbs/','/img/'));
	});
	
	$.preloadImages.start();


});
