
var prevpic = false;
var csection = false;

var WorkByDefault = 0;

var introtext_content_html = "";
var access_images = new Array();
var current_access_image = 0;

function Webpage(){
	this.id = null;
	this.title = '';
	this.description = '';
	this.pictures = new Array();
}

// WORK

	var WorkObjects = new Array();
	var currentWork = false;
	var currentWorkPictureId = 0;

	function WorkExist(id){
		for ( i = 0 ; i < WorkObjects.length ; i++ ){
			if ( WorkObjects[i].id == id ) return true;
		}
		return false;
	}

	function getWorkByID(id){
		for ( i = 0 ; i < WorkObjects.length ; i++ ){
			if ( WorkObjects[i].id == id ) return WorkObjects[i];
		}
		return false;
	}

	function getNextWorkID(id){
		if ( id == undefined ) return WorkObjects[0].id;
		for ( i = 0 ; i < WorkObjects.length ; i++ ){
			if ( WorkObjects[i].id == id ){
				return WorkObjects[(i<WorkObjects.length-1)?i+1:0].id ; 
			}
		}
		return false;
	}
	function getPreviousWorkID(id){
		if ( id == undefined ) return WorkObjects[WorkObjects.length-1].id;
		for ( i = 0 ; i < WorkObjects.length ; i++ ){
			if ( WorkObjects[i].id == id ){
				return WorkObjects[(i>0)?i-1:WorkObjects.length-1].id ; 
			}
		}
		return false;
	}

// JONES

	var JonesObjects = new Array();
	var currentJones = false;
	var currentJonesPictureId = 0;

	function JonesExist(id){
		for ( i = 0 ; i < JonesObjects.length ; i++ ){
			if ( JonesObjects[i].id == id ) return true;
		}
		return false;
	}
	function getJonesByID(id){
		for ( i = 0 ; i < JonesObjects.length ; i++ ){
			if ( JonesObjects[i].id == id ) return JonesObjects[i];
		}
		return false;
	}

	function getNextJonesID(id){
		if ( id == undefined ) return JonesObjects[0].id;
		for ( i = 0 ; i < JonesObjects.length ; i++ ){
			if ( JonesObjects[i].id == id ){
				return JonesObjects[(i<JonesObjects.length-1)?i+1:0].id ; 
			}
		}
		return false;
	}
	function getPreviousJonesID(id){
		if ( id == undefined ) return JonesObjects[JonesObjects.length-1].id;
		for ( i = 0 ; i < JonesObjects.length ; i++ ){
			if ( JonesObjects[i].id == id ){
				return JonesObjects[(i>0)?i-1:JonesObjects.length-1].id ; 
			}
		}
		return false;
	}

// Love

var LoveArray = new Array();

