var vActObj = null;
var vTemp = window.location.href.split('/');
var vHREF = vTemp[vTemp.length-1];

var  vMenu = [
				['Home', 'Home', 'index.htm'],
				['About Us', 'About Us', 'about.htm'],
				['Products', 'Products', 'products.htm'],
				['Quality', 'Quality', 'quality.htm'],
				['Clientele', 'Clientele', 'clientele.htm'],
				['Sales Network', 'Sales Network', 'network.htm'],
				['News & Events', 'News & Events', 'news.htm'],
				['Contact Us', 'Contact Us', 'contact.php']
			];
			
var  vProducts = [
				[
					['Automatic Control Valve', 'Automatic Control Valve', 'automatic.htm'],
					[
						['Digital Control Valve', 'Digital Control Valve', 'digital_control_valve.htm'],
						['Deluge Valve', 'Deluge Valve', 'deluge_valve.htm'],
						['SLUG Control Valve', 'SLUG Control Valve', 'slug_control_valve.htm'],
						['Pressure Reducing Valve', 'Pressure Reducing Valve', 'pressure_reducing_valve.htm'],
						['Slow Acting Check Valve', 'Slow Acting Check Valve', 'slow_acting_check_valve.htm'],
						['Solenoid On/Off Valve', 'Solenoid On/Off Valve', 'solenoid_valve.htm'],
						['Pressure Relief Valve', 'Pressure Relief Valve', 'pressure_relief_valve.htm']
					]
				],
				[
					['Pneumatic Control Valve', 'Pneumatic Control Valve', 'pneumatic.htm'],
					[
						['Motorised Control Valve', 'Motorised Control Valve', 'motorised_control_valve.htm'],
						['Pneumatic Control Valve', 'Pneumatic Control Valve', 'pneumatic_valve.htm'],
						['Pneumatic Actuated Ball Valve', 'Pneumatic Actuated Ball Valve', 'pneumatic_actuated_ball_valve.htm'],
						['Pneumatic Actuated Butterfly Valve', 'Pneumatic Actuated Butterfly Valve', 'pneumatic_actuated_butterfly_valve.htm'],
						['Robotrol Operated Pneumatic Control Valve', 'Robotrol Operated Pneumatic Control Valve', 'robotrol_valve.htm']
					]
				],
				[
					['Safety Relief Valve', 'Safety Relief Valve', 'safety.htm'],
					[
						['Safety Relief Valve SVC-500', 'Safety Relief Valve SVC-500', 'safety_relief_valve_svc500.htm'],
						['Safety Relief Valve SVE-520', 'Safety Relief Valve SVE-520', 'safety_relief_valve_sve520.htm'],
						['Safety Relief Valve T-100', 'Safety Relief Valve T-100', 'safety_relief_valve_t100.htm'],
						['Thermal Relief Valve', 'Thermal Relief Valve', 'thermal_relief_valve.htm'],
						['Pressure Relief Valve', 'Pressure Relief Valve', 'pressure_relief_valve.htm']
					]
				],
				[
					['Pressure Reducing/Regulating Valve', 'Pressure Reducing/Regulating Valve', 'pressure.htm'],
					[
						['Nitrogen Blanketing Valve', 'Nitrogen Blanketing Valve', 'nitrogen_blanketing_valve.htm'],
						['Pressure Reducing Valve', 'Pressure Reducing Valve', 'pressure_reducing_valve.htm'],
						['Pilot Operated Pressure Reducing Valve', 'Pilot Operated Pressure Reducing Valve', 'pilot_operated_pressure_reducing_valve.htm'],
						['Pressure Reducing Valve - Steam Service', 'Pressure Reducing Valve - Steam Service', 'pressure_reducing_valve_steam.htm'],
						['Robotrol Operated Pneumatic Control Valve', 'Robotrol Operated Pneumatic Control Valve', 'robotrol_valve.htm']
					]
				],
				[
					['Gas Skid/PRS/De-superheater', 'Gas Skid/PRS/De-superheater', 'others.htm'],
					[
						['Gas Metering Skid', 'Gas Metering Skid', 'gas_metering_skid.htm'],
						['De-Superheater', 'De-Superheater', 'de_superheater.htm'],
						['Pressure Reducing Station for Gas', 'Pressure Reducing Station for Gas', 'pressure_reducing_station_Gas.htm'],
						['Pressure Reducing Station for Steam', 'Pressure Reducing Station for Steam', 'pressure_reducing_station_steam.htm']
					]
				]
/*				[
					['Digital Control Valve', 'Digital Control Valve', 'digital.htm']
				],
				[
					['Deluge Valve', 'Deluge Valve', 'deluge.htm']
				]*/
			];

function showmenu(obj)
{
	if(vActObj && vActObj!=obj.childNodes[1]) vActObj.style.display = 'none';
	vActObj = obj.childNodes[1];
	vActObj.style.display = 'block';
}

function rendermenu()
{
	var vTemp = '';
	var isPage = false;
	var isProduct = false;
	var vProductsHTML = '';
	
	for(var i=0; i< vProducts.length; i++)
	{
		vTemp = '';
		isPage = false;
		
		for(var j=0; j< vProducts[i][1].length; j++)
		{
			if(vHREF==vProducts[i][1][j][2]) { vTemp += '<p class="over">'; isPage= true; } else vTemp += '<p onmouseover="this.className=\'over\';" onmouseout="this.className=\'\';">';
			vTemp += '<a title="' +  vProducts[i][1][j][1] + '" href="./' +  vProducts[i][1][j][2] + '">' +  vProducts[i][1][j][0] + '</a></p>';
		}
		
		if(!isPage) isPage = (vHREF==vProducts[i][0][2]);
		
		if(isPage) vProductsHTML += '<li class="over">'; else  vProductsHTML += '<li onmouseover="this.className=\'over\'; showmenu(this);" onmouseout="this.className=\'\';">';
		vProductsHTML += '<a title="' +  vProducts[i][0][1] + '" href="' +  vProducts[i][0][2] + '">' +  vProducts[i][0][0] + '</a>';
		if(isPage) vProductsHTML += '<div style="display:block">'; else  vProductsHTML += '<div>';
		vProductsHTML += vTemp + '</div></li>';
		
		if(!isProduct && isPage) isProduct = true;
	}
	
	vProductsHTML = '<h1>Products</h1><ul>' +  vProductsHTML + '</ul>';

	var obj = document.getElementById('product');
	if(obj) obj.innerHTML =  vProductsHTML;

	var obj = document.getElementById('menu'); if(!obj) return;

	for(var i=0; i<vMenu.length; i++)
	{
		obj.innerHTML += '<a class="' + ((vHREF==vMenu[i][2] || (isProduct && vMenu[i][2]=='products.htm')) ? 'active' : '') + '" title="' + vMenu[i][1] + '" href="./' + vMenu[i][2] + '">' + vMenu[i][0] + '</a>';
		if(i<vMenu.length-1) obj.innerHTML += ' | ';
	}
}

if(window.attachEvent) window.attachEvent('onload', rendermenu);
else window.addEventListener('load', rendermenu, false);
