jQuery(document).ready(function () {
		//
		// stop co-op hyphens from splitting across lines..?
 		function stopCoHyphenOpSplitting(element, pattern, callback) {
        for (var childi = element.childNodes.length; childi-- > 0;) {
            var child = element.childNodes[childi];
            if (child.nodeType === 1) {
                stopCoHyphenOpSplitting(child, pattern, callback);
            } else if (child.nodeType === 3) {
                var matches = [];
                var match;
                while (match = pattern.exec(child.data))
                matches.push(match);
                for (var i = matches.length; i-- > 0;)
                callback.call(window, child, matches[i]);
            }
        }
    }
    stopCoHyphenOpSplitting(document.body, /\b.o-operati...?\b/g, function (node, match) {
        node.splitText(match.index + match[0].length);
        var makespan = document.createElement('span');
        makespan.className = 'noBr';
        makespan.appendChild(node.splitText(match.index));
        node.parentNode.insertBefore(makespan, node.nextSibling);
    });
    //
    if (document.getElementById('map')) {
        mapLoad();
    }
    //
    $("#backButton").click(function () {
        history.go(-1);
        return false;
    });
    //	
    $('a[href=#browsertop]').click(function () {
        $.scrollTo(0, 'slow');
        return false;
    });
    $('#navAbout a').click(function () {
        $.scrollTo(0, 'slow');
        return false;
    });
    $('#navPeople a').click(function () {
        $.scrollTo('#people', 'slow');
        return false;
    });
    $('#navServices a').click(function () {
        $.scrollTo('#services', 'slow');
        return false;
    });
    $('#navClients a').click(function () {
        $.scrollTo('#clients', 'slow');
        return false;
    });
		    $('#navYours a').click(function () {
        $.scrollTo(0, 'slow');
        return false;
    });
		    $('#navFortnight a').click(function () {
        $.scrollTo('#fortnight', 'slow');
        return false;
    });
		    $('#navDetails a').click(function () {
        $.scrollTo('#details', 'slow');
        return false;
    });
	//
	
	$('.folio .figure').hover(function () {
         $(this).children().first().next().children().first().children().first().addClass('folioOver');
    }, function () {
         $(this).children().first().next().children().first().children().first().removeClass('folioOver');
    });
	 $('.folio .figure').click(function () {
    $(this).children().first().next().children().first().children().first().removeClass('folioOver');
		 window.location = $(this).children().first().get(0);
    });
    //
});
// --------------------------------------------------------
// END DOC READY FUNCTION
// --------------------------------------------------------
//
// --------------------------------------------------------
// GOOGLE MAPS STUFF
// --------------------------------------------------------
//<![CDATA[
function mapLoad() {
    if (GBrowserIsCompatible()) {
        var map = new GMap(document.getElementById('map'));
        map.id = 'themap';
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(50.8537, 0.5795), 15, G_SATELLITE_MAP);
        // Create our "tiny" marker icon
        var icon = new GIcon();
        icon.image = "http://test.wave.coop/wave_new_2010/img_general/mapicon.png";
        icon.shadow = "http://test.wave.coop/wave_new_2010/img_general/mapiconshadow.png";
        icon.iconSize = new GSize(37, 26);
        icon.shadowSize = new GSize(60, 26);
        icon.iconAnchor = new GPoint(18, 26);
        icon.infoWindowAnchor = new GPoint(5, 1);
        var pointe = new GPoint(0.5775, 50.8552);
        var markere = new GMarker(pointe);
        var markeree = new GMarker(pointe, icon);
        map.addOverlay(markeree, 1);
        var htmle = "<img src='img_general/smiley.jpg' alt='hello!' width='347' height='234' />";
        GEvent.addListener(markeree, 'click', function () {
            markeree.openInfoWindowHtml(htmle);
        });
    }
}
//]]>	
