// JavaScript Document     
var map, loc;
var directionsPanel;
var directions;


function onLoad() {			
map = new GMap2(document.getElementById("map"));
			loc = new GClientGeocoder(); 
			// next two lines are used for adding control on the map  for zoom in and zoom out 
	 	 	//map.setCenter(new GLatLng(0,0), 2);
	 	 	
	 	 	 map.setCenter(new GLatLng(38.476,-96.416),3);
//map.setCenter(new GLatLng(46.476,-121.416),4);
	   		addControl();
	   }
 //////////////////////// 
function addControl(){
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
    		// this line set the longitude and latitude values and also the zoom value 15 means no zoom and 0(Zero) means full zoom
		}	
	
/////////////////////
function GetDirection(){
	onLoad();	
	document.getElementById("directions").innerHTML ="";
	var from =  document.getElementById('from').value; 
	var to = document.getElementById('to').value;
	directions = new GDirections(map, document.getElementById("directions"));
	if((document.getElementById('avoid_highways').checked==true)&& (document.getElementById('avoid_tolls').checked==false))
	{
		directions.load("from: "+from+" to: "+to, {avoidHighways:true});
	 jqueryscroll()
	}
	else if((document.getElementById('avoid_highways').checked==false)&& (document.getElementById('avoid_tolls').checked==true))
	{
		directions.load("from: "+from+" to: "+to, {avoidTolls:true});
		 jqueryscroll()
	}
	else if((document.getElementById('avoid_highways').checked==true)&& (document.getElementById('avoid_tolls').checked==true))
	{
		directions.load("from: "+from+" to: "+to, {avoidTolls:true,avoidHighways:true});
		jqueryscroll()
	}
	else{
		directions.load("from: "+from+" to: "+to);
    jqueryscroll()
	}
	
	//map.setCenter(new GLatLng(49.496675,-102.65625), 3);
}



