// General Javasscript Document for Blue Hen Spring Works. //

//Swfobject 2.0 include for slideshow in header. //
var flashvars = {};
var params = {};
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF("swf/slideshow.swf", "flash", "722", "202", "9.0.0", "expressInstall.swf", flashvars, params, attributes);

// Swfobject 2.0 include for video player on homepage. //
var flashvars2 = {};
var params2 = {};
params2.wmode = "transparent";
var attributes2 = {};
swfobject.embedSWF("swf/video.swf", "video", "230", "180", "9.0.0", "expressInstall.swf", flashvars2, params2, attributes2);

// Google Maps //
var gmarkers = [];
var htmls = [];
var i = 0;
 
function createMarker(point,name,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
   		marker.openInfoWindowHtml(html);
    });
    gmarkers[i] = marker;
    htmls[i] = html;
    i++;
	return marker;
}
 
var map = null;
var geocoder = null;
 
function load() {
   if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("gmap"));
        map.setCenter(new GLatLng(38.917516, -75.417877), 14);
        map.setMapType(G_NORMAL_MAP);  
			
    	geocoder = new GClientGeocoder();
    	showAddress();
	}
}
 
function showAddress() {
    geocoder.getLatLng(
        '112 North Rehoboth Blvd, Milford, Delaware',
        function(point) {
            var marker = createMarker(point,"This place", "112 North Rehoboth Blvd.<br />Milford, DE 19963<br /><br /><a href='http://maps.google.com/maps?f=q&hl=en&geocode=&q=112+North+Rehoboth+Blvd.+Milford,+DE+19963&sll=37.0625,-95.677068&sspn=49.310476,79.101563&ie=UTF8&t=h&z=16&iwloc=addr' target='_blank'>Get Directions</a><br /><br />")
			map.addOverlay(marker);
    	}
	);
}

// onload function - Google maps //
window.onload = function () {
	load();
}
window.onunload = function () {
	GUnload();
}