﻿

swfobject.embedSWF("/externals/flash/active.swf", "dvFlashHeader", "637", "410", "9.0.0", "/externals/flash/expressInstall.swf", {}, { wmode: "transparent" }, {});

var $jq = jQuery.noConflict();


$jq(document).ready(function() {

    // Scrollable Accordion
    //    $jq(function() {        
    //                 
    //        $jq("div.scrollable").scrollable({ 
    //            vertical:true,
    //            size: 3       
    //        
    //        }).mousewheel();     
    //         
    //    });

    // Dialog
    var taal = $jq('#ctl00_hiddenTaal').val();

    $jq(function() {

        if (taal == "BR") {

            $jq('#bairro_modal').dialog({
                modal: true,
                autoOpen: false,
                //bgiframe: true,
                resizable: false,
                width: 620,
                //height: 400,
                //minHeight : 300,
                //maxHeight: 400,
                open: function(type, data) {

                    $jq(this).parents(".ui-dialog").wrap(
                  '<div class="modal_class"></div>'
                );

                    //$jq("div.scrollable").scrollable();

                    $jq("div.scrollable").scrollable({
                        vertical: true,
                        size: 10

                    }).mousewheel();

                },
                close: function(type, data) {

                    var wrapper = $jq(this).parents(".modal_class");
                    wrapper.replaceWith(wrapper.children());

                },
                buttons: {
                    "MARCAR TODOS": function() {

                        $jq("#bairro_modal").find("input:checkbox").each(function() {
                            this.checked = true;
                        });

                        //controleerBairros();

                    },
                    "DESMARCAR TODOS": function() {

                        $jq("#bairro_modal").find("input:checkbox").each(function() {
                            this.checked = false;
                        });

                        //controleerBairros();

                    },
                    "OK": function() {

                        $jq(this).dialog("close");
                        controleerBairros();

                    }
                }
            });

        } else {

            $jq('#bairro_modal').dialog({
                modal: true,
                autoOpen: false,
                //bgiframe: true,
                resizable: false,
                width: 620,
                //height: 400,
                //minHeight : 300,
                //maxHeight: 400,
                open: function(type, data) {

                    $jq(this).parents(".ui-dialog").wrap(
                  '<div class="modal_class"></div>'
                );

                    //$jq("div.scrollable").scrollable();

                    $jq("div.scrollable").scrollable({
                        vertical: true,
                        size: 10

                    }).mousewheel();

                },
                close: function(type, data) {

                    var wrapper = $jq(this).parents(".modal_class");
                    wrapper.replaceWith(wrapper.children());

                },
                buttons: {
                    "CHECK ALL": function() {

                        $jq("#bairro_modal").find("input:checkbox").each(function() {
                            this.checked = true;
                        });

                        //controleerBairros();

                    },
                    "UNCHECK ALL": function() {

                        $jq("#bairro_modal").find("input:checkbox").each(function() {
                            this.checked = false;
                        });

                        //controleerBairros();

                    },
                    "OK": function() {

                        $jq(this).dialog("close");
                        controleerBairros();

                    }
                }
            });

        }

    });
    

    $jq(".tdAlgemeenTitel").each(function() {

        var sTitel = $jq(this).text();
        sTitel = $jq.trim(sTitel);
        var arrTitel = sTitel.split(" ");
        var sEersteWoord = arrTitel[0];

        var titelArray = $jq.grep(arrTitel, function(n, i) {
            return (i > 0);
        });
        $jq(this).html("<span class='orange'>" + sEersteWoord + "</span> ").append(titelArray.join(" "));


    });


    $jq(function() {

        $jq(".imgPandInDeKijker").titleBlock({

            removeTitle: true,
            thefontSize: "20px"

        });

    });


    $jq(function() {

        $jq('.anythingSlider').anythingSlider({
            easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
            autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
            delay: 5000,                    // How long between slide transitions in AutoPlay mode
            startStopped: false,            // If autoPlay is on, this can force it to start stopped
            animationTime: 600,             // How long the slide transition takes
            hashTags: true,                 // Should links change the hashtag in the URL?
            buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
            pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
            startText: "iniciar",             // Start text
            stopText: "parar",               // Stop text
            navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
        });

    });


    function formatText(index, panel) {
        return index + "";
    }

    // Modal
    function toonModalBox_Bairro() {

        $jq(function() {

            $jq.nyroModalManual({
                url: '#modalbox_bairro'
            });

        });

    }


});



//

function controleerBairros() {

    var waardes = [];

    $jq("#bairro_modal").find("input:checkbox").each(function() {

        if (this.checked) {

            //var name = $jq(this).attr('name');
            var val = $jq(this).val();

            waardes.push($jq(this).val());

        }


    });

    __doPostBack('ctl00_uptBairros', waardes.join(';'));

    

}



