function initialize_gmap() {
  if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("map_canvas"));
	map.setCenter(new GLatLng(51.246244, -0.737815), 15);
	map.addOverlay(new GMarker(map.getCenter()));
map.addControl(new GLargeMapControl3D());
map.addControl(new GMapTypeControl());
//	map.openInfoWindowHtml(map.getCenter(), "Fletchers Packaging<br />Blackwater Park<br />Aldershot<br />Hampshire<br />GU12 4PQ");
  }
}

$(document).ready(function() {
	
	/* open links with rel="external" in new window and amend link title */
	$('a[rel*="external"]').each(function() {
		var title = $(this).attr('title') ? $(this).attr('title') + ' (opens in a new tab or window)' : 'This link will open in a new tab or window';
		$(this).attr('title',title).click(function() {
			window.open($(this).attr('href'));
			return false;
		});
	});
	
	// execute sIRF after DOM load
	if(typeof sIFR == "function"){
		sifr_exec();
	};
	
	if(typeof GMap2 == "function"){
		initialize_gmap();
	};
	
	$('#menu li a').hover(function() {
		$('#menu li a').css( {'background-position' : 'top left'} );
		$(this).css( {'background-position' : 'bottom left'} );
    }, function() {
		$(this).css( {'background-position' : 'top left'} );
		$('#b_home #m1, #b_about #m2, #b_products #m3, #b_quote #m4, #b_contact #m5').css( {'background-position' : 'bottom left'} );
    });		
	
	$('.prodindex').hover(function(){
		$(this).css({cursor: 'pointer'});
	});
	
	$('.prodindex').click(function(){
		window.location.href=$(this).find('a').attr('href');
	});
});
