/* STANDARD ROLLOVERS */

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}
 /* ============================================================================================== */
 
 /* MENU INITIALISATION */
 
function init() {
	//==========================================================================================
	// if supported, initialize TransMenus
	//==========================================================================================
	// Check isSupported() so that menus aren't accidentally sent to non-supporting browsers.
	// This is better than server-side checking because it will also catch browsers which would
	// normally support the menus but have javascript disabled.
	//
	// If supported, call initialize() and then hook whatever image rollover code you need to do
	// to the .onactivate and .ondeactivate events for each menu.
	//==========================================================================================
	//if (TransMenu.isSupported()) {
		TransMenu.initialize();

		// hook all the highlight swapping of the main toolbar to menu activation/deactivation
		// instead of simple rollover to get the effect where the button stays hightlit until
		// the menu is closed.
		menu1.onactivate = function() { document.getElementById("tab_about").className = "hover"; };
		menu1.ondeactivate = function() { document.getElementById("tab_about").className = ""; };
	//}
}

 /* ============================================================================================== */
 
 /* MENU CREATION */
 
 function create_menus() {
 
 	//==================================================================================================
 	// create a set of dropdowns
 	//==================================================================================================
 	// the first param should always be down, as it is here
 	//
 	// The second and third param are the top and left offset positions of the menus from their actuators
 	// respectively. To make a menu appear a little to the left and bottom of an actuator, you could use
 	// something like -5, 5
 	//
 	// The last parameter can be .topLeft, .bottomLeft, .topRight, or .bottomRight to inidicate the corner
 	// of the actuator from which to measure the offset positions above. Here we are saying we want the
 	// menu to appear directly below the bottom left corner of the actuator
 	//==================================================================================================
 	var ms = new TransMenuSet(TransMenu.direction.down, 1, 1, TransMenu.reference.bottomLeft);
 
 	//==================================================================================================
 	// create a dropdown menu
 	//==================================================================================================
 	// the first parameter should be the HTML element which will act actuator for the menu
 	//==================================================================================================
 	var menu1 = ms.addMenu(document.getElementById("tab_about"));
 	menu1.addItem("<b>The Chamber</b>", "http://www.nhcci.co.uk/about/index.php");
 	menu1.addItem("<b>Our three offices</b>", "http://www.nhcci.co.uk/about/offices.php");
 	menu1.addItem("<b>Chamberblog</b>", "http://www.nhcci.co.uk/about/chamberblog.php");
 	menu1.addItem("<b>Affiliates</b>", "http://www.nhcci.co.uk/about/affiliates.php");
	menu1.addItem("<b>How to join</b>", "http://www.nhcci.co.uk/about/join.php");
	menu1.addItem("<b>Jobs with the NHCCI</b>", "http://www.nhcci.co.uk/about/vacancies.php");
	menu1.addItem("<b>Useful Links</b>", "http://www.nhcci.co.uk/about/related_organisations.php");
 	menu1.addItem("<b>Site map</b>", "http://www.nhcci.co.uk/about/map.php");
	//==================================================================================================
 	var menu2 = ms.addMenu(document.getElementById("tab_events"));
 	menu2.addItem("<b>Chamber News</b>", "http://www.nhcci.co.uk/events/chamber_news.php");
 	menu2.addItem("<b>NHCCI General Events</b>", "http://www.nhcci.co.uk/events/events.php?event_type=General");
 	menu2.addItem("<b>NHCCI International Events</b>", "http://www.nhcci.co.uk/events/events.php?event_type=International");
 	menu2.addItem("<b>NHCCI Training Events</b>", "http://www.nhcci.co.uk/events/events.php?event_type=Training");
 	menu2.addItem("<b>Other Events</b>", "http://www.nhcci.co.uk/events/events.php?event_type=Other"); 	
	//==================================================================================================	
 	var menu3 = ms.addMenu(document.getElementById("tab_member"));
 	menu3.addItem("<b>Benefits overview</b>", "http://www.nhcci.co.uk/member_benefits/index.php");
 	menu3.addItem("<b>ChamberConnections</b>", "http://www.nhcci.co.uk/member_benefits/chamber_connect.php");
 	menu3.addItem("<b>Chamber HR Support</b>", "http://www.nhcci.co.uk/member_benefits/chamber_hr.php");
 	menu3.addItem("<b>Legal Expenses Insurance</b>", "http://www.nhcci.co.uk/member_benefits/legal.php");
 	menu3.addItem("<b>Chamber H & S Support</b>", "http://www.nhcci.co.uk/member_benefits/chamber_HandS_support.php");
 	menu3.addItem("<b>Debt Management</b>", "http://www.nhcci.co.uk/member_benefits/debt_management.php");
	menu3.addItem("<b>Chamber Utilities</b>", "http://www.nhcci.co.uk/member_benefits/utilities.php");
	menu3.addItem("<b>More Benefits</b>", "http://www.nhcci.co.uk/member_benefits/member_benefits.php");
	menu3.addItem("<b>Subscribe to Business Update</b>", "http://www.nhcci.co.uk/member_benefits/b_update.php");
	//==================================================================================================
 	var menu4 = ms.addMenu(document.getElementById("tab_chamber"));
	menu4.addItem("<b>About our Activities</b>", "http://www.nhcci.co.uk/chamber_activities/index.php");
 	menu4.addItem("<b>Business Seminars</b>", "http://www.nhcci.co.uk/chamber_activities/business_seminars.php"); 
	menu4.addItem("<b>Chamber Directory</b>", "http://www.nhcci.co.uk/chamber_activities/directory.php");
	menu4.addItem("<b>Business in North Hants</b>", "http://www.nhcci.co.uk/binh/index.php");
 	menu4.addItem("<b>Networking Events</b>", "http://www.nhcci.co.uk/chamber_activities/networking.php");
	menu4.addItem("<b>Training</b>", "http://www.nhcci.co.uk/chamber_activities/training.php");
	menu4.addItem("<b>Women in Business</b>", "http://www.nhcci.co.uk/chamber_activities/women.php");
	//==================================================================================================
 	var menu5 = ms.addMenu(document.getElementById("tab_international"));
	menu5.addItem("<b>International Trade Centre</b>", "http://www.nhcci.co.uk/international/international.php");
 	menu5.addItem("<b>Advice and Guidance</b>", "http://www.nhcci.co.uk/international/international_adguid.php"); 
	menu5.addItem("<b>Export Documentation</b>", "http://www.nhcci.co.uk/international/international_export_doc.php");
	menu5.addItem("<b>Training</b>", "http://www.nhcci.co.uk/international/international_training.php");
 	menu5.addItem("<b>Trade Promotion</b>", "http://www.nhcci.co.uk/international/international_trade_prom.php");
	menu5.addItem("<b>International Trade Forum</b>", "http://www.nhcci.co.uk/international/international_trade_forum.php");
	menu5.addItem("<b>Chamber Translation</b>", "http://www.nhcci.co.uk/international/international_chamber_translation.php");
	menu5.addItem("<b>Fact Sheets</b>", "http://www.nhcci.co.uk/international/international_fact_sheets.php");
	menu5.addItem("<b>Useful websites</b>", "http://www.nhcci.co.uk/international/international_useful_web.php");
	menu5.addItem("<b>Contact the ITC</b>", "http://www.nhcci.co.uk/international/international_contact_form.php");
	//==================================================================================================
	var menu6 = ms.addMenu(document.getElementById("tab_business"));
	menu6.addItem("<b>About our role</b>", "http://www.nhcci.co.uk/business/index.php");
	menu6.addItem("<b>Quarterly Economic Survey</b>", "http://www.nhcci.co.uk/business/QES.php");
	menu6.addItem("<b>Current Projects</b>", "http://www.nhcci.co.uk/business/projects_current.php");
	menu6.addItem("<b>Recent Projects</b>", "http://www.nhcci.co.uk/business/projects_recent.php");
	//================================================================================================== 	
	var menu7 = ms.addMenu(document.getElementById("tab_contact"));
 	menu7.addItem("<b>By Phone</b>", "http://www.nhcci.co.uk/contact/phone.php");	
 	menu7.addItem("<b>By Post</b>", "http://www.nhcci.co.uk/contact/post.php");
 	menu7.addItem("<b>North East Office</b>", "http://www.nhcci.co.uk/contact/form_northeast.php");
 	menu7.addItem("<b>Basingstoke Office</b>", "http://www.nhcci.co.uk/contact/form_basingstoke.php");
	menu7.addItem("<b>Winchester Office</b>", "http://www.nhcci.co.uk/contact/form_winchester.php"); 	
	menu7.addItem("<b>Andover Office</b>", "http://www.nhcci.co.uk/contact/form_andover.php"); 	
 	//==================================================================================================
 
 
 	TransMenu.renderAll();


}
