var allmessages = new Object();

allmessages.OVERVIEW_1 = new Array();
allmessages.OVERVIEW_1.message = "Hello, my name is Rose.";
allmessages.OVERVIEW_1.layeroptions = new Array("","",0);

allmessages.OVERVIEW_2 = new Array();
allmessages.OVERVIEW_2.message = "I will help you through the process of designing your ring. To start, click on the design of your choice to use as an initial design. <break size='medium'/> You can switch me off at any time by clicking on me.";
allmessages.OVERVIEW_2.layeroptions = new Array("","",0);


allmessages.INTRO_1 = new Array();
allmessages.INTRO_1.message = "Hello, my name is Rose.";
allmessages.INTRO_1.layeroptions = new Array("","",0);

allmessages.INTRO_2 = new Array();
allmessages.INTRO_2.message = "I will help you through the process of designing your ring. If at any time you would like me to explain a particular option, click on the speaker symbol located next to the option name. <break size='medium'/> You can switch me off at any time by clicking on me.";
allmessages.INTRO_2.layeroptions = new Array("","",0);

allmessages.SETTING_COLLISION_1 = new Array();
allmessages.SETTING_COLLISION_1.message = "You have two gemstones that are too close together.";
allmessages.SETTING_COLLISION_1.layeroptions = new Array("","",0);

allmessages.SETTING_COLLISION_2 = new Array();
allmessages.SETTING_COLLISION_2.message = "Please move one or both of the gemstones until the cross disappears.";
allmessages.SETTING_COLLISION_2.layeroptions = new Array("","",0);

allmessages.SETTING_COLLISION_3 = new Array();
allmessages.SETTING_COLLISION_3.message = "<p>The red box area around the gemstones represents the area around the gemstone that is needed to set your gemstone.</p><p>If that box area overlaps the area needed for another gemstone, you will see the box turn red.</p>";
allmessages.SETTING_COLLISION_3.layeroptions = new Array("","",0);


allmessages.SETTING_INLAY_COLLISION_1 = new Array();
allmessages.SETTING_INLAY_COLLISION_1.message = "A gemstone cannot be placed over the top and bottom edges of the same in-lay stripe.";
allmessages.SETTING_INLAY_COLLISION_1.layeroptions = new Array("","",0);

allmessages.SETTING_INLAY_COLLISION_2 = new Array();
allmessages.SETTING_INLAY_COLLISION_2.message = "<p>Please either move the gemstone, change the gemstone size, increase the in-lay stripe widthe, or remove the in-lay stripe.</p><p>You can move the gemstone using your arrow keys on your keyboard or your mouse.</p>";
allmessages.SETTING_INLAY_COLLISION_2.layeroptions = new Array("","",0);


//<p>The box area around the gemstones represents the area around the gemstone that is needed to set your gemstone. So the actual gemstone image may not physically appear to overlap both edges, the extra area need to set your gemstone has overlapped both edges of the in-lay stripe. 

allmessages.SWITCH_OFF = new Array();
allmessages.SWITCH_OFF.message = "If you would like to switch me back on <break size='small'/> in the future, please click on me. I will now be silent.";
allmessages.SWITCH_OFF.layeroptions = new Array("","",0);

allmessages.SWITCH_ON = new Array();
allmessages.SWITCH_ON.message = "I am now switched on. Thank you.";
allmessages.SWITCH_ON.layeroptions = new Array("","",0);

allmessages.INLAY_OFFSET_REDUCED = new Array();
allmessages.INLAY_OFFSET_REDUCED.message = "I have moved this in-lay stripe because it overlapped another in-lay stripe.";
allmessages.INLAY_OFFSET_REDUCED.layeroptions = new Array("","",0);

allmessages.INLAY_WIDTH_REDUCED = new Array();
allmessages.INLAY_WIDTH_REDUCED.message = "I have reduced the widthe of this active in-lay stripe because it overlapped another in-lay stripe. ";
allmessages.INLAY_WIDTH_REDUCED.layeroptions = new Array("","",0);


allmessages.RING_WIDTH_INCREASED = new Array();
allmessages.RING_WIDTH_INCREASED.message = "<p>I have increased the widthe of your ring to allow enough widthe to include your selected inlay stripe. If you prefer the previous widthe, please select your ring widthe again and choose a narrower in-lay stripe.</p><p>If you prefer the previous ring widthe, please select your widthe again and choose a narrower in-lay stripe.</p>";
allmessages.RING_WIDTH_INCREASED.layeroptions = new Array("","",0);



