/**
 * Global JS file
 * @author Richard Hallows
 */

// GA options
window._gaq = [['_setAccount', 'UA-1147510-1'], ['_trackPageview'], ['_trackPageLoadTime']];

Modernizr.load([{
	
	// if touch device run fixes
	test: Modernizr.touch,
	yep: {
		'mbphelper': '/assets/scripts/vendor/mbphelper.js'		
	},
	callback: {
		'mbphelper': function() {
			MBP.scaleFix();
			MBP.hideUrlBar();
		}
	}
}, {
	
	// conditionally load modal scripts
	test: Modernizr.mq('screen and (min-width:998px)'), 
	yep: {
		'jquery' : 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js',
		'simplemodal': '/assets/scripts/vendor/jquery.simplemodal.js',
		'portfoliomodal': '/assets/scripts/libs/jquery.portfoliomodal.js'
	},
	callback: {
		'portfoliomodal': function () {
			(function($){     
				$('div[role="main"]').portfoliomodal();
			})(jQuery); 
		}
	}
}, {
	
	// finally load analytics
	load : ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'		
}]); 
