﻿function specialDD() {
    var curITem;
    var curborder;

    
    $(".dd-large .ddTitle").click(function () {
        var width = $(this).next('.ddChild').width();
        $(curITem).slideUp();
        $(curborder).hide(800);
        $(curITem).parent().css('z-index', '3');
        curITem = $(this).next('.ddChild');
        curborder = $('.dd-bottom', this);
        $(this).next('.ddChild').slideToggle();
        $(curborder).show();
        $(curITem).parent().css('z-index', '4');
        $('.dd-tabs', curITem).width(width);
        
    });
 

    $(".dd").click(function () {
        $(curITem).slideUp();
    
    });

    $('.btn-sluiten').click(function () {

        $(curITem).slideUp();
   
        return false;
    });

    $('.dd-tabs li').each(function (index) {

        $('a', this).click(function () {
            $('.dd-tabs li').removeClass('on');
            $(this).parent().addClass('on');
            $('.tabcontent').removeClass('on');
            $('.tabcontent:eq(' + index + ')').addClass('on');

            return false;
        });
    });
}
function bannerRotator() {
    var curItem = 0;
    var olditem = 0;
    scrollTimer();
    $('.mainsliderleftbutton').click(function () {
        $('.mainsliderprogress').css('width', '0').stop();
        playNext(true);
    });
    $('.mainsliderrightbutton').click(function () {

        $('.mainsliderprogress').css('width', '0').stop();
        playNext(false);
    });

    function scrollTimer() {
        $('.mainsliderprogress').animate({ width: '+=562px' }, 4000, 'linear', function () {
            $(this).css('width', '0');
            playNext(false);
        });
    }

    function playNext(status) {
        if (status) {
            curItem--;
            if (curItem < 0) {
                curItem = $('.mainsliderimage').length - 1;
            }
        } else {
            curItem++;
            if (curItem > $('.mainsliderimage').length - 1) {
                curItem = 0;
            }
        }

        $('.mainsliderimage:eq(' + (olditem) + ')').fadeOut();
        $('.mainsliderimage:eq(' + (curItem) + ')').fadeIn();

        olditem = curItem;
       scrollTimer();
    }
}

$(document).ready(function () {
    $('.siloheadersmall').each(function () {

        var curItem = 0;
        var olditem = 0;
        var obj = $(this);
        setInterval(rotates, 3000);

        function rotates() {
            if (status) {
                curItem--;
                if (curItem < 0) {
                    curItem = $('.siloimgsmall', obj).length - 1;
                }
            } else {
                curItem++;
                if (curItem > $('.siloimgsmall', obj).length - 1) {
                    curItem = 0;
                }
            }

            $('.siloimgsmall:eq(' + (olditem) + ')', obj).fadeOut();
            $('.siloimgsmall:eq(' + (curItem) + ')', obj).fadeIn();

            olditem = curItem;
        }
    });
});


$(document).ready(function () {
    $('.siloheaderbig').each(function () {

        var curItem = 0;
        var olditem = 0;
        var obj = $(this);
        setInterval(rotates, 3000);

        function rotates() {
            if (status) {
                curItem--;
                if (curItem < 0) {
                    curItem = $('.siloimgbig', obj).length - 1;
                }
            } else {
                curItem++;
                if (curItem > $('.siloimgbig', obj).length - 1) {
                    curItem = 0;
                }
            }

            $('.siloimgbig:eq(' + (olditem) + ')', obj).fadeOut();
            $('.siloimgbig:eq(' + (curItem) + ')', obj).fadeIn();

            olditem = curItem;
        }
    });

});

function activateTabs() {
    var currentTab = oldTab = 0;


    $('.tabs li').each(function (i) {

        $(this).click(function () {
            currentTab = i;
            $('.tabs li:eq(' + oldTab + ')').removeClass('on');

            $('.tabs li:eq(' + i + ')').addClass('on');

            $('.tab:eq(' + oldTab + ')').removeClass('on');
            $('.tab:eq(' + i + ')').addClass('on');
            $('#frame').attr('src', $('#frame').attr('src'));
            oldTab = currentTab;
        });
    });

}

function uspsHover() {
    var currentUsp = oldUsp = 0;


    $('.productdetailbodycenterusps li').each(function (i) {

        $(this).hover(function () {
       
            $('.productdetailbodycenterusps li:eq(' + oldUsp + ')').removeClass('on');
            $(this).addClass('on');

            $('.productdetailbodycenteruspsimg img:eq(' + oldUsp + ')').hide();
            $('.productdetailbodycenteruspsimg img:eq(' + i + ')').show();
      
            oldUsp = i;
        }, function () { });
    });

}

