var pikaboo = {};

var fx;
var loading;
var overlays;
var video;
var scrollbar;
var overview;
var lines;

var sb_options;

var normal_mode = true;
var overview_mode = false;

var scroll_busy = false;

/*** FX CLASS ***/

pikaboo.fx = new Class({
	showLogo: function() {
		$$('h1')[0].setStyle('display','block');
		var fx = new Fx.Morph($$('h1')[0], {duration:1000, transition:Fx.Transitions.Expo.easeOut});
		fx.start({
			'left': [-355, 15],
			'opacity': [0, 1]
		});
	},
	hideLogo: function() {
		var fx = new Fx.Morph($$('h1')[0], {duration:250, transition:Fx.Transitions.Expo.easeIn});
		fx.start({
			'left': [15, -355],
			'opacity': [1, 0]
		});
		setTimeout('fx.completelyHideLogo()',250);
	},
	completelyHideLogo: function() {
		$$('h1')[0].setStyle('display','none');
	},
	showMenuItem: function(param) {
		$('menu').setStyle('display','block');
		var fx = new Fx.Style($('menu_'+param), 'opacity', {duration: 500});
		fx.start(0, 1);
	},
	hideMenu: function() {
		var fx1 = new Fx.Style($('menu_news'), 'opacity', {duration: 500});
		var fx2 = new Fx.Style($('menu_pics'), 'opacity', {duration: 500});
		var fx3 = new Fx.Style($('menu_about'), 'opacity', {duration: 500});
		var fx4 = new Fx.Style($('menu_contact'), 'opacity', {duration: 500});
		fx1.start(1, 0);
		fx2.start(1, 0);
		fx3.start(1, 0);
		fx4.start(1, 0);
		setTimeout('fx.completelyHideMenu()',500);
	},
	completelyHideMenu: function() {
		$('menu').setStyle('display','none');
	},
	showCategories: function() {
		$('categories').setStyle('display','block');
		var height = $$('#categories div')[0].getSize().y;
		var fx = new Fx.Morph($('categories'), {duration:500, transition:Fx.Transitions.Expo.easeOut});
		fx.start({
			'bottom': [-height, 22],
			'opacity': [0, 1]
		});
	},
	hideCategories: function() {
		var height = $$('#categories div')[0].getSize().y;
		var fx = new Fx.Morph($('categories'), {duration:500, transition:Fx.Transitions.Expo.easeIn});
		fx.start({
			'bottom': [22, -height],
			'opacity': [1, 0]
		});
		setTimeout('fx.completelyHideCategories()',500);
	},
	completelyHideCategories: function() {
		$('categories').setStyle('display','none');
	},
	showScrollbar: function() {
		$('scroll_top').setStyle('display','block');
		$('scroll_bottom').setStyle('display','block');
		var fx1 = new Fx.Style($('scroll_top'), 'opacity', {duration: 500});
		var fx2 = new Fx.Style($('scroll_bottom'), 'opacity', {duration: 500});
		fx1.start(0, 1);
		fx2.start(0, 1);
	},
	hideScrollbar: function() {
		var fx1 = new Fx.Style($('scroll_top'), 'opacity', {duration: 500});
		var fx2 = new Fx.Style($('scroll_bottom'), 'opacity', {duration: 500});
		fx1.start(1, 0);
		fx2.start(1, 0);
		setTimeout('fx.completelyHideScrollbar()',500);
	},
	completelyHideScrollbar: function() {
		$('scroll_top').setStyle('display','none');
		$('scroll_bottom').setStyle('display','none');
	},
	showVideo: function(id) {
		var item = $(id);
		var fx = new Fx.Style(item, 'opacity', {duration: 500});
		fx.start(0, 1);
		var next = item.getNext();
		while (next && next.getStyle('display')==='none') {
			next = next.getNext();
		}
		if (next) {
			var id_next = next.getProperty('id');
			setTimeout('fx.showVideo("'+id_next+'")',250);
		}
	},
	showVideoBlock: function(id) {
		var item = $(id);
		item.setStyle('display','block');
		var thumb = item.getElements('.thumbnail')[0].getFirst();
		thumb.setProperty('rel',thumb.getProperty('rel').replace(/Hidden/,'Videos'));
	},
	hideVideoBlock: function(id) {
		var item = $(id);
		item.setStyles({display: 'none', opacity: '0'});
		var thumb = item.getElements('.thumbnail')[0].getFirst();
		thumb.setProperty('rel',thumb.getProperty('rel').replace(/Videos/,'Hidden'));
	},
	hideVideos: function() {
		var item = $('videos');
		var fx = new Fx.Style(item, 'opacity', {duration: 500});
		fx.start(1, 0);
	},
	hideAllVideos: function() {
		var videos = $$('#videos li');
		videos.each(function(item) {
			var fx = new Fx.Style(item, 'opacity', {duration: 500});
			fx.start(1, 0);
		});
	},
	showVideos: function() {
		var item = $('videos');
		var fx = new Fx.Style(item, 'opacity', {duration: 500});
		fx.start(0, 1);
		Shadowbox.reset(sb_options);
	},
	showVideoDescription: function(id) {
		var description = $(id).getElements('.description')[0];
		description.setStyle('display','block');
		var fx = new Fx.Morph(description, {duration:500, transition:Fx.Transitions.Expo.easeOut});
		fx.start({
			'right': [0, -200],
			'opacity': [0, 1]
		});
	},
	showVideoTitle: function(id) {
		var title = $(id).getElements('.title')[0];
		title.setStyle('display','block');
		var title_width = title.getSize().x;
		var fx = new Fx.Morph(title, {duration:500, transition:Fx.Transitions.Expo.easeOut});
		fx.start({
			'right': [0, -title_width],
			'opacity': [0, 1]
		});
	},
	hideVideoDetails: function(id) {
		$$('#'+id+' .description').setStyles({right: '0', opacity: '0'});
		$$('#'+id+' .title').setStyles({right: '0', opacity: '0'});
	},
	reduceMenuItem: function(id) {
		var fx = new Fx.Style($(id), 'height', {duration: 100});
		fx.start(25, 20);
	},
	increaseMenuItem: function(id) {
		var fx = new Fx.Style($(id), 'height', {duration: 150});
		fx.start(20, 25);
	},
	categoryHighlight: function(id) {
		var fx = new Fx.Style($(id), 'opacity', {duration: 250});
		fx.start(0.65, 1);
	},
	categoryDefault: function(id) {
		var fx = new Fx.Style($(id), 'opacity', {duration: 250});
		fx.start(1, 0.65);
	},
	moveVideos: function() {
		var ctop = parseInt($('videos').getStyle('top'));
		var fx1 = new Fx.Style($('videos'), 'top', {duration: 500, transition:Fx.Transitions.Expo.easeOut});
		fx1.start(ctop, -12);
		var fx2 = new Fx.Morph($('videos_container'), {duration:500, transition:Fx.Transitions.Expo.easeOut});
		fx2.start({
			'left': [427, 8],
			'width': [296, 896]
		});
	},
	reposVideos: function() {
		var videos = $$('#videos li');
		var top = 0;
		var left = 0;
		var ctop;
		var compteur = 0;
		for (var i=0; i<videos.length; i++) {
			if (videos[i].getStyle('display') === 'block') {
				videos[i].setStyle('position','absolute');
				videos[i].setStyle('z-index',500-compteur);
				ctop = compteur*171;
				if (compteur !== 0 && compteur%3 === 0) {
					top += 171;
					left = 0;
				}
				var fx = new Fx.Morph(videos[i], {duration:750, transition:Fx.Transitions.Expo.easeOut});
				fx.start({
					'top': [ctop, top],
					'left': [0, left]
				});
				left += 300;
				compteur++;
			}
		}
		setTimeout('fx.showBrowserScrollbar()',750);
	},
	resetVideos: function() {
		$('videos_container').setStyles({
			left: '427px',
			width: '496px'
		});
		$$('#videos li').each(function(item) {
			item.setStyles({
				position: 'relative',
				top: 'auto',
				left: 'auto',
				zIndex: 'auto'
			});
		});
		fx.hideBrowserScrollbar();

	},
	showBrowserScrollbar: function() {
		$('videos_container').setStyles({overflow:'visible', height:'auto'});
		$$('html')[0].setStyle('overflow-y','visible');
		$$('body')[0].setStyle('overflow-y','visible');
	},
	hideBrowserScrollbar: function() {
		$('videos_container').setStyle('overflow','hidden');
		$$('html')[0].setStyle('overflow','hidden');
		$$('body')[0].setStyle('overflow','hidden');
	},
	showCloseOverview: function() {
		var nb = video.nbVideos();
		var left;
		switch (nb) {
			case 1 : left = 304; break;
			case 2 : left = 604; break;
			default : left = 904; break;
		}
		$('close_overview').setStyle('left', left+'px');
		var fx = new Fx.Style($('close_overview'), 'opacity', {duration: 500});
		fx.start(0, 1);
	},
	hideCloseOverview: function() {
		var fx = new Fx.Style($('close_overview'), 'opacity', {duration: 500});
		fx.start(1, 0);
	},
	upVideos: function() {
		var fx = new Fx.Style($('videos'), 'top', {duration: 500});
		fx.start(0, -12);
	},
	downVideos: function() {
		var fx = new Fx.Style($('videos'), 'top', {duration: 500});
		fx.start(-12, 0);
	}
});

