window.onload = function(){
//external links
var allinks = document.getElementsByTagName('a');
for (var i=0; i<allinks.length; i++){
	var anchor = allinks[i];
	if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == 'external' || anchor.getAttribute('rel') == 'external nofollow')){ anchor.target = '_blank'; }
}

//feedburner form
if(document.getElementById('subscribef')){
	var fbform = document.getElementById('subscribef');
	var fbformf = document.getElementById('regemail');
	fbformf.onfocus = function () { if(this.value == this.defaultValue){ this.value=''; }};
	fbformf.onblur = function () { if(this.value.replace(/\s+/g,"") == '' ){ this.value=this.defaultValue; }};
	fbform.onsubmit = function () { window.open('http://feedburner.google.com/fb/a/mailverify?uri=netaccountant&email='+fbformf.value, 'signup', 'scrollbars=yes,width=550,height=520'); return false; };
}
if(document.getElementById('googlemap')){ 
	var office = new google.maps.LatLng(52.02955,-0.72299); 
	var mapOptions = { zoom: 14, center:office, backgroundColor: "#ffffff" };
	var map = new google.maps.Map(document.getElementById("googlemap"), mapOptions);
	var infowindow = new google.maps.InfoWindow({ content: '<img style="display:block;" src="/i/nlogo.gif" alt="Logo" />'});
	var marker = new google.maps.Marker({ position:office, map: map, animation: google.maps.Animation.BOUNCE });		 
	infowindow.open(map,marker);
	map.panBy(30,70);
	
	google.maps.event.addListener(marker, 'click', function() { 
		if (this.getAnimation() != null) { this.setAnimation(null);  } 
		else { this.setAnimation(google.maps.Animation.BOUNCE); } });

	//map customisation
	//colours
	var colours = [
	  { featureType: "administrative", elementType: "all", stylers: [ { saturation: 40 }, { hue: "#ffcc00" } ]},
	  { featureType: "landscape", elementType: "all", stylers: [ { hue: "#ffcc00" }, { saturation: 40 }, { lightness: 0 } ] },
	  { featureType: "poi", elementType: "all", stylers: [ { hue: "#ffcc00" }, { saturation: 40 } ] },
	  { featureType: "road", elementType: "all", stylers: [ { hue: "#ffcc00" }, { saturation: 40 } ] },
	  { featureType: "transit", elementType: "all", stylers: [ { hue: "#ffcc00" }, { saturation: 40 } ] },
	  { featureType: "water", elementType: "all", stylers: [ { hue: "#ffcc00" }, { saturation: 40 } ] } 
	];
	
	//applying colours to map
	var styledMapOptions = { map: map, name: "Map"}
	var myStyledMap =  new google.maps.StyledMapType(colours,styledMapOptions);
	
	//defining new map style
	map.mapTypes.set('colouredMap', myStyledMap);
	map.setMapTypeId('colouredMap');
	
	map.setOptions({ mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, mapTypeIds: ['colouredMap', google.maps.MapTypeId.SATELLITE,  google.maps.MapTypeId.HYBRID] } });
}
}// end window.onload

//email address
displayE = function(whose){var d = 'netaccountant'; var at = '@'; var tld = '.net';
document.write('<a href="mailto:' + whose + at + d + tld + '">' + whose + at + d + tld + '</a>');
}
