var map = null;
var geocoder = null;
var inAddress = '44 Osborne Road, Southsea, Po5 3LT, united kingdom';

$(document).ready(function(){

    // if (jQuery('#mycarousel').length > 0) {
    //     jQuery('#mycarousel').jcarousel({
    //         auto: 1,
    //         wrap: 'last',
    //         initCallback: mycarousel_initCallback
    //     });
    // }
	$('#container-1 > ul').tabs(
		{selected:<cfoutput>#attributes.menuPos#</cfoutput>}
		,{fx: { height: 'toggle', opacity: 'toggle' }}
	);
    
	
    
});

// function mycarousel_initCallback(carousel){
//     // Disable autoscrolling if the user clicks the prev or next button.
//     carousel.buttonNext.bind('click', function(){
//         carousel.startAuto(0);
//     });
//     
//     carousel.buttonPrev.bind('click', function(){
//         carousel.startAuto(0);
//     });
//     
//     // Pause autoscrolling if the user moves with the cursor over the clip.
//     carousel.clip.hover(function(){
//         carousel.stopAuto();
//     }, function(){
//         carousel.startAuto();
//     });
// };


// Google Map Stuff

function initialize(){
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(7.440587, 21.643066), 14);
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        geocoder = new GClientGeocoder();
        showAddress(inAddress);
    }
}

function showAddress(address){
    if (geocoder) {
        geocoder.getLatLng(address, function(point){
            if (!point) {
                alert(address + " not found");
            }
            else {
                map.setCenter(point, 15);
                var marker = new GMarker(point);
                map.addOverlay(marker);
                marker.openInfoWindowHtml(address);
            }
        });
    }
}

// END OF: Google Map Stuff