// XML LOADING

	function getXhr(){
		var xhr = null; 
		if(window.XMLHttpRequest){
			// Firefox et autres
			xhr = new XMLHttpRequest();
		} else if (window.ActiveXObject){
			// Internet Explorer 
			try {
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}

		} else {
			// XMLHttpRequest non supporté par le navigateur 
			xhr = false; 
		}
		return xhr;
	}
	
	function initLaunch(){
		init_Load();
	}

	function initLaunch_Step2(){
 		document.getElementById( 'delights_loading' ).style.display = 'none';
		document.getElementById( 'delights_slogan' ).style.display = 'block';
		document.getElementById( 'delights_address' ).style.display = 'block';
		document.getElementById( 'delights_contacts' ).style.display = 'block';
		document.getElementById( 'delights_phone' ).style.display = 'block';
		document.getElementById( 'delights_love' ).style.display = 'block';
		document.getElementById( 'delights_jones' ).style.display = 'block';
		document.getElementById( 'delights_work' ).style.display = 'block';
		updateFromHash();
	}

	var hashCash = window.location.hash;
	function setHash(val){
		window.location.hash = val.toLowerCase();
		hashCash = window.location.hash;
	}
	function hashChecker(){
		if ( window.location.hash.toLowerCase() != hashCash ){
			updateFromHash();
		}
	}
	function updateFromHash(){
		var hash_reg = /#([a-z]+);?(\d*);?(\d*)?/gi;
		var hash_result = hash_reg.exec(window.location.hash);
		if ( hash_result != null ){

			if ( hash_result[1].toLowerCase() == "introduction" ){

				showIntrotext();

			} else if ( hash_result[1].toLowerCase() == "access" ){

				showAccess();

			} else if ( hash_result[1].toLowerCase() == "works" ){
				
				var idfh = parseInt(hash_result[2]);
				if ( WorkExist(idfh) ){

					var imgid = parseInt(hash_result[3]);
					if ( imgid == NaN || imgid < 1 ){
						showWorkByID( idfh );
					} else {
						showWorkByID( idfh, imgid - 1 );
					}

				} else {
					showWorkList();
				}

			} else if ( hash_result[1].toLowerCase() == "jones" ){
				var idfh = parseInt(hash_result[2]);
				if ( JonesExist(idfh) ){
					showJonesByID( idfh );
				} else {
					showNextJones();
				}
			} else if ( hash_result[1].toLowerCase() == "love" ){
				showLove();
			}
		}
	}
	setInterval("hashChecker()", 300);

	function init_Load(){

		var xhr = getXhr(); 
		if ( ! xhr ){
			document.location.href = "error.html";
		}

		xhr.onreadystatechange = function(){
			if ( xhr.readyState == 4 && xhr.status == 200 ){
				var XmlContent= xhr.responseXML;
				var contentnodes = XmlContent.getElementsByTagName("content");
				var workype;
				for ( i = 0 ; i <contentnodes[0].childNodes.length ; i++ ) {

					if ( contentnodes[0].childNodes[i].tagName == "introtext" ){
						introtext_content_html = contentnodes[0].childNodes[i].childNodes[1].nodeValue;
					}

					if ( contentnodes[0].childNodes[i].tagName == "access" ){
						for ( j = 0 ; j < contentnodes[0].childNodes[i].childNodes.length ; j++ ){
							if (contentnodes[0].childNodes[i].childNodes[j].tagName == 'picture' ){
								access_images.push( contentnodes[0].childNodes[i].childNodes[j].getAttribute("file") );
							}
						}
					}

					if ( contentnodes[0].childNodes[i].tagName == "work" || contentnodes[0].childNodes[i].tagName == "jones" ){

						worktype = contentnodes[0].childNodes[i].tagName ;

						var cobj = new Webpage();
						cobj.id = contentnodes[0].childNodes[i].getAttribute("id");
						for ( j = 0 ; j < contentnodes[0].childNodes[i].childNodes.length ; j++ ){
							if ( contentnodes[0].childNodes[i].childNodes[j].firstChild ){
								switch ( contentnodes[0].childNodes[i].childNodes[j].tagName){
									case "title":
										cobj.title = contentnodes[0].childNodes[i].childNodes[j].firstChild.nodeValue;
										break;
									case "description":
										cobj.description = contentnodes[0].childNodes[i].childNodes[j].firstChild.nodeValue;
										break;
									case "picture":
										cobj.pictures.push([contentnodes[0].childNodes[i].childNodes[j].getAttribute("file"),contentnodes[0].childNodes[i].childNodes[j].firstChild.nodeValue]);
										break;
								}
							}
						}

						if ( worktype == 'work' ){
							WorkObjects.push(cobj);
						} else if ( worktype == 'jones' ){
							JonesObjects.push(cobj);
						}
					}

					if ( contentnodes[0].childNodes[i].tagName == "love" ){
						var clove = new Array();
						clove[0] = contentnodes[0].childNodes[i].getAttribute("id");
						for ( j = 0 ; j < contentnodes[0].childNodes[i].childNodes.length ; j++ ){
							if ( contentnodes[0].childNodes[i].childNodes[j].firstChild ){
								switch ( contentnodes[0].childNodes[i].childNodes[j].tagName){
									case "title":
										clove[1] = contentnodes[0].childNodes[i].childNodes[j].firstChild.nodeValue;
										break;
									case "url":
										clove[2] = contentnodes[0].childNodes[i].childNodes[j].firstChild.nodeValue;
										break;
									case "target":
										clove[3] = contentnodes[0].childNodes[i].childNodes[j].firstChild.nodeValue;
										break;
								}
							}
						}
						LoveArray.push(clove);
					}
				}
				initLaunch_Step2();
			}
		}
		xhr.open("GET","content.php",true);
		xhr.send(null);
		return void(0);
	}
	
	
