
    var base= "http://www.trireme.com/";
    var sideMenuBase= base + "graphics/side_menu/";
    var menu = base + "graphics/menu/";


    var initialised= false;
	


// data and function to make side menu items light up on mouse over

	// number of images and links before the array of side menu images/links
	var num_pre_side_menu = 0;
	
	// number of images in side menu    ( = last index + 1 !!)
	var num_side_menu = 11;
   
	var side_menu = new Array(num_side_menu);
	side_menu[0] = 'testimonials';
	side_menu[1] = 'contact_us';
	side_menu[2] = 'about_us';
	side_menu[3] = 'partners';
	side_menu[4] = 'site_map';
	side_menu[5] = 'courses';
	side_menu[6] = 'events';
	side_menu[7] = 'clients';
	side_menu[8] = 'home';
	side_menu[9] = 'news';	
	side_menu[10]= 'links';
	
	function sideMenuHighlight(side_menu_index, mouse_in) 
        {
                if (!initialised) init();
	
    		for (var i = 0; i < num_side_menu; i++) {
			document.images[num_pre_side_menu + i].src = sideMenuBase
                             + (mouse_in == 1 && side_menu_index == i ? "selected/" : "")
                             + side_menu[i] + '.gif';
	  	}
	}
// ++++++++++++ script to handle top and side menus +++++++++++++++++++


    
	var firstImage = 0;
	var firstLink = 0;
	
	// code to find the array number of an image and link - in this case 'your_requirements.gif'
	// These are used as starting points in manipulation of the array

