
var menu = new Array (
	new Array ("Home"),
	new Array ("About Us",
			"Introduction",
			"Company Background",
			"Recruitment"),
	new Array ("What We Do",
			"Restoration Projects",
			"General Building",
			"Specialist Building",
			"Insurance Funded Reconstruction"),
	new Array ("Contract Profiles",
		/*	"Current Contracts",*/
			"Restoration Contracts",
			"Building Contracts",
			"Specialist Contracts",
			"Insurance Contracts"),
	new Array ("Contact Us",
			"Survey Request",
			"How To Find Us"/*,
			"Send Feedback"*/)
);

var links = new Array (
	new Array ("home/index.htm"),
	new Array ("aboutus/index.htm",
			"aboutus/introduction.htm",
			"aboutus/companybackground.htm",
			"aboutus/recruitment.htm"),
	new Array ("whatwedo/index.htm",
			"whatwedo/restorationprojects.htm",
			"whatwedo/generalbuilding.htm",
			"whatwedo/specialistbuilding.htm",
			"whatwedo/insurancefundedreconstruction.htm"),
	new Array ("contractprofiles/index.htm",
			/*"contractprofiles/currentcontracts.htm",*/
			"contractprofiles/restorationcontracts.htm",
			"contractprofiles/buildingcontracts.htm",
			"contractprofiles/specialistcontracts.htm",
			"contractprofiles/insurancecontracts.htm"),
	new Array ("contactus/index.htm",
			"contactus/enquiry.htm",
			"contactus/howtofindus.htm"/*,
			"contactus/feedback.htm"*/)
);

function generatemenu(selected_main, selected_sub, within) {
	var html = '';
	var nextid = 100;

	for (var n = 0; n < menu.length; n++) {
		if (selected_main == n) {
			if (selected_sub == 0) {
				// main menu page
				html += '<div class="ln-1-currentpage"><img src="../images/layout/1x1trans.gif" width="10" height="30" alt="" border="0"><img src="../images/layout/LNa_R.gif" width="14" height="7" alt="' +
					menu[n][0] + 
					'" vspace="7" align="middle"><span class="lntxt-1">' + 
					menu[n][0] +
					'</span> </div>';
				
				for (var i = 1; i < menu[n].length; i++) {
					// sub-menu item
					html += '<div class="ln-2" id="LN_2_' +
						nextid +
						'"><img src="../images/layout/LNa_R.gif" alt="' +
						menu[n][i] +
						'" width="14" height="7" vspace="7" align="top" id="LN_2_' +
						nextid +
						'"><span class="lntxt-2" id="LN_2_' +
						nextid +
						'"><a id="LN_2_' +
						nextid +
						'" href="../' +
						links[n][i] +
						'">' +
						menu[n][i] +
						'</a></span></div>';
					
					nextid++;
				}
				
				// white line
				html += '<div style="height:1px;width:190px"> <img src="../images/layout/1x1white.gif" width="190" height="1" alt="---" border="0" style="position:absolute;"></div>';
			}
			else {
				// main menu item
				html += '<div class="ln-1" id="LN_1_' +
					nextid +
					'"> <img src="../images/layout/1x1trans.gif" width="10" height="30" alt="" border="0" id="LN_1_' +
					nextid +
					'"><img src="../images/layout/LNa_D.gif" width="14" height="7" alt="' +
					menu[n][0] +
					'" vspace="7" align="middle" id="LN_1_' +
					nextid +
					'"><span class="lntxt-1" id="LN_1_' +
					nextid +
					'"><a id="LN_1_' +
					nextid +
					'" href="../' +
					links[n][0] + 
					'">' +
					menu[n][0] +
					'</a></span> </div>';
				
				// sub-menu items
				for (var i = 1; i < menu[n].length; i++) {
					if (i == selected_sub) {
						if (!within) {
							// selected sub-menu item
							html += '<div class="ln-2-currentpage"><img src="../images/layout/LNa_R.gif" alt="' +
								menu[n][i] +
								'" width="14" height="7" vspace="7" align="top"><span class="lntxt-2">' +
								menu[n][i] +
								'</span></div>';
						}
						else {
							// sub-menu page is within
							html += '<div class="ln-2-within" id="LN_3_' +
								nextid +
								'"><img src="../images/layout/LNa_R.gif" alt="' +
								menu[n][i] +
								'" width="14" height="7" vspace="7" align="top" id="LN_3_' +
								nextid +
								'"><span class="lntxt-2" id="LN_3_' +
								nextid +
								'"><a id="LN_3_' +
								nextid +
								'" href="../' +
								links[n][i] +
								'">' +
								menu[n][i] +
								'</a></span></div>';
						
							nextid++;
						}
					}
					else {
						// sub-menu item
						html += '<div class="ln-2" id="LN_2_' +
							nextid +
							'"><img src="../images/layout/LNa_R.gif" alt="' +
							menu[n][i] +
							'" width="14" height="7" vspace="7" align="top" id="LN_2_' +
							nextid +
							'"><span class="lntxt-2" id="LN_2_' +
							nextid +
							'"><a id="LN_2_' +
							nextid +
							'" href="../' +
							links[n][i] +
							'">' +
							menu[n][i] +
							'</a></span></div>';
						
						nextid++;
					}
				}
			}

		}
		else {
			// main menu item
			html += '<div class="ln-1" id="LN_1_' +
				nextid +
				'"> <img src="../images/layout/1x1trans.gif" id="LN_1_' +
				nextid +
				'" width="10" height="30" alt="" border="0"><img src="../images/layout/LNa_R.gif" id="LN_1_' +
				nextid +
				'" width="14" height="7" alt="' +
				menu[n][0] +
				'" vspace="7" align="middle"><span class="lntxt-1" id="LN_1_' +
				nextid +
				'"><a id="LN_1_' +
				nextid +
				'" href="../' +				
				links[n][0] +
				'">' +
				menu[n][0] +
				'</a></span></div>';
			
			// white line
			html += '<div style="height:1px;width:190px"> <img src="../images/layout/1x1white.gif" width="190" height="1" alt="---" border="0" style="position:absolute;"></div>';
							
			nextid++;
		}
	}
	document.write(html);
}

