
var currentSection = null;
var currentSubSection = null;

//custom functions
function findPage() {
	
	//find page name
	var thisURL = document.URL;
	var thisDomain = "lyonhealy.com";
	var currentPage = thisURL.substring(thisURL.indexOf(thisDomain) + thisDomain.length);
	if (currentPage.charAt(currentPage.length) == "/") {
		currentPage = currentPage.substring(currentPage.length - 1);
	}
	
	var urlSection = null;
	
	if (currentPage.indexOf("/pedal-") > -1) {
		currentSection = "nav_harps";
		urlSection = "harps_pedalHarps";
	} else if (currentPage.indexOf("/lever-") > -1) {
		currentSection = "nav_harps";
		urlSection = "harps_leverHarps";
	} else if (currentPage.indexOf("/special-") > -1) {
		currentSection = "nav_harps";
		urlSection = "harps_specialInst";
	}
	
	if ( currentPage == "/index.htm" || currentPage == "/") {
		currentSection = "nav_home";
	}
	else if ( currentSection == "nav_harps" || currentPage == "/prices.htm" || currentPage == "/finishes.htm" ) {
		MM_showHideLayers('subnav_harps','','show','subnav_services','','hide','subnav_about','','hide','subnav_news','','hide','subnav_hall','','hide');
		
		//if current page is a subpage, highlight that page too
		if ( urlSection == "harps_pedalHarps" ) {		changeImages('harps_pedalHarps', '/images/subnav/pedal-harps-on.gif');	currentSubSection = "harps_pedalHarps";	}
		else if ( urlSection == "harps_leverHarps" ) {	changeImages('harps_leverHarps', '/images/subnav/lever-harps-on.gif');	currentSubSection = "harps_leverHarps";	}
		else if ( urlSection == "harps_specialInst" ) {	changeImages('harps_specialInst', '/images/subnav/gold-harps-on.gif');	currentSubSection = "harps_specialInst";	}
		else if ( currentPage == "/finishes.htm" ) {	changeImages('harps_finishes', '/images/subnav/finishes-on.gif');		currentSubSection = "harps_finishes";	}
		else if ( currentPage == "/prices.htm" ) {		changeImages('harps_prices', '/images/subnav/prices-on.gif');			currentSubSection = "harps_prices";	}
	}
	else if ( currentPage == "/roadRegulation.htm" || currentPage == "/repairs.htm" || currentPage == "/techguild.htm" || currentPage == "/appraisal.php" ) {
		currentSection = "nav_services";
		MM_showHideLayers('subnav_harps','','hide','subnav_services','','show','subnav_about','','hide','subnav_news','','hide','subnav_hall','','hide');
		
		//if current page is a subpage, highlight that page too
		if ( currentPage == "/roadRegulation.htm" ) {	changeImages('services_roadReg', '/images/subnav/road-regulation-on.gif');	currentSubSection = "services_roadReg";	}
		else if ( currentPage == "/repairs.htm" ) {		changeImages('services_repairs', '/images/subnav/repairs-on.gif');			currentSubSection = "services_repairs";	}
		else if ( currentPage == "/techguild.htm" ) {	changeImages('services_techGuild', '/images/subnav/tech-guide-on.gif');		currentSubSection = "services_techGuild";	}
		else if ( currentPage == "/appraisal.php" ) {	changeImages('services_appraisal', '/images/subnav/appraisals-on.gif');		currentSubSection = "services_appraisal";	}
	}
	else if ( currentPage == "/about.htm" || currentPage == "/worldwideDealers.htm" || currentPage == "/downloads.htm" || currentPage == "/whereToHear.htm" || currentPage == "/lhwest.htm" || currentPage == "/lheurope.html" ) {
		currentSection = "nav_about";
		MM_showHideLayers('subnav_harps','','hide','subnav_services','','hide','subnav_about','','show','subnav_news','','hide','subnav_hall','','hide');
		
		//if current page is a subpage, highlight that page too
		if ( currentPage == "/about.htm" ) {		changeImages('about_about', '/images/subnav/about-us-on.gif');	currentSubSection = "about_about";	}
		else if ( currentPage == "/worldwideDealers.htm" ) {	changeImages('about_dealers', '/images/subnav/worldwide-on.gif');		currentSubSection = "about_dealers";	}
		else if ( currentPage == "/downloads.htm" ) {			changeImages('about_downloads', '/images/subnav/downloads-on.gif');		currentSubSection = "about_downloads";	}
		else if ( currentPage == "/whereToHear.htm" ) {		changeImages('about_whereToHear', '/images/subnav/where-on.gif');		currentSubSection = "about_whereToHear";	}
		else if ( currentPage == "/lhwest.htm" ) {		changeImages('about_newsletter', '/images/subnav/newsletter-on.gif');	currentSubSection = "about_newsletter";		}
		else if ( currentPage == "/lheurope.html" ) {		changeImages('about_europe', '/images/subnav/about-europe-on.gif');	currentSubSection = "about_europe";		}
	}
	else if ( currentPage == "/calendar.htm" || currentPage == "/press.htm" || currentPage == "/news.htm" || currentPage == "/links.htm") {
		currentSection = "nav_news";
		MM_showHideLayers('subnav_harps','','hide','subnav_services','','hide','subnav_about','','hide','subnav_news','','show','subnav_hall','','hide');
		
		//if current page is a subpage, highlight that page too
		if ( currentPage == "/calendar.htm" ) {		changeImages('news_calendar', '/images/subnav/calendar-on.gif');	currentSubSection = "news_calendar";	}
		else if ( currentPage == "/press.htm" ) {	changeImages('news_press', '/images/subnav/media-room-on.gif');	currentSubSection = "news_press";		}
		else if ( currentPage == "/news.htm" ) {	changeImages('news_events', '/images/subnav/news-on.gif');		currentSubSection = "news_events";		}
		else if ( currentPage == "/links.htm" ) {	changeImages('news_links', '/images/subnav/links-on.gif');		currentSubSection = "news_links";	}
	}
	else if ( currentPage == "/hall" || currentPage == "/hall/index.htm" || currentPage == "/hall/visitorInfo.htm" || currentPage == "/hall/facilitiesInfo.htm" || currentPage == "/hall/mediaRoom.htm" || currentPage == "/hall/concertSeries.htm" ) {
		currentSection = "nav_hall";
		MM_showHideLayers('subnav_harps','','hide','subnav_services','','hide','subnav_about','','hide','subnav_news','','hide','subnav_hall','','show');
		
		//if current page is a subpage, highlight that page too
		if ( currentPage == "/hall" || currentPage == "/hall/index.htm" ) {					changeImages('hall_concert', '/images/subnav/about-hall-on.gif');			currentSubSection = "hall_concert";		}
		else if ( currentPage == "/hall/visitorInfo.htm" ) {			changeImages('hall_visitor', '/images/subnav/visitors-on.gif');				currentSubSection = "hall_visitor";		}
		else if ( currentPage == "/hall/facilitiesInfo.htm" ) {		changeImages('hall_facilities', '/images/subnav/facilities-on.gif');			currentSubSection = "hall_facilities";		}
		else if ( currentPage == "/hall/mediaRoom.htm" ) {			changeImages('hall_mediaRoom', '/images/subnav/media-room-on.gif');			currentSubSection = "hall_mediaRoom";		}
		else if ( currentPage == "/hall/concertSeries.htm" ) {	changeImages('hall_07-08ConcertSeries', '/images/subnav/concerts-on.gif');	currentSubSection = "hall_07-08ConcertSeries";		}
	}
	else if ( currentPage == "/faqs.htm" ) {
		currentSection = "nav_faqs";
	}
	else if ( currentPage == "/contact.php" ) {
		currentSection = "nav_contact";
	}
	else if ( currentPage == "/careers.htm" ) {
		currentSection = "nav_careers";
	}
	else if ( currentPage == "/sitemap.htm" ) {
		currentSection = "nav_sitemap";
	}
	else {
		currentSection = "nav_home";
	}
	
	changeImages(currentSection, '/images/nav/'+currentSection+'-over.gif');
}