function showIntrotext(){

	setHash('#introduction');

	document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');
	document.getElementById('delights_work').style.backgroundColor  = '#464F4C';

	document.getElementById('delights_work').onmouseover = function(){
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work_l.gif');
	};
	document.getElementById('delights_work').onmouseout = function(){
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');
	};

	document.getElementById('delights_slogan').onclick = function(){};
	document.getElementById('delights_slogan').onmouseover = function(){};
	document.getElementById('delights_slogan').onmouseout = function(){};
	document.getElementById('delights_slogan').style.backgroundImage  = 'url(images/delights_sprl_h.gif)';

	HideJones();
	HideLove();
	HideWorks();
	hideAccess();

	document.getElementById('delights_introtext').innerHTML = '<div class="Introduction">' + introtext_content_html + '</div>';
	document.getElementById('content').innerHTML = "";

}
function hideIntrotext(){

	document.getElementById('delights_introtext').innerHTML = "";
	document.getElementById('delights_slogan').onclick = showIntrotext;
	document.getElementById('delights_slogan').onmouseover = function(){ document.getElementById('delights_slogan').style.backgroundImage  = 'url(images/delights_sprl_h.gif)'};
	document.getElementById('delights_slogan').onmouseout = function(){ document.getElementById('delights_slogan').style.backgroundImage  = 'url(images/delights_sprl.gif)'};
	document.getElementById('delights_slogan').style.backgroundImage  = 'url(images/delights_sprl.gif)';

}
	
function showAccess(){

	setHash('#access');

	document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');
	document.getElementById('delights_work').style.backgroundColor  = '#464F4C';

	document.getElementById('delights_work').onmouseover = function(){
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work_l.gif');
	};
	document.getElementById('delights_work').onmouseout = function(){
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');
	};
	document.getElementById('delights_address').onclick = function(){};
	document.getElementById('delights_address').onmouseover = function(){};
	document.getElementById('delights_address').onmouseout = function(){};
	document.getElementById('delights_address').style.backgroundImage  = 'url(images/delights_148_rue_jourdan_10_h.gif)';

	HideJones();
	HideLove();
	HideWorks();
	hideIntrotext();

	$('content').empty();
	var element_access_img = new Element('img', { 'id': 'accessImg' , 'src': access_images[current_access_image] , 'alt': '' ,'class': '', 'styles': {'cursor': (( access_images.length > 1 ) ? 'pointer' : 'cursor')} } ).inject($('content'));
	if ( access_images.length > 1 ) {
		element_access_img.addEvent('click', function(e) {
				current_access_image = ( current_access_image < access_images.length - 1 ) ? current_access_image + 1 : 0 ;
				element_access_img.setProperty('src', access_images[current_access_image] ); 
			}
		);
	}

}
function hideAccess(){

	document.getElementById('delights_address').onclick = showAccess;
	document.getElementById('delights_address').onmouseover = function(){ document.getElementById('delights_address').style.backgroundImage  = 'url(images/delights_148_rue_jourdan_10_h.gif)'};
	document.getElementById('delights_address').onmouseout = function(){ document.getElementById('delights_address').style.backgroundImage  = 'url(images/delights_148_rue_jourdan_10.gif)'};
	document.getElementById('delights_address').style.backgroundImage  = 'url(images/delights_148_rue_jourdan_10.gif)';

}

function HideWorks(){
	document.getElementById('delights_worklist').innerHTML = "";
	document.getElementById('btn_work_left').style.display = "none";
	document.getElementById('btn_work_right').style.display = "none";
	document.getElementById('delights_work').onclick = showWorkList;
	return void(0);
}

function showWorkList(){

	setHash('#works');

	document.getElementById('delights_work').onclick = function(){};
	document.getElementById('delights_work').onmouseover = function(){};
	document.getElementById('delights_work').onmouseout = function(){};
	document.getElementById('delights_work').style.backgroundColor  = '#464F4C';

	document.getElementById('btn_work').setAttribute('src', 'images/delights_work_a.gif');

	HideJones();
	HideLove();
	hideIntrotext();
	hideAccess();
	document.getElementById('content').innerHTML = "";

	var html_worklist = '';
	for ( i=0 ; i<WorkObjects.length ; i++ ){
		html_worklist += "<a href=\"#works;" + WorkObjects[i].id + "\" onclick=\"showWorkByID(" + WorkObjects[i].id + ");\">" + WorkObjects[i].title + "</a><br/>";
	}
	document.getElementById('delights_worklist').innerHTML = html_worklist;
	document.getElementById('btn_work_left').style.display = "none";
	document.getElementById('btn_work_right').style.display = "none";

	return void(0);
}