/*** LOADING CLASS ***/

pikaboo.loading = new Class({
	showBlocks: function() {
		$('opaque').setStyle('display','block');
		$('loading').setStyle('display','block');
	},
	hideBlocks: function() {
		$('opaque').setStyle('display','none');
		$('loading').setStyle('display','none');
	},
	show: function() {
		loading.showBlocks();
		var fx1 = new Fx.Style($('opaque'), 'opacity', {duration: 500});
		var fx2 = new Fx.Style($('loading'), 'opacity', {duration: 500});
		fx1.start(0, 0.65);
		fx2.start(0, 1);
	},
	hide: function() {
		var fx1 = new Fx.Style($('opaque'), 'opacity', {duration: 500});
		var fx2 = new Fx.Style($('loading'), 'opacity', {duration: 500});
		fx1.start(0.65, 0);
		fx2.start(1, 0);
		setTimeout('loading.hideBlocks()',500);
	}
});

/*** OVERLAYS CLASS ***/

pikaboo.overlays = new Class({
	showBlocks: function(param) {
		$('opaque').setStyle('display','block');
		$('overlay_'+param).setStyle('display','block');
	},
	hideBlocks: function(param) {
		$('opaque').setStyle('display','none');
		$('overlay_'+param).setStyle('display','none');
		switch (param) {
			case 'news' : 	$$('.new').each(function(item) { item.setStyle('opacity','0'); });
							break;
			case 'pics' : 	$$('.pic').each(function(item) { item.setStyle('opacity','0'); });
							break;
		}
	},
	show: function(param) {
		lines.hide();
		overlays.showBlocks(param);
		var fx1 = new Fx.Style($('opaque'), 'opacity', {duration: 500});
		var fx2 = new Fx.Style($('overlay_'+param), 'opacity', {duration: 500});
		fx1.start(0, 0.65);
		fx2.start(0, 1);
		switch (param) {
			case 'news' : 	if ($('news').getFirst().hasClass('new')) overlays.showNew($('news').getFirst().getProperty('id'));
							break;
			case 'pics' : 	if ($('pics').getFirst().hasClass('pic')) overlays.showPic($('pics').getFirst().getProperty('id'));
							break;
		}
	},
	hide: function(param) {	
		setTimeout('lines.show()',500);	
		var fx1 = new Fx.Style($('opaque'), 'opacity', {duration: 500});
		var fx2 = new Fx.Style($('overlay_'+param), 'opacity', {duration: 500});
		fx1.start(0.65, 0);
		fx2.start(1, 0);
		setTimeout('overlays.hideBlocks("'+param+'")',500);
	},
	getCurrent: function() {
		var current;
		$$('.overlay').each(function(overlay) {
			if (overlay.getStyle('display') === 'block') {
				current = overlay.getProperty('id').substr(8, overlay.getProperty('id').length);
			}
		});
		return current;
	},
	showNew: function(id) {
		var item = $(id);
		var fx = new Fx.Style(item, 'opacity', {duration: 250});
		fx.start(0, 1);
		var next = item.getNext();
		if (next && next.hasClass('new')) {
			var id_next = next.getProperty('id');
			setTimeout('overlays.showNew("'+id_next+'")',125);
		}
	},
	showPic: function(id) {
		var item = $(id);
		var fx = new Fx.Style(item, 'opacity', {duration: 250});
		fx.start(0, 1);
		var next = item.getNext();
		if (next && next.hasClass('pic')) {
			var id_next = next.getProperty('id');
			setTimeout('overlays.showPic("'+id_next+'")',125);
		}
	}
});

