<!--
// v1.7 Copyright (c) 2006 TJKDesign - Thierry Koblentz
// For help, visit http://www.tjkdesign.com/articles/navigation_links_and_current_location.asp

//Modified by Amy to support Sliding Doors tabbed menu by adding the option to specify a different class for the LI
//Modified by Amy to support sales parameter for search 15/05/2008


function currentLink(zMenu,subMenu,linkClass,listClass){
if(document.getElementById && document.createElement && document.getElementById(zMenu)){
var strLocation = top.location.hostname+top.location.pathname;

	var a = document.getElementById(zMenu).getElementsByTagName("a");
	var li = document.getElementById(zMenu).getElementsByTagName("li");
	
	if(document.getElementById(subMenu)){
		var subAs = document.getElementById(subMenu).getElementsByTagName("a");
		strLocation = top.location.hostname + "/site/go/" + subAs[0].getAttribute("rel");
	}

	if(top.location.pathname == "/"){ 
				for (var x=0,i=a.length;x<i;x++){
					if(a[x].href.indexOf("/site/go/home") >= 0){
						a[x].className += " "+linkClass;
						li[x].className += " "+listClass;
					}
				}
	}
		
	else{
		
		var paramValue = getParam("sales");
		var changeLink = false;
		
		if(paramValue!="") { //if search has been called with the sales parameter...
				strLocation += "?sales=" + paramValue;
				changeLink = true;
		}
		
		else {
			if (strLocation.indexOf("/search") < 0){
				changeLink = true;
			}
		}
		
		
			if(changeLink==true) {
				for (var x=0,i=a.length;x<i;x++){	
					if (a[x].href.indexOf(strLocation,0)>0){	
						a[x].className += " "+linkClass;
						li[x].className += " "+listClass;
					}
				} 
			}

	}
}
}


function getParam(paramName){
  paramName = paramName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+paramName+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null ) 
  {
    return "";
  }
  else 
  {
    return results[1];
  }
}


function callLink(){
	currentLink('siteNav','subNav','currentLink','currentListItem');
}



