    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("themap"));
		map.enableGoogleBar();

		var firstaddress = "5075 Lower Valley Road, Atglen, PA 19310";

		var geocoder = new GClientGeocoder();
		geocoder.getLatLng(
						   firstaddress, 
						   function(point) {
							   if (!point) {
								   alert(firstaddress + " not found");
								} else {
									map.setCenter(point, 13);
									var marker = new GMarker(point);
									map.addOverlay(marker);
									marker.openInfoWindowHtml('Zook Cabins: (Point A)<br/><strong>' + firstaddress + '</strong><br/><a target="_blank" href="http://www.zookstructures.net">www.zookstructures.net</a>');
								}
							}
							);
	  }
	}
	
    function showAddress(address) {
		map.clearOverlays();

		var dirn = new GDirections(map);
	
		var start = "5075 Lower Valley Road, Atglen, PA 19310,USA";
		var end = address;
		
		dirn.loadFromWaypoints([start,end]); 

		var dist = dirn.getSummaryHtml();

		  GEvent.addListener(dirn,"load", function() {
				document.getElementById('distance').innerHTML = dirn.getDistance().html;
				
				//assign miles to a variable for use
				var milevar = document.getElementById('distance').innerHTML;
				
				var temp = new Array();
				temp = milevar.split('&');
				
				milevarcommanum = temp[0];


				var commamiles = new Array();
				commamiles = milevarcommanum.split(',');
				
				milevarcommanum1 = commamiles[0];
				milevarcommanum2 = commamiles[1];
				milevarnumshort = milevarcommanum1+milevarcommanum2;

				var temp2 = new Array();
				temp2 = milevarnumshort.split('u');

				milevarnum = temp2[0];

				if (milevarnum<=500){
					
				document.getElementById('distance').innerHTML = "Below you will find all the pricing information on Cabin Styles and Floorplans with respect to <strong>"+address+"</strong> and your shipping distance from Zook Cabin's main facility.  These prices already include delivery costs.";
					
						$(document).ready(function() {
												   
								var toLoad = '500miles.php #pricingcontent';
								$('#pricingcontent').hide('fast',loadContent);
								$('#load').remove();
								$('#pricingcontentholder').append('<span id="load">LOADING...</span>');
								$('#load').fadeIn('normal');
								function loadContent() {
									$('#pricingcontent').load(toLoad,'',showNewContent())
								}
								function showNewContent() {
									$('#pricingcontent').show('normal',hideLoader());
								}
								function hideLoader() {
									$('#load').fadeOut('normal');
								}
								return false;
								
						});	
	
				}
				
				
				else if (milevarnum<=1000){
					
				document.getElementById('distance').innerHTML = "Below you will find all the pricing information on Cabin Styles and Floorplans with respect to <strong>"+address+"</strong> and your shipping distance from Zook Cabin's main facility.  These prices already include delivery costs.";
					
						$(document).ready(function() {
												   
								var toLoad = '1000miles.php #pricingcontent';
								$('#pricingcontent').hide('fast',loadContent);
								$('#load').remove();
								$('#pricingcontentholder').append('<span id="load">LOADING...</span>');
								$('#load').fadeIn('normal');
								function loadContent() {
									$('#pricingcontent').load(toLoad,'',showNewContent())
								}
								function showNewContent() {
									$('#pricingcontent').show('normal',hideLoader());
								}
								function hideLoader() {
									$('#load').fadeOut('normal');
								}
								return false;
								
						});	
	
				}

				else if (milevarnum<=1500){
					
				document.getElementById('distance').innerHTML = "Below you will find all the pricing information on Cabin Styles and Floorplans with respect to <strong>"+address+"</strong> and your shipping distance from Zook Cabin's main facility.  These prices already include delivery costs.";
					
						$(document).ready(function() {
												   
								var toLoad = '1500miles.php #pricingcontent';
								$('#pricingcontent').hide('fast',loadContent);
								$('#load').remove();
								$('#pricingcontentholder').append('<span id="load">LOADING...</span>');
								$('#load').fadeIn('normal');
								function loadContent() {
									$('#pricingcontent').load(toLoad,'',showNewContent())
								}
								function showNewContent() {
									$('#pricingcontent').show('normal',hideLoader());
								}
								function hideLoader() {
									$('#load').fadeOut('normal');
								}
								return false;
								
						});	
	
				}



				else if (milevarnum<=2000){
					
				document.getElementById('distance').innerHTML = "Below you will find all the pricing information on Cabin Styles and Floorplans with respect to <strong>"+address+"</strong> and your shipping distance from Zook Cabin's main facility.  These prices already include delivery costs.";
					
						$(document).ready(function() {
												   
								var toLoad = '2000miles.php #pricingcontent';
								$('#pricingcontent').hide('fast',loadContent);
								$('#load').remove();
								$('#pricingcontentholder').append('<span id="load">LOADING...</span>');
								$('#load').fadeIn('normal');
								function loadContent() {
									$('#pricingcontent').load(toLoad,'',showNewContent())
								}
								function showNewContent() {
									$('#pricingcontent').show('normal',hideLoader());
								}
								function hideLoader() {
									$('#load').fadeOut('normal');
								}
								return false;
								
						});	
	
				}


				else if (milevarnum<=2500){
					

				document.getElementById('distance').innerHTML = "Below you will find all the pricing information on Cabin Styles and Floorplans with respect to <strong>"+address+"</strong> and your shipping distance from Zook Cabin's main facility.  These prices already include delivery costs.";
					
						$(document).ready(function() {
												   
								var toLoad = '2500miles.php #pricingcontent';
								$('#pricingcontent').hide('fast',loadContent);
								$('#load').remove();
								$('#pricingcontentholder').append('<span id="load">LOADING...</span>');
								$('#load').fadeIn('normal');
								function loadContent() {
									$('#pricingcontent').load(toLoad,'',showNewContent())
								}
								function showNewContent() {
									$('#pricingcontent').show('normal',hideLoader());
								}
								function hideLoader() {
									$('#load').fadeOut('normal');
								}
								return false;
								
						});	
	
				}



else {
document.getElementById('distance').innerHTML = "We are sorry, but the zip code or address you entered does not appear to by in our system.  Please call us at (610) 593-4556 and ask about shipping and prices for your location.  You can also email us at <a href=\"mailto:info@zookcabins.com\">info\@zookcabins.com</a>";
					
						$(document).ready(function() {
												   
								var toLoad = 'toofar.php #pricingcontent';
								$('#pricingcontent').hide('fast',loadContent);
								$('#load').remove();
								$('#pricingcontentholder').append('<span id="load">LOADING...</span>');
								$('#load').fadeIn('normal');
								function loadContent() {
									$('#pricingcontent').load(toLoad,'',showNewContent())
								}
								function showNewContent() {
									$('#pricingcontent').show('normal',hideLoader());
								}
								function hideLoader() {
									$('#load').fadeOut('normal');
								}
								return false;
								
						});	
	
				}
		  });
	}
	
	
$(document).ready(function() {
						   
//	var hash = window.location.hash.substr(1);
//	var href = $('#nav li a').each(function(){
//		var href = $(this).attr('href');
//		if(hash==href.substr(0,href.length-5)){
//			var toLoad = hash+'.html #content';
//			$('#content').load(toLoad)
//		}											
//	});

	$('#nav li a').click(function(){
								  
		var toLoad = $(this).attr('href')+'';
		$('#pricingcontent').hide('fast',loadContent);
		$('#load').remove();
		$('#pricingcontentholder').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
//		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#pricingcontent').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#pricingcontent').show('normal',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	});

});