//reset all main nav images
function resetMainNav() {
	if (currentSection != null && currentSection != "") {
		if ( currentSection == 'nav_home') {	changeImages('nav_home', '/images/nav/nav_home-over.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}		
		else if ( currentSection == 'nav_harps') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps-over.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_services') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services-over.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_about') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about-over.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_news') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news-over.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_hall') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall-over.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_faqs') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs-over.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_contact') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact-over.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_careers') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers-over.gif','nav_sitemap', '/images/nav/nav_sitemap.gif' )	}
		else if ( currentSection == 'nav_sitemap') {	changeImages('nav_home', '/images/nav/nav_home.gif', 'nav_harps', '/images/nav/nav_harps.gif', 'nav_services', '/images/nav/nav_services.gif', 'nav_about', '/images/nav/nav_about.gif', 'nav_news', '/images/nav/nav_news.gif','nav_hall', '/images/nav/nav_hall.gif','nav_faqs', '/images/nav/nav_faqs.gif', 'nav_contact', '/images/nav/nav_contact.gif','nav_careers', '/images/nav/nav_careers.gif','nav_sitemap', '/images/nav/nav_sitemap-over.gif' )	}
	}
}

function navRollOut() {
	if (arguments[0] != currentSection) {
		changeImages(arguments[0], arguments[1]);
	}
}

