<!--

// Put popup image in DIV
function fillPopup( tag ) {
	var divStyle;
	if (document.getElementById("testimonials")) {
		document.getElementById("testimonials").style.display = "none";
	}
	document.getElementById("popupImage").src = tag.src.replace( "photo-", "photo-large-" );
	document.getElementById("popupImage").alt = tag.alt;
	document.getElementById("popup").style.display = "block";
}

// Remove popup image
function removePopup( tag ) {
	var divStyle;
	divStyle = document.getElementById("popup").style;
	divStyle.display = "none";
	if (document.getElementById("testimonials")) {
		document.getElementById("testimonials").style.display = "block";
	}
}

// Test if two URLs point to files in the same directory
function inSameDir( url1, url2 ) {
	if (url1.substr( 0, 7 ) == "http://") {
		url1 = url1.substr( 7 );
	}
	if (url2.substr( 0, 7 ) == "http://") {
		url2 = url2.substr( 7 );
	}
	url1 = url1.split( "/" ).slice(1, -1);
	url2 = url2.split( "/" ).slice(1, -1);
	if (url1.length != url2.length) {
		return false;
	}
	var i = 0;
	for( i=0; i<url1.length; i++ ) {
		if (url1[i] != url2[i]) {
			return false;
		}
	}
	return true;
}

// Make current tab highlighted
function tabHighlight() {
	var i=0;
	var imgTag;
	var linkTagHref;
	tags = document.getElementById( "navigation" ).childNodes;
	for ( i=0; i<tags.length; i++ ) {
		if ( tags[i].childNodes[0] ) {
			linkTagHref = tags[i].href;
			imgTag = tags[i].childNodes[0];
			
			if (inSameDir( location.pathname, linkTagHref )) {
				imgTag.src = imgTag.src.replace( "f1", "f2" );
			}
		}
	}
}

// Menu rollovers 

function preLoadImages () {
	return;
	var list = new Array (
		"nav-exhibition_f1.gif",
		"nav-exhibition_f2.gif",
		"nav-marketing_f1.gif",
		"nav-marketing_f2.gif",
		"nav-conference_f1.gif",
		"nav-conference_f2.gif",
		"nav-graphics_f1.gif",
		"nav-graphics_f2.gif",
		"nav-testimonials_f1.gif",
		"nav-testimonials_f2.gif",
		"nav-contact_f1.gif",
		"nav-contact_f2.gif"
	);

	if (document.images) {
		noImages = list.length;
		preloadedImages = new Array (noImages);
		for (x = 0; x < noImages; x++) {
			preloadedImages[x] = new Image;
			preloadedImages[x].src = '/images/' + list[x];
		}
	}
}

function swapImage(imageName, newImage) {
    if (document.images) {
      document.images[imageName].src = newImage;
  }
}

function imgMouseOver( tag ) {
	tag.src = tag.src.replace( "f1", "f2" );
}

function imgMouseOut( tag ) {
	tag.src = tag.src.replace( "f2", "f1" );
}

preLoadImages();

// Auto-menu highlighter. Copyright Cayenne Web Development 2003 - www.cayenne.co.uk


	function getPathPositions(url) {
		var pos = 0;
		positions = new Array();
		pathParts = url.split("/");
		count = pathParts.length;
		for (x = 0; x < count; x++) {
			pos = pos + pathParts[x].length + 1;
			positions[x] = pos;
		}
		return positions;
	}


	function urlsMatch(url, testUrl, level, positions, doAlert) {
		if(level == 0) {
			return (url.substr(1) == testUrl);
		} else {
			return (url.substr(1, positions[level]-1) == testUrl.substr(0, positions[level]-1))
		}
	}


// set highlight styles for menus

function linkHighlight() {
	var positions = getPathPositions(location.pathname);
	var count = document.links.length;
	for (i = 0; i < count; i++) {
		thisLink = document.links[i];
		if (urlsMatch(location.pathname, thisLink.pathname, 0, positions) && thisLink.className == "nav2") {
			thisLink.style.fontWeight = "bold";
			continue;
		}
		if (urlsMatch(location.pathname, thisLink.pathname, 0, positions) && thisLink.className == "nav3") {
			thisLink.style.color = "#C00";
			continue;
		}
	}
}

// Open page in new window

function newWindow(object) {
	window.open(object.href, "");
	return false;
}

//-->
