// Object declaration
// ******************
// Topic images
var topicImage= new Object ();
topicImage["topic1"]= "pics/cv.png";
topicImage["topic2"]= "pics/nippon.png";
topicImage["topic3"]= "pics/travel.png";
topicImage["topic4"]= "pics/liens.png";
topicImage["topic5"]= "pics/lexique.png";
topicImage["topic6"]= "pics/humour.png";

var topicImageOver= new Object ();
topicImageOver["topic1"]= "pics/cv_on.png";
topicImageOver["topic2"]= "pics/nippon_on.png";
topicImageOver["topic3"]= "pics/travel_on.png";
topicImageOver["topic4"]= "pics/liens_on.png";
topicImageOver["topic5"]= "pics/lexique_on.png";
topicImageOver["topic6"]= "pics/humour_on.png";

// Topic connection lines
var blankImage= "pics/hidden_dot.gif";
var topicLine= new Object ();
topicLine["topic1"]= "pics/topLineLeft.png";
topicLine["topic2"]= "pics/topLineCenter.png";
topicLine["topic3"]= "pics/topLineRight.png";
topicLine["topic4"]= "pics/bottomLineLeft.png";
topicLine["topic5"]= "pics/bottomLineCenter.png";
topicLine["topic6"]= "pics/bottomLineRight.png";

// Status topics
var statusTopics= new Object ();
statusTopics["topic1"]= 'My Curriculum Vitae';
statusTopics["topic2"]= 'Le Japon...';
statusTopics["topic3"]= 'Mes Voyages...';
statusTopics["topic4"]= 'Mes liens...';
statusTopics["topic5"]= 'Le Lexique...';
statusTopics["topic6"]= 'Humour...';

// Line target
var lineTarget= new Object();
lineTarget["topic1"]= 'topLine';
lineTarget["topic2"]= 'topLine';
lineTarget["topic3"]= 'topLine';
lineTarget["topic4"]= 'bottomLine';
lineTarget["topic5"]= 'bottomLine';
lineTarget["topic6"]= 'bottomLine';

// Topic description
var emptyDescription= null;
var topicDescription= new Object ();

// Initialize the document tree.
function init ()
{
  initDiv= document.getElementById("initContainer");

  // Get the topics from the hidden structure and set them on the right place!
  for (i = 1; i < 7; i++)
  {
    target= "topicDesc" + i;
    topicDescription["topic" + i]= document.getElementById(target);
    initDiv.removeChild(topicDescription["topic" + i]);
  }

  // The emtpy topic
  emptyDescription= document.getElementById("emptyTopic");
  initDiv.removeChild(emptyDescription);
} // END init ()

// Function called when the mouse cursor goes over the object.
//
// Parameters:
// - topic: The target topic.
function over (topic)
{
 // Topic Image
 img= document.getElementById(topic);
 img.setAttribute('src', topicImageOver[topic]);

 // Connection Line
 line= document.getElementById('topLine');
 line.setAttribute('src', blankImage);
 line= document.getElementById('bottomLine');
 line.setAttribute('src', blankImage);
 line= document.getElementById(lineTarget[topic]);
 line.setAttribute('src', topicLine[topic]);


 // The content text
 desc= document.getElementById("topicDesc");
 if (desc.hasChildNodes())
 {
   // Get old
   oldNode= desc.childNodes.item(0);

   // Make new
   newNode= topicDescription[topic];
  
   // Replace
   desc.appendChild(newNode);
   if (newNode != oldNode)
     desc.removeChild(oldNode);
 }

 // The alt description
 img.setAttribute('alt', statusTopics[topic]);

 // Status
 window.status= statusTopics[topic]; 

 // Valid return value
 return true;
} // END over ()

// Function called when the mouse cursor goes out of the object's focus
//
// Parameters:
// - topic: The target topic.
function out (topic)
{
 // Topic Image
 img= document.getElementById(topic);
 img.setAttribute('src', topicImage[topic]);

 // Connection Line
 //line= document.getElementById(lineTarget[topic]);
 //line.setAttribute('src', blankImage);


 // The content text
 desc= document.getElementById("topicDesc");
 if (desc.hasChildNodes())
 {
   // Get old
   oldNode= desc.childNodes.item(0);

   // Make new
   newNode= emptyDescription;
  
   // Replace
   //desc.appendChild(newNode);
   //desc.removeChild(oldNode);
 }

 // Status
 window.status= ''; 

 // Valid return value
 return true;
} // END out ()
