var fashion = {
	setGlobals: function() {
		fashion.bigPhoto = jQuery('div#fashion-gallery-main img');
		fashion.bigPhotoHTML = '<div id="fashion-gallery-main"><img src="" /></div>';
		fashion.photographer = jQuery('div#fashion-gallery-main p span');
		fashion.photoTitle = jQuery('div#fashion-gallery-main p');
		fashion.thumbLinks = jQuery('ul#fashion-gallery-thumbs li > a, ul#fashion-gallery-thumbs2 li > a');
	},
	
	setThumbs: function() {		
			fashion.thumbLinks.bind('click', function(){
			var newSrc = jQuery(this).attr('href');
			brizo.unFadeMe(fashion.thumbLinks);
			brizo.fadeMe(this);
			var newphotographer = jQuery(this).attr('title');
			brizo.changePhoto(fashion.bigPhoto, newSrc, 'white');
			if (fashion.bigPhoto.attr('src') != newSrc && jQuery(this).attr('title') != "") {
				fashion.changePhotographer(fashion.photographer, newphotographer);
			} else {
				fashion.disappear(fashion.photographer, newphotographer);
			}
			return false;
		});
	},
	
	changePhotographer: function(credit, newphotographer) {
			fashion.photoTitle.animate({ opacity: 1 }, 150);
			credit.animate({ opacity: 0 }, 150, function(){
				credit.text(newphotographer);
			});
			credit.animate({ opacity: 1 }, 150);
	},
	
	disappear: function(credit, newphotographer) {
			fashion.photoTitle.animate({ opacity: 0 }, 150);
			credit.animate({ opacity: 0 }, 150, function(){
				credit.text(newphotographer);
			});
			credit.animate({ opacity: 1 }, 150);
	},
	
	preloadImages: function() {
		var _newImages = [];
		fashion.thumbLinks.each(function(){
			_newImages.push(this.href);
		});
		brizo.preloadImages(_newImages);
	},
	
	setVideo: function() {
		video.init();
	}
};

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