
window.onload = function()
{

	highlightNav('subnav');
	var thispath = window.location.toString().split('#')[0].split('?')[0];
	thispath = thispath.replace(/^http:\/\/.+?\/(.*)$/, "/$1");
	if(thispath=='/contact/') showGMap();

}



function highlightNav(divId)
{
	var thispath = window.location.toString().split('#')[0].split('?')[0];
	var navwrap = document.getElementById(divId);
	
	if (navwrap) {
			var navanchors = navwrap.getElementsByTagName('a');
			if (navanchors) {
				for(var i = 0; i <= navanchors.length-1; i++) {
					if (navanchors[i].href == thispath) {
						navanchors[i].className = 'here';
						break;
					}
				}
			}
	}
}

function showGMap() {
	if (GBrowserIsCompatible()) {

		var m = document.getElementById("google-map");
		m.style.height = "275px";
		m.style.width = "310px";
		var map = new GMap(m);
		map.addControl (new GSmallMapControl());
		// Map GPoint Coordinates Here
		map.centerAndZoom(new GPoint(-122.33477, 47.610046), 2);
		var point = new GPoint(-122.33477, 47.610046);
		marker = new GMarker(point);
		// Address for Marker Popup
		var html = '<div style="white-space:nowrap;"><strong>Clothier &amp; Head</strong><br />1301 Fifth Avenue, Suite 2800<br />Seattle, Wa 98101</div>';
			GEvent.addListener(marker, 'click', function() {
			marker.openInfoWindowHtml(html);
		});
		map.addOverlay(marker);
	}
}
//Get Directions to Location
function toTarget () {
	var addr = document.directions.address.value;
	addr = addr.replace(/\+/g, '%2B');
	addr = addr.replace(/ /g, '+');
	var googleAddress = '1301+5th+Ave,';
	googleAddress += 'Seattle, Wa';
	var txt = 'http://maps.google.com/?q=from:'+addr+'+to:+';
	txt += googleAddress;
	return txt;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}