/**
 * FIX IE6 IMAGE FLICKER PROBLEM
 *
 */
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch (e) { }

/*
Cufon font registration.
*/
Cufon.replace('div.primary div.rtsLevel1 a.rtsLink, #calls-to-action div.action h3, #sidebar div.feature h3, #body h2, #body div.team-bio h3');


$(function() {
    // Ensure call to action boxes are the same height.
    var tmpHeight = 0;
    $('#calls-to-action div.action').each(function(i) {
        tmpHeight = (tmpHeight < $(this).height()) ? $(this).height() : tmpHeight;
    });
    $('#calls-to-action div.action').each(function(i) {
        $(this).height(tmpHeight + 'px');
    });

    // Move "Related Documents" feature to the sidebar.
    $('#body div.related-documents').prependTo('#sidebar');

    // Google Maps overlay.
    if ($('#feature-maps').size() > 0) {
        $('div.overlay').appendTo('body');
        $('#feature-maps a').overlay({
            expose: '#f1f1f1',
            target: '#overlay_google_maps',
			onLoad: function() {
				var latlng = new google.maps.LatLng(45.419382, -75.691012);
				var myOptions = {
				  zoom: 15,
				  center: latlng,
				  mapTypeId: google.maps.MapTypeId.ROADMAP
				};

				var map = new google.maps.Map(document.getElementById("gmap"), myOptions);

				var marker = new google.maps.Marker({
					position: latlng,
					map: map
				});

        	}
        });
    }

    // Explore Our Services overlay
    if ($('#feature-explore').size() > 0) {
        $('div.overlay').appendTo('body');
        $('#feature-explore a').overlay({
            expose: '#f1f1f1',
            target: '#overlay-flash-animation'
        });
    }

});