/***********************************************
PLAIN MESSAGES
*************************************************/

allmessages.TITANIUM_COLOR_1 = new Array();
allmessages.TITANIUM_COLOR_1.message = "<p>The titanium color option allows you to choose the color for your tititanium ring. </p>";
allmessages.TITANIUM_COLOR_1.layeroptions = new Array("","",0);

allmessages.TITANIUM_COLOR_2 = new Array();
allmessages.TITANIUM_COLOR_2.message = "<p>You can choose a natural color,<break size='medium'/> blue,<break size='medium'/>, purple,<break size='medium'/> sun-berst <break size='medium'/> or blu-moone color. <break size='small'/> </p> <p> Click on the color <break size='small'/> that you would like.</p>";
allmessages.TITANIUM_COLOR_2.layeroptions = new Array("","",0);

allmessages.TITANIUM_COLOR_3 = new Array();
allmessages.TITANIUM_COLOR_3.message = "<p>The titanium color is achieved through a natural oxidization process. </p> <p>You can see more information about the durability of the titanium colors in the help section. <break size='small'/>I have opened the titanium color information for you in the help section located on the right</p>";
allmessages.TITANIUM_COLOR_3.layeroptions = new Array("","",0);

allmessages.TEXTURE_1 = new Array();
allmessages.TEXTURE_1.message = "<p>Use the texture option to choose the texture for the outside surface of your ring. <break size='small'/> You can choose a polished texture, or a light, <break size='small'/> mead-ium <break size='small'/> or heavy texture.</p>";
allmessages.TEXTURE_1.layeroptions = new Array("","",0);

allmessages.TEXTURE_2 = new Array();
allmessages.TEXTURE_2.message = "<p>The polished finish has a smooth shiny surface.<break size='small'/> </p><p>The light, medium and heavy textures a satin finished texture in the three grades of courseness. </p>";
allmessages.TEXTURE_2.layeroptions = new Array("","",0);

allmessages.TEXTURE_3 = new Array();
allmessages.TEXTURE_3.message = "<p>Move your mouse over the texture options to see the names of the textures. Then click on the texture that you would like.</p>";
allmessages.TEXTURE_3.layeroptions = new Array("","",0);



allmessages.RING_SHAPE_1 = new Array();
allmessages.RING_SHAPE_1.message = "<p>The ring shayp option allows you to choose the shayp of your ring. </p>";
allmessages.RING_SHAPE_1.layeroptions = new Array("","",0);

allmessages.RING_SHAPE_2 = new Array();
allmessages.RING_SHAPE_2.message = "<p>You can choose a flat shayp, <break size='medium'/> or a soft rounded shayp, <break size='medium'/> or a heavily rounded shayp.</p><p>Move your mouse over the shayp options to see the names of the shayps. Then click on the shayp that you would like.</p>";
allmessages.RING_SHAPE_2.layeroptions = new Array("","",0);

allmessages.RING_WIDTH_1 = new Array();
allmessages.RING_WIDTH_1.message = "<p>The ring widthe option refers to the total widthe of your ring.</p> ";
allmessages.RING_WIDTH_1.layeroptions = new Array("","",0);

allmessages.RING_WIDTH_2 = new Array();
allmessages.RING_WIDTH_2.message = "<p>It does not refer to the internal diametere.<break size='small'/> </p><p> The widthe is measured in milimeters. <break size='small'/> The minimum widthe is three milimeters. The maximum widthe is twelve milimeters.</p>";
allmessages.RING_WIDTH_2.layeroptions = new Array("","",0);

allmessages.RING_WIDTH_3 = new Array();
allmessages.RING_WIDTH_3.message = "<p>You can choose the widthe by <prosody rate='medium'>clicking</prosody> on the up or down buttons, or, by selecting the widthe from the drop down menu.</p>";
allmessages.RING_WIDTH_3.layeroptions = new Array("","",0);



allmessages.FINGER_SIZE_1 = new Array();
allmessages.FINGER_SIZE_1.message = "<p>The finger size option refers to the internal size of the ring.</p>";
allmessages.FINGER_SIZE_1.layeroptions = new Array("","",0);

