var qf_Directions = true;	// Beau, 02/02/2007, true=ITTServices (default) / false=QuickRouteRequest
 
 	//checkEnter uses the event object that is passed (keydown event)
	//to determine if the enter key was pressed, if so, it performs the search
	function checkEnter(e)
	{
		var characterCode //literal character code will be stored in this variable
	
		if(e && e.which)
		{ //if which property of event object is supported (NN4)
			e = e
			characterCode = e.which //character code is contained in NN4's which property
		}
		else
		{
			e = event
			characterCode = e.keyCode //character code is contained in IE's keyCode property
		}
	
		if(characterCode == 13)//if generated character code is equal to ascii 13 (if enter key)
		{
			openDirectionsWin(document.DirectionsSearch);
			//performSearch(form);
		}
			
	}
	
	function isEmpty(txtField) {
		if ((txtField.value.length==0) || (txtField.value==null)) {
			return true;
		} else { 
			return false;
		}
	}
 
//open a window for aaamaps
	function openDirectionsWin(form)
	{
		var fromAddr1, fromCity, fromState, toAddr1, toCity, toState;

//If all fields empty
		if ((isEmpty(form.fromAddress1)) && (isEmpty(form.fromCity)) && (isEmpty(form.fromState)) && (isEmpty(form.toAddress1)) && (isEmpty(form.toCity)) && (isEmpty(form.toState))) {
top.location.href = "http://www.aaa.com/scripts/WebObjects.dll/AAAOnline?association=aaa&amp;club=258&amp;page=ITTServices";
} else {
				
		if (!isEmpty(form.fromAddress1)){ fromAddr1 = form.fromAddress1.value.replace(/ /g,"+"); } else { fromAddr1 = "%20"; }
		if (!isEmpty(form.fromCity)){ fromCity = form.fromCity.value.replace(/ /g,"+"); } else { fromCity = "%20"; }
		if (!isEmpty(form.fromState)){ fromState = form.fromState.value.replace(/ /g,"+"); } else { fromState = "%20"; }
		if (!isEmpty(form.toAddress1)){ toAddr1 = form.toAddress1.value.replace(/ /g,"+"); } else { toAddr1 = "%20"; }
		if (!isEmpty(form.toCity)){ toCity = form.toCity.value.replace(/ /g,"+"); } else { toCity = "%20"; }
		if (!isEmpty(form.toState)){ toState = form.toState.value.replace(/ /g,"+"); } else { toState = "%20"; }
		
		// now choose which site to send the form information to (from the qf_Directions flag)
		if (qf_Directions){
		top.location.href = "http://www.aaa.com/scripts/WebObjects.dll/AAAOnline?association="+"aaa"+"&amp;club="+"258"+"&amp;page=ITTServices&amp;subCommand=routeLocs&amp;routeLocs=Address|"+fromAddr1+"|"+fromCity+"|"+fromState+"|%20|%20|%20|Address|"+toAddr1+"|"+toCity+"|"+toState+"|%20|%20|%20";

		} else {	
			window.location = "/scripts/WebObjects.dll/AAAOnline?association="+"aaa"+"&amp;club="+"258"+"&amp;page=QuickRouteRequest&advancedSearch=NO&fromAddress1="+fromAddr1+"&amp;fromCity="+fromCity+"&amp;toState="+fromState+"&amp;toAddress1="+toAddr1+"&amp;toCity="+toCity+"&amp;fromState="+toState;
		}

	}
 }