$(document).ready(function(){
/* When Page Is Finished Loading, Initialize the Magnifier and Audio Player */

/* Art Magnification Variables */
var
	left = 0,
	top = 0,
	sizes = { retina: { width:190, height:190 }, artview: { width:400, height:400 } },
	artview = $('#artview'),
	offset = { left: artview.offset().left, top: artview.offset().top },
	retina = $('#retina'),
	gongoleft = 0,
	gongoright = 0,
	gongosizes = { gongoretina: { width:190, height:190 }, gongoview: { width:440, height:440 } },
	gongoview = $('#gongoview'),
	gongoretina = $('#gongoretina'),
	nfiniteleft = 0,
	nfiniteright = 0,
	nfinitesizes = { nfiniteretina: { width:190, height:190 }, nfiniteview: { width:440, height:440 } },
	nfiniteview = $('#nfiniteview'),
	nfiniteretina = $('#nfiniteretina'),
	milagroleft = 0,
	milagroright = 0,
	milagrosizes = { milagroretina: { width:190, height:190 }, milagroview: { width:440, height:440 } },
	milagroview = $('#milagroview'),
	milagroretina = $('#milagroretina'),
	halcyonleft = 0,
	halcyonright = 0,
	halcyonsizes = { halcyonretina: { width:190, height:190 }, halcyonview: { width:440, height:440 } },
	halcyonview = $('#halcyonview'),
	halcyonretina = $('#halcyonretina'),
	shadowsleft = 0,
	shadowsright = 0,
	shadowssizes = { shadowsretina: { width:190, height:190 }, shadowsview: { width:440, height:440 } },
	shadowsview = $('#shadowsview'),
	shadowsretina = $('#shadowsretina'),
	wonderleft = 0,
	wonderright = 0,
	wondersizes = { wonderretina: { width:190, height:190 }, wonderview: { width:440, height:440 } },
	wonderview = $('#wonderview'),
	wonderretina = $('#wonderretina'),
	lawleft = 0,
	lawright = 0,
	lawsizes = { lawretina: { width:190, height:190 }, lawview: { width:440, height:440 } },
	lawview = $('#lawview'),
	lawretina = $('#lawretina'),
	vapouraleft = 0,
	vapouraright = 0,
	vapourasizes = { vapouraretina: { width:190, height:190 }, vapouraview: { width:440, height:440 } },
	vapouraview = $('#vapouraview'),
	vapouraretina = $('#vapouraretina'),
	loveleft = 0,
	loveright = 0,
	lovesizes = { loveretina: { width:190, height:190 }, loveview: { width:440, height:440 } },
	loveview = $('#loveview'),
	loveretina = $('#loveretina'),
	summonsleft = 0,
	summonsright = 0,
	summonssizes = { summonsretina: { width:190, height:190 }, summonsview: { width:440, height:440 } },
	summonsview = $('#summonsview'),
	summonsretina = $('#summonsretina'),
	collapseleft = 0,
	collapseright = 0,
	collapsesizes = { collapseretina: { width:190, height:190 }, collapseview: { width:440, height:440 } },
	collapseview = $('#collapseview'),
	collapseretina = $('#collapseretina'),
	angelsleft = 0,
	angelsright = 0,
	angelssizes = { angelsretina: { width:190, height:190 }, angelsview: { width:440, height:440 } },
	angelsview = $('#angelsview'),
	angelsretina = $('#angelsretina'),
	sheolleft = 0,
	sheolright = 0,
	sheolsizes = { sheolretina: { width:190, height:190 }, sheolview: { width:440, height:440 } },
	sheolview = $('#sheolview'),
	sheolretina = $('#sheolretina');

/* jPlayer Audio Variables */
	var playItem = 0;
	var myPlayList = [
		{name:"Gongo Dodan",mp3:"../mux/jayaprime_vapoura_01_gongo.mp3"},
		{name:"Non-finite",mp3:"../mux/jayaprime_vapoura_02_nfinite.mp3"},
		{name:"Le Miracle de la Machine",mp3:"../mux/jayaprime_vapoura_03_milagro.mp3"},
		{name:"Halcyon Electronica (Effusionary Mix)",mp3:"../mux/jayaprime_vapoura_04_halcyon.mp3"},
		{name:"At a tea house, under paper shadows",mp3:"../mux/jayaprime_vapoura_05_shadows.mp3"},
		{name:"A day in the Bazaar of Wonders",mp3:"../mux/jayaprime_vapoura_06_wonder.mp3"},
		{name:"LAW [The Threefold Goddess]",mp3:"../mux/jayaprime_vapoura_07_law.mp3"},
		{name:"IO Vapoura (Renaissantia Soft Dub)",mp3:"../mux/jayaprime_vapoura_08_vapoura.mp3"},
		{name:"1 love 0 [infinitely]",mp3:"../mux/jayaprime_vapoura_09_love.mp3"},
		{name:"To Summon the Sky [The Gears of Heaven]",mp3:"../mux/jayaprime_vapoura_10_summons.mp3"},
		{name:"Synapse Collapse [The fUSION Anomaly]",mp3:"../mux/jayaprime_vapoura_11_collapse.mp3"},
		{name:"May Angels Take You",mp3:"../mux/jayaprime_vapoura_12_angels.mp3"},
		{name:"Last Train to Sheol [Fantasmas Krystalinos]",mp3:"../mux/jayaprime_vapoura_13_sheol.mp3"}
	];
	var jpPlayTime = $("#jplayer_play_time");

/* Initialize External Page Items */
	var pageloaditem = 0;
	var pageloadorder = [
		{wichdivid:"#track01intro",url:"../notes/track01.html"},
		{wichdivid:"#loveandgratitude",url:"../notes/loveandgratitude.html"},
		{wichdivid:"#track02intro",url:"../notes/track02.html"},
		{wichdivid:"#notesonvapoura",url:"../notes/notesonvapoura.html"},
		{wichdivid:"#track03intro",url:"../notes/track03.html"},
		{wichdivid:"#track04intro",url:"../notes/track04.html"},
		{wichdivid:"#track05intro",url:"../notes/track05.html"},
		{wichdivid:"#track06intro",url:"../notes/track06.html"},
		{wichdivid:"#track07intro",url:"../notes/track07.html"},
		{wichdivid:"#albumjournal",url:"../notes/albumjournal.html"},
		{wichdivid:"#track08intro",url:"../notes/track08.html"},
		{wichdivid:"#track09intro",url:"../notes/track09.html"},
		{wichdivid:"#track10intro",url:"../notes/track10.html"},
		{wichdivid:"#track11intro",url:"../notes/track11.html"},
		{wichdivid:"#track12intro",url:"../notes/track12.html"},
		{wichdivid:"#track13intro",url:"../notes/track13.html"}
	];
	$(window).scroll(function(){
        	if (($(window).scrollTop() > (($(document).height() - $(window).height())/15)) && (pageloaditem <= pageloadorder.length)){
			if (($(window).scrollTop() > (($(document).height() - $(window).height())/6))) {
				for (i=pageloaditem; i < pageloadorder.length; i++) {
					$(pageloadorder[i].wichdivid).load(pageloadorder[i].url, function() { });
				}
			} else {
				$(pageloadorder[pageloaditem].wichdivid).load(pageloadorder[pageloaditem].url, function() { });
				pageloaditem++;
			}
        	}
	});


	if(navigator.userAgent.indexOf('Chrome')!=-1)
	{
		/* Chrome Rejects Blank Cursors, so Render a Special Dot Cursor */

		retina.addClass('chrome');
		gongoretina.addClass('chrome');
		nfiniteretina.addClass('chrome');
		milagroretina.addClass('chrome');
		halcyonretina.addClass('chrome');
		shadowsretina.addClass('chrome');
		wonderretina.addClass('chrome');
		lawretina.addClass('chrome');
		vapouraretina.addClass('chrome');
		loveretina.addClass('chrome');
		summonsretina.addClass('chrome');
		collapseretina.addClass('chrome');
		angelsretina.addClass('chrome');
		sheolretina.addClass('chrome');
	}

	artview.mousemove(function(e){

		left = (e.pageX-offset.left);
		top = (e.pageY-offset.top);

		if(retina.is(':not(:animated):hidden')){
			/* Retina Div View Fix */
			artview.trigger('mouseenter');
		}

		if(left<20 || top<20 || left > sizes.artview.width ||
			top > sizes.artview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!retina.is(':animated')){
				artview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		retina.css({
			left				: left - sizes.retina.width/2,
			top					: top - sizes.retina.height/2,
			backgroundPosition	: '-'+(1.569*left)+'px -'+(1.569*top)+'px'
		});

	}).mouseleave(function(){
		retina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		retina.stop(true,true).fadeIn('fast');
	});

	gongoview.mousemove(function(e){
		var gongooffset = { left: gongoview.offset().left, top: gongoview.offset().top };
		gongoleft = (e.pageX-gongooffset.left);
		gongotop = (e.pageY-gongooffset.top);

		if(gongoretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			gongoview.trigger('mouseenter');
		}

		if(gongoleft<0 || gongotop<0 || gongoleft > gongosizes.gongoview.width ||
			gongotop > gongosizes.gongoview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!gongoretina.is(':animated')){
				gongoview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		gongoretina.css({
			left			: gongoleft - gongosizes.gongoretina.width/2,
			top			: gongotop - gongosizes.gongoretina.height/2,
			/* backgroundPosition	: '-'+(1.6*gongoleft)+'px -'+(1.35*gongotop)+'px' */
			backgroundPosition	: '-'+(1.569*gongoleft)+'px -'+(1.569*gongotop)+'px'
		});
	}).mouseleave(function(){
		gongoretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		gongoretina.stop(true,true).fadeIn('fast');
	});

	nfiniteview.mousemove(function(e){
		var nfiniteoffset = { left: nfiniteview.offset().left, top: nfiniteview.offset().top };
		nfiniteleft = (e.pageX-nfiniteoffset.left);
		nfinitetop = (e.pageY-nfiniteoffset.top);

		if(nfiniteretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			nfiniteview.trigger('mouseenter');
		}

		if(nfiniteleft<0 || nfinitetop<0 || nfiniteleft > nfinitesizes.nfiniteview.width ||
			nfinitetop > nfinitesizes.nfiniteview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!nfiniteretina.is(':animated')){
				nfiniteview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		nfiniteretina.css({
			left			: nfiniteleft - nfinitesizes.nfiniteretina.width/2,
			top			: nfinitetop - nfinitesizes.nfiniteretina.height/2,
			/* backgroundPosition	: '-'+(1.6*nfiniteleft)+'px -'+(1.35*nfinitetop)+'px' */
			backgroundPosition	: '-'+(1.569*nfiniteleft)+'px -'+(1.569*nfinitetop)+'px'
		});
	}).mouseleave(function(){
		nfiniteretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		nfiniteretina.stop(true,true).fadeIn('fast');
	});

	milagroview.mousemove(function(e){
		var milagrooffset = { left: milagroview.offset().left, top: milagroview.offset().top };
		milagroleft = (e.pageX-milagrooffset.left);
		milagrotop = (e.pageY-milagrooffset.top);

		if(milagroretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			milagroview.trigger('mouseenter');
		}

		if(milagroleft<0 || milagrotop<0 || milagroleft > milagrosizes.milagroview.width ||
			milagrotop > milagrosizes.milagroview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!milagroretina.is(':animated')){
				milagroview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		milagroretina.css({
			left			: milagroleft - milagrosizes.milagroretina.width/2,
			top			: milagrotop - milagrosizes.milagroretina.height/2,
			/* backgroundPosition	: '-'+(1.6*milagroleft)+'px -'+(1.35*milagrotop)+'px' */
			backgroundPosition	: '-'+(1.569*milagroleft)+'px -'+(1.569*milagrotop)+'px'
		});
	}).mouseleave(function(){
		milagroretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		milagroretina.stop(true,true).fadeIn('fast');
	});

	halcyonview.mousemove(function(e){
		var halcyonoffset = { left: halcyonview.offset().left, top: halcyonview.offset().top };
		halcyonleft = (e.pageX-halcyonoffset.left);
		halcyontop = (e.pageY-halcyonoffset.top);

		if(halcyonretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			halcyonview.trigger('mouseenter');
		}

		if(halcyonleft<0 || halcyontop<0 || halcyonleft > halcyonsizes.halcyonview.width ||
			halcyontop > halcyonsizes.halcyonview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!halcyonretina.is(':animated')){
				halcyonview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		halcyonretina.css({
			left			: halcyonleft - halcyonsizes.halcyonretina.width/2,
			top			: halcyontop - halcyonsizes.halcyonretina.height/2,
			/* backgroundPosition	: '-'+(1.6*halcyonleft)+'px -'+(1.35*halcyontop)+'px' */
			backgroundPosition	: '-'+(1.569*halcyonleft)+'px -'+(1.569*halcyontop)+'px'
		});
	}).mouseleave(function(){
		halcyonretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		halcyonretina.stop(true,true).fadeIn('fast');
	});

	shadowsview.mousemove(function(e){
		var shadowsoffset = { left: shadowsview.offset().left, top: shadowsview.offset().top };
		shadowsleft = (e.pageX-shadowsoffset.left);
		shadowstop = (e.pageY-shadowsoffset.top);

		if(shadowsretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			shadowsview.trigger('mouseenter');
		}

		if(shadowsleft<0 || shadowstop<0 || shadowsleft > shadowssizes.shadowsview.width ||
			shadowstop > shadowssizes.shadowsview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!shadowsretina.is(':animated')){
				shadowsview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		shadowsretina.css({
			left			: shadowsleft - shadowssizes.shadowsretina.width/2,
			top			: shadowstop - shadowssizes.shadowsretina.height/2,
			/* backgroundPosition	: '-'+(1.6*shadowsleft)+'px -'+(1.35*shadowstop)+'px' */
			backgroundPosition	: '-'+(1.569*shadowsleft)+'px -'+(1.569*shadowstop)+'px'
		});
	}).mouseleave(function(){
		shadowsretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		shadowsretina.stop(true,true).fadeIn('fast');
	});

	wonderview.mousemove(function(e){
		var wonderoffset = { left: wonderview.offset().left, top: wonderview.offset().top };
		wonderleft = (e.pageX-wonderoffset.left);
		wondertop = (e.pageY-wonderoffset.top);

		if(wonderretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			wonderview.trigger('mouseenter');
		}

		if(wonderleft<0 || wondertop<0 || wonderleft > wondersizes.wonderview.width ||
			wondertop > wondersizes.wonderview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!wonderretina.is(':animated')){
				wonderview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		wonderretina.css({
			left			: wonderleft - wondersizes.wonderretina.width/2,
			top			: wondertop - wondersizes.wonderretina.height/2,
			/* backgroundPosition	: '-'+(1.6*wonderleft)+'px -'+(1.35*wondertop)+'px' */
			backgroundPosition	: '-'+(1.569*wonderleft)+'px -'+(1.569*wondertop)+'px'
		});
	}).mouseleave(function(){
		wonderretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		wonderretina.stop(true,true).fadeIn('fast');
	});

	lawview.mousemove(function(e){
		var lawoffset = { left: lawview.offset().left, top: lawview.offset().top };
		lawleft = (e.pageX-lawoffset.left);
		lawtop = (e.pageY-lawoffset.top);

		if(lawretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			lawview.trigger('mouseenter');
		}

		if(lawleft<0 || lawtop<0 || lawleft > lawsizes.lawview.width ||
			lawtop > lawsizes.lawview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!lawretina.is(':animated')){
				lawview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		lawretina.css({
			left			: lawleft - lawsizes.lawretina.width/2,
			top			: lawtop - lawsizes.lawretina.height/2,
			/* backgroundPosition	: '-'+(1.6*lawleft)+'px -'+(1.35*lawtop)+'px' */
			backgroundPosition	: '-'+(1.569*lawleft)+'px -'+(1.569*lawtop)+'px'
		});
	}).mouseleave(function(){
		lawretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		lawretina.stop(true,true).fadeIn('fast');
	});

	vapouraview.mousemove(function(e){
		var vapouraoffset = { left: vapouraview.offset().left, top: vapouraview.offset().top };
		vapouraleft = (e.pageX-vapouraoffset.left);
		vapouratop = (e.pageY-vapouraoffset.top);

		if(vapouraretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			vapouraview.trigger('mouseenter');
		}

		if(vapouraleft<0 || vapouratop<0 || vapouraleft > vapourasizes.vapouraview.width ||
			vapouratop > vapourasizes.vapouraview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!vapouraretina.is(':animated')){
				vapouraview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		vapouraretina.css({
			left			: vapouraleft - vapourasizes.vapouraretina.width/2,
			top			: vapouratop - vapourasizes.vapouraretina.height/2,
			/* backgroundPosition	: '-'+(1.6*vapouraleft)+'px -'+(1.35*vapouratop)+'px' */
			backgroundPosition	: '-'+(1.569*vapouraleft)+'px -'+(1.569*vapouratop)+'px'
		});
	}).mouseleave(function(){
		vapouraretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		vapouraretina.stop(true,true).fadeIn('fast');
	});

	loveview.mousemove(function(e){
		var loveoffset = { left: loveview.offset().left, top: loveview.offset().top };
		loveleft = (e.pageX-loveoffset.left);
		lovetop = (e.pageY-loveoffset.top);

		if(loveretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			loveview.trigger('mouseenter');
		}

		if(loveleft<0 || lovetop<0 || loveleft > lovesizes.loveview.width ||
			lovetop > lovesizes.loveview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!loveretina.is(':animated')){
				loveview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		loveretina.css({
			left			: loveleft - lovesizes.loveretina.width/2,
			top			: lovetop - lovesizes.loveretina.height/2,
			/* backgroundPosition	: '-'+(1.6*loveleft)+'px -'+(1.35*lovetop)+'px' */
			backgroundPosition	: '-'+(1.569*loveleft)+'px -'+(1.569*lovetop)+'px'
		});
	}).mouseleave(function(){
		loveretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		loveretina.stop(true,true).fadeIn('fast');
	});

	summonsview.mousemove(function(e){
		var summonsoffset = { left: summonsview.offset().left, top: summonsview.offset().top };
		summonsleft = (e.pageX-summonsoffset.left);
		summonstop = (e.pageY-summonsoffset.top);

		if(summonsretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			summonsview.trigger('mouseenter');
		}

		if(summonsleft<0 || summonstop<0 || summonsleft > summonssizes.summonsview.width ||
			summonstop > summonssizes.summonsview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!summonsretina.is(':animated')){
				summonsview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		summonsretina.css({
			left			: summonsleft - summonssizes.summonsretina.width/2,
			top			: summonstop - summonssizes.summonsretina.height/2,
			/* backgroundPosition	: '-'+(1.6*summonsleft)+'px -'+(1.35*summonstop)+'px' */
			backgroundPosition	: '-'+(1.569*summonsleft)+'px -'+(1.569*summonstop)+'px'
		});
	}).mouseleave(function(){
		summonsretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		summonsretina.stop(true,true).fadeIn('fast');
	});

	collapseview.mousemove(function(e){
		var collapseoffset = { left: collapseview.offset().left, top: collapseview.offset().top };
		collapseleft = (e.pageX-collapseoffset.left);
		collapsetop = (e.pageY-collapseoffset.top);

		if(collapseretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			collapseview.trigger('mouseenter');
		}

		if(collapseleft<0 || collapsetop<0 || collapseleft > collapsesizes.collapseview.width ||
			collapsetop > collapsesizes.collapseview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!collapseretina.is(':animated')){
				collapseview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		collapseretina.css({
			left			: collapseleft - collapsesizes.collapseretina.width/2,
			top			: collapsetop - collapsesizes.collapseretina.height/2,
			/* backgroundPosition	: '-'+(1.6*collapseleft)+'px -'+(1.35*collapsetop)+'px' */
			backgroundPosition	: '-'+(1.569*collapseleft)+'px -'+(1.569*collapsetop)+'px'
		});
	}).mouseleave(function(){
		collapseretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		collapseretina.stop(true,true).fadeIn('fast');
	});

	angelsview.mousemove(function(e){
		var angelsoffset = { left: angelsview.offset().left, top: angelsview.offset().top };
		angelsleft = (e.pageX-angelsoffset.left);
		angelstop = (e.pageY-angelsoffset.top);

		if(angelsretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			angelsview.trigger('mouseenter');
		}

		if(angelsleft<0 || angelstop<0 || angelsleft > angelssizes.angelsview.width ||
			angelstop > angelssizes.angelsview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!angelsretina.is(':animated')){
				angelsview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		angelsretina.css({
			left			: angelsleft - angelssizes.angelsretina.width/2,
			top			: angelstop - angelssizes.angelsretina.height/2,
			/* backgroundPosition	: '-'+(1.6*angelsleft)+'px -'+(1.35*angelstop)+'px' */
			backgroundPosition	: '-'+(1.569*angelsleft)+'px -'+(1.569*angelstop)+'px'
		});
	}).mouseleave(function(){
		angelsretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		angelsretina.stop(true,true).fadeIn('fast');
	});

	sheolview.mousemove(function(e){
		var sheoloffset = { left: sheolview.offset().left, top: sheolview.offset().top };
		sheolleft = (e.pageX-sheoloffset.left);
		sheoltop = (e.pageY-sheoloffset.top);

		if(sheolretina.is(':not(:animated):hidden')){
			/* Fixes a bug where the retina div is not shown */
			sheolview.trigger('mouseenter');
		}

		if(sheolleft<0 || sheoltop<0 || sheolleft > sheolsizes.sheolview.width ||
			sheoltop > sheolsizes.sheolview.height)
		{
			/*	If we are out of the bondaries of the
				artview screenshot, hide the retina div */

			if(!sheolretina.is(':animated')){
				sheolview.trigger('mouseleave');
			}
			return false;
		}

		/*	Moving the retina div with the mouse
			(and scrolling the background) */

		sheolretina.css({
			left			: sheolleft - sheolsizes.sheolretina.width/2,
			top			: sheoltop - sheolsizes.sheolretina.height/2,
			/* backgroundPosition	: '-'+(1.6*sheolleft)+'px -'+(1.35*sheoltop)+'px' */
			backgroundPosition	: '-'+(1.569*sheolleft)+'px -'+(1.569*sheoltop)+'px'
		});
	}).mouseleave(function(){
		sheolretina.stop(true,true).fadeOut('fast');
	}).mouseenter(function(){
		sheolretina.stop(true,true).fadeIn('fast');
	});


	$("#jquery_jplayer").jPlayer({
		ready: function() {
			displayPlayList();
			playListInit(false);
		},
		volume: 90
	})

	.jPlayer("onProgressChange", function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) {
		jpPlayTime.text($.jPlayer.convertTime(playedTime));
	})
	.jPlayer("onSoundComplete", function() {
		playListNext();
	});

	$("#jplayer_previous").click( function() {
		playListPrev();
		$(this).blur();
		return false;
	});

	$("#jplayer_next").click( function() {
		playListNext();
		$(this).blur();
		return false;
	});

	function displayPlayList() {
		$("#jplayer_playlist ul").empty();
		for (i=0; i < myPlayList.length; i++) {
			var listItem = (i == myPlayList.length-1) ? ("<"+"li class='jplayer_playlist_item_last'") : ("<"+"li");
			if (((i+1) % 2) == 0) {
				listItem += " style='background-color: #ccf;'";
                        }
			listItem += ">";
			if (i < 9) {
				listItem += "0"+(i+1)+". ";
                        }
			if (i > 8) {
				listItem += (i+1)+". ";
			}
			if (i == 0) listItem += ("<"+"a href='#gongo' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:48] ");
			else if (i == 1) listItem += ("<"+"a href='#nfinite' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:10] ");
			else if (i == 2) listItem += ("<"+"a href='#milagro' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:17] ");
			else if (i == 3) listItem += ("<"+"a href='#halcyon' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:49] ");
			else if (i == 4) listItem += ("<"+"a href='#shadows' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [3:43] ");
			else if (i == 5) listItem += ("<"+"a href='#wonder' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [3:36] ");
			else if (i == 6) listItem += ("<"+"a href='#law' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:16] ");
			else if (i == 7) listItem += ("<"+"a href='#vapoura' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:01] ");
			else if (i == 8) listItem += ("<"+"a href='#love' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [3:27] ");
			else if (i == 9) listItem += ("<"+"a href='#summons' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:28] ");
			else if (i == 10) listItem += ("<"+"a href='#collapse' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:25] ");
			else if (i == 11) listItem += ("<"+"a href='#angels' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [6:56] ");
			else if (i == 12) listItem += ("<"+"a href='#sheol' title='Go to Album Art, Notes and Story'"+">"+"&Phi;"+"<"+"/a"+">"+" [4:10] ");
			listItem += ("<"+"a href='#' id='jplayer_playlist_item_"+i+"' tabindex='1'"+">"+ myPlayList[i].name +"<"+"/a"+"><"+"/li"+">");
			$("#jplayer_playlist ul").append(listItem);
			$("#jplayer_playlist_item_"+i).data( "index", i ).click( function() {
				var index = $(this).data("index");
				if (playItem != index) {
					playListChange( index );
				} else {
					$("#jquery_jplayer").jPlayer("play");
				}
				$(this).blur();
				return false;
			});
		}
	}

	function playListInit(autoplay) {
		if(autoplay) {
			playListChange( playItem );
		} else {
			playListConfig( playItem );
		}
	}

	function playListConfig( index ) {
		$("#jplayer_playlist_item_"+playItem).removeClass("jplayer_playlist_current").parent().removeClass("jplayer_playlist_current");
		$("#jplayer_playlist_item_"+index).addClass("jplayer_playlist_current").parent().addClass("jplayer_playlist_current");
		playItem = index;
		$("#jquery_jplayer").jPlayer("setFile", myPlayList[playItem].mp3);
	}

	function playListChange( index ) {
		playListConfig( index );
		$("#jquery_jplayer").jPlayer("play");
	}

	function playListNext() {
		var index = (playItem+1 < myPlayList.length) ? playItem+1 : 0;
		playListChange( index );
	}

	function playListPrev() {
		var index = (playItem-1 >= 0) ? playItem-1 : myPlayList.length-1;
		playListChange( index );
	}

	$("#playgongo").data( "index", 0 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playnfinite").data( "index", 1 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playmilagro").data( "index", 2 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playhalcyon").data( "index", 3 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playshadows").data( "index", 4 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playwonder").data( "index", 5 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playlaw").data( "index", 6 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playvapoura").data( "index", 7 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playlove").data( "index", 8 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playsummons").data( "index", 9 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playcollapse").data( "index", 10 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playangels").data( "index", 11 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});
	$("#playsheol").data( "index", 12 ).click( function() {
		var index = $(this).data("index");
		if (playItem != index) {
			playListChange( index );
		} else {
			$("#jquery_jplayer").jPlayer("play");
		}
		$(this).blur();
		return false;
	});


	/* This is basic - uses default settings */
	
	$("a#single_image").fancybox();
	
	/* Using custom settings */
	
	$("a#inline").fancybox({
		'hideOnContentClick': true
	});

	/* Apply fancybox to multiple items */
	
	$("a.iframe").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
	});


});
