// Google Maps controls




//<![CDATA[
	
	
	
    function MapPop() {
			// creates the pop-up map.
   			var par = window.document;
			var bodypart = par.getElementsByTagName('body')[0];
			 
			var box= par.createElement("div");
			box.style.width = '600px';
			box.style.height = '360px';
	 
			box.style.position = 'absolute';
			box.style.top = ((document.documentElement.clientHeight/2)-180)+'px' ;
			box.style.left =((document.documentElement.clientWidth/2)-300)+'px' ;
		 
			box.id = "map";
			   
			bodypart.appendChild(box);
			var closebox =  par.createElement("div");
			closebox.style.border ="2px solid black";
			closebox.style.fontWeight ="bold";
			closebox.innerHTML = "<a href='javascript:CloseMap();'>X</a>";
			closebox.style.zIndex = "1000";
			closebox.style.fontSize = "20px";
		 
			closebox.style.textDecoration = "none";
			closebox.style.lineHeight = "19px";
			closebox.style.position = 'absolute';
		 
			closebox.style.top = ((document.documentElement.clientHeight/2)-165)+'px' ;
			closebox.style.left =((document.documentElement.clientWidth/2)+270)+'px' ;
			closebox.style.width = '13px';
			closebox.style.height = '19px';
			closebox.style.backgroundColor = "white";
			closebox.style.cursor ="pointer";
			closebox.id = "closebox";
			 
			bodypart.appendChild(closebox);
	 
		}
		
	function showAddress(address) {
	 // Inputs: address from the link
	 // opens map, and centers map on address
	 
	MapPop();
	var map = new GMap2(document.getElementById("map"));
	var geocoder = new GClientGeocoder();

  	geocoder.getLatLng(
		address,
		function(point) {
		  if (!point) {
			alert(address + " not found");
		  } else {
			map.setCenter(point, 10);
			
			map.openInfoWindowHtml(map.getCenter(),
					   setInfoBlurb(address));
		  }
		}
	  );
	}
	
	function CloseMap() {
		 
	 var par = window.document;
	var closebox = par.getElementById('closebox');
		var box = par.getElementById("map");
	  par.getElementsByTagName('body')[0].removeChild(closebox);
	  par.getElementsByTagName('body')[0].removeChild(box);
	 GUnload();

	 
	 }
	 
	function setInfoBlurb(address) {
		// This defines the Addresses info bubble contents - any changes you want to make to its contents here - the styling is done in pages.css
		switch (address)
		{

		case 'Jamesburg, NJ':
			return "<div class='infoBubble'><h3>Jamesburg, NJ</h3>800-225-5538<br>1085 Cranbury South River Road Suite 5<br>Jamesburg, NJ 08831<p> <a href='http://www.google.com/maps?f=q&hl=en&q=1085+Cranbury-South+River+Rd,+Jamesburg,+Middlesex,+New+Jersey+08831,+United+States&sll=38.030786,-78.486328&sspn=23.952269,40.78125&ie=UTF8&cd=1&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p></div> ";
			break;
		case 'Parsippany, NJ':
			return "<div class='infoBubble'><h3>Parsippany, NJ</h3>	800-220-1583<br> 1279 Route 46 E. Bld C 2nd Level<br> Parsippany, NJ 07054 <p> <a href='http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=1279+Us+Highway+46+Parsippany,+NJ+07054&sll=37.0625,-95.677068&sspn=50.157795,78.75&ie=UTF8&ll=40.860434,-74.390445&spn=0.011798,0.019226&z=16'> Click here to get driving directions </a></p> </div> ";
			break;
		case 'Montgomery, NY':
			return "<div class='infoBubble'> <h3>Montgomery, NY</h3> 800-714-3375<br> 504 Neelytown Road <br> Montgomery, NY 12549 <p> <a href='http://www.google.com/maps?f=q&hl=en&q=504+Neelytown+Road+&sll=40.851653,-74.424332&sspn=0.011264,0.019913&ie=UTF8&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p> </div> ";
			break;
		case 'Columbia, MD':
			return "<div class='infoBubble'> <h3>Columbia, MD</h3> 877-895-5538<br> 9009 Mendenhall Court Suite G<br>				Columbia, MD 21045	<p> <a href='http://www.google.com/maps?f=q&hl=en&q=9009+Mendenhall+Court,+columbia,+md&sll=41.488564,-74.234014&sspn=0.011155,0.019913&ie=UTF8&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p></div> ";
			break;
		case 'Ashland, VA':
			return "<div class='infoBubble'> <h3>Ashland, VA </h3> 800-221-0004<br> 10054 Whitesel Road Suite B<br> Ashland, VA 23005 <p> <a href='http://www.google.com/maps?f=q&hl=en&q=10054+Whitesel+Road&sll=39.185923,-76.826196&sspn=0.011542,0.019913&ie=UTF8&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p></div> ";
			break;
		case 'Alexandria, VA':
			return "<div class='infoBubble'> <h3>Alexandria, VA</h3> 877-895-5538<br> 5380 Eisenhower Avenue<br> 	Alexandria, VA  22304 	<p> <a href='http://www.google.com/maps?f=q&hl=en&q=5380+Eisenhower+Avenue&sll=37.705169,-77.442059&sspn=0.011782,0.019913&ie=UTF8&om=1&z=16&iwloc=addr'> Click here to get driving directions </a></p>	</div> ";
			break;
		case 'Roanoke, VA':
			return "<div class='infoBubble'> <h3>Roanoke, VA</h3> 800-221-0004<br> 7629 Williamson Road Suite 19<br>			Roanoke, VA 24019 <p> <a href='http://www.google.com/maps?f=q&hl=en&q=7629+Williamson+Road+Suite+19,+roanoke,+va&sll=38.801801,-77.124955&sspn=0.011605,0.019913&ie=UTF8&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p> </div> ";
			break;
		case 'Hampton, VA':
			return "<div class='infoBubble'> <h3>Hampton, VA </h3> 	800-221-0004<br> 19-21 Newsome Place<br> 				Hampton, VA 23661 <p> <a href='http://www.google.com/maps?f=q&hl=en&q=19-21+Newsome+Place,+va&sll=37.349195,-79.947436&sspn=0.011838,0.019913&ie=UTF8&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p> </div> ";
			break;
		case 'Chesapeake, VA':
			return "<div class='infoBubble'> <h3>Chesapeake, VA </h3> 800-221-0004<br> 	2299 South Military Highway<br> 				Chesapeake, VA 23320 <p> <a href='http://www.google.com/maps?f=q&hl=en&q=2299+South+Military+Highway,+va&sll=37.019269,-76.376724&sspn=0.01189,0.019913&ie=UTF8&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p> </div> ";
			break;
		case 'Charlottesville, VA':
			return "<div class='infoBubble'> <h3>Charlottesville, VA</h3> 800-221-0004<br> 2345 Hunters Way #135<br>		Charlottesville, VA 22911 	<p> <a href='http://www.google.com/maps?f=q&hl=en&q=2345+Hunters+Way+%23135,+va&sll=36.776085,-76.271324&sspn=0.011928,0.019913&ie=UTF8&z=16&iwloc=addr&om=1'> Click here to get driving directions </a></p> </div> ";
			break;
		case 'Glen Burnie, MD':
			return "<div class='infoBubble'> <h3>Glen Burnie, MD</h3> 877-895-5538<br> 796 Cromwell Park Drive Suite R<br>		Glen Burnie, MD 21061 	<p> <a href='http://www.google.com/maps?q=796%20Cromwell%20Park%20Drive%20Suite%20R%20Glen%20Burnie%2C%20MD%2021061'> Click here to get driving directions </a></p> </div> ";
			break;
		}
	}
	
    //]]>



