  var navPath = "";
  var section = "";
  var lastCalled = "";
  var lastClientCount = 1;
 
  function setup(menu, path)
  {
    navPath = path; //alert ("this is working");
    section = menu;
  }

  function rotateImage (baseName)
  {
    if (lastClientCount <= 2)
    {
      document.images['clientImages'].src = navPath+"images/"+baseName+"_0"+lastClientCount+".gif";
      lastClientCount++;
    } else {
      lastClientCount = 1;
    }
    
    setTimeout("rotateImage('"+baseName+"')",4000);
  }	 
  
  function show(menu)
  {
	 
   showSubMenu(menu + "Tab");
   switch (menu)
   {
    case "home":      
      if (!section.match("homeTab"))
        document.images['homeTab'].src = navPath+"images/homeTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("homeTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "homeTab";
    break;
    case "about": // About
      if (!section.match("aboutTab"))
        document.images['aboutTab'].src = navPath+"images/aboutTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("aboutTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "aboutTab";
    break;
    case "news":
      if (!section.match("newsTab"))
        document.images['newsTab'].src = navPath+"images/newsTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("newsTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "newsTab";
    break;
    case "software":
      if (!section.match("softwareTab"))
        document.images['softwareTab'].src = navPath+"images/softwareTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("softwareTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "softwareTab";
    break;
    case "products": // Products     
      if (!section.match("productsTab"))
        document.images['productsTab'].src = navPath+"images/productsTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("productsTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "productsTab";
    break;
    case "applications": //Your Applications      
      if (!section.match("applicationsTab"))
       document.images['applicationsTab'].src = navPath+"images/applicationsTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("applicationsTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "applicationsTab";      
    break;
    case "service": // Service and Support    
      if (!section.match("serviceTab"))
        document.images['serviceTab'].src = navPath+"images/serviceTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("serviceTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "serviceTab";
    break;
    case "contact":
      if (!section.match("contactTab"))
        document.images['contactTab'].src = navPath+"images/contactTab_ov.gif";
      
      if (lastCalled) {
        if (!lastCalled.match("contactTab")) {
          if (!section.match(lastCalled))
            document.images[lastCalled].src = navPath+"images/"+lastCalled+".gif";    
        }
      }
      
      lastCalled = "contactTab";
    break;
    default:
      lastCalled = "";
    break;
   }  
  }  
  
  function hide(menu)
  {
	 
   if (section != lastCalled) {
	 			// Return the lastCalled tab to normal
			  tab = menu + "Tab";
        document.images[tab].src = navPath+"images/"+tab+".gif";
				
				// Show the subMenu for the current tab
				showSubMenu(section);
			}		
	}
	
  function showSubMenu(menu)
  {
   switch (menu)
   {
    case "homeTab":
      document.getElementById('subMenu').innerHTML = "<div class=\"homeNav\">&nbsp;</div>";
    break;
    case "aboutTab": //About
      document.getElementById('subMenu').innerHTML = "<div class=\"aboutNav\"><a href=\""+navPath+"about/corporate.html\" target=\"_top\">Corporate Profiles</a>"
            + "<a href=\""+navPath+"about/careers.html\" target=\"_top\">Careers</a>"
            + "<a href=\""+navPath+"contact.html\" target=\"_top\">Contact</a></div>";
    break;
    case "newsTab":
      document.getElementById('subMenu').innerHTML = "<div class=\"newsNav\">&nbsp;</div>";
    break;
    case "softwareTab":
      document.getElementById('subMenu').innerHTML = "<div class=\"softwareNav\">&nbsp;</div>";
    break;
    case "productsTab": // Products
      document.getElementById('subMenu').innerHTML = "<div class=\"productsNav\"><a href=\""+navPath+"products/inspectionSystems.html\" target=\"_top\">Inspection Systems</a>"
            + "<a href=\""+navPath+"products/automaticLaneBal.html\" target=\"_top\">Automatic Lane Balancing</a>"
			      + "<a href=\""+navPath+"products/systemOptions.html\" target=\"_top\">System Options</a></div>";
    break;
    case "applicationsTab": //Your Applications
//      document.getElementById('subMenu').innerHTML = "<div class=\"applicationsNav\"><a href=\""+navPath+"applications/training.html\" target=\"_top\">Training</a>";
    break;
    case "serviceTab": // Service and Support
      document.getElementById('subMenu').innerHTML = "<div class=\"serviceNav\"><a href=\""+navPath+"services/supportServices.html\" target=\"_top\">Support Services</a>"
            + "<a href=\""+navPath+"services/training.html\" target=\"_top\">Training</a></div>";
    break;
    default:
      document.getElementById('subMenu').innerHTML = "&nbsp;";
    break;
   }
//    document.getElementById('subMenu').innerHTML = "<div class=\"serviceNav\"><a href=\""+navPath+"services/supportServices.html\" target=\"_top\">"+menu+"&nbsp;&nbsp;"+lastCalled+"</a></div>";
	 	 
  }
  
  function openVideo(file) {
    videoWindow = 'toolbar=0,location=0,directories=0,status=0,menubar=0, scrollbars=0,resizable=0,width=300,height=220';
    Connect = file;
    // Create a window object
    term=window.open(Connect, 'video', videoWindow);
  }
  