function subNav() {
    var curItem = 0;
    var curoldItem = 0;
    var opened = false;

    $('.sub .sub-col1').each(function (index) {
        $(this).children('li').children('ul').each(function (index) {
            var totSub = $(this).children().length;
            if (totSub == 1) {
                $(this).css('width', '100%').css('float', 'left').children().css('background', 'none');
            }
        });
    });

    $('.menu li').each(function (index) {
        var h = $('.sub:eq(' + index + ')').height();

        $('a', this).hover(function () {
            curItem = index;
            subSwitch(h);
            curoldItem = index;
            opened = true;
        }, function () { });
        $('.sub:eq(' + index + ')').hover(function () { }, function () {
            $(this).hide();
            opened = false;
        });
    });

    $(window).click(function(){
        if(opened){
            $('.sub:eq(' + curItem + ')').hide();
            opened = false;
        }
    });

    function subSwitch(h) {
        if (h > ($(window).height() - $(".menu").offset().top)) {
            $('html, body').animate({
                scrollTop: $(".menu").offset().top
            }, 500);
        }
        $('.menu li:eq(' + curoldItem + ')').removeClass('on');
        $('.menu li:eq(' + curItem + ')').addClass('on');
        $('.sub:eq(' + curoldItem + ')').hide();
        if (h > 20) {
            $('.sub:eq(' + curItem + ')').show();
        }
        $('.sub:eq(' + curItem + ') .sub-col1 > li > ul').height(h);
        $('.sub:eq(' + curItem + ') .sub-top').parent().height(h - 40).css('overflow', 'hidden');


    }

}


function imageSlide() {
    var currenID = 1;
    var dataItems = new Array();
    var dataTitleItems = new Array();
    $("a[rel^='prettyPhoto']").prettyPhoto({ slideshow: 5000, autoplay_slideshow: false, theme: 'facebook', overlay_gallery: false, show_title: false });
    $('#carousel').show().jcarousel().prepend('<div class="overstate"></div>');
    $('.overstate').css("left", 0 + 'px');

    $('#carousel li').each(function () {
        var val = $('a', this).attr("modal");
        dataItems.push(val);
        dataTitleItems.push('');
    });
    $('.overstate,#DetailImg,#photoPreview').click(function () {
        $.prettyPhoto.open(dataItems, dataTitleItems, dataTitleItems);
        $.prettyPhoto.changePage(currenID-1);
    });
    $('#carousel li').mouseover(function () {
        $('.overstate').css("left", ($(this).index() * 72) - 72 + 'px');
        currenID = $(this).index();
        $('#DetailImg').css("background", "url(" + $('a', this).attr('rel') + ")");
        $('#DetailImg').attr("href", $('a', this).attr('href'));
        $('.cloud-zoom').CloudZoom();
    });
    $('.cloud-zoom').CloudZoom();
   
}

function activateInfoTools() {
    $(".info-tool").hover(function () {
        var copyhtml = $("span", this).html();
        $('.pop-info-m').html(copyhtml);
        var w = $('.pop-info').width();
        var xcor = $(this).offset().left - w + 20;
      
        var ycor = $(this).offset().top ;

        $('.pop-info').fadeIn().offset({ top: (ycor-4), left: (xcor) });

        return false;
    }, function () {

    });
    $('.pop-info').hover(function () { }, function () { $(this).fadeOut(); });
    
}

function ShowPopup(ID) {
    var layer = $('#' + ID);
    layer.css('top', $(window).height() / 2 - layer.height() / 2);
    layer.css('left', $('.wrap').width() / 2 - layer.width() / 2);

    layer.fadeIn('slow');
    $('#overlayer').fadeIn('fast');
    if ($.browser.version <= 6.9 && $.browser.msie) {
        $('select').hide();
    }
    $('#overlayer').css('height', $(window).height());
    $('#overlayer').css('width', $(window).width());

    $(window).resize(function () {
        $('#overlayer').css('height', $(window).height());
        $('#overlayer').css('width', $(window).width());
        layer.css('top', $(window).height() / 2 - layer.height() / 2);
        layer.css('left', $('.wrap').width() / 2 - layer.width() / 2);
    });
}

function HidePopup(ID) {
    $('#' + ID).hide();
    $('#overlayer').hide();
    if ($.browser.version <= 6.9 && $.browser.msie) {
        $('select').show();
    }
}

