function showDriveDiv(divname){

if (divname == 'drivedivfrom'){
	document.getElementById('drivedivto').style.display = 'none';
	document.getElementById('drivedivfrom').style.display = 'block';
	}
else {
	document.getElementById('drivedivfrom').style.display ='none';
	document.getElementById('drivedivto').style.display = 'block';
	}
}
function FlipShowNewLocationDiv(){
	var isshowing = document.getElementById('locationdiv').style.display;
	if(isshowing =='none')
	
		document.getElementById('locationdiv').style.display = 'block';
	else{
		var SUBDIVISION = searchform.SUBDIVISION.value ='';
		var ZIPCODE = searchform.ZIPCODE.value = '';
		var KEYMAP = searchform.KEYMAP.value = '';
		var MLS_AREA_sel = document.getElementById('MLS_AREA');
		var location_sel = document.getElementById('LOCATION');
		
		
		for (var i=0; i<=MLS_AREA_sel.options.length-1; i++) {
			if(i==0)
				MLS_AREA_sel.options[i].selected = true;
			else 
				MLS_AREA_sel.options[i].selected = false;
		
		}
		
	
		for (var i=0; i<=location_sel.options.length-1; i++) {
				if(i ==0){
				location_sel.options[i].selected = true;
				}else{
				location_sel.options[i].selected = false;
				}
		}
	
		
		document.getElementById('locationdiv').style.display = 'none';
	}
}
function FindLoc(dir){
	
	//alert(dir)
	if(dir =='from'){
		//alert(document.getElementById('txtFrom').value + document.getElementById('fromtxtTo').value);
		map.GetRoute(document.getElementById('txtFrom').value,document.getElementById('fromtxtTo').value,null,null,onGotRoute);
	}else if (dir =='to'){
		//alert(document.getElementById('totxtFrom').value + document.getElementById('txtTo').value);
		map.GetRoute(document.getElementById('totxtFrom').value,document.getElementById('txtTo').value,null,null,onGotRoute);
		}
  //map.GetRoute(document.getElementById('txtFrom').value,document.getElementById('txtTo').value,null,null,onGotRoute);
}

function onGotRoute(route){
		var boxhtml = "<table border='0' width='400' bgcolor='DEE7EF' cellspacing='0' cellpadding='2'><tr><td width='100%'><table border='0' width='100%' cellspacing='0' cellpadding='0' height='36'>";
		boxhtml = boxhtml + "<tr><td id='titleBar' style='cursor:move' width='100%' class='xlBlue'><ilayer width='100%' onSelectStart='return false'><layer width='100%' onMouseover='isHot=true;if (isN4) ddN4(theLayer)' onMouseout='isHot=false'>Route info:</layer></ilayer></td><td style='cursor:hand' valign='top'><a href='#' onClick='hideMe();return false'><font color=#ffffff size=4 face=arial  style='text-decoration:none'>X</font></a></td></tr>";
		boxhtml = boxhtml + "<tr><td width='100%' bgcolor='#FFFFFF' style='padding:4px' colspan='2' class='smBlack'>";
		
		var routeinfo="";
		routeinfo+="Total distance: ";
		routeinfo+=   route.Itinerary.Distance+" ";
		routeinfo+=   route.Itinerary.DistanceUnit+"<br>";
		
		
		var steps="";
		var len = route.Itinerary.Segments.length;
		   for(var i = 0; i < len ;i++)
		   {
		      steps+=route.Itinerary.Segments[i].Instruction+" -- (";
		      steps+=route.Itinerary.Segments[i].Distance+") ";
		      steps+=route.Itinerary.DistanceUnit+"<br>";
		   }
		routeinfo+="Steps:\n"+steps;
		
		
		boxhtml = boxhtml + routeinfo;
		boxhtml = boxhtml + "</td></tr></table></td></tr></table>";
		document.getElementById('theLayer').innerHTML = boxhtml;
		//alert(document.getElementById('theLayer').innerHTML)
		
		showMe();
		//myroutinfobox.style.visibility= ' ';
		//myroutinfobox.innerHTML = routeinfo;
}