function subnavRollOut() {
	if (document.images && (preloadFlag == true)) {
		if (arguments[0] != currentSubSection) {
			changeImages(arguments[0], arguments[1]); 
		}
	}
}

//preload images
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;	}}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<arguments.length; i+=2) {
			if (arguments[i] != currentSubSection)
			{
				document[arguments[i]].src = arguments[i+1]; 
			}
		}
	}
}
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		
		// top level
		nav_home_over = newImage("/images/nav/nav_home-over.gif");
		nav_harps_over = newImage("/images/nav/nav_harps-over.gif");
		nav_services_over = newImage("/images/nav/nav_services-over.gif");
		nav_about_over = newImage("/images/nav/nav_about-over.gif");
		nav_news_over = newImage("/images/nav/nav_news-over.gif");
		nav_hall_over = newImage("/images/nav/nav_hall-over.gif");
		nav_faqs_over = newImage("/images/nav/nav_faqs-over.gif");
		nav_contact_over = newImage("/images/nav/nav_contact-over.gif");
		nav_careers_over = newImage("/images/nav/nav_careers-over.gif");
		nav_sitemap_over = newImage("/images/nav/nav_sitemap-over.gif");
		
		//harps
		harps_pedalHarps_over = newImage("/images/subnav/pedal-harps-on.gif");
		harps_cpoHarps_over = newImage("/images/nav/cpo-harps-on.gif");
		harps_leverHarps_over = newImage("/images/subnav/lever-harps-on.gif");
		harps_goldHarps_over = newImage("/images/subnav/gold-harps-on.gif");
		harps_finishes_over = newImage("/images/subnav/finishes-on.gif");
		harps_prices_over = newImage("/images/subnav/prices-on.gif");
		
		//services
		services_roadReg_over = newImage("/images/subnav/road-regulation-on.gif");
		services_repairs_over = newImage("/images/subnav/repairs-on.gif");
		services_techGuild_over = newImage("/images/subnav/tech-guide-on.gif");
		services_appraisal_over = newImage("/images/subnav/appraisals-on.gif");
		
		//about
		about_about_over = newImage("/images/subnav/about-us-on.gif");
		about_dealers_over = newImage("/images/subnav/worldwide-on.gif");
		about_downloads_over = newImage("/images/subnav/downloads-on.gif");
		about_whereToHear_over = newImage("/images/subnav/where-on.gif");
		about_newsletter_over = newImage("/images/subnav/newsletter-on.gif");
		about_europe_over = newImage("/images/subnav/about-europe-on.gif");
		
		//news
		news_calendar_over = newImage("/images/subnav/calendar-on.gif");
		news_newsletter_over = newImage("/images/subnav/media-room-on.gif");
		news_events_over = newImage("/images/subnav/news-on.gif");
		news_links_over = newImage("/images/subnav/links-on.gif");
		
		//hall
		hall_about_over = newImage("/images/subnav/about-hall-on.gif");
		hall_visitor_over = newImage("/images/subnav/visitors-on.gif");
		hall_facilities_over = newImage("/images/subnav/facilities-on.gif");
		hall_mediaRoom_over = newImage("/images/subnav/media-room-on.gif");
		hall_concerts_over = newImage("/images/subnav/concerts-on.gif");
		
		//additional pages
		if( typeof preloadArray == 'function')
		{
			var preloadArrayLength = preloadArray.length;
			var preload_over = new Array();
			for ( var x=0 ; x<preloadArrayLength ; x++ ) {
				preload_over[x] = newImage("/images/nav/" + preloadArray[x]);
			}
		}
		preloadFlag = true;

		findPage();
		if (window.pageLoaded) {
			pageLoaded();	
		}
		
	}
}


//show/hide layers
function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }}
