Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

performance

Status
Not open for further replies.

dijo123

Programmer
Jan 13, 2004
30
SE
Hello,

I'm programming a menu. The menu is dynamic and for every submenu the user wants, he/she have to declare two arrays. How can I estimate the performance?

How long does it take to write the content from an array?
(To find the array and do document.write of the contents)

Is it possible to do such a calculation of the performance, to find out how many seconds it takes for the browser to show the menu?


/Diana
 
You can capture the date as unix time at the start of the script.

Capture the date again at the end and print the difference.

Unless it's a huge script with lots of loops you will probably find there is no delay.

----------
I'm willing to trade custom scripts for... [see profile]
 
It is a problem:
I need 88 arrays to make a specific menu and I also uses 3 loops that prints the contents of these arrays.


It takes 10 seconds to execute this menu!! If I build a smaller menu, it works perfect. What could I have done to foreseen this problem? (I don't use Explorer, I use WebC.)


/Diana
 
88 arrays sounds like a lot of code... bleh, but if you post the functions I'm sure someone can help.

I dunno what WebC is.

----------
I'm willing to trade custom scripts for... [see profile]
 
There are a lot of additional factors that need to be considered:

* what type of machine is the site hosted on and how old is it
* how many users at a given time
* what is the speed of the users processor and how much memory is available
* the size of the arrays (how many subscripts and the size of the data in each)

etc, etc, etc...

Arrays are variables that exist in memory so, as Dan & Stormbind noted, speed of processing normally wouldn't be a factor. I suspect that there is something else going on that's slowing your script.

There's always a better way. The fun is trying to find it!
 
Until recently I have been making the error of storing data in HTML/XML elements instead of creating new vars. "It didn't seem like a bad idea at the time!"

However, that forces the browser to re-render the page (even if object.style.display='none') and that can cause massive slowdown! :(

I suspect a similar scenario with this menu.

----------
I'm willing to trade custom scripts for... [see profile]
 
Thank you very much for trying to help me!

I post the functions:

first the function initiateMenu() is called, then foldInit().

It's function initiateMenu() that contains the 88 arrays!
The function foldInit() contains a for-loop and 3 while-loops.

Code:
function initiateMenu(){
	menu=new Array("Set it Up!", "Sewing Mode", "Set to Embroider", "Embroidery Mode", "File Manager");  //length = 4
	 indexmenu=new Array(3, 5, 6, 13, 6); //Hur många menyer menu har under respektive meny
	
	  	subMenu0=new Array("Accessories", "Accessory Tray", "Spool Pins", "Threading", "Bobbin", "Function Buttons", "Presser Feet", "Changing Presser Foot", "Needles", "Lower Feed Teeth", "Thread Tension", "Balance", "Presser Foot Pressure", "E! Light", "USB ports", "Interactive Designer Screen", "Computer", "Update");
	  	 indexsubMenu0=new Array(0, 1, 3, 3, 4, 12, 13, 0, 5, 0, 0, 0, 0, 1, 2, 2, 3, 0);//Hur många menyer subMenu0 har under respektive meny
	  	 indexsubMenu0.link0="%internal%/%language%/template_06.htm";
	  	 indexsubMenu0.link7="%internal%/%language%/template_06.htm";
	  	 indexsubMenu0.link9="%internal%/%language%/template_06.htm";
	  	 indexsubMenu0.link10="%internal%/%language%/template_06.htm";
	  	 indexsubMenu0.link11="%internal%/%language%/template_06.htm";
	  	 indexsubMenu0.link12="%internal%/%language%/template_06.htm";
	  	 indexsubMenu0.link17="%internal%/%language%/template_06.htm";
	    
	    		subMenu0_1=new Array("Remove");
	    		 indexsubMenu0_1=new Array(0);
	    		 indexsubMenu0_1.link0="%internal%/%language%/template_06.htm";
	    
	    		subMenu0_2=new Array("General", "Main","Auxiliary");
	    		 indexsubMenu0_2=new Array(0, 3, 0);
	    		 indexsubMenu0_2.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_2.link2="%internal%/%language%/template_06.htm";
	    		 
	    		 	subMenu0_2_1=new Array("General", "Horizontal Position", "Vertical Position");
				 indexsubMenu0_2_1=new Array(0, 0, 0);
				 indexsubMenu0_2_1.link0="%internal%/%language%/template_06.htm";
				 indexsubMenu0_2_1.link1="%internal%/%language%/template_06.htm";
				 indexsubMenu0_2_1.link2="%internal%/%language%/template_06.htm";
	    		 
	    		subMenu0_3=new Array("Top Thread", "Needle", "Twin Needle");
	    		 indexsubMenu0_3=new Array(3, 0, 0);
	    		 indexsubMenu0_3.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_3.link2="%internal%/%language%/template_06.htm";
	    		 
	    		 	subMenu0_3_0=new Array("General", "Horizontal Spool Pin", "Vertical Spool Pin");
	    		 	indexsubMenu0_3_0=new Array(0, 0, 0);
	    		 	indexsubMenu0_3_0.link0="%internal%/%language%/template_06.htm";
	    		 	indexsubMenu0_3_0.link1="%internal%/%language%/template_06.htm";
	    		 	indexsubMenu0_3_0.link2="%internal%/%language%/template_06.htm";
	    		 	
	    		subMenu0_4=new Array("Winding", "Winding from Needle", "Winding while Embroidering", "Placing in Machine");
	    		 indexsubMenu0_4=new Array(0, 0, 0, 0);
	    		 indexsubMenu0_4.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_4.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_4.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_4.link3="%internal%/%language%/template_06.htm"; 	
	    		 
	    		subMenu0_5=new Array("Overview", "Stitch Re-Start", "Stop", "Fix", "Thread Cutter", "Needle Stop Up/Down", "Speed", "Start/Stop", "Reverse", "Lift", "Pivot", "Down");
	    		 indexsubMenu0_5=new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	    		 indexsubMenu0_5.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link3="%internal%/%language%/template_06.htm";  
	    		 indexsubMenu0_5.link4="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link5="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link6="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link7="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link8="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link9="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link10="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_5.link11="%internal%/%language%/template_06.htm";
	    		 
	    	  	subMenu0_6=new Array("A", "B", "C", "D", "E", "H", "J", "P", "R", "S", "Transparent", "Sensor Buttonhole Foot", "Glide Plates");
	    		 indexsubMenu0_6=new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	    		 indexsubMenu0_6.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link3="%internal%/%language%/template_06.htm";  
	    		 indexsubMenu0_6.link4="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link5="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link6="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link7="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link8="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link9="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link10="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link11="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_6.link12="%internal%/%language%/template_06.htm";
	    		 
	    		subMenu0_8=new Array("Universal", "Stretch", "Wing", "Jeans", "Twin Needle");
	    		 indexsubMenu0_8=new Array(0, 0, 0, 0, 2);
	    		 indexsubMenu0_8.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_8.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_8.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_8.link3="%internal%/%language%/template_06.htm"; 	
	    		 
	    		 	subMenu0_8_4=new Array("General", "Set width");
	    		 	indexsubMenu0_8_4=new Array(0, 0);
	    		 	indexsubMenu0_8_4.link0="%internal%/%language%/template_06.htm";
	    		 	indexsubMenu0_8_4.link1="%internal%/%language%/template_06.htm";
	    		 	
	    		subMenu0_13=new Array("Adjust");
	    		 indexsubMenu0_13=new Array(0);
	    		 indexsubMenu0_13.link0="%internal%/%language%/template_06.htm";
	    		 	
	    		subMenu0_14=new Array("General", "USB Embroidery Stick (insert/remove)");
	    		 indexsubMenu0_14=new Array(0,0);
	    		 indexsubMenu0_14.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_14.link1="%internal%/%language%/template_06.htm";  
	    		 
	    		subMenu0_15=new Array("Calibrate", "Clean");
	    		 indexsubMenu0_15=new Array(0,0);
	    		 indexsubMenu0_15.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_15.link1="%internal%/%language%/template_06.htm";	
	    		 
	    		subMenu0_16=new Array("General", "Connect", "Install Application");
	    		 indexsubMenu0_16=new Array(0,0, 0);
	    		 indexsubMenu0_16.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_16.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu0_16.link2="%internal%/%language%/template_06.htm";	
	    		 	 
	
	  	subMenu1=new Array("Sewing Advisor", "Stitches", "Alphabets", "Button Size Set", "Programming"); 
	  	 indexsubMenu1=new Array(4, 4, 2, 0, 10);
	  	 indexsubMenu1.link3="%internal%/%language%/template_06.htm";
	  	
	  		subMenu1_0=new Array("General", "Fabric", "Techniques", "Extended");
			 indexsubMenu1_0=new Array(0, 0, 0, 0);
			 indexsubMenu1_0.link0="%internal%/%language%/template_06.htm";
			 indexsubMenu1_0.link1="%internal%/%language%/template_06.htm";
			 indexsubMenu1_0.link2="%internal%/%language%/template_06.htm";
			 indexsubMenu1_0.link3="%internal%/%language%/template_06.htm";
			 
			subMenu1_1=new Array("Menus", "Select", "Adjust", "Save in My Stitches");
			 indexsubMenu1_1=new Array(0, 0, 4, 0);
			 indexsubMenu1_1.link0="%internal%/%language%/template_06.htm";
			 indexsubMenu1_1.link1="%internal%/%language%/template_06.htm";
			 indexsubMenu1_1.link3="%internal%/%language%/template_06.htm"; 
			 
			 	subMenu1_1_2=new Array("General", "Adjust S&T menu", "Adjust Satin and Scallop stitches", "Adjust Omnigram Stitches");
			 	 indexsubMenu1_1_2=new Array(0, 0, 0, 0);
			 	 indexsubMenu1_1_2.link0="%internal%/%language%/template_06.htm";
			 	 indexsubMenu1_1_2.link1="%internal%/%language%/template_06.htm";
			 	 indexsubMenu1_1_2.link2="%internal%/%language%/template_06.htm";
			 	 indexsubMenu1_1_2.link3="%internal%/%language%/template_06.htm"; 
			 	 
			subMenu1_2=new Array("Menus", "Select");
			 indexsubMenu1_2=new Array(0, 0);
			 indexsubMenu1_2.link0="%internal%/%language%/template_06.htm";
			 indexsubMenu1_2.link1="%internal%/%language%/template_06.htm";
			 
			subMenu1_4=new Array("General", "Add Stitch", "Delete Stitch", "Change Stitch", "Adjust Stitch", "Adjust Program", "Program Stop, FIX, Cut", "Preview", "Sew", "Save");
			 indexsubMenu1_4=new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 3);
			 indexsubMenu1_4.link0="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link1="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link2="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link3="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link4="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link5="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link6="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link7="%internal%/%language%/template_06.htm";
			 indexsubMenu1_4.link8="%internal%/%language%/template_06.htm";
			 	
			 	subMenu1_4_9=new Array("General", "In My Stitches", "In My Files");
			 	 indexsubMenu1_4_9=new Array(0, 5, 0);
			 	 indexsubMenu1_4_9.link0="%internal%/%language%/template_06.htm";
			 	 indexsubMenu1_4_9.link1="%internal%/%language%/template_06.htm";
			 	 indexsubMenu1_4_9.link2="%internal%/%language%/template_06.htm";
			 	 indexsubMenu1_4_9.link3="%internal%/%language%/template_06.htm"; 
			 	  
			 	  	 subMenu1_4_9_1=new Array("General", "Save on Free Position", "Save on Occupied Position", "Cancel", "Delete");
			 	  	  indexsubMenu1_4_9_1=new Array(0, 0, 0, 0, 0);
			 	 	  indexsubMenu1_4_9_1.link0="%internal%/%language%/template_06.htm";
			 		  indexsubMenu1_4_9_1.link1="%internal%/%language%/template_06.htm";
			 		  indexsubMenu1_4_9_1.link2="%internal%/%language%/template_06.htm";
			 		  indexsubMenu1_4_9_1.link3="%internal%/%language%/template_06.htm"; 
			 	 	  indexsubMenu1_4_9_1.link4="%internal%/%language%/template_06.htm"; 
			 	 
			 	 
	  	subMenu2=new Array("Embroidery Unit", "Hoop Fabric", "Embroidery Template", "Hoops", "Hoop, Slide on", "Function Buttons"); 
	  	 indexsubMenu2=new Array(3, 0, 0, 0, 0, 12);
	  	 indexsubMenu2.link0="%internal%/%language%/template_06.htm";
	  	 indexsubMenu2.link1="%internal%/%language%/template_06.htm";
		 indexsubMenu2.link2="%internal%/%language%/template_06.htm";
	  	 indexsubMenu2.link3="%internal%/%language%/template_06.htm";
	  	 indexsubMenu2.link4="%internal%/%language%/template_06.htm";
	  	 indexsubMenu2.link5="%internal%/%language%/template_06.htm";
	  	 
	  	 	subMenu2_0=new Array("Overview", "Connect", "Remove");
			 indexsubMenu2_0=new Array(0, 0, 0);
			 indexsubMenu2_0.link0="%internal%/%language%/template_06.htm";
			 indexsubMenu2_0.link1="%internal%/%language%/template_06.htm";
			 indexsubMenu2_0.link2="%internal%/%language%/template_06.htm";
			 
			subMenu2_5=new Array("Overview", "Parking Position/Easy Thread Cutting", "Stop", "Baste", "Thread Cutter", "Bobbin Access", "Speed", "Start/Stop", "Reverse", "Lift", "Pivot", "Down");
	    		 indexsubMenu2_5=new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	    		 indexsubMenu2_5.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link3="%internal%/%language%/template_06.htm";  
	    		 indexsubMenu2_5.link4="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link5="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link6="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link7="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link8="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link9="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link10="%internal%/%language%/template_06.htm";
	    		 indexsubMenu2_5.link11="%internal%/%language%/template_06.htm";
	  	 
	  	 
	  	subMenu3=new Array("Embroidery Advisor", "Design", "Customizing", "Hoop Selection", "Text", "Embroider Stitches and Stitch Fonts", "Color", "Thread Tension", "Grid", "Bobbin Access", "Parking Position", "Easy Thread Cutting", "Stylus Functions"); 
	  	 indexsubMenu3=new Array(0, 10, 0, 0, 2, 3, 4, 0, 0, 0, 0, 0, 8);
	  	 indexsubMenu3.link0="%internal%/%language%/template_06.htm";
	  	 indexsubMenu3.link2="%internal%/%language%/template_06.htm";
		 indexsubMenu3.link3="%internal%/%language%/template_06.htm";
	  	 indexsubMenu3.link7="%internal%/%language%/template_06.htm";
	  	 indexsubMenu3.link8="%internal%/%language%/template_06.htm";
	  	 indexsubMenu3.link9="%internal%/%language%/template_06.htm";
	  	 indexsubMenu3.link10="%internal%/%language%/template_06.htm";
	  	 indexsubMenu3.link11="%internal%/%language%/template_06.htm";
	  	 
	  	 	subMenu3_1=new Array("Load Design", "Stitch Count", "Color Block Count", "Adjust Design", "Select Design", "Check Size", "Duplicate Design", "Save Design", "Restore Design", "Delete Design");
	    		 indexsubMenu3_1=new Array(2, 0, 0, 4, 0, 0, 0, 3, 0, 0);
	    		 indexsubMenu3_1.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_1.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_1.link4="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_1.link5="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_1.link6="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_1.link8="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_1.link9="%internal%/%language%/template_06.htm";
	    		 
	    		 	subMenu3_1_0=new Array("From My Designs", "From USB Embroidery Stick or other location");
			 	 indexsubMenu3_1_0=new Array(0, 0);
			 	 indexsubMenu3_1_0.link0="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_1_0.link1="%internal%/%language%/template_06.htm";
			  	 
			  	subMenu3_1_3=new Array("Scaling", "Rotation", "Position", "Mirror");
			 	 indexsubMenu3_1_3=new Array(0, 0, 0, 0);
			 	 indexsubMenu3_1_3.link0="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_1_3.link1="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_1_3.link2="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_1_3.link3="%internal%/%language%/template_06.htm";
			  	 
			  	subMenu3_1_7=new Array("To My Designs", "To USB", "Combination");
			 	 indexsubMenu3_1_7=new Array(0, 0, 0);
			 	 indexsubMenu3_1_7.link0="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_1_7.link1="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_1_7.link2="%internal%/%language%/template_06.htm";
			  	 
			subMenu3_4=new Array("Create", "Edit");
			 indexsubMenu3_4=new Array(0, 7);
			 indexsubMenu3_4.link0="%internal%/%language%/template_06.htm";
			   
			   	subMenu3_4_1=new Array("General", "Add Letters", "Change letters", "Delete Letters", "Font Size", "Text Spacing", "Change Font");
			 	 indexsubMenu3_4_1=new Array(0, 0, 0, 0, 0, 0, 0);
			 	 indexsubMenu3_4_1.link0="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_4_1.link1="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_4_1.link2="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_4_1.link3="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_4_1.link4="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_4_1.link5="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_4_1.link6="%internal%/%language%/template_06.htm";
			  	 
			subMenu3_5=new Array("General", "Adjust", "Load to Embroidery Area");
			 indexsubMenu3_5=new Array(0, 2, 0);
			 indexsubMenu3_5.link0="%internal%/%language%/template_06.htm";
			 indexsubMenu3_5.link2="%internal%/%language%/template_06.htm";
			 	
			   	subMenu3_5_1=new Array("General", "Adjust on Embroidery Area");
			 	 indexsubMenu3_5_1=new Array(0, 0);
			 	 indexsubMenu3_5_1.link0="%internal%/%language%/template_06.htm";
			  	 indexsubMenu3_5_1.link1="%internal%/%language%/template_06.htm";
			  	 
			subMenu3_6=new Array("Color Block", "Color Change", "Background Color Change", "One Color Embroidery");
	    		 indexsubMenu3_6=new Array(0, 0, 0, 0);
	    		 indexsubMenu3_6.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_6.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_6.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_6.link3="%internal%/%language%/template_06.htm";	
	    		 
	    		subMenu3_12=new Array("General", "Select & Position", "Select & Scale", "Select & Rotate", "Zoom to Hoop Extents", "Zoom to Show All", "Pan Area", "Zoom In/Out");
	    		 indexsubMenu3_12=new Array(0, 0, 0, 0, 0, 0, 0, 0);
	    		 indexsubMenu3_12.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_12.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_12.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_12.link3="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_12.link4="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_12.link5="%internal%/%language%/template_06.htm";
	    		 indexsubMenu3_12.link6="%internal%/%language%/template_06.htm"; 
	    		 indexsubMenu3_12.link7="%internal%/%language%/template_06.htm"; 
	    		 
	    		 
	    		 
	    	subMenu4=new Array("Browsing", "File Types", "Supported File Formats", "Load File", "Folders", "Move, Copy and Delete Files"); 
	  	 indexsubMenu4=new Array(4, 0, 0, 5, 4, 3);
	  	 indexsubMenu4.link0="%internal%/%language%/template_06.htm";
	  	 indexsubMenu4.link1="%internal%/%language%/template_06.htm";
		 indexsubMenu4.link2="%internal%/%language%/template_06.htm";
	  	 indexsubMenu4.link3="%internal%/%language%/template_06.htm";
	  	 indexsubMenu4.link4="%internal%/%language%/template_06.htm";
	  	 indexsubMenu4.link5="%internal%/%language%/template_06.htm"; 
	  	 
	  	 	subMenu4_0=new Array("My Files", "My Fonts", "My Designs", "USB port");
	    		 indexsubMenu4_0=new Array(0, 0, 0, 4);
	    		 indexsubMenu4_0.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_0.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_0.link2="%internal%/%language%/template_06.htm";
	    		 
	    		 	subMenu4_0_3=new Array("General/Overview", "Stick", "Computer", "Other");
	    		 	 indexsubMenu4_0_3=new Array(0, 0, 0, 0);
	    		 	 indexsubMenu4_0_3.link0="%internal%/%language%/template_06.htm";
	    		 	 indexsubMenu4_0_3.link1="%internal%/%language%/template_06.htm";
	    		 	 indexsubMenu4_0_3.link2="%internal%/%language%/template_06.htm";
	    		 	 indexsubMenu4_0_3.link3="%internal%/%language%/template_06.htm";
	    		 	 
	    		subMenu4_3=new Array("General", "Stitch", "Font", "Design", "Text or HTML");
	    		 indexsubMenu4_3=new Array(0, 0, 0, 0, 0);
	    		 indexsubMenu4_3.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_3.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_3.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_3.link3="%internal%/%language%/template_06.htm"; 
	    		 indexsubMenu4_3.link4="%internal%/%language%/template_06.htm"; 
	    		 	 	 
	    	  	subMenu4_4=new Array("Create New", "Rename", "Step Up Level", "Open");
	    		 indexsubMenu4_4=new Array(0, 0, 0, 0);
	    		 indexsubMenu4_4.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_4.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_4.link2="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_4.link3="%internal%/%language%/template_06.htm";
	    		 
	    		subMenu4_5=new Array("Move", "Copy", "Delete");
	    		 indexsubMenu4_5=new Array(0, 0, 0);
	    		 indexsubMenu4_5.link0="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_5.link1="%internal%/%language%/template_06.htm";
	    		 indexsubMenu4_5.link2="%internal%/%language%/template_06.htm";
					

}

function initiateVariables(){	
				
	headmenuIdDiv="divMenu";  //första divens namn som innehåller alla menyer
	menuId="menu";			//Id blir tex menu0, menu1 osv
	subMenuId="subMenuId";		//id blir tex subMenuId0, subMenuId1 osv
	subsubMenuId="subsubMenuId";	//id blir tex subsubMenuId0, subsubMenuId1 osv	
	sub3MenuId="sub3MenuId";	//id blir tex sub3MenuId0, sub3MenuId1 osv
	sub4MenuId="sub4MenuId";	//id blir tex sub4MenuId0, sub4MenuId1 osv
	firstDiv=("<DIV ID='"+headmenuIdDiv+"' class=divMenuFold>");
	
	subMenuNbr=0;  //Nummer på id i submenyerna
	subsubMenuNbr=0;  //Nummer på id i subsubmenyerna
	sub3MenuNbr=0; //Nummer på id i sub3menyerna
	sub4MenuNbr=0;  //Nummer på id i sub4menyerna
	
	aLink="";
	
	openedMenus=new Array();   //en array med id på alla öppnade menyer
	openedSub1=new Array();   //en array med id på alla öppnade submenyer
	openedSub2=new Array();   //en array med id på alla öppnade submenyer
	openedSub3=new Array();   //en array med id på alla öppnade submenyer

	openedImage="";  	   //en sträng med öppnad huvudmeny
	openedImages0=new Array(); //en array med öppnade subar
	openedImages1=new Array(); //en array med öppnade sub2'or
	openedImages2=new Array(); //en array med öppnade sub3'or
	
	foldImg=new Image(); foldImg.src="%internal%/common/closed_arrow.png";
	foldOpenImg=new Image(); foldOpenImg.src="%internal%/common/open_arrow.png";
	foldNoImg=new Image(); foldNoImg.src="%internal%/common/no_arrow.png";
	
	cookies=1;		//Om man vill använda sig av cookies för att komma ihåg vilka menyer man öppnat: sätt denna till 1, annars 0
	
	
}


// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}


function foldInit(){

initiateVariables();

document.write(firstDiv);   //diven över alla
  document.write('<br>');
  	
	var menuTmpObj;
	for(var i=0;i<menu.length;i++)	{		//stega igenom variabeln menu
							//och skriver ut alla huvudmenyer
		//alert("i= "+i);			//i ändras varje gång det blir ny huvudmeny
		/***********************************************
		*  		Huvudmenyer		       *
		************************************************/
		if( indexmenu[i]>0 ){   //Då ska bild läggas till
			document.write("<img src="+foldImg.src+" id=img"+menuId+(i)+" width=10 height=10 border=0 style='position: relative; top: -7px; left: 0px;'>" );  //bilden för menu[0] har namnet imgmenu0
			document.write('&nbsp');
			document.write('<a href="#" onclick="foldmenu(\''+menuId+(i)+'\'); return false" onKeyPress="foldmenu(\''+menuId+(i)+'\'); return false" class="clFoldLinks" > '+menu[i]+' </a><br>');
		}else{
			 document.write("<img src="+foldNoImg.src+" id=img"+menuId+(i)+" width=10 height=10 border=0>" );  //ingen bild
			 document.write('&nbsp');
			 //document.write('<a href="%internal%/manual/index.htm" class="clFoldLinks" > '+menu[i]+' </a><br>');
		}
		
		document.write("<div id=" +menuId+(i)+" class=clFold>");  //diven över första menyerna, alla divar ska ha id
		
		
			/***********************************************
			*  		subMenyer 		       *
			************************************************/
			if ( eval( 'typeof( (subMenu'+i+'))' ) != 'undefined'){
				var j=0;					//ökar för varje submeny, börjar om igen efter varje huvudmeny
				while( (eval( '(subMenu'+i+'[j])' )!=null) ){  //tänk om den inte finns!!!  //kollar om submenyer finns till huvudmenyerna //while1
					//eval('document.write((subMenu'+i+'))');
					//eval('document.write((subMenu'+i+'[0]))');
						
								
					document.write("<div id=" +subMenuId+(subMenuNbr)+" class=clFoldSub>" );
				
					if( eval( '(indexsubMenu'+i+'[j])' )>0 ){   //Då ska bild läggas till
						document.write("<img src="+foldImg.src+" id=imgsubMenu"+i+"_"+j+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //bilden för submenu
						document.write('&nbsp');
						document.write('<a href="#" onclick="foldSubmenu(\'subMenu'+i+'_'+j+'\',\''+subsubMenuNbr+'\'); return false" onKeyPress="foldSubmenu(\'subMenu'+i+'_'+j+'\',\''+subsubMenuNbr+'\'); return false" class="clSubLinks" > '+ eval( '(subMenu'+i+'[j])' ) +' </a><br>' );
					
					}else{
						aLink=( eval( '(indexsubMenu'+i+'.link'+j+')' ) )  // tex indexsubMenu0.link0
						document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+" width=10 height=10 border=0>" );  //ingen bild
						document.write('&nbsp');
						document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks" > '+ eval( '(subMenu'+i+'[j])' ) +' </a><br>' );  //länk
					}
			
					/***********************************************
					*  		subsubMenyer 		       *
					************************************************/
					//kollar först om det finns submenyer till subMenu0[0]:
					//  ->finns det en subMenu00? 
					//sedan om det finns submenyer till subMenu0[1]:
					//  ->finns det en subMenu01? .....
					//sedan om det finns submenyer till subMenu1[0]:
					//  ->finns det en subMenu10?
					
					if ( eval( 'typeof( (subMenu'+i+'_'+j+'))' ) != 'undefined'){
						var k=0;   
						while( (eval( '(subMenu'+i+'_'+j+'[k])' )!=null) ){      //while2
							//eval( 'document.write( (subMenu'+i+j+'[k]  ) )' );
							//document.write(subMenu0_0[0]);
							document.write("<div id=" +subsubMenuId+(subsubMenuNbr)+" class=clFoldSub2>" );
							
							if( eval( '(indexsubMenu'+i+'_'+j+'[k])' )>0 ){   //Då ska bild läggas till
								document.write("<img src="+foldImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //bilden 
								document.write('&nbsp');
								document.write('<a href="#" onclick="foldSub2menu(\'subMenu'+i+'_'+j+'_'+k+'\',\''+sub3MenuNbr+'\'); return false" onKeyPress="foldSub2menu(\'subMenu'+i+'_'+j+'_'+k+'\',\''+sub3MenuNbr+'\'); return false" class="clSubLinks2" > '+ eval( '(subMenu'+i+'_'+j+'[k])' ) +' </a><br>' );
						
							}else{
								aLink=( eval( '(indexsubMenu'+i+'_'+j+'.link'+k+')' ) )  // tex indexsubMenu01.link0
								document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+" width=10 height=10 border=0>" );  //ingen bild
								document.write('&nbsp');
								document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks2" > '+ eval( '(subMenu'+i+'_'+j+'[k])' ) +' </a><br>' );  //länk
						
							}
							
							menuTmpObj = document.getElementById((subsubMenuId+subsubMenuNbr));  //sätter alla submenyer till synliga
							menuTmpObj.style.display = 'none';
							menuTmpObj.style.visibility="hidden";
							
							/***********************************************
							*  		sub3Menyer 		       *
							************************************************/					
							if ( eval( 'typeof( (subMenu'+i+'_'+j+'_'+k+'))' ) != 'undefined'){
								var l=0;	//subMenu000
								while( (eval( '(subMenu'+i+'_'+j+'_'+k+'[l])' )!=null) ){   //tex subMenuId111[0]  while3
									document.write("<div id=" +sub3MenuId+(sub3MenuNbr)+" class=clFoldSub3>" );
									
									if( eval( '(indexsubMenu'+i+'_'+j+'_'+k+'[l])' )>0 ){   //Då ska bild läggas till, indexsubMenu111
										document.write("<img src="+foldImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+"_"+l+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //bild
										document.write('&nbsp');
										document.write('<a href="#" onclick="foldSub3menu(\'subMenu'+i+'_'+j+'_'+k+'_'+l+'\',\''+sub4MenuNbr+'\'); return false" onKeyPress="foldSub3menu(\'subMenu'+i+'_'+j+'_'+k+'_'+l+'\',\''+sub4MenuNbr+'\'); return false" class="clSubLinks3" > '+ eval( '(subMenu'+i+'_'+j+'_'+k+'[l])' ) +' </a><br>' );  
									}else{	
										aLink=( eval( '(indexsubMenu'+i+'_'+j+'_'+k+'.link'+l+')' ) )  // tex indexsubMenu010.link0
										document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+"_"+l+" width=10 height=10 border=0>" );  //ingen bild
										document.write('&nbsp');
										document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks3" > '+ eval( '(subMenu'+i+'_'+j+'_'+k+'[l])' ) +' </a><br>' );  //länk
									}
										 
									menuTmpObj = document.getElementById((sub3MenuId+sub3MenuNbr));  //sätter alla submenyer till synliga
									menuTmpObj.style.display = 'none';
									menuTmpObj.style.visibility="hidden";
									
									
									
									/***********************************************
									*  		sub4Menyer 		       *
									************************************************/					
									if ( eval( 'typeof( (subMenu'+i+'_'+j+'_'+k+'_'+l+'))' ) != 'undefined'){
										var m=0;	//subMenu0100
										while( (eval( '(subMenu'+i+'_'+j+'_'+k+'_'+l+'[m])' )!=null) ){   //tex subMenuId1111[0]
											aLink=( eval( '(indexsubMenu'+i+'_'+j+'_'+k+'_'+l+'.link'+m+')' ) )  // tex indexsubMenu010.link0
											document.write("<div id=" +sub4MenuId+(sub4MenuNbr)+" class=clFoldSub4>" );
											document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+"_"+l+"_"+m+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //ingen bild
											document.write('&nbsp');
											document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks4" > '+ eval( '(subMenu'+i+'_'+j+'_'+k+'_'+l+'[m])' ) +' </a><br>' );  
											document.write("</div>"); 
				
											menuTmpObj = document.getElementById((sub4MenuId+sub4MenuNbr));  //sätter alla submenyer till osynliga
											menuTmpObj.style.display = 'none';
											menuTmpObj.style.visibility="hidden";
											m++;
											sub4MenuNbr++;
							
							  			}
						
						
									}   
									/***********************************************
									*  		slut på sub4Menyer 	       *
									************************************************/
															
									l++;
									sub3MenuNbr++;
									document.write("</div>");
							
							  	}   //slut på while3
						
						
							}   
							/***********************************************
							*  		slut på sub3Menyer 	       *
							************************************************/
							
							
							k++;
							subsubMenuNbr++;
						     document.write("</div>");  //slut på array subMenu11, diven subsubMenuId0, subsubMenuId1.. 
							
						} 	//slut på while2
					
					}
					/***********************************************
					*  		slut på subsubMenyer 	       *
					************************************************/
					
					
					j++;		//plats i varje array (i subMenuId0, subMenuId1)
					subMenuNbr++;  //Nummer på id i submenyerna (tex subMenuId0, subMenuId7), incrementeras varje gång det blir en ny submeny
				     document.write("</div>");	//slut på div subMenuId0, subMenuId1						
		
				} //slut på while1
			}
			/***********************************************
			*  		slut på subMenyer 	       *
			************************************************/
		
		document.write("</div>");  //slut på div menu0, menu1
		document.write("<BR>");
		/***********************************************
		*  	slut på huvudmenyer		       *
		************************************************/
		
		
	} 	//slut på for()
	
document.write('</div>');  //slut på diven över alla

if(cookies==1){	
	var co;
	//document.write(getCookie("Menu")+'<BR>');   //tex: "menu1/subsubMenuId4,subsubMenuId3/sub3MenuId0/sub4MenuId1,sub4MenuId0/"

	if(co=getCookie("Menu")){		//om det finns en cookie är någon meny öppnad
		my_opened=new Array();
		my_opened=co.split("/");	//nu hamnar alla nivåer på var sin plats i vektorn my_opened

		/**** tex: my_opened[0]="menu1" my_opened[1]= "subsubMenuId4,subsubMenuId3" my_opened[2]="sub3MenuId0" my_opened[3]="sub4MenuId1,sub4MenuId0" ****/
		//document.write(my_opened[0]+my_opened[1]+my_opened[2]+my_opened[3]+my_opened[4]+'<BR>');

		//headmenu=my_opened[0].split(",");
		//openedMenus[0]=headmenu;
		openedMenus[0]=my_opened[0];
		
		if(my_opened.length>1){
			openedSub1=my_opened[1].split(",");		//och alla element i en nivå på olika platser 
			openedMenus=(openedMenus.concat(openedSub1));
			//document.write("my_opened.length=>1 "+'<BR>');
		}
		if(my_opened.length>2){
			openedSub2=my_opened[2].split(",");		//alla öppnade sub2 menyer..osv
			openedMenus=(openedMenus.concat(openedSub2));
		}
		if(my_opened.length>3){
			openedSub3=my_opened[3].split(",");
			openedMenus=(openedMenus.concat(openedSub3));	
		}
		
		//document.write("openedMenus"+openedMenus[0]+openedMenus[1]+openedMenus[2]);
	
		my=new Array();     //kopiera arrayen openedMenus till arrayen my
		for(var jk=0;jk<openedMenus.length;jk++){
			my[jk]=openedMenus[jk];
		}
		//document.write(openedMenus[0]+openedMenus[1]+openedMenus[2]+openedMenus[3]+openedMenus[4]+'<BR>');

		var openNbr=my.length;
		
		while(openNbr>0){
			menuTmpObj = document.getElementById(my.shift());
			menuTmpObj.style.display='block';
			menuTmpObj.style.visibility="visible";
			openNbr=my.length;	
		}
		
		deleteCookie("Menu");		
	}
	
	if(co=getCookie("Image")){		//öppna huvud pilen
		
         	my_openedImage=new Array();
		my_openedImage=co.split("/");	//nu hamnar alla nivåer på var sin plats i vektorn my_opened

		/**** tex: my_opened[0]="menu1" my_opened[1]= "subsubMenuId4,subsubMenuId3" my_opened[2]="sub3MenuId0" my_opened[3]="sub4MenuId1,sub4MenuId0" ****/
		//document.write(my_opened[0]+my_opened[1]+my_opened[2]+my_opened[3]+my_opened[4]+'<BR>');

		openedImage=my_openedImage[0];		//huvudmeny-pil
		myImage=new Array();     //innehåller alla pilarna som ska öppnas
		myImage[0]=my_openedImage[0];
		
		if(my_openedImage.length>1){
			openedImages0=my_openedImage[1].split(",");		//och alla element i en nivå på olika platser 
			//document.write("openedImages0= " + openedImages0 + '<BR>');
			myImage=(myImage.concat(openedImages0));
		}
		if(my_openedImage.length>2){
			openedImages1=my_openedImage[2].split(",");		//alla öppnade sub2 menyer..osv
			//document.write("openedImages1= " + openedImages1 + '<BR>');
			myImage=(myImage.concat(openedImages1));
		}
		if(my_openedImage.length>3){
			openedImages2=my_openedImage[3].split(",");	
			//document.write("openedImages2= " + openedImages2 + '<BR>');
			myImage=(myImage.concat(openedImages2));
		}
		
		//document.write("openedImage get cookie= " + openedImage + '<BR>');
		//document.write("myImage= " + myImage + '<BR>');  
		
		var openNbrI=myImage.length;  //byt alla pilarna till öppna
		
		while(openNbrI>0){
			menuTmpObj = document.getElementById(myImage.shift());
			if(menuTmpObj.src!=foldNoImg.src)       //byt bild om den finns någon
         			menuTmpObj.src =  foldOpenImg.src;
			openNbrI=myImage.length;	
		}  
		
		deleteCookie("Image"); 
			
	}  
}	
	

	

}
 
I haven't had a chance to look at yet: long scripts have a terrible effect on me :[

However, MSDN claim that using innerHTML is faster than document.write() and you use a lot of the latter.

Also, I don't know but I assume 1x document.write() is faster than many.

I would probably start by keeping everything in memory for as long as possible without asking the browser to render anything. Example:

Code:
var output = '';

if( indexmenu[i]>0 ){
output += "<img src="+foldImg.src+" id=img"+menuId+(i)+" width=10 height=10 border=0 style='position: relative; top: -7px; left: 0px;'>" ;
output += '&nbsp';
output += '<a href="#" onclick="foldmenu(\''+menuId+(i)+'\';return false" onKeyPress="foldmenu(\''+menuId+(i)+'\'); return false" class="clFoldLinks" > '+menu[i]+' </a><br>';

}else{

output += "<img src="+foldNoImg.src+" id=img"+menuId+(i)+" width=10 height=10 border=0>" );
output += '&nbsp';
output += '<a href="%internal%/manual/index.htm" class="clFoldLinks" > '+menu[i]+' </a><br>';
        }
        
