// Smile Machine Global.js 
// Copyright 2011

$(document).ready(function() {
	// Stuff to do as soon as the DOM is ready;
	if($.browser.msie && $.browser.version=="6.0") {
		$('#topLogo img').attr('src','/images/logo.gif');
	}
	
	// Initialize Lastest Tweet
	$('.tweet').tweet({
		username: "smilemcn",
		join_text: null,
		avatar_size: null,
		count: 2,
		auto_join_text_default: "we said,",
		auto_join_text_ed: "we",
		auto_join_text_ing: "we were",
		auto_join_text_reply: "we replied to",
		auto_join_text_url: "we were checking out",
		loading_text: "loading latest tweet..."
	});
	
	// Slideshows
	$(function(){
		$('.slide-messages').slides({
			preload: true,
			container: 'slide-container',
			preloadImage: '/images/loading.gif',
			generateNextPrev: false,
			pagination: false,
			generatePagination: false,
			effect: 'fade',
			play: 6000,
			fadeSpeed: 250,
			pause: 2500,
			hoverPause: true
		});
		
		$('.slide-projects').slides({
			preload: true,
			container: 'slide-container',
			preloadImage: '/images/loading.gif',
			generateNextPrev: false,
			next: 'btn-arrow-next',
			prev: 'btn-arrow-prev',
			pagination: false,
			generatePagination: false,
			effect: 'slide',
			play: 0,
			fadeSpeed: 250,
			pause: 2500,
			hoverPause: true
		});
		
		$('.slide-case').slides({
			preload: true,
			container: 'slide-container',
			preloadImage: '/images/loading.gif',
			generateNextPrev: false,
			next: 'btn-arrow-next',
			prev: 'btn-arrow-prev',
			pagination: true,
			generatePagination: false,
			paginationClass: 'pagination',
			effect: 'fade',
			crossfade: false,
			play: 6000,
			fadeSpeed: 250,
			autoHeight: false,
			pause: 5500,
			hoverPause: true
		});
	});
	
	$('a#footermap').fancybox({
		'width'				: '85%',
		'height'				: '85%',
		'overlayOpacity'	: '0.4',
		'overlayColor'		: '#000',
		'autoScale'			: false,
		'transitionIn'		: 'fade',
		'transitionOut'	: 'none',
		'type'				: 'iframe'
	});
	
	$('blockquote .quote:first-child').addClass('first');
	
	
	// Case Study Prev / Next nav
	if ($('body.workDetail').length > 0) {
		if ($('.project-nav .btn-icon-prev').length == 0) {
			// There is no prev button
			$('.project-nav .btn-icon-next').css('padding-left', 0);
		}
		if ($('.project-nav .btn-icon-next').length == 0) {
			// There is no next button
			$('.project-nav .btn-icon-prev').css('border-right','none');
		}
	}
	
});