/*** VIDEO CLASS ***/

pikaboo.video = new Class({
	find: function(tag) {
		new Ajax('/videos_controller.php?action=find', {
			method: 'post',
			data: {tag: tag},
			onComplete: function() {
				var response = Json.evaluate(this.response.text);
				video.findCallback(response);
			}
		}).request();
	},
	findAll: function() {
		new Ajax('/videos_controller.php?action=findAll', {
			method: 'post',
			onComplete: function() {
				var response = Json.evaluate(this.response.text);
				video.findCallback(response);
			}
		}).request();
	},
	findCallback: function(jsonData) {
		fx.hideVideos();
		$$('#videos li').each(function(item) {
			setTimeout('fx.hideVideoBlock("'+item.getProperty('id')+'")',625);
		});
		jsonData.each(function(item) {
			setTimeout('fx.showVideoBlock("video'+item.id+'")',750);
		});
		setTimeout('fx.showVideos()',875);
		var id_first = $$('#videos li')[0].getProperty('id');
		setTimeout('fx.showVideo("'+id_first+'")',1000);
		setTimeout('loading.hide()',1000);
		setTimeout('scrollbar.calculate(true)',1000);
	},
	blockSize: function() {
		var n = video.nbVideos();
		return (171 * n) + 4;
	},
	nbVideos: function() {
		var n = 0;
		$$('#videos li').each(function(item) {
			if (item.getStyle('display')==='block') {
				n++;
			}
		});
		return n;
	}
});