output += "<div id=" +menuId+(i)+" class=clFold>"; 

// document.body.innerHTML += output;
document.write(output);

----------
I'm willing to trade custom scripts for... [see profile]
 
Sorry, I don't have an answer for you, but I do have a few comments that might help.

First, it loads fine on my computer (Internet Explorer 6). Second, I would highly recommend reading some tutorials on classes and objects. It's a little too much to explain here, but I believe that by using classes, you could easily condense your code, making it much more efficient, easier to read, and easier to edit. Most menu scripts or scripts of such complexity almost require classes to run fast.
 

Dijo,

Did you code post completely, or did it cut off?

Maybe if the code is too much longer, you can post a URL instead?

Dan
 
I post the completely code, but it is cut off. How do I post a URL?
 
Well, yes, but how do I post a URL, including my code on the c-drive? I do't have a homesite.


/Di
 

Apply for a free homesite from someone like geocities or angelfire... Upload the code to them, and then post the URL to that free site.

Or ask your ISP if you get any webspace with your internet account... Most offer some free space (20Mb or so) these days.

Hope this helps,
Dan


 
ok, then I post the following code in this message:
Code:
*  		subMenyer 		       *
			************************************************/
			if ( eval( 'typeof( (subMenu'+i+'))' ) != 'undefined'){
				var j=0;					//ökar för varje submeny, börjar om igen efter varje huvudmeny
				while( (eval( '(subMenu'+i+'[j])' )!=null) ){  //tänk om den inte finns!!!  //kollar om submenyer finns till huvudmenyerna //while1
					//eval('document.write((subMenu'+i+'))');
					//eval('document.write((subMenu'+i+'[0]))');
						
								
					document.write("<div id=" +subMenuId+(subMenuNbr)+" class=clFoldSub>" );
				
					if( eval( '(indexsubMenu'+i+'[j])' )>0 ){   //Då ska bild läggas till
						document.write("<img src="+foldImg.src+" id=imgsubMenu"+i+"_"+j+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //bilden för submenu
						document.write('&nbsp');
						document.write('<a href="#" onclick="foldSubmenu(\'subMenu'+i+'_'+j+'\',\''+subsubMenuNbr+'\'); return false" onKeyPress="foldSubmenu(\'subMenu'+i+'_'+j+'\',\''+subsubMenuNbr+'\'); return false" class="clSubLinks" > '+ eval( '(subMenu'+i+'[j])' ) +' </a><br>' );
					
					}else{
						aLink=( eval( '(indexsubMenu'+i+'.link'+j+')' ) )  // tex indexsubMenu0.link0
						document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+" width=10 height=10 border=0>" );  //ingen bild
						document.write('&nbsp');
						document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks" > '+ eval( '(subMenu'+i+'[j])' ) +' </a><br>' );  //länk
					}
			
					/***********************************************
					*  		subsubMenyer 		       *
					************************************************/
					//kollar först om det finns submenyer till subMenu0[0]:
					//  ->finns det en subMenu00? 
					//sedan om det finns submenyer till subMenu0[1]:
					//  ->finns det en subMenu01? .....
					//sedan om det finns submenyer till subMenu1[0]:
					//  ->finns det en subMenu10?
					
					if ( eval( 'typeof( (subMenu'+i+'_'+j+'))' ) != 'undefined'){
						var k=0;   
						while( (eval( '(subMenu'+i+'_'+j+'[k])' )!=null) ){      //while2
							//eval( 'document.write( (subMenu'+i+j+'[k]  ) )' );
							//document.write(subMenu0_0[0]);
							document.write("<div id=" +subsubMenuId+(subsubMenuNbr)+" class=clFoldSub2>" );
							
							if( eval( '(indexsubMenu'+i+'_'+j+'[k])' )>0 ){   //Då ska bild läggas till
								document.write("<img src="+foldImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //bilden 
								document.write('&nbsp');
								document.write('<a href="#" onclick="foldSub2menu(\'subMenu'+i+'_'+j+'_'+k+'\',\''+sub3MenuNbr+'\'); return false" onKeyPress="foldSub2menu(\'subMenu'+i+'_'+j+'_'+k+'\',\''+sub3MenuNbr+'\'); return false" class="clSubLinks2" > '+ eval( '(subMenu'+i+'_'+j+'[k])' ) +' </a><br>' );
						
							}else{
								aLink=( eval( '(indexsubMenu'+i+'_'+j+'.link'+k+')' ) )  // tex indexsubMenu01.link0
								document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+" width=10 height=10 border=0>" );  //ingen bild
								document.write('&nbsp');
								document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks2" > '+ eval( '(subMenu'+i+'_'+j+'[k])' ) +' </a><br>' );  //länk
						
							}
							
							menuTmpObj = document.getElementById((subsubMenuId+subsubMenuNbr));  //sätter alla submenyer till synliga
							menuTmpObj.style.display = 'none';
							menuTmpObj.style.visibility="hidden";
							
							/***********************************************
							*  		sub3Menyer 		       *
							************************************************/					
							if ( eval( 'typeof( (subMenu'+i+'_'+j+'_'+k+'))' ) != 'undefined'){
								var l=0;	//subMenu000
								while( (eval( '(subMenu'+i+'_'+j+'_'+k+'[l])' )!=null) ){   //tex subMenuId111[0]  while3
									document.write("<div id=" +sub3MenuId+(sub3MenuNbr)+" class=clFoldSub3>" );
									
									if( eval( '(indexsubMenu'+i+'_'+j+'_'+k+'[l])' )>0 ){   //Då ska bild läggas till, indexsubMenu111
										document.write("<img src="+foldImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+"_"+l+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //bild
										document.write('&nbsp');
										document.write('<a href="#" onclick="foldSub3menu(\'subMenu'+i+'_'+j+'_'+k+'_'+l+'\',\''+sub4MenuNbr+'\'); return false" onKeyPress="foldSub3menu(\'subMenu'+i+'_'+j+'_'+k+'_'+l+'\',\''+sub4MenuNbr+'\'); return false" class="clSubLinks3" > '+ eval( '(subMenu'+i+'_'+j+'_'+k+'[l])' ) +' </a><br>' );  
									}else{	
										aLink=( eval( '(indexsubMenu'+i+'_'+j+'_'+k+'.link'+l+')' ) )  // tex indexsubMenu010.link0
										document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+"_"+l+" width=10 height=10 border=0>" );  //ingen bild
										document.write('&nbsp');
										document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks3" > '+ eval( '(subMenu'+i+'_'+j+'_'+k+'[l])' ) +' </a><br>' );  //länk
									}
										 
									menuTmpObj = document.getElementById((sub3MenuId+sub3MenuNbr));  //sätter alla submenyer till synliga
									menuTmpObj.style.display = 'none';
									menuTmpObj.style.visibility="hidden";
									
									
									
									/***********************************************
									*  		sub4Menyer 		       *
									************************************************/					
									if ( eval( 'typeof( (subMenu'+i+'_'+j+'_'+k+'_'+l+'))' ) != 'undefined'){
										var m=0;	//subMenu0100
										while( (eval( '(subMenu'+i+'_'+j+'_'+k+'_'+l+'[m])' )!=null) ){   //tex subMenuId1111[0]
											aLink=( eval( '(indexsubMenu'+i+'_'+j+'_'+k+'_'+l+'.link'+m+')' ) )  // tex indexsubMenu010.link0
											document.write("<div id=" +sub4MenuId+(sub4MenuNbr)+" class=clFoldSub4>" );
											document.write("<img src="+foldNoImg.src+" id=imgsubMenu"+i+"_"+j+"_"+k+"_"+l+"_"+m+" width=10 height=10 border=0 style='position: relative; top: -5px; left: 0px;'>" );  //ingen bild
											document.write('&nbsp');
											document.write('<a href="#" onclick="link(\''+aLink+'\'); return false" onKeyPress="link(\''+aLink+'\'); return false" class="clSubLinks4" > '+ eval( '(subMenu'+i+'_'+j+'_'+k+'_'+l+'[m])' ) +' </a><br>' );  
											document.write("</div>"); 
				
											menuTmpObj = document.getElementById((sub4MenuId+sub4MenuNbr));  //sätter alla submenyer till osynliga
											menuTmpObj.style.display = 'none';
											menuTmpObj.style.visibility="hidden";
											m++;
											sub4MenuNbr++;
							
							  			}
						
						
									}   
									/***********************************************
									*  		slut på sub4Menyer 	       *
									************************************************/
															
									l++;
									sub3MenuNbr++;
									document.write("</div>");
							
							  	}   //slut på while3
						
						
							}   
							/***********************************************
							*  		slut på sub3Menyer 	       *
							************************************************/
							
							
							k++;
							subsubMenuNbr++;
						     document.write("</div>");  //slut på array subMenu11, diven subsubMenuId0, subsubMenuId1.. 
							
						} 	//slut på while2
					
					}
					/***********************************************
					*  		slut på subsubMenyer 	       *
					************************************************/
					
					
					j++;		//plats i varje array (i subMenuId0, subMenuId1)
					subMenuNbr++;  //Nummer på id i submenyerna (tex subMenuId0, subMenuId7), incrementeras varje gång det blir en ny submeny
				     document.write("</div>");	//slut på div subMenuId0, subMenuId1						
		
				} //slut på while1
			}
			/***********************************************
			*  		slut på subMenyer 	       *
			************************************************/
		
		document.write("</div>");  //slut på div menu0, menu1
		document.write("<BR>");
		/***********************************************
		*  	slut på huvudmenyer		       *
		************************************************/
		
		
	} 	//slut på for()
	
document.write('</div>');  //slut på diven över alla
}


/Diana
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top