// Search fields in the header and footer
// Should submit on click on form and should not on click in textfield
function stopIt(e) {
	try {
		window.event.cancelBubble = true;
	}
	catch (err) {
		e.stopPropagation();
	}
}


// Dropdown menu
dropdownMenu = function() {
		if (document.all&&document.getElementById) {
				var navRoot = document.getElementById("navRoot");
				for (i=0; i<navRoot.childNodes.length; i++) {
						var node = navRoot.childNodes[i];
						if (node.nodeName=="LI") {
								node.onmouseover=function() {
										this.className+=" over";
								}
								node.onmouseout=function() {
										this.className=this.className.replace("over", "");
								}
						}
				}
		}
}
window.onload = dropdownMenu;

function carColours() {
	// Colours
		var car_image = $("#car-colours .image img");
		var car_colour_link = $("#car-colours .colours a");
		var car_colour = $("#car-colours .colour-name");
		//var prefix = "file:///D:/www/Honda/";
		//var bi = "";
		car_colour_link.mouseover(function() {
			//bi = this.href.substr(prefix.length);
			car_image.attr('src', this.href);
			car_colour.html(this.title);
		}	);
		
		// prevent default behavious on click
		car_colour_link.click(function() { return false; });
		
		// on load show first colour
		car_image.attr('src', $("#car-colours .colours a:first").attr('href'));
		car_colour.html($("#car-colours .colours a:first").attr('title'));
}

try {
	jQuery(function($){
		carColours();
	});
} catch(err) {
	// No jQuery
}
