// EAN			--------	This script has been developed only for Internet Explorer (manager request)

function submenu(){
	
	
	var menu = document.getElementById("equip_submenu");
	var nb_options = menu.childNodes.length;
	var page_title = document.title;
	var equiment_name_index = page_title.indexOf("Equipment > ");
	
	var equipment_name = page_title.substring(equiment_name_index);
		equipment_name_index = equipment_name.indexOf("> ") + 2;
		equipment_name = equipment_name.substring(equipment_name_index);
	var index2 =  equipment_name.indexOf(" >");
		equipment_name = equipment_name.substring(0, index2) +"_";
	
	//alert(equipment_name);
	
	var focus_btn;
	
	//default settings
	
	
	
	//alert( page_title.indexOf(subsection_name) >= 0 );
	
	for(var i = 0 ; i < nb_options ; i++){
		var btn_ID = menu.childNodes[i].getAttribute("id");
		//alert(btn_ID);
		var subsection_index = btn_ID.indexOf("_") + 1;
		var subsection_name = btn_ID.substring(subsection_index);
		//alert( page_title.indexOf(subsection_name) >= 0 );
		
		if( page_title.indexOf(subsection_name) >= 0 ){
			
			focus_btn = menu.childNodes[i];
			focus_btn.style.backgroundColor = "#3D1101";
			focus_btn.style.color = "#F6F4DF";
		}
	}
	
	
	
	
	


	for(var i = 0 ; i < nb_options ; i++){
		
			menu.childNodes[i].onmouseover = function(){
				if(this != focus_btn){
					this.style.backgroundColor = "#3D1101";
					this.style.color = "#F6F4DF";
					this.style.cursor = "pointer";
				}
				else if(this == focus_btn){
					this.style.cursor = "default";
				}
			}
			
			menu.childNodes[i].onmouseout = function(){
				if(this != focus_btn){
					this.style.backgroundColor = "#E5E3CE";
					this.style.color = "#3D1101";
					this.style.cursor = "default";
				}
			}	
			
			menu.childNodes[i].onclick = function(){
				var father = "Equipment_"
				var son_index = (this.getAttribute("id")).indexOf("_") + 1;
				var son_name = (this.getAttribute("id")).substring(son_index);
				var grandSon;
				//alert(equiment_name_index);
				//alert(father+ equipment_name +"---"+ son_name);
				
				switch(son_name){
					case "Prestige": grandSon = "_990";			break;
					case "Esprit": grandSon = "_770";			break;
					case "OpenSun": grandSon = "_550";			break;
					case "Affinity": grandSon = "_500";			break;
					case "Advantage": grandSon = "_350";		break;
					case "Ambition": grandSon = "_200";			break;
					
					case "Radius": grandSon = "_252";			break;
					case "332Pro": grandSon = "_332";			break;
					
					default: grandSon = "";	//alert(grandSon);
				}
				grandSon += ".html";
				
			//	alert(grandSon);
				
				var direction = father+ equipment_name + son_name + grandSon;
				
				
				
				//if we are not already in the page
				if(this != focus_btn)
					document.location.href = direction;
			}	

	}//---- end for
	
}