/*** SCROLLBAR CLASS ***/

pikaboo.scrollbar = new Class({
	vheight: 0,
	nbVideos: 0,
	nbVisibleVideos: 0,
	nbHiddenVideos: 0,
	calculate: function(tr) {
		var wheight = (Browser.Engine.presto) ? $$('body')[0].clientHeight : window.getSize().y;
		$('videos_container').setStyle('height', wheight+'px');
		scrollbar.vheight = wheight - 32;
		scrollbar.nbVideos = video.nbVideos();
		
		var nbFitVideos = Math.floor((scrollbar.vheight-4) / 171);
		
		scrollbar.nbVisibleVideos = (scrollbar.nbVideos > nbFitVideos) ? nbFitVideos : scrollbar.nbVideos;
		scrollbar.nbHiddenVideos = scrollbar.nbVideos - scrollbar.nbVisibleVideos;
		
		var top = parseInt($('videos').getStyle('top'));
		
		if (scrollbar.nbHiddenVideos === 0) {
			if (tr) {
				fx.hideScrollbar();
				if (top !== -12)
					fx.upVideos();
			}
			else {
				$('scroll_top').setStyles({display: 'none', visibility: 'hidden', opacity: '0'});
				$('scroll_bottom').setStyles({display: 'none', visibility: 'hidden', opacity: '0'});
				if (top !== -12)
					$('videos').setStyle('top','-12px');
			}
		}
		else {
			if (tr) {
				fx.showScrollbar();
				if (top !== 0)
					fx.downVideos();
			}
			else {
				$('scroll_top').setStyles({display: 'block', visibility: 'visible', opacity: '1'});
				$('scroll_bottom').setStyles({display: 'block', visibility: 'visible', opacity: '1'});
				if (top !== 0)
					$('videos').setStyle('top','0');
			}
		}
	},
	scrollTop: function() {
		if (scrollbar.nbHiddenVideos > 0 && !scroll_busy) {
			scroll_busy = true;
			setTimeout("scroll_busy = false",500);
			var vtop = parseInt($('videos').getStyle('top'));
				if (vtop < -171) {
					var nvtop = vtop + 171;
				}
				else {
					var nvtop = 0;
				}
				var fx = new Fx.Style($('videos'), 'top', {duration: 485, transition:Fx.Transitions.Expo.easeInOut});
				fx.start(vtop, nvtop);
		}
	},
	scrollBottom: function() {
		if (scrollbar.nbHiddenVideos > 0 && !scroll_busy) {
			scroll_busy = true;
			setTimeout("scroll_busy = false",500);
			var vtop = parseInt($('videos').getStyle('top'));
			if (scrollbar.vheight + 171 < video.blockSize() + vtop) {
				var nvtop = vtop - 171;
			}
			else {
				var reste = video.blockSize() + vtop - scrollbar.vheight;
				var nvtop = vtop - reste;
				if (Browser.Engine.trident) {
					nvtop = nvtop - 12;
				}
			}
			var fx = new Fx.Style($('videos'), 'top', {duration: 485, transition:Fx.Transitions.Expo.easeInOut});
			fx.start(vtop, nvtop);
		}
	}
});

