var fashionHome = {
	setGlobals: function() {
		fashionHome.bigPhoto = jQuery('div#fashion-gallery-main img');
		fashionHome.bigPhotoHTML = '<div id="fashion-gallery-main"><img src="" /></div>';
		fashionHome.thumbLinks = jQuery('ul#fashion-gallery-thumbs li > a');
		fashionHome.contentContainer = jQuery('div#fashion-content-container');
		fashionHome.photoTitle = jQuery('div#fashion-gallery-main p');
		fashionHome.thumbsContent = jQuery('ul#fashion-gallery-thumbs li div.fashion-content');
	},
	
	// changeContent: function(description, newphotographer) {
	// 		fashionHome.contentContainer.animate({ opacity: 1 }, 150);
	// 		description.animate({ opacity: 0 }, 150, function(){
	// 			description.html(newContent);
	// 		});
	// 		description.animate({ opacity: 1 }, 150);
	// },
	
	changeThumbContent: function(newContent) {
		fashionHome.contentContainer.animate({ opacity: 0 }, 150, brizo.easing, function(){
			fashionHome.contentContainer.html(newContent);
			brizo.externalLinks();
		});
		if (jQuery.browser.msie) {
			fashionHome.contentContainer.animate({ opacity: 1 }, 150, brizo.easing, function(){
				this.style.removeAttribute('filter');
			});
		} else {
			fashionHome.contentContainer.animate({ opacity: 1 }, 150, brizo.easing);
		}
	},
	
	setThumbs: function() {
		fashionHome.thumbsContent.hide();		
		fashionHome.thumbLinks.bind('click', function(){
			var thisContent = jQuery(this).parents().find('div.fashion-content').html();
			fashionHome.changeThumbContent(thisContent);

			var newSrc = jQuery(this).attr('href');
			fashionHome.thumbLinks.css({ borderBottom: 'none', paddingBottom: '1px' });
			jQuery(this).css({ borderBottom: '1px solid black', paddingBottom: 0 });

			if (fashionHome.bigPhoto.attr('src') != newSrc) {
				brizo.changePhoto(fashionHome.bigPhoto, newSrc);
				fashionHome.photoTitle.animate({ opacity: 0 }, 150);
			} else { 
				brizo.changePhoto(fashionHome.bigPhoto, newSrc); 
				fashionHome.photoTitle.hide();
				fashionHome.photoTitle.animate({ opacity: 0 }, 150);
			}
			return false;
		});
	},
	
	preloadImages: function() {
		var _newImages = [];
		fashionHome.thumbLinks.each(function(){
			console.log('adding: ', this.href);
			_newImages.push(this.href);
		});
		brizo.preloadImages(_newImages);
	},
	
	setVideo: function() {
		video.init();		
	}
};

jQuery(document).ready(function(){
	fashionHome.setGlobals();
	fashionHome.setThumbs();
	fashionHome.preloadImages();
	//fashionHome.setVideo();
});
