(function($){
	$(document).ready(function(){
		Lisar = {
			intro: (typeof LisarIntro != 'undefined') ? (new LisarIntro('.lisar-start', 'lisar-intro')) : null,
			theme: new Theme(),
			runIntro: function() {
				$('div.js-dollyShot').each(function() {
					this._dollyShot.stop();
				});
				Lisar.intro.run(function() {	
					$('div.js-dollyShot').each(function() {
						this._dollyShot.start();
					});
				});
			}
		};
	
		if (Lisar.intro) {
			Lisar.intro.init();
		}
		Lisar.theme.init();
		Lisar.theme.selectNext();
		
		$('div.js-slideshow').css('opacity', 0);
		$('div.js-slideshow').each(function(){
			this._slideShow = new SlideShow($(this));
		});
		$('div.js-dollyShot').each(function(){
			this._dollyShot = new DollyShot($(this));
		});
		$('.js-overlay-link').each(function(){
			this._overlay = new Overlay($(this), $('.overlay'));
			this._overlay.init();
		});
		$('.js-cmd').each(function() {
			this._cmd = new Cmd($(this));
			this._cmd.init();
		});
		$('#js-sendMail').each(function() {
			this._sendMail = new SendMail($(this));
			this._sendMail.init();
		});
	});
	$(window).load(function(){
		$('div.js-slideshow').each(function() {
			this._slideShow.init();
		});
		$('div.js-dollyShot').each(function() {
			this._dollyShot.init();
		});
		$('div.js-dollyShot').each(function() {
			this._dollyShot.start();
		});
		var startOthers = function() {
			$('div.js-dollyShot').each(function() {
				this._dollyShot.start();
			});
			$('.js-overlay-link').each(function(){
				this._overlay.start();
			});
		}
		if (Lisar.intro) {
			Lisar.intro.start(startOthers);
		} else {
			startOthers();
		}
	});
}(jQuery));

// Google Analytics

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22532376-1']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

if (typeof MyLib == 'undefined') {
	MyLib = {};
}
MyLib.gaTrack = function(reqUrl) {
	var docPath = location.pathname;
	var lastIndex = docPath.lastIndexOf('/');
	var trackUrl;
	if (typeof reqUrl == 'undefined') {
		trackUrl = location.pathname;
	} else {
		if (reqUrl.charAt(0) == '/') {
			trackUrl = reqUrl;
		} else {
			if (lastIndex >= 0) {
				trackUrl = docPath.substr(0, lastIndex + 1) + reqUrl;
			} else {
				trackUrl = '/' + reqUrl;
			}
		}
	}
	if (typeof _gaq != 'undefined') {
		_gaq.push(['_trackPageview', trackUrl]);
	}
}