/*** OVERVIEW CLASS ***/

pikaboo.overview = new Class({
	show: function() {
		normal_mode = false;
		setTimeout("overview_mode = true",2000);
		
		fx.hideLogo();
		fx.hideMenu();
		fx.hideCategories();
		fx.hideScrollbar();
		setTimeout("fx.moveVideos()",750);
		setTimeout("fx.reposVideos()",1250);
		setTimeout("fx.showCloseOverview()",1500);
		
		lines.hide();
	},
	hide: function() {
		normal_mode = true;
		overview_mode = false;
		
		fx.hideAllVideos();
		fx.hideCloseOverview();
		
		setTimeout('scrollbar.calculate(true)',2000);
		
		setTimeout('fx.resetVideos()',750);
		setTimeout('fx.showLogo()',750);
		setTimeout('fx.showMenuItem("news")',1000);
		setTimeout('fx.showMenuItem("pics")',1200);
		setTimeout('fx.showMenuItem("about")',1400);
		setTimeout('fx.showMenuItem("contact")',1600);
		setTimeout('fx.showCategories()',1500);
		
		var id_first = $$('#videos li')[0].getProperty('id');
		setTimeout('fx.showVideo("'+id_first+'")',2000);
		
		setTimeout('lines.show()',2000);
	}
});

/*** FLV ***/

pikaboo.lines = new Class({
	show: function() {
		$('flv').setStyles({width:'600px', height:'700px'});
		if (!Browser.Engine.trident && $('vidPlayer')) {
			$('vidPlayer').setStyle('visibility','visible');
		}
	},
	hide: function() {
		if (!Browser.Engine.trident && $('vidPlayer')) {
			$('vidPlayer').setStyle('visibility','hidden');
		}
		$('flv').setStyles({width:'0', height:'0'});
	}
});

/*** MAIN PROCESS ***/