function showWorkByID(wid,imgid){
	HideJones();
	HideLove();
	hideIntrotext();
	hideAccess();
	document.getElementById('delights_worklist').innerHTML = "";
	document.getElementById('btn_work_left').style.display = "inline";
	document.getElementById('btn_work_right').style.display = "inline";
	showWork(wid,imgid);
	return void(0);
}
function showPreviousWork(){
	HideJones();
	HideLove();
	hideIntrotext();
	hideAccess();
	document.getElementById('delights_worklist').innerHTML = "";
	document.getElementById('btn_work_left').style.display = "inline";
	document.getElementById('btn_work_right').style.display = "inline";
	showWork( getPreviousWorkID(currentWork.id) );
	return void(0);
}
function showNextWork(){
	HideJones();
	HideLove();
	hideIntrotext();
	hideAccess();
	document.getElementById('delights_worklist').innerHTML = "";
	document.getElementById('btn_work_left').style.display = "inline";
	document.getElementById('btn_work_right').style.display = "inline";
	showWork( getNextWorkID(currentWork.id) );
	return void(0);
}

function showWork(id, imgid ){

	var imgid = parseInt(imgid);
	if ( ! isNaN(imgid) && imgid > 0 ){
		setHash( 'works;' + id + ';' + ( imgid + 1 ) );
	} else {
		setHash( 'works;' + id );
		imgid = 0
	}

	HideJones();
	HideLove();
	hideIntrotext();
	hideAccess();

	document.getElementById('delights_work').onclick = function(){};
	document.getElementById('delights_work').onmouseover = function(){};
	document.getElementById('delights_work').onmouseout = function(){ };
	document.getElementById('delights_work').style.backgroundColor  = '#464F4C';
	document.getElementById('btn_work').setAttribute('src', 'images/delights_work_a.gif');

	currentWork = getWorkByID( id );

	currentWorkPictureId = imgid;
	if ( prevpic ){
		currentWorkPictureId = currentWork.pictures.length -1 ;
		prevpic = false;
		setHash( 'works;' + id + ';' + currentWork.pictures.length );
	}
	var workHtml = "";
	workHtml += "<div class=\"picture\"><a id=\"content_picture\" href=\"javascript:showWorkPicture(+1);\" onfocus=\"blur();\"><img src=\"" + currentWork.pictures[currentWorkPictureId][0] + "\" alt=\"" + currentWork.pictures[currentWorkPictureId][1] + "\"/></a></div>\n";
	workHtml += "<div class=\"Info\">\n";
	if ( currentWork.pictures.length > 1 ){
		workHtml += "<div class=\"nav\"><a href=\"javascript:showWorkPicture(-1);\" onfocus=\"blur();\"><img id=\"content_navimg_left\" src=\"images/image_arrow_left.gif\" alt=\"previous image\"/></a><a id=\"content_navimg_right\" href=\"javascript:showWorkPicture(+1);\" onfocus=\"blur();\"><img src=\"images/image_arrow_right.gif\" alt=\"next image\"/></a> &nbsp; <span id=\"content_picturenbr\">" + (currentWorkPictureId+1) + "</span> / " + currentWork.pictures.length + "</div>\n";
	}
	workHtml += "<div class=\"title\">" + currentWork.title + "</div>\n";
	workHtml += "<div class=\"description\">" + currentWork.description + "</div>\n";
	workHtml += "<div class=\"legend\"><span id=\"content_legend\">" + currentWork.pictures[currentWorkPictureId][1] + "</span></div>\n";
	workHtml += "</div>\n";
	document.getElementById('content').innerHTML = workHtml;
	
	return void(0);
}

function showWorkPicture( w ){

	var newPictureId = currentWorkPictureId;

	if ( w > 0 ) {
		if ( ++newPictureId >= currentWork.pictures.length ){
			showNextWork();
			return void(0);
		}
	} else if ( w < 0 ){
		if ( --newPictureId < 0 ){
			prevpic = true;
			showPreviousWork();
			return void(0);
		}
	}

	currentWorkPictureId = newPictureId;
	
	setHash( 'works;' + currentWork.id + ';' + ( currentWorkPictureId + 1 ) );

	document.getElementById('content_picture').innerHTML = "<img src=\"" + currentWork.pictures[newPictureId][0] + "\" alt=\"" + currentWork.pictures[newPictureId][1] + "\" />";
	document.getElementById('content_picturenbr').innerHTML = (newPictureId+1);
	document.getElementById('content_legend').innerHTML = currentWork.pictures[newPictureId][1];
	return void(0);
}

