function refreshPage() {
	window.location = window.location;
}

function addEvent( elm, evType, fn ) {
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, 0);
	} 
}

function adjustScroll(e) {
	var isSafari = self.navigator.userAgent.indexOf("Safari") > 0;

	if (window.event) {
		target = window.event.srcElement;
	} else if (e) {
		target = e.target;
	} else return;

	// Make sure that the target is an element, not a text node within an element
	if (target.nodeType == 3) target = target.parentNode;
 
	// Paranoia; check this is an A tag
 	if (target.nodeName.toLowerCase() != 'a') return;
 
	// Go To the Anchor
	if (!isSafari) self.location = target;

	if (isSafari) {
		setTimeout ('self.scrollBy (0, -175)', 300); // wait 300ms, then scroll
	} else {
		self.scrollBy(0,-175);
	}

	// And stop the actual click happening
	if (e && e.preventDefault && e.stopPropagation) {
		e.preventDefault();
		e.stopPropagation();
	} 
	e.returnValue = false;
        return false;
}

function checkScroll() {
	var isSafari = self.navigator.userAgent.indexOf("Safari") > 0;
	var urlStr = String(window.location);

	if ( getBrowserWidth() >  900 ) { // check if using fixed header

		// Check current link for anchor tag and adjust scroll if necessary
		if (urlStr.indexOf('#') != -1 ) {
			if (isSafari) {
				setTimeout ('self.scrollBy (0, -175)', 300); // wait 300ms, then scroll
		        } else {
				self.scrollBy(0,-175);
			}

		}

		// Check all links in the document and add adjustScroll() handler to anchor tags
		var allLinks = document.getElementsByTagName('a');
		for (var i=0;i<allLinks.length;i++) {
			var lnk = allLinks[i];
			if (lnk.href && lnk.href.indexOf('#') != -1) addEvent( lnk, 'click', adjustScroll );
		}
	}
}

addEvent( window, 'load' , checkScroll);