window.addEvent('domready', function() {
	
	// initialization
	scrollbar = new pikaboo.scrollbar();
	loading = new pikaboo.loading();
	overlays = new pikaboo.overlays();
	video = new pikaboo.video();
	overview = new pikaboo.overview();
	fx = new pikaboo.fx();
	lines = new pikaboo.lines();
	
	// resize categories items
	var max = 0, width, awidth;
	$$('#categories li').each(function(item) {
		width = item.getSize().x;
		if (width > max) {
			max = width;
		}
	});
	$$('#categories li').each(function(item) {
		item.setStyle('width', max+'px');
		awidth = (item.getProperty('id')==='overview') ? max-29 : max-10;
		item.getFirst().setStyle('width', awidth+'px');
	});
	
	// set scrolls
	window.addEvent('resize', function() {
		if (normal_mode)
			scrollbar.calculate(false);
	});
	document.addEvent('mousewheel', function(event) {
		if (normal_mode) {
			if (event.wheel > 0)
				scrollbar.scrollTop();
			else
				scrollbar.scrollBottom();
			return false;
		}
	});
	document.addEvent('keydown', function(event) {
		if (normal_mode) {
			if (event.key === 'up') {
				scrollbar.scrollTop();
				return false;
			}
			if (event.key === 'down') {
				scrollbar.scrollBottom();
				return false;
			}
		}
		else if (overview_mode) {
			if ((event.key === 'esc') && $('shadowbox_overlay').getStyle('visibility') === 'hidden') {
				overview.hide();
			}
		}
	});
	
	// apparitions
	fx.showLogo();
	setTimeout('fx.showMenuItem("news")',200);
	setTimeout('fx.showMenuItem("pics")',400);
	setTimeout('fx.showMenuItem("about")',600);
	setTimeout('fx.showMenuItem("contact")',800);
	setTimeout('fx.showCategories()',750);
	
	video.findAll();
	
	// resizing overlays
	var width = $$('body')[0].getSize().x - 24;
	var width2 = window.getSize().x - 24;
	$$('.overlay').each(function(overlay) {
		overlay.setStyle('width',width+'px');
	});
	
	// scrollbar top
	$('scroll_top').addEvent('click', function() {
		scrollbar.scrollTop();
	});
	// scrollbar bottom
	$('scroll_bottom').addEvent('click', function() {
		scrollbar.scrollBottom();
	});
	
	// observe categories
	$$('#categories li a').each(function(item) {
		var id = item.getParent().getProperty('id');
		item.addEvent('click', function() {
			if (id !== 'overview') {
				lines.hide();
				setTimeout('lines.show()',2000);
				loading.show();
				if (id !== 'all') {
					video.find(item.getProperty('rel'));
				}
				else {
					video.findAll();
				}
				if ($$('#categories .selected').length > 0) {
					$$('#categories .selected')[0].removeClass('selected');
				}
				item.getParent().addClass('selected');
			}
			else {
				overview.show();
			}
			return false;
		});
		item.addEvent('mouseover', function() {
			fx.categoryHighlight(item.getParent().getProperty('id'));
		});
		item.addEvent('mouseout', function() {
			setTimeout('fx.categoryDefault("'+item.getParent().getProperty('id')+'")',125);
		});
	});
	
	// observe videos
	$$('#videos li .thumbnail a img').each(function(item) {
		var id = item.getParent().getParent().getParent().getProperty('id');
		item.addEvent('mouseover', function() {
			fx.showVideoDescription(id);
			fx.showVideoTitle(id);
		});
		item.addEvent('mouseout', function() {
			$$('#'+id+' .description').setStyle('display', 'none');
			$$('#'+id+' .title').setStyle('display', 'none');
			setTimeout('fx.hideVideoDetails("'+id+'")',500);
		});
	});
	
	// observe menu --> open overlays and mouseover/out
	$$('#menu_about a')[0].addEvent('click', function() {
		overlays.show('about');
		return false;
	});
	$$('#menu_news a')[0].addEvent('click', function() {
		overlays.show('news');
		return false;
	});
	$$('#menu_pics a')[0].addEvent('click', function() {
		overlays.show('pics');
		return false;
	});
	$$('#menu_contact a')[0].addEvent('click', function() {
		overlays.show('contact');
		return false;
	});
	$$('#menu li a').each(function(item) {
		item.addEvent('mouseover', function() {
			fx.reduceMenuItem(item.getParent().getProperty('id'));
		});
		item.addEvent('mouseout', function() {
			setTimeout('fx.increaseMenuItem("'+item.getParent().getProperty('id')+'")',100);
		});
	});
	
	// close overlays
	$$('#overlay_about .close')[0].addEvent('click', function() {
		overlays.hide('about');
		return false;
	});
	$$('#overlay_news .close')[0].addEvent('click', function() {
		overlays.hide('news');
		return false;
	});
	$$('#overlay_pics .close')[0].addEvent('click', function() {
		overlays.hide('pics');
		return false;
	});
	$$('#overlay_contact .close')[0].addEvent('click', function() {
		overlays.hide('contact');
		return false;
	});
	
	// other ways to close overlays
	$('opaque').addEvent('click', function() {
		var current = overlays.getCurrent();
		if (current) {
			overlays.hide(current);
		}
	});
	document.addEvent('keydown', function(event) {
		var current = overlays.getCurrent();
		if (current && (event.key === 'esc') && $('shadowbox_overlay').getStyle('visibility') === 'hidden') {
			overlays.hide(current);
		}
	});
	
	// close overview
	$('close_overview').addEvent('click', function() {
		overview.hide();
		return false;
	});
	
	// parsing photos
	$$('.pic').each(function(pic) {
		var url = pic.getElements('img')[0].getProperty('src');
		var title = pic.getElements('a')[1].getProperty('title');
		pic.empty();
		var link = new Element('a', {href: url.replace(/_m.jpg/,'.jpg'), title: title, rel: 'shadowbox[Pics]'});
		var image = new Element('img', {src: url.replace(/_m.jpg/,'_s.jpg'), alt: title});
		image.injectInside(link);
		link.injectInside(pic);
	});
	
	// init the Shadowbox plugin
	sb_options = {
		loadingImage: '_images/loading.gif',
		overlayOpacity: 0.65,
		overlayBgImage: '/_images/overlay-65.png',
		fadeDuration: 0.5
	};
	
	Shadowbox.init(sb_options);
});