allmessages.FINGER_SIZE_2 = new Array();
allmessages.FINGER_SIZE_2.message = "<p>The finger size is measured on a finger size scale. It is not the milimeter diametere or circumference. </p>";
allmessages.FINGER_SIZE_2.layeroptions = new Array("","",0);

allmessages.FINGER_SIZE_3 = new Array();
allmessages.FINGER_SIZE_3.message = "<p>If you are from the United States, or Canada <break size='small'/>you should see the United States numericle finger size scale from sizes 4 to 15. </p><p>If you are from Australia, <break size='small'/>the United Kingdom <break size='small'/>or New Zealand you should see the alphabetical finger size scale from sizes H to z plus.</p>";
allmessages.FINGER_SIZE_3.layeroptions = new Array("","",0);


allmessages.FINGER_SIZE_4 = new Array();
allmessages.FINGER_SIZE_4.message = "<p>If you are from Europe <break size='small'/> you should see the numericle finger size scale.</p>";
allmessages.FINGER_SIZE_4.layeroptions = new Array("","",0);


allmessages.FINGER_SIZE_5 = new Array();
allmessages.FINGER_SIZE_5.message = "<p>We suggest you have your finger size <break size='small'/>measured by a local jeweller <break size='small'/>to get an accurait measurement</p>";
allmessages.FINGER_SIZE_5.layeroptions = new Array("","",0);



allmessages.TOP_INLAY_ACTIVE_1 = new Array();
allmessages.TOP_INLAY_ACTIVE_1.message = "<p>You are now in the top in-lay section.</p> ";
allmessages.TOP_INLAY_ACTIVE_1.layeroptions = new Array("","",0);

allmessages.TOP_INLAY_ACTIVE_2 = new Array();
allmessages.TOP_INLAY_ACTIVE_2.message = "<p>To add a top-inlay to your ring, click on the red tick. <break size='medium'/>To remove the top-inlay, click on the red cross. </p><p>To add a middle or a bottom-inlay click on the middle, or bottom-inlay section</p>";
allmessages.TOP_INLAY_ACTIVE_2.layeroptions = new Array("","",0);

allmessages.TOP_INLAY_WIDTH_1 = new Array();
allmessages.TOP_INLAY_WIDTH_1.message = "<p>Use the in-lay widthe option to choose the widthe of your top in-lay stripe. </p> ";
allmessages.TOP_INLAY_WIDTH_1.layeroptions = new Array("","",0);


allmessages.TOP_INLAY_WIDTH_2 = new Array();
allmessages.TOP_INLAY_WIDTH_2.message = "<p>The in-lay widthe refers to the widthe of the in-lay stripe not the total ring widthe. <break size='medium'/></p><p>You can change the widthe <break size='small'/>or <break size='small'/>leave the default widthe.</p>";
allmessages.TOP_INLAY_WIDTH_2.layeroptions = new Array("","",0);

allmessages.TOP_INLAY_DISTANCE_FROM_EDGE_1 = new Array();
allmessages.TOP_INLAY_DISTANCE_FROM_EDGE_1.message = "<p>Use the distance from top edge option to position your top in-lay stripe.</p> ";
allmessages.TOP_INLAY_DISTANCE_FROM_EDGE_1.layeroptions = new Array("","",0);

allmessages.TOP_INLAY_DISTANCE_FROM_EDGE_2 = new Array();
allmessages.TOP_INLAY_DISTANCE_FROM_EDGE_2.message = "<p>This option means the distance between the top edge of the ring, and, the top edge of the in-lay stripe.</p>";
allmessages.TOP_INLAY_DISTANCE_FROM_EDGE_2.layeroptions = new Array("","",0);

allmessages.INLAY_METAL_1 = new Array();
allmessages.INLAY_METAL_1.message = "<p>You can choose the metal type for your in-lay stripe.</p>";
allmessages.INLAY_METAL_1.layeroptions = new Array("","",0);

allmessages.INLAY_METAL_2 = new Array();
allmessages.INLAY_METAL_2.message = "<p>You can choose nine carrot yellow gold,<break size='small'/> 18 carrot yellow gold,<break size='medium'/> 9 carrot white gold,<break size='medium'/> 18 carrot white gold,<break size='medium'/> 9 carrot rose gold,<break size='medium'/> 18 carrot rose gold,<break size='medium'/> silver or platinum.</p>";
allmessages.INLAY_METAL_2.layeroptions = new Array("","",0);