function showWorkPictureByOffset( newPictureId ){
	currentWorkPictureId = newPictureId;
	setHash( 'works;' + currentWork.id + ';' + ( currentWorkPictureId + 1 ) );
	document.getElementById('content_picture').innerHTML = "<img src=\"" + currentWork.pictures[newPictureId][0] + "\" alt=\"" + currentWork.pictures[newPictureId][1] + "\" />";
	document.getElementById('content_picturenbr').innerHTML = (newPictureId+1);
	document.getElementById('content_legend').innerHTML = currentWork.pictures[newPictureId][1];
	return void(0);
}


function HideJones(){
	
	document.getElementById('delights_jones').onclick = showNextJones;

	document.getElementById('delights_jones').onmouseover = function(){ document.getElementById('delights_jones').style.backgroundColor  = '#FE8500'};
	document.getElementById('delights_jones').onmouseout = function(){  document.getElementById('delights_jones').style.backgroundColor  = '#C5D6CE'};
	document.getElementById('delights_jones').style.backgroundColor  = '#C5D6CE';

	document.getElementById('delights_joneslist').innerHTML = "";
	document.getElementById('btn_jones_left').style.display = "none";
	document.getElementById('btn_jones_right').style.display = "none";
}
function showJonesList(){

	setHash('#jones');

	document.getElementById('delights_work').onmouseover = function(){
		document.getElementById('delights_work').style.backgroundColor  = '#464F4C';
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work_l.gif');
	};
	document.getElementById('delights_work').onmouseout = function(){
		document.getElementById('delights_work').style.backgroundColor  = '#C5D6CE';
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');
	};
	document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');

	document.getElementById('delights_work').style.backgroundColor  = '#C5D6CE';

	HideWorks();
	HideLove();
	hideIntrotext();
	hideAccess();

	var html_jonelist = '';
	for ( i=0 ; i<JonesObjects.length ; i++ ){
		html_jonelist += "<a href=\"javascript:showJonesByID(" + JonesObjects[i].id + ");\">" + JonesObjects[i].title + "</a><br/>";
	}
	document.getElementById('delights_joneslist').innerHTML = html_jonelist;
	document.getElementById('btn_jones_left').style.display = "none";
	document.getElementById('btn_jones_right').style.display = "none";
	document.getElementById('content').innerHTML = "";
	return void(0);
}
function showJonesByID(wid){

	HideWorks();
	HideLove();
	hideIntrotext();
	hideAccess();

	showJones(wid);
	return void(0);
}
function showPreviousJones(){

	HideWorks();
	HideLove();
	hideIntrotext();
	hideAccess();

	if ( currentJones.id != undefined ) {
		showJones( getPreviousJonesID(currentJones.id) );
	} else {
		showJones( JonesObjects[JonesObjects.length-1].id );
	}
	return void(0);
}
function showNextJones(){

	HideWorks();
	HideLove();
	hideIntrotext();
	hideAccess();

	if ( currentJones.id != undefined ) {
		showJones( getNextJonesID(currentJones.id) );
	} else {
		showJones( JonesObjects[0].id );
	}
	return void(0);
}