function PlayersAnimate() {
    var totalscroll = 0;
    var countit = 0;
    var items = $(".productdetailbodyleftvoetballers li").length;

    var goToByScroll = function () {
        countit++;
        if (countit == items) {
            totalscroll = 0;
            countit = 0;
        } else {
            totalscroll -= 30;

        }
        $('.productdetailbodyleftvoetballers ul').animate({ top: totalscroll }, 'fast');

    }
    setInterval(goToByScroll, 2000);
}

$(document).ready(function () {
    $('.maattabelschoenen tbody tr:even').addClass('zebra');
    $('.maattabelschoenen tbody tr:first').css('background', '#000000');
    $('.maattabelschoenen tbody tr:first').css('text-transform', 'uppercase');
    $('.maattabelschoenen tbody td:last-child').css('border-right', 'none');
    $('.maattabelhandschoenen tbody tr:even').addClass('zebra');
    $('.maattabelhandschoenen tbody tr:first').css('background', '#000000');
    $('.maattabelhandschoenen tbody tr:first').css('text-transform', 'uppercase');
    $('.maattabelhandschoenen tbody td:last-child').css('border-right', 'none');
    $('.maattabelkleding tbody tr:odd').addClass('zebra');
    $('.maattabelkleding tbody td:first-child').css('width', '123px');
    $('.maattabelkleding tbody td:first-child').css('text-transform', 'uppercase');
    $('.maattabelkleding tbody td:first-child').css('padding-left', '10px');
    $('.maattabelkleding tbody td:last-child').css('border-right', 'none');
    $('.silolistsmall li:last-child').css('border-bottom', 'none');
    $('.silolistbig li:last-child').css('border-bottom', 'none');
    $('.maattabelscheenbeschermers tbody tr:odd').addClass('zebra');
    $('.maattabelscheenbeschermers tbody td:first-child').css('width', '123px');
    $('.maattabelscheenbeschermers tbody td:first-child').css('text-transform', 'uppercase');
    $('.maattabelscheenbeschermers tbody td:first-child').css('padding-left', '10px');
    $('.maattabelscheenbeschermers tbody td:last-child').css('border-right', 'none');
    $('.maattabelbal tbody tr:odd').addClass('zebra');
    $('.maattabelbal tbody td:first-child').css('width', '123px');
    $('.maattabelbal tbody td:first-child').css('text-transform', 'uppercase');
    $('.maattabelbal tbody td:first-child').css('padding-left', '10px');
    $('.maattabelbal tbody td:last-child').css('border-right', 'none');
    $('.sub-col1.nobg li  ul li  li a:first').css('padding-top', '30px');
});

Cufon.replace('.white-title,.dd-tabs li a,h1, .siloheadertxtsmall, .siloheadertxtbig, .newsletterheadertitle, .sale-prodpricebig, .productoverzichtfooter, .sale-prodpricesmall, .productdetailbodycenterkeuzeprijsbodylefttxttop, .productdetailbodycenterkeuzeprijsbodyrightttxttop, .productdetailbodycenterkeuzeprijsfooter, .productdetailbodyleftvoetballersname, .productdetailfooterhistorytxt, .productdetailcrossselecttitle, .productdetailcrosselectproducttitle, .productdetailcrossselecttitleorange, .tabs, .productdetailfootertabtitle, .winkelmandjeheadertxt, .accountmenuleftcenter, .accountbestellingenheadertxt, .accountgegevenssubtitle, .bestelprocesmenucentertitle, .bestelprocesmenucentertabstap, .accountblocktitle, .bestelprocesgegevenstitleaantal, .bestelprocesgegevenstitleomschrijving, .bestelprocesgegevenstitletotaal, .bestelproceswinkelwagencontrolegegevenstitle, .sub-col1 > li > a', {
    textShadow: ' 1px 1px rgba(0,0,0,0.4)', fontFamily: 'Century Gothic'
});
Cufon.replace('.productdetailbodyleftvoetballers li, .afhaalpuntentitle, .usp li, .hyperlinkstitle, .plaats, .maattabeltitle, .onlinebestellentitle, .seofootertitle, .filtertitle, .productoverzichtpricesmall, .productdetailbodyrightproducttitle, .productdetailbodycenteruspslist, .subtitle, .productdetailbodycenterkeuzeprijsbodylefttxtunder', {
    fontFamily: 'Century Gothic'
});
Cufon.replace('.productoverzichtpricebig, .productdetailbodycenterkeuzeprijsbodyleftpricetag, .productdetailbodycenterkeuzeprijsbodyrightpricetag', {
    fontFamily: 'Hand Of Sean'
});



