	LSRun = 0;
	
	/* Called on window load. Wraps anchor hrefs and form actions 
	 * in SetNewLoc() function call.
	 */
	function ChangeCurLinks() {
		if(document.forms.length > 0) {
			for(var a=0; a < document.forms.length; a++) {
				document.forms[a].action='javascript: SetNewLoc("'+a+'","'+document.forms[a].action+'",1);';
			}
		}
		if(document.links.length > 0) {
			for(var a=0; a < document.links.length; a++) {
				document.links[a].href='javascript: SetNewLoc(this,"'+document.links[a].href+'",0);';
			}
		}
	}

	/* Called when link is clicked or form is submitted. Checks if
	 * destination page is part of Turf site, and loads survey if not.
	 */
	function SetNewLoc(CurElement,NewLoc,Type) {
		if(Type==1) {
			if(NewLoc.toLowerCase().indexOf("turf")<0 && NewLoc.slice(0, 1)=='/' && NewLoc.toLowerCase().indexOf("sendmail.asp")<0) {
				LoadSurvey();
			}
			LSRun = 1;
			document.forms[CurElement].action=NewLoc;
			document.forms[CurElement].submit();
		} else {
			if(NewLoc.toLowerCase().indexOf("turf")<0) {
				LoadSurvey();
			}
			LSRun = 1;
			location=NewLoc;
		}
	}
	
	/* Opens popup survey with given options
	 */
	function openSurvey() {
	 	window.open('http://survey.confirmit.com/wix/p256227098.aspx','surveyintro','Toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=650,height=600');
	}
	
	/* Dropdown nav handler. "Wraps" standard jumpto() function.  
	 * This function adds a check for an offsite destination, and then 
	 * calls jumpto().
	 */
	function jumpto_check(sel) {
		if (sel[sel.selectedIndex].value.toLowerCase().indexOf("turf")>-1) {
			LSRun=1;
		}
		jumpto(sel);
	}
	
	/* Called by SetNewLoc(). Pops survey and sets cookie 
	 * preventing survey from popping more than once.
	 */
	function LoadSurvey() {
		CookieName = 'TOSurvey022005';
		var today = new Date();
		var expiry = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
		if(LSRun==0) {
			if(document.cookie.length > 0) {
				if(document.cookie.indexOf(CookieName)<0) {
					openSurvey();
					document.cookie=CookieName + "=Y; expires=" + expiry.toGMTString();
				}
			} else {
				openSurvey();
				document.cookie=CookieName + "=Y; expires=" + expiry.toGMTString();
			}
		}
	}

	// set onload and onunload events

	//window.onload=ChangeCurLinks;
	//window.onunload=LoadSurvey;