function showJones(id){

	setHash('#jones;' + id );

	document.getElementById('delights_jones').onclick = function(){};

	document.getElementById('delights_work').onmouseover = function(){
		document.getElementById('delights_work').style.backgroundColor  = '#464F4C';
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work_l.gif');
	};
	document.getElementById('delights_work').onmouseout = function(){
		document.getElementById('delights_work').style.backgroundColor  = '#C5D6CE';
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work_l.gif');
	};
	document.getElementById('btn_work').setAttribute('src', 'images/delights_work_l.gif');

	document.getElementById('delights_work').style.backgroundColor  = '#C5D6CE';

	document.getElementById('delights_joneslist').innerHTML = "";
	document.getElementById('btn_jones_left').style.display = "inline";
	document.getElementById('btn_jones_right').style.display = "inline";
	
	document.getElementById('delights_jones').onmouseover = function(){ document.getElementById('delights_love').style.backgroundColor  = '#FE8500'};
	document.getElementById('delights_jones').onmouseout = function(){  document.getElementById('delights_love').style.backgroundColor  = '#C5D6CE'};
	document.getElementById('delights_jones').style.backgroundColor  = '#FE8500';
	
	HideWorks();
	HideLove();
	hideIntrotext();
	hideAccess();

	currentJones = getJonesByID( id );
	currentJonesPictureId = 0;

//	var jonesHtml = "<div class=\"picture\"><a id=\"content_picture\" href=\"javascript:showJonesPicture(+1);\" onfocus=\"blur();\"><img src=\"" + currentJones.pictures[0][0] + "\" alt=\"" + currentJones.pictures[0][1] + "\" /></a></div>\n";
	var jonesHtml = "<div class=\"picture\"><a id=\"content_picture\" href=\"javascript:showJonesPicture(+1);\" onfocus=\"blur();\"><img src=\"" + currentJones.pictures[0][0] + "\" alt=\"" + currentJones.pictures[0][1] + "\" /></a></div>\n";
	
/*
	jonesHtml += "<div class=\"Info\">\n";
	if ( currentJones.pictures.length > 1 ){
		jonesHtml += "	<div class=\"nav\"><a href=\"javascript:showJonesPicture(-1);\" onfocus=\"blur();\"><img id=\"content_navimg_left\" src=\"images/image_arrow_left.gif\" alt=\"previous image\"/></a><a id=\"content_navimg_right\" href=\"javascript:showJonesPicture(+1);\" onfocus=\"blur();\"><img src=\"images/image_arrow_right.gif\" alt=\"next image\"/></a> &nbsp; <span id=\"content_picturenbr\">1</span> / " + currentJones.pictures.length + "</div>\n";
	}
	jonesHtml += "	<div class=\"title\">" + currentJones.title + "</div>\n";
	jonesHtml += "	<div class=\"description\">" + currentJones.description + "</div>\n";
	jonesHtml += "	<div class=\"legend\"><span id=\"content_legend\">" + currentJones.pictures[0][1] + "</span></div>\n";
	jonesHtml += "</div>\n";
*/
	document.getElementById('content').innerHTML = jonesHtml;
	return void(0);
}

function showJonesPicture( w ){
	var newPictureId = currentJonesPictureId;
	if ( w > 0 ) {
		if ( ++newPictureId >= currentJones.pictures.length ){
			showNextJones();
			return void(0);
		}
	} else if ( w < 0 ){
		if ( --newPictureId < 0 ){
			prevpic = true;
			showPreviousJones();
			return void(0);
		}
	}
	currentJonesPictureId = newPictureId;
	//document.getElementById('content_picture').innerHTML = "<img src=\"" + currentJones.pictures[newPictureId][0] + "\" alt=\"" + currentJones.pictures[newPictureId][1] + "\" width=\"760\" height=\"532\" />";
	//document.getElementById('content_picturenbr').innerHTML = (newPictureId+1);
	//document.getElementById('content_legend').innerHTML = currentJones.pictures[newPictureId][1];
	return void(0);
}

function HideLove(){
	document.getElementById('delights_lovelist').innerHTML = "";
	document.getElementById('delights_love').onmouseover = function(){
		document.getElementById('delights_love').style.backgroundImage  = 'url(images/delights_love_h.gif)'
	};
	document.getElementById('delights_love').onmouseout = function(){
		document.getElementById('delights_love').style.backgroundImage  = 'url(images/delights_love.gif)'
	};
	document.getElementById('delights_love').style.backgroundImage  = 'url(images/delights_love.gif)';
}

function showLove(){
	
	setHash('#love');

	document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');
	document.getElementById('delights_work').style.backgroundColor  = '#464F4C';

	document.getElementById('delights_work').onmouseover = function(){
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work_l.gif');
	};
	document.getElementById('delights_work').onmouseout = function(){
		document.getElementById('btn_work').setAttribute('src', 'images/delights_work.gif');
	};

	document.getElementById('delights_love').onmouseover = function(){};
	document.getElementById('delights_love').onmouseout = function(){};
	document.getElementById('delights_love').style.backgroundImage  = 'url(images/delights_love_h.gif)';

	HideJones();
	HideWorks();
	hideIntrotext();
	hideAccess();

	var html_worklist = '';
	for ( i=0 ; i<LoveArray.length ; i++ ){
		html_worklist += "<a href=\"" + LoveArray[i][2] + "\" target=\"" + LoveArray[i][3] + "\">" + LoveArray[i][1] + "</a><br/>";
	}
	document.getElementById('delights_lovelist').innerHTML = html_worklist;
	document.getElementById('content').innerHTML = "";
}
