﻿$(document).ready(function() {
    $("body").append("<script type='text/javascript' src='/_scripts/jQuery/plugins/jquery.cycle.all.js'></script>");
    $("body").append("<script type='text/javascript' src='/_scripts/jquery/plugins/plugin.ajaxform.js'></script>");
    $("body").append("<script type='text/javascript' src='/_scripts/jquery/plugins/plugin.inputs.js'></script>");
    $("body").append("<script type='text/javascript' src='/_scripts/jQuery/plugins/plugin.carousel.js'></script>");
    $("body").append("<script type='text/javascript' src='/_scripts/jQuery/plugins/plugin.jcarousel.js'></script>");
    

    // Carousel
    $(".partnerlogos").Carousel({
        elementwidth: 120,
        elementwrapper: ".elements",
        element: "li",
        elementsperview: 4,
        speed: 60
    });

    //Slideshow
    $("#ctl00_ContentPlaceHolder1_Banner_banner").cycle({
        pagerEvent: "mouseover",
        pager: "#ctl00_ContentPlaceHolder1_Banner_nav ul",
        timeout: 7000,
        speed: 900,
        pagerAnchorBuilder: function(idx, slide) {

            return '#ctl00_ContentPlaceHolder1_Banner_nav li:eq(' + (idx) + ')';

        }
    });
    //zuigvis
    $(".menu ul").Suckerfish();

    // Ajaxforms
    //$(".callbackform .fields").Ajaxform({
    //    executionpath: "/Ajax/SendCallBackForm.aspx",
    //    reloadform: false
    //});

    $(".contactform .fields").Ajaxform({
        executionpath: "/Ajax/SendContactForm.aspx",
        reloadform: false
    });
    // Forms
    // Handle inputs
    $(".name input").Inputs({
        defaultvalue: "Naam"
    });

    $(".phone input").Inputs({
        defaultvalue: "Telnummer"
    });

    $(".email input").Inputs({
        defaultvalue: "E-mailadres"
    });

    // Set selected tree
    $(".menu").each(function() {
        $(this).find("li.selected").each(function() {
            $(this).parents("li").each(function() {

                $(this).children("a").each(function() {
                    $(this).addClass("selected");
                });
                $(this).children("ul").each(function() {
                    $(this).addClass("selectedul");
                });
            });
        });
    });

    // Search
    $(".searchbar").find("input").live("keypress", function(e) {
        if (e.keyCode == 13) {
            e.preventDefault();
            WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$SearchBox$SearchButton", "", false, "", "/SearchPage.aspx", false, true));
        }
    });
});


