/*
*** Coded with loving care by Mat at Demotive ***
***	"Toiling since '75" | September 2009      ***
*** .......... www.demotive.com ............. ***
*/

Cufon
	.set('fontFamily', 'Soho')
	.replace('#footer p strong, #site-intro h2, #site-intro h3, #site-intro p, #latest-work h5, .work-pull h5, #also-links a strong, .tab, .level-2, .article h1, .about h2, .about h3');

$(document).ready(function(){
	
	// 1. Set up main nav
	$('#nav-main > ul').addClass('hide');
	$('#nav-title').replaceWith('<a href="#" id="nav-title">' + $('#nav-title').text() + '</a>');
	$('#nav-title').click(function(e) {
		e.preventDefault();
		$('#nav-main > ul').toggleClass('hide');
	});
	
	// set up js link within Cufon intro:
	$('#site-intro p a')
		.attr("href", "javascript:cufonFire();");
	
	// fire up rollovers
	if ($('.dem-slidepuff').length > 0) {
		DEMOTIVE.slidepuffs.init($('.dem-slidepuff'));
		DEMOTIVE.fadepuffs.init($('.dem-fadepuff'), { speed:500 });
	}
	
	// fire up scrollers (about)
	if ($('#quotes').length > 0) {
		DEMOTIVE.scroller.init($('#quotes'), { direction:'vertical', behaviour:'loop', timer:'true', interval:6000, speed:500 });
		$('.dem-prev a, .dem-next a').attr('tabindex', '-1');
	}
	
	// fire up lightbox (protfolio)
	if ($('#visuals').length > 0) {
        $('#visuals ol li a').lightBox({
			overlayOpacity: 0.5,
			imageLoading: '../images/structural/lightbox-ico-loading.gif',
			imageBtnClose: '../images/structural/lightbox-btn-close.gif',
			imageBtnPrev: '../images/structural/lightbox-btn-prev.gif',
			imageBtnNext: '../images/structural/lightbox-btn-next.gif',
			containerResizeSpeed: 350
		});

		
		
		$('#visuals > a').click(function(e) {
			e.preventDefault();
			$('#visuals ol li a:first').click();
		});
	}

	
});

var cufonFire = function() {
	$('#nav-title').click();
}
