$(document).ready(function() {
    //Cycle
    $(".Banner").find("ul").cycle();

    //shoppingcart
    $(".ShoppingCart").ShoppingCart();

    //Cufon
    //Cufon.replace("h2");

    //suckerfish
    $(".Navigation ul ul").Suckerfish();

    //picture resizer
    //$(".Picture").ImageResizer();

    //linkmaker
    $(".Product").each(function() {
        var link = $(this).find("a").attr("href");
        $(this).attr({
            onclick: "parent.window.location = '" + link + "';"
        })
    });

    //close lightwindow
    $(".CloseLightWindow").click(function() {
        var link = $(this).attr("href");
        parent.window.location = link;
    });

    //gallery
    $(".Gallery").Gallery({
        Loader: ".MainPic .Picture"
    });

    //close thickbox
    $("#ShopFurther").live("click", function() {
        shopfurther();
    });

    //clicking functions for first level element
    //    $(".Left .Navigation ul").each(function() {
    //        $(this).find("li").children("a").click(function(e) {
    //            //return false;
    //        })

    //        $(this).find("li").click(function() {
    //            if ($(this).children("ul").is(":hidden")) {
    //                $(this).children("ul").show();
    //            }
    //            else {
    //                $(this).children("ul").hide();
    //            }
    //            return false;
    //        })
    //    });

    //init tree
    $(".Navigation").each(function() {
        $(this).find("li").each(function() {
            if ($(this).is(".ParentOfSelected")) {

                $(this).children("ul").show();
            }
        });
    });

    $(".Navigation").find("ul").find("ul").find("ul").hide();

    //$("#Contact").AjaxForm({
    //    Action: "MailForm",
    //    Title: "Contact Hans keuzekamp",
    //    //To: "rik@nedfinity.com",
    //    To: "info@fotohanskeuzekamp.nl",
    //    From: "website@fotohanskeuzekamp.nl",
    //    Message: "Bedankt voor uw intresse, wij nemen zo spoedig mogelijk contact met u op.",
    //    FalseFromHEX: "#eaa2ab",
    //    FalseToHEX: "#a70317",
    //    TrueHEX: "#b0db6a",
    //    FalseText: "Verplicht veld"
    //});

    $(".signup").Ajaxform2({
        falsecolor: "#ff2a00"
    });

    $("#Contact").Ajaxform3({
        executionpath: "/Ajax/sendform.aspx"
    });

    //putinstockrequest
    $(".PutInStockButtonWrapper").each(function() {
        var tempproductid = $(this).attr("id");
        var parent = $(this);

        $(this).find("a").click(function() {
            $(parent).load("/Ajax/SiteControls.aspx", { action: "sendstockrequest", productid: tempproductid });
        });
    });

    // Google map
    var Locations = new Array();
    Locations[0] = "Oude vismarkt 20, Zwolle";

    $("#googlemapholder").googlemap({
        addresses: Locations,
        labels: true,
        controls: false,
        zoom: 15,
        maptype: 1,
        controltype: 1,
        iconImage: "/_images/Gicon.png",
        iconShadow: "/_images/GiconShadow.png",
        iconSizeX: 25,
        iconSizeY: 31,
        iconShadowSizeX: 60,
        iconShadowSizeY: 31,
        iconAnchorX: 9,
        iconAnchorY: 34
    });

    //json
    //$(".selectlist").each(function() {
    //    $(this).append("<select>");
    //    $.getJSON("/Ajax/JSON.aspx", function(data) {
    //        $.each(data.items, function(item) {
    //            $(this).append("<option>" + item + "</option>");
    //        });
    //    });
    //    $(this).append("</select>");
    //});    

});