var currentIndex = 0;
   
function mouseOver(graphic)
{
 document.getElementById(graphic).src = "images/" + selectedTest(graphic,"_active_off.png") + "_on.png";
}
   
function mouseOut(graphic)
{
 document.getElementById(graphic).src = "images/" + selectedTest(graphic,"_active_on.png") + "_off.png";
}
  
function selectedTest(graphic, selectedstring)
{
 if (document.getElementById(graphic).src.substring(document.getElementById(graphic).src.length-selectedstring.length) == selectedstring)
 {
  return (graphic + "_active");
 } else {
  return graphic;
 }
}
   
function clearMenus()
{
 document.getElementById('menu_programs').style.display = "none";
 document.getElementById('menu_options').style.display = "none";

 return;
}

function showMenu(menu)
{
 clearMenus();
 document.getElementById('menu_' + menu).style.display = "block";
 document.getElementById('menu_' + menu).style.zIndex='10000';

 return;
}
   
   function load_section(section,id)
   {
       if (section == 'invitessent')
       {
           writeHelp(5);
       }
       if (section == 'backup')
       {
           if (id == 1)
           {
            writeHelp(6);
            } else {
                writeHelp(7);
            }
       }
       if (section == 'create')
       {
           writeHelp(8);
       }
       if (section == 'control')
       {
           if (id == 3)
           {
            writeHelp(10);
           } else {
               writeHelp(9);
           }
       }
       if (section == 'inviteuser')
       {
           writeHelp(11);
       }

     
    if (id > 1)
	{
	 var oneless = id - 1;
     if (document.getElementById(section + oneless + '_body').style.display == "block")
	 {
	  close_content(section,oneless);
	  
	  if (section == 'inviteuser')
	  {
	   document.getElementById('left_trustedusers_inviteduser').style.display = "block";
	   document.getElementById('left_mobimessages_messages').src = "images/left_mobimessages_messages_active_off.png";
	  }

	 }
	}
	
    if (section == 'viewuser')
	{
        writeHelp(12);
	 document.getElementById('left_trustedusers_inviteduser').src = "images/left_trustedusers_inviteduser_active_on.png";
	}
	
	if (section == 'messages')
	{
	 if (id == 0)
	 {
	  if (document.getElementById('left_trustedusers_inviteduser').style.display == "block")
      {
          writeHelp(4);
	   id = 2;
      }
	  
	  var teststring = "active_on.png";
	  if (document.getElementById('left_mobimessages_messages').src.substring(document.getElementById('left_mobimessages_messages').src.length-teststring.length) == teststring)
	  {
          writeHelp(3);
	   id = 1;
	  }
      
      if (id == 0)
      {
          writeHelp(2);
      }
	  
	 } else {
	  if (tickme("messages_unread_mark",0) == 1)
	  {
	   document.getElementById('left_mobimessages_messages').src = "images/left_mobimessages_messages_off.png";
	  } else {
	   id = 1;
	  }
	 }
	}
	
	if (section == 'mobiroom')
	{
        writeHelp(16);
	 document.getElementById('left_mobimanager_mobiroom_room').src = "images/left_mobimanager_mobiroom_room_active_on.png";
	}

	if (section == 'mobivault')
	{
        writeHelp(16);
	 document.getElementById('left_mobimanager_mobivault_vault').src = "images/left_mobimanager_mobivault_vault_active_on.png";
	}

	
	currentIndex++;

	document.getElementById(section + '_title').style.display = "block";
	document.getElementById(section + '_title').style.zIndex = currentIndex;
    document.getElementById(section + id + '_body').style.display = "block";
    document.getElementById(section + id + '_body').style.zIndex = currentIndex;
   }
   
   function close_section(section)
   {
   
	if (section == 'mobivault')
	{
	 document.getElementById('left_mobimanager_mobivault_vault').src = "images/left_mobimanager_mobivault_vault_off.png";
	}

	if (section == 'mobiroom')
	{
	 document.getElementById('left_mobimanager_mobiroom_room').src = "images/left_mobimanager_mobiroom_room_off.png";
	}
	
    if (section == 'messages')
	{
     if (document.getElementById(section + '0_body').style.display == "block")
 	 {
 	  close_content(section,0);
	 }
	 if (tickme("messages_unread_mark",0) == 1)
	 {
	  tickme("messages_unread_mark",1);
	 }
	}
	
    if (document.getElementById(section + '1_body').style.display == "block")
	{
	 close_content(section,1);
	}
	
	if (document.getElementById(section + '2_body').style.display == "block")
	{
	 close_content(section,2);
	}
	
	if (document.getElementById(section + '3_body').style.display == "block")
	{
	 close_content(section,3);
	}
	
   }
   
   function close_content(section,id)
   {
	currentIndex--;
	
	document.getElementById(section + id + '_body').style.display = "none";
	document.getElementById(section + id + '_body').style.zIndex = currentIndex;
	document.getElementById(section + '_title').style.display = "none";
	document.getElementById(section + '_title').style.zIndex = currentIndex;
	
	document.getElementById('left_trustedusers_inviteduser').src = "images/left_trustedusers_inviteduser_off.png";
   }
   
   function tickme(graphic,change)
   {
    var teststring="_ticked.png";
	 
	if (document.getElementById(graphic).src.substring(document.getElementById(graphic).src.length-teststring.length) == teststring)
	{
	 if (change == 1) 
	 {
	  document.getElementById(graphic).src = "images/content_messages_unread_unticked.png";
	 } else {
	  return 1;
	 }
	} else {
	 if (change == 1)
	 {
	  document.getElementById(graphic).src = "images/content_messages_unread_ticked.png";
     } else {
      return 0;
	 }
	}
   }
   
   function menuList(section)
   {
    if (document.getElementById('left_mobimanager_mobi' + section + '_' + section).style.display == "block")
	{
	 if (section == 'room')
	 {
	  document.getElementById('left_mobimanager_mobivault').style.top = "148px";
	  document.getElementById('left_mobimanager_mobivault_vault').style.top = "178px";
	 }
 	 document.getElementById('left_mobimanager_mobi' + section + '_' + section).style.display = "none";
	} else {
	
 	 if (section == 'room')
	 {
	  document.getElementById('left_mobimanager_mobivault').style.top = "178px";
	  document.getElementById('left_mobimanager_mobivault_vault').style.top = "208px";
	 }
 	 document.getElementById('left_mobimanager_mobi' + section + '_' + section).style.display = "block";
	}
   }

   function expand(side,section,page)
   {
    var teststring="_active_on.png";

	if (document.getElementById('content_mobi' + section + page + '_' + side + '_1').src.substring(document.getElementById('content_mobi' + section + page + '_' + side + '_1').src.length-teststring.length) == teststring)
	{
	 document.getElementById('content_mobi' + section + page + '_' + side + '_1').src = "images/content_mobi" + section + page + "_left_1_on.png";
	 document.getElementById('content_mobi' + section + page + '_' + side + '_2').style.display = "none";
     if (section == 'room')
	 {
	  document.getElementById('content_mobi' + section + page + '_' + side + '_3').style.display = "none";
	 }
	} else {
	 document.getElementById('content_mobi' + section + page + '_' + side + '_1').src = "images/content_mobi" + section + page + "_left_1_active_on.png";
	 document.getElementById('content_mobi' + section + page + '_' + side + '_2').style.display = "block";
     if (section == 'room')
	 {
	  document.getElementById('content_mobi' + section + page + '_' + side + '_3').style.display = "block";
	 }
	}
   }

   function showInfo(file,origin,destination)
   {
    var teststring="_active_off.png";
	
	if (file == 0)
	{
 	 if (document.getElementById('content_mobiroom1_right_1').src.substring(document.getElementById('content_mobiroom1_right_1').src.length-teststring.length) == teststring)
     {
	  file = 1;
	 } 
	 if (document.getElementById('content_mobivault1_right_1').src.substring(document.getElementById('content_mobivault1_right_1').src.length-teststring.length) == teststring)
     {
	  file = 1;
	 }
	 if (document.getElementById('content_mobiroom1_right_2').src.substring(document.getElementById('content_mobiroom1_right_2').src.length-teststring.length) == teststring)
     {
	  file = 2;
	 }

     if (file != 0)
 	 {
        writeHelp(16);
      destination = 'content_mobi' + origin + '1_right_' + file + '_selected_';

	  var x = 0;

	  for (i = 1; i <= 3; i++) 
      {
	   
	   if (document.getElementById(destination + i).style.display == "block")
	   {
        document.getElementById(destination + i).style.display = "none";
	    x = 1;
	   }

	  }

	  if (x == 0)
      {
          writeHelp(17);
	   document.getElementById(destination + 1).style.display = "block";
	  }
	 }
	} else { 	 
	 document.getElementById(origin).style.display = "none";
	 document.getElementById(destination).style.display = "block";
     writeHelp(16 + parseInt(destination.substring(destination.length-1)));
	}
   }
   
   function toggleSelection(graphic,index)
   {   
    var teststring="_active_on.png";
	 
	if (document.getElementById(graphic).src.substring(document.getElementById(graphic).src.length-teststring.length) == teststring)
	{
     document.getElementById(graphic).src = "images/" + graphic + "_on.png";
	} else {
	 document.getElementById(graphic).src = "images/" + graphic + "_active_on.png";
	 document.getElementById("content_mobiroom1_right_" + index).src = "images/content_mobiroom1_right_" + index + "_off.png";

	 for (i = 1; i <= 3; i++) 
     {
	  if (document.getElementById('content_mobiroom1_right_' + index + '_selected_' + i).style.display == "block")
	  {
	   document.getElementById('content_mobiroom1_right_' + index + '_selected_' + i).style.display = "none";
	   document.getElementById('content_mobiroom1_right_' + ((index == 1) ? 2 : 1) + '_selected_' + i).style.display = "block";
	  }
	 }
	 
	}
	
   }
   

   