allmessages.INLAY_METAL_3 = new Array();
allmessages.INLAY_METAL_3.message = "<p>You do not need to use the same metal for all inlay stripes. </p><p>You can have one inlay stripe in one metal, and another inlay stripe in a different metal.</p>";
allmessages.INLAY_METAL_3.layeroptions = new Array("","",0);


allmessages.MIDDLE_INLAY_ACTIVE_1 = new Array();
allmessages.MIDDLE_INLAY_ACTIVE_1.message = "<p>You are now in the middle inlay section. </p>";
allmessages.MIDDLE_INLAY_ACTIVE_1.layeroptions = new Array("","",0);

allmessages.MIDDLE_INLAY_ACTIVE_2 = new Array();
allmessages.MIDDLE_INLAY_ACTIVE_2.message = "<p>To add a middle inlay to your ring click on the red tick. <break size='medium'/></p><p>To remove the middle inlay click on the red cross.</p>";
allmessages.MIDDLE_INLAY_ACTIVE_2.layeroptions = new Array("","",0);

allmessages.BOTTOM_INLAY_ACTIVE_1 = new Array();
allmessages.BOTTOM_INLAY_ACTIVE_1.message = "<p>You are now in the bottom inlay section. </p>";
allmessages.BOTTOM_INLAY_ACTIVE_1.layeroptions = new Array("","",0);

allmessages.BOTTOM_INLAY_ACTIVE_2 = new Array();
allmessages.BOTTOM_INLAY_ACTIVE_2.message = "<p>To add a bottom inlay to your ring, click on the red tick. </p><p>To remove the bottom inlay click on the red cross.</p>";
allmessages.BOTTOM_INLAY_ACTIVE_2.layeroptions = new Array("","",0);

allmessages.MIDDLE_INLAY_WIDTH_1 = new Array();
allmessages.MIDDLE_INLAY_WIDTH_1.message = "<p>Use the inlay widthe option to choose the widthe of your middle inlay stripe. </p>";
allmessages.MIDDLE_INLAY_WIDTH_1.layeroptions = new Array("","",0);

allmessages.MIDDLE_INLAY_WIDTH_2 = new Array();
allmessages.MIDDLE_INLAY_WIDTH_2.message = "<p>The in-lay widthe refers to the widthe of the in-lay stripe, not the total ring widthe. <break size='medium'/></p><p>You can change the widthe or <break size='small'/>leave the default widthe.</p>";
allmessages.MIDDLE_INLAY_WIDTH_2.layeroptions = new Array("","",0);

allmessages.BOTTOM_INLAY_WIDTH_1 = new Array();
allmessages.BOTTOM_INLAY_WIDTH_1.message = "<p>Use the in-lay widthe option to choose the widthe of your bottom in-lay stripe. </p>";
allmessages.BOTTOM_INLAY_WIDTH_1.layeroptions = new Array("","",0);

allmessages.BOTTOM_INLAY_WIDTH_2 = new Array();
allmessages.BOTTOM_INLAY_WIDTH_2.message = "<p>The in-lay widthe refers to the widthe of the in-lay stripe, not the total ring widthe. <break size='medium'/></p><p>You can change the widthe or leave the default widthe.</p>";
allmessages.BOTTOM_INLAY_WIDTH_2.layeroptions = new Array("","",0);

allmessages.BOTTOM_INLAY_DISTANCE_FROM_EDGE_1 = new Array();
allmessages.BOTTOM_INLAY_DISTANCE_FROM_EDGE_1.message = "<p>Use the distance from bottom edge option to position your bottom in-lay stripe. </p> ";
allmessages.BOTTOM_INLAY_DISTANCE_FROM_EDGE_1.layeroptions = new Array("","",0);

allmessages.BOTTOM_INLAY_DISTANCE_FROM_EDGE_2 = new Array();
allmessages.BOTTOM_INLAY_DISTANCE_FROM_EDGE_2.message = "<p>This option means the distance between the bottom edge of the ring, and, the bottom edge of the in-lay stripe</p>";
allmessages.BOTTOM_INLAY_DISTANCE_FROM_EDGE_2.layeroptions = new Array("","",0);

