/*----------------------------------------
AIA Triangle Javascript
Author: Marcus Ellis
Last Updated: April 19, 2011
(c) 2011 Affiniscape, Inc.
All Rights Reserved. This JavaScript file must not be reproduced without the express written permission of Affiniscape, Inc.
For questions regarding licensing or setup please contact Affiniscape, projects @ affiniscape dot com
----------------------------------------*/

var j = jQuery.noConflict();
j(document).ready(function($){
	
	// Clickable Logo
    $('body').addClickableLogo({
        name: 'AIA Triangle',
        url: 'http://www.aiatriangle.org'
    });
    
    // Gallery
	var thumb_ht = $('#gallery-thumbs img').parent().height();
	$('#gallery-thumbs img').each(function(){
		var ht = $(this).height();
		var top = Math.floor((thumb_ht - ht) / 2);
		if (top < 0){
			$(this).css('margin-top',top +'px');
		}
	});
	$('#gallery-thumbs img').hover(function(){
		$(this).fadeTo('fast',1);
	},function(){
		$(this).fadeTo('fast',0.75);
	});
	$('#gallery-thumbs a').click(function(e){
		e.preventDefault();
		var c = 'current';
		
		// Current Class
		$('#gallery-thumbs li').removeClass(c);
		$(this).parent().addClass(c);
		
		// Load Image/Slideshow
		if ($(this).parent().hasClass('award')){
			$('#gallery-stage').load($(this).attr('href'),function(){
				$('#gallery-stage ul').cycle();
			});
		} else {
			$('#gallery-stage').html($('img',this).clone().removeAttr('style'));
		}
		
		// Load Title & Description
		$('#album-desc').html('<h4>'+ $(this).attr('title') +'</h4><p>'+ $(this).attr('desc') +'</p>');
	});
						   
});

