// functions for adap.co.uk
 
var url = location.href;

var sub_menus = new Object();
sub_menus.services= new Array("design","domainnames","solutions");
sub_menus.portfolio=new Array("bikeshed","starterpianos","sibeliusmusic","mycheapdomains");
sub_menus.contact=new Array();
sub_menus.home=new Array();

var main_section="home";
var sub_section ="";


function init() {
	
	// make the main nav button switch on.
	var mainButtons = document.getElementById("mainButtons");
	if (mainButtons) {
		for (i=0; i<mainButtons.childNodes.length; i++) {
			li = mainButtons.childNodes[i];
	
			if (li.nodeName=="LI") {	// is it really an li element?
				for (var x=0; x<li.childNodes.length; x++) {
					var a = li.childNodes[x];
					if (a.nodeName=="A") {	// is it really an a element?
						
						var linkUrl = a.href;
						linkUrl=linkUrl.replace(/.html/, "")
										
						if (url.indexOf(linkUrl) != -1) {
							a.style.backgroundPosition="100% 0px";
							a.style.color="#FFFFFF";
						}
						
					}
				}
			}
		}
	}
	
	// make the sub navigation main nav button switch on.
	var subButtons = document.getElementById("subButtons");
	if (subButtons) {
		for (i=0; i<subButtons.childNodes.length; i++) {
			li = subButtons.childNodes[i];
	
			if (li.nodeName=="LI") {	// is it really an li element?
				for (var x=0; x<li.childNodes.length; x++) {
					var a = li.childNodes[x];
					if (a.nodeName=="A") {	// is it really an a element?
						
						var linkUrl = a.href;
						linkUrl=linkUrl.replace(/.html/, "")
										
						if (url.indexOf(linkUrl) != -1) {
							a.style.backgroundPosition="100% 0px";
							a.style.color="#FFFFFF";
						}
						
					}
				}
			}
		}
	}
} 
	
function thing() {	
	//alert(node);
	
	for (var loop=0; loop< main_menu_options.length; loop++) {
		if (url.indexOf("/" + main_menu[loop]) != -1) {
			// we found the main nav_button that we are using.
			main_section = main_menu[loop];
			// change the button colour.
			document.getElementById("mainNav_" + main_section).style.backgroundPosition="100% 0px";
		}
	}
	
	
	for (var loop=0; loop< sub_menus[main_section].length; loop++) {
		if (url.indexOf("/" + sub_menus[main_section][loop]) != -1) {
			// we found the correct sub section
			document.getElementById("subNav_" + sub_menus[main_section][loop]).style.backgroundPosition="100% 0px";
		}
	}
	
}