allmessages.GEMSTONE_ACTIVE_1 = new Array();
allmessages.GEMSTONE_ACTIVE_1.message = "<p>A gem-stone has been added to your ring.</p> ";
allmessages.GEMSTONE_ACTIVE_1.layeroptions = new Array("","",0);

allmessages.GEMSTONE_ACTIVE_2 = new Array();
allmessages.GEMSTONE_ACTIVE_2.message = "<p>To remove the active gem-stone click on the red cross.</p><p>The active gem-stone is displayed inside the white box.</p> <p>Use your mouse or arrow keys on your keyboard to move your gem-stone</p>";
allmessages.GEMSTONE_ACTIVE_2.layeroptions = new Array("","",0);

allmessages.GEMSTONE_TYPE_1 = new Array();
allmessages.GEMSTONE_TYPE_1.message = "<p> You can choose from eight gem-stone types. </p>";
allmessages.GEMSTONE_TYPE_1.layeroptions = new Array("","",0);

allmessages.GEMSTONE_TYPE_2 = new Array();
allmessages.GEMSTONE_TYPE_2.message = "<p>Move your mouse over each option, to see the name of that gemstone. <break size='medium'/></p><p>You can choose white-diamond,<break size='small'/> black-diamond,<break size='small'/> cognac diamond,<break size='small'/> red-ruby,<break size='small'/> pink-safire,<break size='small'/> yellow-safire,<break size='small'/> black-safire or blue-safire.</p>";
allmessages.GEMSTONE_TYPE_2.layeroptions = new Array("","",0);

allmessages.GEMSTONE_TYPE_3 = new Array();
allmessages.GEMSTONE_TYPE_3.message = "<p>You can add different gem-stones to your ring. For example, <break size='small'/>you can have one white-diamond, and one pink-safire.</p>";
allmessages.GEMSTONE_TYPE_3.layeroptions = new Array("","",0);

allmessages.GEMSTONE_SETTING_1 = new Array();
allmessages.GEMSTONE_SETTING_1.message = "<p>You can choose how your gem-stone will be set in your ring. </p> ";
allmessages.GEMSTONE_SETTING_1.layeroptions = new Array("","",0);

allmessages.GEMSTONE_SETTING_2 = new Array();
allmessages.GEMSTONE_SETTING_2.message = "<p>You can choose a hammer setting, or, a grain setting.</p>  <p> Both setting types will set your gem-stone in the ring with the top of the gem-stone at the same height as the top of the ring. </p> ";
allmessages.GEMSTONE_SETTING_2.layeroptions = new Array("","",0);

allmessages.GEMSTONE_SETTING_3 = new Array();
allmessages.GEMSTONE_SETTING_3.message = "<p>The difference between a hammer setting and a grain setting is four very small prongs are used on a grain set gem-stone. </p> <p>A hammer setting does not use visible prongs</p>";
allmessages.GEMSTONE_SETTING_3.layeroptions = new Array("","",0);

allmessages.GEMSTONE_SETTING_4 = new Array();
allmessages.GEMSTONE_SETTING_4.message = "<p>The hammer setting has a round shaped indentation in the metal around the gemstone.</p> <p>There is a square shaped indentation in the metal around the edges of a grain set gemstone. <break size='medium'/></p>. <p>The grain setting can make the gemstone look more square shaped.</p> ";
allmessages.GEMSTONE_SETTING_4.layeroptions = new Array("","",0);

//<p><break size=’small’/>Choose a hammer setting if you want your gem-stone to appear with-out any visible prongs.</p>";


allmessages.GEMSTONE_SIZE_1 = new Array();
allmessages.GEMSTONE_SIZE_1.message = "<p>The gemstone size option allows you to choose the size of your gemstone.</p>";
allmessages.GEMSTONE_SIZE_1.layeroptions = new Array("","",0);

allmessages.GEMSTONE_SIZE_2 = new Array();
allmessages.GEMSTONE_SIZE_2.message = "<p>The size of the gemstones is measured in a jewellery measurement called <prosody rate='slow'>points</prosody>. <break size='medium'/>You may be familiar with the jewellery term carats. <break size='small'/>Carats, is also used to measure the size of gemstones. <break size='small'/>There are 100 points to one carat. <break size='small'/>That means that a 5 point gemstone, is zero point zero five carrats.</p>";
allmessages.GEMSTONE_SIZE_2.layeroptions = new Array("","",0);