function openHelp(id,override)
{
 if (override)
 {
    document.getElementById('help1').style.display = "block";
    document.getElementById('help1').style.zIndex = "1000000000";
    writeHelp(id);
 } else {
    if (document.getElementById(id).style.display == "block")
    {
        document.getElementById(id).style.display = "none";
    } else {
        document.getElementById(id).style.display = "block";
        document.getElementById(id).style.zIndex = "1000000000";
    }
 }
}

function writeHelp(section)
{
 var helpText = new Array("<p><b>Welcome to this interactive demonstration of the Mobiu Manager software.</b></p>"
    + "<p>This demonstration will show you the various sections of the Mobiu Manager software.</p>"
    + "<p>We believe that the Mobiu Manager should be intuitive and easy-to-use.  However if you just want to get going please choose from"
    + " one of the sections on the left hand side navigation.</p>"
    + "<p><b>Help:</b><br>Mobiu has all the necessary documentation already preloaded within the software so if forget how to perform"
    + " a certain action, don't worry, you won't find yourself rummaging through your house/office trying to find the User Guide.</p>",
// 1
    "<p><b>Help:</b></p><p>Mobiu has all the necessary documentation already preloaded within the software so if forget how to perform"
    + " a certain action, don't worry, you won't find yourself rummaging through your house/office trying to find the User Guide.<br><br>"
    + "To continue please select one of the sections on the left hand side navigation.</p>",
// 2    
    "<p><b>Messages:</b></p><p>This section allows you to accept, delete and read messages that have arrived on your Mobiu.</p>",
// 3
    "<p><b>Messages:</b></p><p>You have one unread message telling you that John Smith has accepted your invitation.<br><br>To mark "
    + "this as read please tick &quot;Mark As Read&quot;, the press on the &quot;Apply Changes&quot; button at the bottom of "
    + "the screen.</p>",
// 4
    "<p><b>Messages:</b></p><p>Here we can see that you have one read message telling you that John Smith has accepted your invitation.</p>",
// 5
    "<p><b>Invites Sent:</b></p><p>This section allows you to delete any invitations that are pending.</p>",
// 6
    "<p><b>Backup to MobiVault:</b></p><p>This section shows what happens when you insert a Mobiu into a PC that is hasn't seen before.<br><br>"
    + "Click &quot;Next&quot;</p>",
// 7
    "<p><b>Backup to MobiVault:</b></p><p>Now that we have created a MobiVault associated with this PC we can now choose what we want "
    + "to back up.<br><br>This can simply be either your &quot;Desktop&quot; or your &quot;My Documents&quot; however you may want to choose "
    + "a specific directory. To do this Click &quot;Show Advanced Settings&quot;</p>",
// 8
    "<p><b>Create New MobiRoom:</b></p><p>This section allows you to simply create a new MobiRoom that will allow you to share files and "
    + "document with other trusted users.<br><br>Click &quot;OK&quot;</p>",
// 9
    "<p><b>Control MobiRoom Access:</b></p><p>This section allows you to control access to existing MobiRoom's that you have created "
    + "with other trusted users.<br><br>Select &quot;My MobiRoom&quot;</p>",
// 10
    "<p><b>Control MobiRoom Access:</b></p><p>You can now simply &quot;Grant&quot; or &quot;Remove&quot; access to your trusted users "
    + "for &quot;My MobiRoom&quot;.</p>",
// 11
    "<p><b>Invite User:</b></p><p>This section allows you to easily invite another Mobiu User to become a trusted user.<br><br>"
    + "Click &quot;OK&quot;.</p>",
// 12
    "<p><b>View User:</b></p><p>This section allows you to easily view another trusted user's details.<br><br>"
    + "If you would like further information please contact us at the details displayed.</p>",
// 13
    "<p><b>This Computer:</b></p><p>This section allows you to easily view the files and folders on your own PC.<br><br>"
    + "This feature has been disabled for this demonstration.</p>",
// 14
    "<p><b>Downloaded Documents:</b></p><p>This section allows you to easily view the documents you have downloaded from any &quot;MobiVault&quot; "
    + "or &quot;MobiRoom&quot; and which your working copy is currently stored on your Mobiu Key.<br><br>"
    + "This feature has been disabled for this demonstration.</p>",
// 15
    "<p><b>My Mobiu Key:</b></p><p>This section allows you to easily view the files and folders currently stored on the your Mobiu Key.<br><br>"
    + "This feature has been disabled for this demonstration.</p>",
// 16
    "<p><b>MobiManager:</b></p><p>This section allows you to easily Copy, Create Directory's, Delete, Edit, Paste, Rename and View the "
    + "files and folders currently stored within this MobiRoom or MobiVault.<br><br>"
    + "Try selecting a folder and Click the Information button.</p>",
// 17
    "<p><b>MobiManager: File Properties</b></p><p>This information panel allows you to easily view the File or Folder's properties.<br><br>"
    + "Please Click either one of the other information tabs, or Click the Information button to close.</p>",
// 18
    "<p><b>MobiManager: History</b></p><p>This information panel allows you to easily see the history of the File or Folder you are examining.<br><br>"
    + "Please Click either one of the other information tabs, or Click the Information button to close.</p>",
// 19
    "<p><b>MobiManager: Versions</b></p><p>This information panel allows you to easily view previous versions of the File you are examining.<br><br>"
    + "Please Click either one of the other information tabs, or Click the Information button to close.</p>");
    
 document.getElementById('helpText').innerHTML = helpText[section];
}
   



// ***************************************************************************************************************************
// ***************************************************************************************************************************
// ***************************************************************************************************************************

//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************

// Determine browser and version.

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;


function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

// ***************************************************************************************************************************
// ***************************************************************************************************************************
// ***************************************************************************************************************************