        /* Adding submenus :
             * Fill in the sub-menu name at the end of the main menu entry (last parameter)
             * Create the sub-menu using startdivsub/bisub/enddivsub using the same name
             * Add the sub-menu to the whideall() function using the same name

             * Note : A sub-menu must be enclosed within its parent main menu's bistart()/biend()
        */

	var agt=navigator.userAgent.toLowerCase();
	var is_safari = agt.indexOf("safari")!=-1;
	var click_processed = false;

	function getdropdowns(){

                dn = 'store';startdiv(dn,'160');
                  bistart('http://www.naturalpoint.com/optitrack/store/catalog.html',dn,'Catalog &nbsp;&raquo;','sub_store_catalog');
                    dnsub = 'sub_store_catalog';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/products/motion-capture/',dnsub,'Motion Capture Bundles','sub_store_catalog_packages');
                      bisub('http://www.naturalpoint.com/optitrack/store/hardware.html',dnsub,'Cameras &amp; Components','sub_store_catalog_hardware');
                      bisub('http://www.naturalpoint.com/optitrack/store/software.html',dnsub,'Software','sub_store_catalog_software');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-camera.html',dnsub,'Camera Lenses &amp; Cases','sub_store_catalog_camera');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-mocap.html',dnsub,'Mocap Suits &amp; Markers','sub_store_catalog_mocap');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-tracking.html',dnsub,'Tracking Markers &amp; Accessories','sub_store_catalog_tracking');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-facial-mocap.html',dnsub,'Face Mocap Markers','sub_store_catalog_facial');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-cables.html',dnsub,'Cables &amp; Hubs','sub_store_catalog_cables');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-calibration.html',dnsub,'Calibration Accessories','sub_store_catalog_calibration');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-tripods.html',dnsub,'Tripods &amp; Mounts','sub_store_catalog_tripods');
                    enddivsub();
                  biend();
                  bistart('http://www.naturalpoint.com/optitrack/cart/editcart.html',dn,'Adjust Shopping Cart','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/store/distributors.html',dn,'Authorized Distributors','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/support/storehelp.html',dn,'Online Store Help','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/warranty.html',dn,'Warranty &amp; Repair','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/returnpolicy.html',dn,'Return Policy','');biend();
                enddiv();

                dn = 'products';startdiv(dn ,'160');
                  bistart('http://www.naturalpoint.com/optitrack/products/overview.html',dn,'Products Overview','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/motion-capture/',dn,'Motion Capture Bundles &nbsp;&raquo;','sub_products_mocap');
                    dnsub = 'sub_products_mocap';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/products/motion-capture/',dnsub,'Body Mocap Bundles','sub_products_mocap_body');
                      bisub('/optitrack/products/motion-capture/face-mocap.html',dnsub,'Face Mocap Bundles','sub_products_mocap_face');
                      bisub('http://www.naturalpoint.com/optitrack/support/motion-capture-faq.html',dnsub,'Motion Capture FAQ','sub_products_mocap_faq');
                      /*bisub('http://forum.naturalpoint.com/forum/ubbthreads.php?ubb=cfrm&c=10',dnsub,'ARENA Mocap Forums','sub_products_mocap_arena');*/
                      bisub('http://www.naturalpoint.com/optitrack/products/demos.html',dnsub,'Demo Videos &amp; Sample Data','sub_products_mocap_data');
                    enddivsub();
                  biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/camera-comparison.html',dn,'Cameras &amp; Components &nbsp;&raquo;','sub_products_hardware');
                    dnsub = 'sub_products_hardware';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/products/camera-comparison.html',dnsub,'Camera Comparison','sub_products_hardware_comp');
                      bisub('http://www.naturalpoint.com/optitrack/products/flex-v100r2/',dnsub,'OptiTrack FLEX:V100R2 Camera','sub_products_hardware_v100r2');
                      bisub('http://www.naturalpoint.com/optitrack/products/flex-v100r2-fs/',dnsub,'OptiTrack FLEX:V100R2-FS Camera','sub_products_hardware_v100r2fs');
                      bisub('http://www.naturalpoint.com/optitrack/products/v120-slim/',dnsub,'OptiTrack V120:SLIM Camera','sub_products_hardware_v120');
                      bisub('http://www.naturalpoint.com/optitrack/products/hardware-key/',dnsub,'Hardware Key','sub_products_hardware_hwkey');
                      bisub('http://www.naturalpoint.com/optitrack/products/optihub/',dnsub,'OptiHub','sub_products_hardware_optihub');
                    enddivsub();
                  biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/software-comparison.html',dn,'Software &nbsp;&raquo;','sub_products_software');
                    dnsub = 'sub_products_software';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/products/software-comparison.html',dnsub,'Software Comparison','sub_products_software_comp');
                      bisub('http://www.naturalpoint.com/optitrack/products/full-body-mocap.html',dnsub,'ARENA Body Mocap','sub_products_software_arena');
                      bisub('http://www.naturalpoint.com/optitrack/products/arena-expression/',dnsub,'ARENA Expression Face Mocap','sub_products_software_expression');
                      bisub('http://www.naturalpoint.com/optitrack/products/tracking-tools/',dnsub,'Tracking Tools','sub_products_software_tt');
                      bisub('http://www.naturalpoint.com/optitrack/products/sdk.html',dnsub,'Free Baseline SDK','sub_products_software_sdk');
                    enddivsub();
                  biend();;
                  bistart('http://www.naturalpoint.com/optitrack/store/accessories-tracking.html',dn,'Accessories &nbsp;&raquo;','sub_products_accessories');
                    dnsub = 'sub_products_accessories';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-camera.html',dnsub,'Camera Accessories','sub_products_accessories_camera');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-mocap.html',dnsub,'Motion Capture Accessories','sub_products_accessories_mocap');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-tracking.html',dnsub,'Tracking Accessories','sub_products_accessories_tracking');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-facial-mocap.html',dnsub,'Face Mocap Markers','sub_products_accessories_face');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-cables.html',dnsub,'Cables &amp; Hubs','sub_products_accessories_cables');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-calibration.html',dnsub,'Calibration Accessories','sub_products_accessories_calibration');
                      bisub('http://www.naturalpoint.com/optitrack/store/accessories-tripods.html',dnsub,'Tripods &amp; Mounts','sub_products_accessories_tripods');
                      bisub('http://www.naturalpoint.com/optitrack/products/lens-comparison.html',dnsub,'Lens Comparison Table','sub_products_accessories_lenstable');
                    enddivsub();
                  biend();               
                  bistart('http://www.naturalpoint.com/optitrack/products/flex-3/',dn,'Retired Products &nbsp;&raquo;','sub_products_retired');
                    dnsub = 'sub_products_retired';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/products/slim-v100/',dnsub,'OptiTrack SLIM:V100 Camera','sub_products_retired_s100');
                      bisub('http://www.naturalpoint.com/optitrack/products/flex-v100/',dnsub,'OptiTrack FLEX:V100 Camera','sub_products_retired_v100');
                      bisub('http://www.naturalpoint.com/optitrack/products/flex-c120/',dnsub,'OptiTrack FLEX:C120 Camera','sub_products_retired_c120');
                      bisub('http://www.naturalpoint.com/optitrack/products/flex-3/',dnsub,'OptiTrack FLEX:3 Camera','sub_products_retired_flex3');
                      bisub('http://www.naturalpoint.com/optitrack/products/rigid-body.html',dnsub,'Rigid Body Toolkit','sub_products_retired_rb');
                      bisub('http://www.naturalpoint.com/optitrack/products/point-cloud.html',dnsub,'Point Cloud Toolkit','sub_products_retired_pc');
                    enddivsub();
                  biend(); 
                  bistart('http://www.naturalpoint.com/optitrack/products/videos.html',dn,'Tutorial Videos &amp; Demos','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/reviews.html',dn,'Reviews &amp; Interviews','');biend();
                enddiv();

                dn = 'solutions';startdiv(dn,'160');
                  bistart('http://www.naturalpoint.com/optitrack/solutions/',dn,'Solutions Overview','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/motion-capture/',dn,'Body Motion Capture','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/motion-capture/face-mocap.html',dn,'Face Motion Capture','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/tracking-tools/',dn,'Rigid Body Tracking','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/products/demos.html',dn,'Demo Videos &amp; Sample Data','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/solutions/usage-examples.html',dn,'Usage Examples','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/solutions/design-services.html',dn,'Design Services','');biend();
                enddiv();

                dn = 'community';startdiv(dn,'160');
                  bistart('http://www.naturalpoint.com/optitrack/community/welcome.html',dn,'Welcome','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/news.html',dn,'News &amp; Newsletters','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/events.html',dn,'Events &amp; Tradeshows','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/solutions/usage-examples.html',dn,'Usage Examples','');biend();
                  bistart('http://forum.naturalpoint.com/ubbthreads.php?Cat=0&C=8',dn,'<b>Discussion Forums</b>','');biend();
                enddiv();

                dn = 'support';startdiv(dn,'160');
                  bistart('http://www.naturalpoint.com/optitrack/support/information.html',dn,'Information','');biend();
                  
                  bistart('http://www.naturalpoint.com/optitrack/support/downloads.html',dn,'Downloads &nbsp;&raquo;','sub_support_downloads');
                    dnsub = 'sub_support_downloads';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/support/downloads.html#software',dnsub,'Software','sub_support_downloads_sample');
                      bisub('http://www.naturalpoint.com/optitrack/support/manuals/',dnsub,'Manuals','sub_support_downloads_manuals');
                      bisub('http://www.naturalpoint.com/optitrack/support/downloads.html#add-ons',dnsub,'Add-ons','sub_support_downloads_addons');
                      bisub('http://www.naturalpoint.com/optitrack/support/downloads.html#streaming',dnsub,'Real-time Streaming','sub_support_downloads_realtime');
                      bisub('http://www.naturalpoint.com/optitrack/support/sample-applications.html',dnsub,'Sample Applications','sub_support_downloads_sample');
                    enddivsub();
                  biend();

                  bistart('http://www.naturalpoint.com/optitrack/support/opti-faq.html',dn,'FAQs &nbsp;&raquo;','sub_support_faq');
                    dnsub = 'sub_support_faq';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/support/opti-faq.html',dnsub,'General FAQ','sub_support_faq_general');
                      bisub('http://www.naturalpoint.com/optitrack/support/motion-capture-faq.html',dnsub,'Motion Capture FAQ','sub_support_faq_mocap');
                      bisub('http://www.naturalpoint.com/optitrack/support/activate/faq.html',dnsub,'Licensing &amp; Activation FAQ','sub_support_faq_license');
                    enddivsub();
                  biend();

                  bistart('http://www.naturalpoint.com/optitrack/products/videos.html',dn,'Training &amp; Tutorial Videos','');biend();
                  
                  bistart('http://www.naturalpoint.com/optitrack/support/activate/',dn,'Licensing &nbsp;&raquo;','sub_support_license');
                    dnsub = 'sub_support_license';startdivsub(dnsub,'140');
                      bisub('http://www.naturalpoint.com/optitrack/support/activate/',dnsub,'License Activation','sub_support_license_activate');
                      bisub('http://www.naturalpoint.com/optitrack/support/activate/license_query_form.html',dnsub,'License Status Lookup','sub_support_license_status');
                      bisub('http://www.naturalpoint.com/optitrack/support/activate/faq.html',dnsub,'Licensing &amp; Activation FAQ','sub_support_license_faq');
                    enddivsub();
                  biend();
                  
                  bistart('http://www.naturalpoint.com/optitrack/support/storehelp.html',dn,'Online Store Help','');biend();
                  bistart('http://forum.naturalpoint.com/ubbthreads.php?Cat=0&C=8',dn,'<b>Support Forums</b>','');biend();
                enddiv();

                dn = 'corporate';startdiv(dn,'160');
                  bistart('http://www.naturalpoint.com/optitrack/corporate/about.html',dn,'About NaturalPoint','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/press.html',dn,'Press Releases','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/employment-opportunities.html',dn,'Employment','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/media-kit.html',dn,'Media Kit','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/termsofuse.html',dn,'Terms of Use','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/privacy.html',dn,'Privacy Policy','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/warranty.html',dn,'Warranty &amp; Repair','');biend();
                  bistart('http://www.naturalpoint.com/optitrack/corporate/returnpolicy.html',dn,'Return Policy','');biend();
                enddiv();
	}

	function startdiv(idval,w){
		var s = document.write ('<div id="'+idval+'"><table width="'+w+'" border="0" cellpadding="0" cellspacing="0" class="mt">');
	}
	function enddiv(){
		var s = document.write ("</table></div>");
	}
	function bistart(link,div,name,subname)
        {
          // if the submenu name is not null, include javascript to invoke it, otherwise don't try
          if (subname != '')
          {
		var s = document.write ("<tr><td onClick=\"lnk('"+link+"');\"      \
                                                 onMouseOver=\"menuovr('"+div+"','"+pn(name)+"',this); whidesubs(); wshow('"+subname+"');\"       \
                                                 onMouseOut=\"menuout('"+div+"',this);\" class=\"nav2\">      \
                                                 <a class=\"navmenutext\" HREF=\""+link+"\">"+name+"</a>");
          }
          else
          {
		var s = document.write ("<tr><td onClick=\"lnk('"+link+"');\" onMouseOver=\"menuovr('"+div+"','"+pn(name)+"',this); whidesubs();\" onMouseOut=\"menuout('"+div+"',this);\" class=\"nav2\"><a class=\"navmenutext\" HREF=\""+link+"\">"+name+"</a>");
          }
	}

        function biend()
        {
            document.write ("</td></tr>");
        }


	function pn(name){
		var s=name;if(s.indexOf("<")>0) {return(s.slice(0,s.indexOf("<")-1));}return(s);
	}
	function lnk(link){
      // prevent parent menu item table cell onClick events from stealing the sub menu navigation onClick events
        if (click_processed == false)
        {
          internal_clicked = true;
          click_processed = true;
		  window.open(link,'_self');
        }
	}
	function mainovr(div,status){
		if(is_safari){
			bHover=status;window.status=status;setDD(div,status,false);}
		else{
			bHover=status;window.status=status;setTimeout('setDD(\'' + div + '\', \'' + status + '\', false)',0);}
		whidesubs();
	}
	function mainout(div){
		bHover='';window.status='';setDDTimeout(div);
	}
	function menuovr(div, link, item){
		window.status=link;item.style.backgroundColor='#CCCCCC';setDD(div,'',true);
	}
	function imgovr(div){
	}
	function menuout(div, item){
		setDDTimeout(div);item.style.backgroundColor='#F0F0F0';
		whidesubs();
	}
	function findDiv(n, d) {
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findDiv(n,d.layers[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	function tNav() {
		var i,p,v,obj,args=tNav.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=findDiv(args[i]))!=null) { v=args[i+2];
	    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	    obj.visibility=v;
            }
	}
	function hideDDs(sect) {
		tNav('store','','hide');tNav('products','','hide');tNav('solutions','','hide');tNav('community','','hide');tNav('support','','hide');tNav('corporate','','hide');showElement('SELECT');showElement('OBJECT');showElement('EMBED');
	}
	function hideDD(sect) {
		tNav(sect,'','hide');hideDDs(sect);
	}
	var secSet = null;
	var activeTimer = null;
	var bHover = '';
	var img = '';
	function setDD(sect, windowStatusVal, bshow) {
		hideDDs(sect);
		if ((bHover==windowStatusVal)||(bshow)){
			tNav(sect,'','show');
			if (secSet != null) window.clearTimeout(secSet);
//			hideElement('SELECT', document.all[sect]);
//			hideElement('OBJECT', document.all[sect]);
//			hideElement('EMBED', document.all[sect]);
		}
	}
	function setDDTimeout(sect){
		if (secSet != null) window.clearTimeout(secSet);
		secSet = window.setTimeout('hideDD("' + sect + '")',270);
	}

	function hideElement( elmID, overDiv ) {
	  if(document.all) {
	    for(i = 0; i < document.all.tags( elmID ).length; i++) {
	      obj = document.all.tags( elmID )[i];
	      if(!obj || !obj.offsetParent) continue;
	      // Find the element's offsetTop and offsetLeft relative to the BODY tag.
	      objLeft   = obj.offsetLeft - overDiv.offsetParent.offsetLeft;
	      objTop    = obj.offsetTop;
	      objParent = obj.offsetParent;
	      while(objParent.tagName.toUpperCase() != 'BODY') {
	        objLeft  += objParent.offsetLeft;
	        objTop   += objParent.offsetTop;
	        objParent = objParent.offsetParent;}
	      objHeight = obj.offsetHeight;
	      objWidth  = obj.offsetWidth;

	      if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);
	      else if((overDiv.offsetParent.offsetTop + overDiv.offsetHeight + 20) <= objTop);
	      else if(overDiv.offsetParent.offsetTop >= eval(objTop + objHeight));
	      else if(overDiv.offsetLeft >= eval(objLeft + objWidth));
	      else {
	        obj.style.visibility = 'hidden';
	      }

	    }
	  }
	}

	function showElement(elmID) {
	  if(document.all) {
	    for(i = 0; i < document.all.tags( elmID ).length; i++) {
	      obj = document.all.tags(elmID)[i];
	      if(!obj || !obj.offsetParent) continue;
	      obj.style.visibility = '';
	    }
	  }
	}

        // ==================================  START SUB MENU FUNCTIONS ======================================

        //--------shows whichever menu popup is sent to it.
        function wshow(whichMenu)
        {
          // reset click processed here whenever a new menu is opened, just to make sure navigation can occur if it failed before
          click_processed = false;
        document.getElementById(whichMenu).style.visibility = "visible";
        }

        //--------hides whichever menu popup is sent to it.
        function whide(whichMenu){
        document.getElementById(whichMenu).style.visibility = "hidden";
        }

        function whidesubs(){
        document.getElementById('sub_store_catalog').style.visibility = "hidden";
        document.getElementById('sub_products_mocap').style.visibility = "hidden";
        document.getElementById('sub_products_hardware').style.visibility = "hidden";
        document.getElementById('sub_products_software').style.visibility = "hidden";
        document.getElementById('sub_products_accessories').style.visibility = "hidden";
        document.getElementById('sub_products_retired').style.visibility = "hidden";
        document.getElementById('sub_support_downloads').style.visibility = "hidden";
        document.getElementById('sub_support_faq').style.visibility = "hidden";
        document.getElementById('sub_support_license').style.visibility = "hidden";
        }

	function startdivsub(idval,w){
		var s = document.write ('<div id="'+idval+'"><table width="'+w+'" border="0" cellpadding="0" cellspacing="0" class="navsubposition">');
	}
	function enddivsub(){
		var s = document.write ("</table></div>");
	}
	function bisub(link,div,name,subname){
          var s = document.write ("<tr><td class=\"navsubmenuitem\" onMouseOver=\"this.style.backgroundColor=\'#C0C0C0\'\" onMouseOut=\"this.style.backgroundColor=\'#F0F0F0\';\" bgcolor=\"#F0F0F0\" \
                                   onClick=\"lnk('"+link+"');\" > \
                                   <a class=\"navmenutext\" HREF=\""+link+"\">"+name+"</a></td></tr>");
	}

        // ==================================  END SUB MENU FUNCTIONS ======================================