allmessages.GEMSTONE_SIZE_3 = new Array();
allmessages.GEMSTONE_SIZE_3.message = "<p>The milimeter size of the gemstones ranges from a one point gemstone that is 1 point 4 milimeters to a five point gemstone that is two point four milimeters. <break size='medium'/>Five points is the largest gemstone size available in these rings.</p> ";
allmessages.GEMSTONE_SIZE_3.layeroptions = new Array("","",0);


allmessages.GEMSTONE_POSITION_1 = new Array();
allmessages.GEMSTONE_POSITION_1.message = "<p>Use your mouse <break size='small'/>or the arrow keys on your keyboard to move the active gem-stone. <break size='medium'/></p>";
allmessages.GEMSTONE_POSITION_1.layeroptions = new Array("","",0);

allmessages.GEMSTONE_POSITION_2 = new Array();
allmessages.GEMSTONE_POSITION_2.message = "<p>The active gemstone is the gemstone with the white box.</p><p>When positioning your gem-stone, the entire area in the white box is needed to set that gem-stone. </p>";
allmessages.GEMSTONE_POSITION_2.layeroptions = new Array("","",0);

allmessages.GEMSTONE_POSITION_3 = new Array();
allmessages.GEMSTONE_POSITION_3.message = "<p>Make sure that the white box does not overlap another gemstone area <break size='small'/> or overlap both edges of the one in-lay stripe.</p>.<p><break size='medium'/>It is okay if the white box overlaps different inlays, for example, <break size='small'/> it is okay if the white box overlaps the top edge of the middle inlay, and<break size='small'/> the bottom edge of the top inlay</p>";
allmessages.GEMSTONE_POSITION_3.layeroptions = new Array("","",0);

allmessages.GEMSTONE_POSITION_4 = new Array();
allmessages.GEMSTONE_POSITION_4.message = "<p>You can also use the position guide helpers. <break size='small'/> To use the position helpers, click on the gemstone that you want to position, then click on the position helper. The position guides are absolute center, horizontal center and vertical center. </p>";
allmessages.GEMSTONE_POSITION_4.layeroptions = new Array("","",0);

var vhost_toggle;

if (!getCookie("vhosttoggle")) { 
   registerCookie("vhosttoggle","1");
   vhost_toggle = true;
} else {
   var vhost_cookie = getCookie("vhosttoggle");
   if (vhost_cookie == "1") {
      vhost_toggle = true;
   } else {
      vhost_toggle = false;
   }
}

/* ###########################################################

   sayMessage

 * ###########################################################
 
 message        - The name of the message to say
 layerOptions   - Array("layer name", "position", offset)
                  where the position is either left, right, top, bottom
                  offset is the number of pixels to place the object away from the layer

*/

var previousIndex = '';

function sayMessage() {

   if (!vhost_toggle) return;

   var messageText, messageIndex, layerName, position, offset;
   var argv = sayMessage.arguments;

   messageIndex = argv[0];
  
   if (messageIndex == previousIndex) { return; }
   
   // Dont set the previous index on _2 _3 _4 and _5 messages
   if ((messageIndex.substr(messageIndex.length-2,messageIndex.length) == "_2") || 
       (messageIndex.substr(messageIndex.length-2,messageIndex.length) == "_3") ||
       (messageIndex.substr(messageIndex.length-2,messageIndex.length) == "_4") ||
       (messageIndex.substr(messageIndex.length-2,messageIndex.length) == "_5") ||
       (messageIndex.substr(messageIndex.length-2,messageIndex.length) == "_6") ||
       (messageIndex.substr(messageIndex.length-2,messageIndex.length) == "_7")
       ) {
      // dont do anything
   } else {
      previousIndex = messageIndex;
   }

   // If the passed in option is NOT an index into the allmessages array,
   // then we assume that we want to say the actual text passed

   if (typeof allmessages[messageIndex] == "undefined") {
      
      messageText = messageIndex;
      
   } else {

      // Ensure that we have this message and everything we need
      if ((typeof allmessages[messageIndex] == "undefined") || 
           typeof allmessages[messageIndex]["message"] == "undefined" ||
           typeof allmessages[messageIndex]["layeroptions"][0] == "undefined" ||
           typeof allmessages[messageIndex]["layeroptions"][1] == "undefined" ||
           typeof allmessages[messageIndex]["layeroptions"][2] == "undefined"
           ) {
         return;
      }
      // Grab the message text and other positioning options
      messageText = allmessages[messageIndex]["message"];
      layerName   = allmessages[messageIndex]["layeroptions"][0];
      position    = allmessages[messageIndex]["layeroptions"][1];
      offset      = allmessages[messageIndex]["layeroptions"][2];
   }
   
   // Here we will override any of the options with those passed in
   
   if (argv.length >= 2) {
      var layerOptions = argv[1];
      
      layerName = layerOptions[0];
      position  = layerOptions[1];
      offset    = layerOptions[2];
   }

   // Move her into the correct position if we have a layer and position
   if (layerName && position) {
      sendChickTo(layerName,position,offset);
   }
   // Say the message
   var fullMessage = "<prosody rate='-18%'>" + messageText + "</prosody>";
   sayText(fullMessage,1,1,2);
}