function init()
{
        initialised= true;
	var i = null;
	for (i = 0 ; i < 300 ; i++) {
	 if (document.images[i].src.indexOf("your_requirements")!=-1){
	  firstImage = i;
	  break;
	 }
	}
	
	
	// code to find the array number of a link
	// in this case 'your_requirements'
	for (i = 0 ; i < document.links.length ; i++) {
	
	 if (document.links[i].href.indexOf('your_requirements') != -1){
	  firstLink = i;
	  break;
	 }
	}
}
	// number of images within the main menu
	var num_top = 4;
	var num_middle = 4;
	var num_bottom = 4;
	
	// MENU TREE MATRICES:
	var top_menu = new Array(num_top);
  	top_menu[0] = 'your_requirements';
  	top_menu[1] = 'custom_solutions';
  	top_menu[2] = 'expert_help';
  	top_menu[3] = 'whitepapers';  
	
  	// First element of the nested array is the value of the middle menu, rest bottom menu
	// matrix for the tree under top[0] - in this case 'your_requirements' 
  	var top_0 = new Array(num_middle);
  	top_0[0] = new Array('blank', 'blank', 'blank', 'blank', 'blank');
  	top_0[1] = new Array('blank', 'blank', 'blank', 'blank', 'blank');
  	top_0[2] = new Array('blank', 'blank', 'blank', 'blank', 'blank');
  	top_0[3] = new Array('blank', 'blank', 'blank', 'blank', 'blank');
	
  	// matrix for the tree under top[1] - in this case 'custom_solutions'
  	var top_1 = new Array(num_middle);
  	top_1[0] = new Array('consultancy', 'blank', 'blank', 'blank', 'blank');
  	top_1[1] = new Array('project_work', 'blank', 'manage_projects', 'develop_software', 'blank');
  	top_1[2] = new Array('training', 'blank', 'blank', 'blank', 'blank');
  	top_1[3] = new Array('mentoring', 'blank', 'blank', 'blank', 'blank');
	
   	// matrix for the tree under top[2] - in this case 'expert_help' 
  	var top_2 = new Array(num_middle);
  	top_2[0] = new Array('blank', 'blank', 'blank', 'blank', 'blank');
  	top_2[1] = new Array('blank', 'blank', 'blank', 'blank', 'blank');
  	top_2[2] = new Array('blank', 'blank', 'blank', 'blank', 'blank');
  	top_2[3] = new Array('blank',  'blank', 'blank', 'blank', 'blank');
	
  	// matrix for the tree under top[3] - in this case 'whitepapers' 
  	var top_3 = new Array(num_middle);
  	top_3[0] = new Array('process', 'adoption', 'requirements', 'definition', 'business_modelling');
  	top_3[1] = new Array('architecture', 'model_based', 'integration', 'e_business', 'blank');
  	top_3[2] = new Array('design', 'blank', 'patterns', 'components', 'objects');
  	top_3[3] = new Array('development', 'technology', 'languages', 'applications', 'usability');

	// SELECTION STATE:
	// use to change individual top menu items
  	var top_item_choice = 'unchosen';
	// use to hold the matrix related to a top menu choice
  	var top_choice = 'unchosen';
	// use to hold the matrix related to a middle menu choice
  	var middle_choice = 'unchosen';

  	function processMouseOver(menu, position) {
                if (!initialised) init();
    
		if (menu == 'top') {
	  		middle_choice = 'unchosen';

			if (position == '0') {
				top_item_choice = top_menu[0];
				top_choice = top_0;
			}
			if (position == '1') {
				top_item_choice = top_menu[1];
				top_choice = top_1;
			}
			if (position == '2') {
				top_item_choice = top_menu[2];
				top_choice = top_2;
			}
			if (position == '3') {
				top_item_choice = top_menu[3];
				top_choice = top_3;
			}
			highlight (menu, position);
			display (top_choice);
    	        }
		if ((menu == 'middle') & (top_choice != 'unchosen')) {
	  		if (top_choice[position][0] != 'blank') 
                        {   middle_choice = top_choice[position];
	  		    highlight (menu, position);
	  		    display (middle_choice);
                        }
		}	
		if ((menu == 'bottom') & (middle_choice != 'unchosen')){
	  		highlight (menu, position);
		}
  	}
    
	function highlight (menu_in, position_in) 
        {
		if (menu_in == 'top') {
		    var i = null;
		    for (i = 0; i < num_top; i++) {
  			document.images[i + firstImage].src = menu
                            + (i == position_in ? 'selected/' : 'greyed/')
			    + top_menu[i] + '.gif';
		    }
		}
		
 		if (menu_in == 'middle') {
		    var i = null;
	  	    for (i = 0; i < num_middle; i++) {
  			document.images[i + firstImage + num_top].src = menu 
		  		+ (i == position_in ? 'selected/' : 'greyed/')
		  		+ top_choice[i][0] + '.gif';
      		    }
		}
 	
		if (menu_in == 'bottom') {
		    var i = null;
	  	    for (i = 0; i < num_bottom; i++) {
	    		document.images[i + firstImage + num_top + num_middle].src = menu
		  		+ (i == position_in ? 'selected/' : 'greyed/')
                                + middle_choice[i + 1] + '.gif';
	  	    }
		}	
	}
    
  	// this also handles the dynamic links
 	function display(choice_array) {
      	    if (choice_array == top_choice) {
		// set bottom row to blanks
		var i = null;
		for (i = 0; i < num_bottom; i++) {
	    	    document.images[i + firstImage + num_top + num_middle].src = menu + 'blank.gif';
		    document.links[i + firstLink + num_top + num_middle].href = '#';
	  	}

	 	for (i = 0; i < num_middle; i++) {
		    document.images[i + firstImage + num_top].src = 
			    menu + choice_array[i][0] + '.gif';
                    document.links[i + firstLink + num_top].href = 
                        choice_array[i][0] == 'blank' ? "#" :
                            base + top_item_choice + '/' + choice_array[i][0] + '.html';
	  	}
	    }
	
	    if (choice_array == middle_choice) {
		var i = null;
		for (i = 0; i < num_bottom; i++) {
	    	    document.images[i + firstImage + num_top + num_middle].src = 
		    menu + choice_array[i+1] + '.gif';
		    document.links[i + firstLink + num_top + num_middle].href = 
                        middle_choice[i+1] == 'blank' ? '#' :
			    base + top_item_choice + '/' + middle_choice[0] + '/' + middle_choice[i+1] + '.html';
		}
            }
  	}	


        function resetTopMenu()
        {
            if (!initialised) init();
            
            if ('unchosen' == middle_choice)
            {
                var i = null;
		for (i=0; i < num_top; i++) 
                {
  			document.images[i + firstImage].src = menu + top_menu[i] + '.gif';
		}

                for (i=0; i<num_middle; i++)
                {
			document.images[i + firstImage + num_top].src = menu + 'blank.gif';
                        document.links[i+ firstLink + num_top].href = "#";
                }
                top_choice= 'unchosen';
            }
        }


// ++++++++++++ END OF script to handle top and side menus +++++++++++++++++++



menuScriptLoaded=true;
