//Banner slider
$(document).ready(function() {
    $(function() {
        $("#foo3").carouFredSel({
            items: 1,
            pagination: "#foo3_pag",
            direction: "up",
            auto: {
                pauseOnHover: true,
                pauseDuration: 12000
            }
        });
    });
});

$(document).ready(function() {
    $(function() {
        $("#fooIndeKijker").carouFredSel({
            items: 1,
            direction: "up",
            auto: {
                pauseOnHover: true,
                pauseDuration: 6000
            }
        });
    });
});

$(document).ready(function() {
    $(function() {
        $("#fooDetail").carouFredSel({
            circular: true,
            auto: true,
            pagination: "#fooDetail_pag",
            items: {
                width: "variable",
                visible: 4
            },
            scroll: {
                duration: 500,
                items: 1,
                pauseOnHover: true
            },
            prev: {
                button: "#prev_photo",
                key: "left",
                items: 1,
                duration: 100
            },
            next: {
                button: "#next_photo",
                key: "right",
                items: 1,
                duration: 100
            }
        });

    });
});

//$(document).ready(function() {
//    $(function() {
//        $("#fooNieuws").carouFredSel({
//            circular: true,
//            auto: true,
//            items: {
//                width: "variable",
//                visible: 3
//            },
//            scroll: {
//                duration: 500,
//                items: 1,
//                pauseOnHover: true
//            },
//            prev: {
//                button: "#fooNieuws_prev",
//                key: "left",
//                items: 1,
//                duration: 100
//            },
//            next: {
//                button: "#fooNieuws_next",
//                key: "right",
//                items: 1,
//                duration: 100
//            }
//        });
//    });
//});

//function laadGoogleMaps(mapID, arrMarkers) {
//    if (mapID != undefined) {
//        $(function() {
//            // init map
//            $("#" + mapID).goMap({
//                address: arrMarkers[0].adres,
//                zoom: 15,
//                scrollwheel: false,
//                maptype: 'ROADMAP',
//                icon: 'imgsite/marker.png'
//            });
//            $("#" + mapID).resize();
//            // plaatsen van markers
//            var iAantalMarkers = arrMarkers.length;
//            var i = 0;
//            for (i = 0; i < iAantalMarkers; i++) {
//                $.goMap.createMarker({
//                    address: arrMarkers[i].adres
//                });
//            }
//            // centreren van de markers
//        });
//    }
//}

function laadGoogle_Contact(sID, sMapType, arrMarkers) {

    $(function() {

        var iAantalMarkers = arrMarkers.length;
        var i = 0;
        var sMarkerID = "";
        var sKantoorInfo = "";

        for (i = 0; i < iAantalMarkers; i++) {

            sMarkerID = "marker_" + i;
            sKantoorInfo = arrMarkers[i].tekst;


            $("#" + sID).gmap3({
                action: ':addMarker',
                address: arrMarkers[i].adres,
                map: {
                    center: true,
                    zoom: 12,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                },
                marker: {
                    options: {
                        draggable: false,
                        icon: '/imgsite/marker.png',
                        id: 'marker_' + i
                    },
                    events: {
                        mouseover: function($e, marker) {
                            openInfoWindow($e, marker, sKantoorInfo);
                        },
                        mouseout: function($e) {
                            hideInfoWindow($e);
                        }
                    }
                }
            });

        }

    });

}

function openInfoWindow($e, marker, content) {
    var map = $e.gmap3({ action: ':get' }),
            infowindow = $e.gmap3({ action: ':get', name: 'infowindow' });
    if (infowindow) {
        infowindow.open(map, marker);
        infowindow.setContent(content);
    } else {
        $e.gmap3({ action: ':addinfowindow', anchor: marker, options: { content: content} });
    }
}

function hideInfoWindow($e) {
    var infowindow = $e.gmap3({ action: ':get', name: 'infowindow' });
    if (infowindow) {
        infowindow.close();
    }
}