function loadMessage() {

   if (!vhost_toggle) return;

   var messageText, messageIndex;
   var argv = loadMessage.arguments;

   messageIndex = argv[0];

   if (typeof allmessages[messageIndex] == "undefined") {
      
      messageText = messageIndex;
      
   } else {


      // Ensure that we have this message and everything we need
      if ((typeof allmessages[messageIndex] == "undefined") || 
           typeof allmessages[messageIndex]["message"] == "undefined"
           ) {
         return;
      }
      // Grab the message text and other positioning options
      messageText = allmessages[messageIndex]["message"];

   }
      
   // Load the message
   var fullMessage = "<prosody rate='-18%'>" + messageText + "</prosody>";
   loadText(fullMessage,1,1,2);
}


function vh_talkEnded() {
   if ((typeof previousScene != "undefined") && 
       (typeof previousScene.postaction != "undefined") &&
       (previousScene.postaction != "")
       ) {
      eval(previousScene.postaction);
      previousScene = '';
   }

   var scene = remainingScenes.shift();
   if (scene) {
      previousScene = scene;
      eval(scene.preaction);
      sayMessage(scene.message,scene.layeroptions);
      // Load up the next message if there is one
      if (remainingScenes.length > 0) {
         loadMessage(remainingScenes[0].message);
      }
      
   } else {
      setTimeout("sendChickHome()",1000);
   }
   
}


function toggleVhost() {
   
   var fullMessage;
   
   // Switch her OFF
   if (vhost_toggle) {
      stopSpeech();
      sayMessage("SWITCH_OFF");
      vhost_toggle = false;
      registerCookie("vhosttoggle","0");
      sendChickHome();
   } else { // Switch her ON
      vhost_toggle = true;
      registerCookie("vhosttoggle","1");
      stopSpeech();
      sayMessage("SWITCH_ON");
   }
      
}


var remainingScenes = new Array();
var previousScene;

var allscenes = new Object();

allscenes.BASE   = new Array();


allscenes.BASE[0] = new Array();
allscenes.BASE[0].message      = "We are now the base options section.";
allscenes.BASE[0].preaction    = "alert('pre action');opentab('options-base');openinfotab('help-generalhelp');scroll('help_base_options');";
allscenes.BASE[0].postaction   = "alert('post action');";
allscenes.BASE[0].layeroptions = new Array("","",0);

allscenes.BASE[1] = new Array();
allscenes.BASE[1].message      = "We have now switched to the in-lays section.";
allscenes.BASE[1].preaction    = "alert('pre action 2');opentab('options-topinlay');openinfotab('help-generalhelp');scroll('help_inlays');";
allscenes.BASE[1].postaction   = "alert('post action 2');";
allscenes.BASE[1].layeroptions = new Array("","",0);


function startScene(sceneName) {
   if (typeof allscenes[sceneName] == "undefined") return;

   for (sceneNumber in allscenes[sceneName]) {
      remainingScenes.push(allscenes[sceneName][sceneNumber]);
   }

   scene = remainingScenes.shift();
   previousScene = scene;
   eval(scene.preaction);
   sayMessage(scene.message,scene.layeroptions);

}

function promptMessage() {
   var message = prompt("Rose to say:","");
   if (message != null) {
      sayMessage(message);
   }   
}

