// JQUERY CUSTOM COMMANDS $(document).ready( function() { // start javascript when document is loaded /* LIST-IEMS classes to each three */ $('#content.oneColumn .blocks, #content.oneColumn .cells ').each(function(){ $(this).find('ul li').each(function(i){ var n = i % 3; $(this).addClass( n == 0 ? 'first' : n == 1 ? 'second' : n == 2 ? 'third' : ''); }); }); $('#content.twoColumn .blocks , #content.twoColumn .cells ').each(function(){ $(this).find('ul li').each(function(i){ var n = i % 4; $(this).addClass( n == 0 ? 'first' : n == 1 ? 'second' : n == 2 ? 'third' : n == 3 ? 'fourth' : ''); }); }); if ($.browser.msie && ($.browser.version == 6 ) ){ $('a.info').hover(function(){ $(this).addClass('infohover'); }, function() { $(this).removeClass('infohover'); }); } /* LIST-IEMS hover and click */ $('#mainCarrousel #slidePager ol li, #mainCarrousel #slides ol li, #sidebar .block .item, .blocks .block, .cells .cell, #search .choice ol li label, #bookCarrousel td, .dropdown, #lister .items .item, #addressChoice tbody tr, #account #methods .method, #history tbody').hover(function(){ $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }); $('#account #lister .items ol .item:last').addClass('last'); $('#bookCarrousel td').hover(function(){ $(this).parents('#bookCarrousel').addClass('hovered'); $(this).prevAll().addClass('hovered').end().nextAll().addClass('hovered'); $('#next, #prev').addClass('hovered'); }, function() { $(this).parents('#bookCarrousel').removeClass('hovered'); $(this).prevAll().removeClass('hovered').end().nextAll().removeClass('hovered'); $('#next, #prev').removeClass('hovered'); }); //$('#sidebar .block .item, #sidebar .cell .item, .blocks .block, .cells .cell #lister .items .item, #addressChoice tbody tr, #history tbody tr').click(function(event) { //if ($(event.target).is(":not('select, option, a, img, input, label, label canvas, label .cufon')") ) { //window.location = $(this).find('a.link').attr("href"); //} //}); $('#account #methods .method').click(function(event) { var $target = $(event.target); if ($target.is(":not('input, label')") ) { $('input', this).trigger('click'); } }); $('#slidePager a').click(function(){ window.location = $(this).attr("href"); }); // BOOKCARROUSEL $('#bookCarrousel li').each(function() { $(this).find('table td:gt(2) .balloon').addClass('alternate'); // BookCarrousel vertical centering ie6 & 7 if ($.browser.msie && ($.browser.version == 6 || $.browser.version == 7) ){ $("#bookCarrousel li td a.image").each(function () { var imageHeight = $(this).find('img').height() + 14; var top = Math.floor((180 - imageHeight)/2); var top = top +'px'; $(this).css('margin-top', top); }); } }); $('.wishlist td').hover(function(){ $(this).parent().addClass('hover'); }, function() { $(this).parent().removeClass('hover'); }); $('.wishlist td').click(function(event) { if ($(event.target).is(":not('a, input, label, label canvas, label .cufon')") ) { window.location = $(this).parent('tr').find('a.link').attr("href"); } }); /* Table-IEMS hover and click */ $('.basketContent .item').hover(function(){ $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }); $('.basketContent .item').click(function(event) { if ($(event.target).is(":not('a, input, label, label canvas, label .cufon')") ) { window.location = $(this).find('a.link').attr("href"); } }); $('input.textfield, textarea').focus(function() { $(this).parent().addClass('focus'); }); $('input.textfield, textarea').blur(function() { $(this).parent().removeClass('focus'); }); // SEARCH $('#searchForm').attr('autocomplete', 'off'); $("#search #fc_query").click(function() { $('#search .choice').show(); $(this).parent().addClass('clicked'); }); $("#search #fc_query").focus(function() { $('#search .choice').show(); $(this).parent().addClass('focus'); }); $("#search").mouseenter(function() { if (($("#search").find('.focus').length == 1)) { $('#search #fc_query').parent().addClass('clicked'); } }); $("#search").mouseleave(function() { $('#search #fc_query').parent().removeClass('clicked'); if (($("#search").find('.focus').length == 0) && ($("#search").find('.clicked').length == 0)) { $('#search .choice').hide(); } }); $("#search #fc_query").blur(function() { $(this).parent().removeClass('focus'); if (($("#search").find('.focus').length == 0) && ($("#search").find('.clicked').length == 0)) { $('#search .choice').hide(); } }); // Geselecteerde optie juist stylen $("#search .choice input.check").click(function() { //alert('radio click'); $("#search .choice .check").removeClass('selected').parent().removeClass('selection'); $(this).addClass('selected').parent().addClass('selection'); }); // Equalheights (2/2) ivm dhl2 thickbox equalheights rest buiten ready function equalHeight($(".blocks .button")); equalHeight($(".blocks .description")); equalHeight($(".cells .button")); equalHeight($(".cells .description")); equalHeight($(".topItems h3")); equalHeight($(".recent h3")); equalHeight($(".mustHaves h3")); equalHeight($(".blocks .block")); equalHeight($(".cells .cell")); // EQUAL HEIGHTS Bars function heights() { var cHeight = $('#content').height(); var sHeight = $('#sidebar #sideBlocks').height(); var mainHeight = $('#mainContent').height(); var secHeight = $('#secondaryContent').height(); var accHeight = $('#basket #account').height(); var mbHeight = $('#mainBlock').height(); /* var tbiHeight = $('#TB_iframeContent').height(); var tbiwHeight = $('#TB_iframeContent #wrapper').height(); if (tbiwHeight > tbiHeight) { $('#TB_iframeContent').height(tbiHeight); } */ if ($('#detail').length == 0) { // not on detailpage if (cHeight > sHeight) { $('#sidebar').height(cHeight - 9); //1 for border & 1 for last 8px margin-bottom } } if ($('#detail').length == 1) { // on detailpage because of different margin/padingbottom if (cHeight > sHeight) { $('#footer').addClass('mtMin'); $('#sidebar').height(cHeight - 31); //1 for border & 1 for last 10px margin-bottom } } if ((mainHeight > secHeight) && (mainHeight > sHeight)) { $('#secondaryContent').height(mainHeight - 27); $('#sidebar').height(mainHeight - 1); } if ((mainHeight < secHeight) && (mainHeight > sHeight)) { $('#sidebar').height(mainHeight - 1); } if ((mainHeight > secHeight) && (mainHeight < sHeight)) { $('#secondaryContent').height(mainHeight - 27); } if ((mainHeight < secHeight) && (secHeight < sHeight)) { $('#secondaryContent').height(sHeight - 26); } if ((mainHeight < secHeight) && (secHeight > sHeight)) { $('#sidebar').height(secHeight + 26); } if ((accHeight + 18) < sHeight) { $('#basket #account').css('min-height', (sHeight - 102) + "px"); } if ($('#mainBlock').length == 1) { // on myCosmox, staticPromo, FAQ if (mbHeight < sHeight) { $('#mainBlock #faq').height(sHeight - 72); $('#mainBlock #promotions').height(sHeight - 42); } } //alert(secHeight); } setTimeout(function() { heights(); }, 1000); //LOGIN $('#login .forgot').click(function() { if ($.browser.msie && ($.browser.version == 6 || $.browser.version == 7 ) ){ $(this).parents('#login').hide(); $(this).parents('#account').find('#forgotten').show(); return false; } else { $(this).parents('#login').slideUp(1000); $(this).parents('#account').find('#forgotten').slideDown(1000); return false; } }); $('#forgotten .back').click(function() { if ($.browser.msie && ($.browser.version == 6 || $.browser.version == 7 ) ){ $(this).parents('#forgotten').hide(); $(this).parents('#account').find('#login').show(); return false; } else { $(this).parents('#forgotten').slideUp(1000); $(this).parents('#account').find('#login').slideDown(1000); return false; } }); // INPUT LABEL IMG CLICK $('#account label img').click(function() { if ($.browser.msie && ($.browser.version == 6 || $.browser.version == 7 ) ){ $(this).parent().prev().trigger('click'); } }); // INPUT FOCUS & BLUR $('#account.data .zip .input input, #account.data .birthdate .input input, #account.data .number .selectInput input').focus(function(){ $(this).addClass('focus'); }); $('#account.data .zip .input input, #account.data .birthdate .input input, #account.data .number .selectInput input').blur(function(){ $(this).removeClass('focus'); }); // DISABLED LINK $('a.disabled, .paging a.active, #basket .couponCell .more, a.info').click(function() { return false; }); // CUSTOM SELECT // Show on click $(".dropdown a.selected, .customSelect a.selected").click(function() { $(this).parent("li").css({position:"relative"}); $(this).parent().find('ol').show(); $(this).addClass("down"); return false; }); // Hide on mouseout $(".dropdown, .customSelect").mouseleave(function() { $(this).find('ol').hide(); $(this).find("li").css({position:"static"}); $(this).find("a.selected").removeClass("down"); }); $(".dropdown ol li a, .customSelect ol li a").click(function() { $(this).parents('ol').hide(); $(this).parents(".formfields").find('a.selected').removeClass("down"); }); /* ROLLOVER IMAGES ($naam.gif <-> $naam_on.gif) */ $(".rollover").hover(function(){$(this).attr("src", $(this).attr("src").split('.gif').join('_on.gif'))}, function(){$(this).attr("src", $(this).attr("src").split('_on.gif').join('.gif'))}); $(document).bind('mw-overlay-loaded', function() { $(".rollover").hover(function(){$(this).attr("src", $(this).attr("src").split('.gif').join('_on.gif'))}, function(){$(this).attr("src", $(this).attr("src").split('_on.gif').join('.gif'))}); }); /* FAQ */ $(".faq dt a").click(function(){ $(this).parent('dt').toggleClass('active').next('dd').toggleClass('active').nextAll().removeClass('active').end().prev().prevAll().removeClass('active'); }); /* DELIVERY ADDRESS */ //$("input#fc_diff[@checked]").parents('#dataForm').find('#delivery').show().parents('#dataForm').find('.next').hide().prev().show(); $("input#fc_diff[@checked]").parents('#dataForm').find('#delivery').show(); //$("input#fc_diff").not(":checked").parents('#dataForm').find('#delivery').hide().parents('#dataForm').find('.next').show().prev().hide(); $("input#fc_diff").not(":checked").parents('#dataForm').find('#delivery').hide(); $("input#fc_diff, input#fc_same, input#fc_home").click(function () { if ($("input#fc_diff").is(":checked")) { //$(this).parents('#dataForm').find("#delivery").show().parents('#dataForm').find('.next').hide().prev().show(); $(this).parents('#dataForm').find("#delivery").show(); } else { //$(this).parents('#dataForm').find("#delivery").hide().parents('#dataForm').find('.next').show().prev().hide(); $(this).parents('#dataForm').find("#delivery").hide(); } }); /* DELIVERY Message */ $("input#fc_invoice[@checked]").parents('#dataForm').find('.formfields.message').show(); $("input#fc_invoice").not(":checked").parents('#dataForm').find('.formfields.message').hide(); $("input#fc_invoice, input#fc_invoice2").click(function () { if ($("input#fc_invoice").is(":checked")) { $(this).parents('#dataForm').find('.formfields.message').show(); } else { $(this).parents('#dataForm').find('.formfields.message').hide(); } }); // HEADER LOFOFF LINK /*$("#user .logOff").click(function(){ $(this).parent().hide(); //$(this).parent().next().show().find('span').animate({ color: "#fff" }, 4000).animate({ opacity: 0 }, 4000); $(this).parent().next().show().find('span').animate({ color: "#fff" }, 4000); return false; });*/ /* $('#secondaryContent .block').each(function(){ $(this).find('li:gt(4)').hide().parents('.block').append("Meer opties"); $(this).find('.moreFilters').click(function(){ if ($(this).parents('.block').find('li:gt(4)').is(':hidden')){ $(this).parents('.block').find('li:gt(4)').show(); } else { $(this).parents('.block').find('li:gt(4)').hide(); } $(this).text($(this).text() == 'Meer opties' ? 'Minder opties' : 'Meer opties'); }); }); */ // DETAIL $("#secondaryInfo .moreInfo tr:even, #secondaryInfo .tracks li:even").addClass("odd"); $("#reviews ul li:gt(2)").hide(); $("#reviews #lessReviews").hide(); $("#reviews #moreReviews").click(function() { $(this).parents('#reviews').find('li').slideDown(1500); $(this).slideUp(1500); $("#reviews #lessReviews").slideDown(1500); return false; }); $("#reviews #lessReviews").click(function() { $(this).parents('#reviews').find('li:gt(2)').slideUp(1500); $(this).slideUp(1500); $("#reviews #moreReviews").slideDown(1500); return false; }); $("#write .write").click(function() { $(this).next('#reviewPane').slideDown(1500); return false; }); $("#write #reviewPane .hide").click(function() { $(this).parents('#reviewPane').slideUp(1500); return false; }); if (!$.browser.msie && $.browser.version != 6){ $("#detail #social #tip").click(function() { $('#detail #secondaryInfo #tips').fadeIn(500); return false; }); $("#detail #social .hide").click(function() { $('#detail #secondaryInfo #tips').fadeOut(500); return false; }); } else { $("#detail #social #tip").click(function() { $('#detail #secondaryInfo #tips').show(); return false; }); $("#detail #social .hide").click(function() { $('#detail #secondaryInfo #tips').hide(); return false; }); } $("#detail #social #rate").click(function() { $('#detail #reviewPane').show(); }); /* ?f dit ?f waarschijnlijk meer breedtes aangeven in css voor ie7 */ if ($.browser.msie && $.browser.version != 8){ $("#detail #social #tag").click(function() { $(this).next('#addTags').show(); return false; }); } else { $("#detail #social #tag").click(function() { $(this).next('#addTags').slideDown(1000); return false; }); } $(".tags .more").click(function() { $(this).next('.addTagBottom').slideDown(1000); return false; }); $("#basket .couponCell .more").click(function() { $(this).slideUp(1000); $(this).next().slideDown(1000); }); $(".supplem").each(function() { if ($(this).find('.priceAction').length == 1) { $(this).find('.priceNew').addClass('pricePrev'); } }); // STAR-RATING TEXT var included = $('.star-rating-on').length; // alert(included); if (included == 0) { $("#reviewPane .rateText").html("Nog geen oordeel"); } if (included == 1) { $("#reviewPane .rateText").html("Slecht"); } if (included == 2) { $("#reviewPane .rateText").html("Matig"); } if (included == 3) { $("#reviewPane .rateText").html("Goed"); } if (included == 4) { $("#reviewPane .rateText").html("Erg Goed"); } if (included == 5) { $("#reviewPane .rateText").html("Uitmuntend!"); } $("#reviewPane .raterBox,#reviewPane .raterBox div").click(function() { var included = $('.star-rating-on').length; // alert(included); if (included == 0) { $("#reviewPane .rateText").html("Nog geen oordeel"); } if (included == 1) { $("#reviewPane .rateText").html("Slecht"); $(this).parents(".raterBox").find('input').attr('checked', 'checked'); } if (included == 2) { $("#reviewPane .rateText").html("Matig"); } if (included == 3) { $("#reviewPane .rateText").html("Goed"); } if (included == 4) { $("#reviewPane .rateText").html("Erg Goed"); } if (included == 5) { $("#reviewPane .rateText").html("Uitmuntend!"); } $(this).parents('.rater').next().hide(); }); // TRACKLIST $('.tracks .contains li:gt(4), .tracks .contains h3:gt(0)').hide(); $('.tracks .more').click(function() { if ($('.tracks .contains li:gt(4), .tracks .contains h3:gt(0)').is(':hidden')){ $('.tracks .contains li:gt(4), .tracks .contains h3:gt(0)').slideDown(1000); } else { $('.tracks .contains li:gt(4), .tracks .contains h3:gt(0)').slideUp(1000); } $(this).text($(this).text() == 'Meer' ? 'Minder' : 'Meer'); return false; }); // TAGS var tHeight = $('#tagBox').height(); if (tHeight > 90) { if ($.browser.msie && ( $.browser.version == 7 || $.browser.version == 6 ) ){ $('#tagBox').height(81); } else { $('#tagBox').height(90); } $(".tags .less").hide(); } else { $(".tags .less, .tags .all").hide(); } $(".tags .all").click(function () { $('#tagBox').height(tHeight); $(this).hide(); $(".tags .less").show(); return false; }); $(".tags .less").click(function () { if ($.browser.msie && ( $.browser.version == 7 || $.browser.version == 6 ) ){ $('#tagBox').height(85); } else { $('#tagBox').height(90); } $(this).hide(); $(".tags .all").show(); return false; }); // DHL2 thickbox sequential list $("#menu ul li").each(function (i) { $(this).addClass("item" + (++i)); }); $("#addresses > ul > li").each(function (i) { $(this).addClass("item" + (++i)); }); $("#addresses > ul > li").hide(); $("#addresses > ul > li:first").show(); $("#menu ul li a:first").addClass('active'); $('#menu ul li a').click(function() { $(this).parents('ul').find('a').removeClass('active'); $(this).addClass('active'); var theClass = $(this).parent().attr("class"); // alert(theClass); $("#addresses > ul > li").hide(); $("#addresses > ul > li[class='" + theClass + "']").show(); return false; }); // FOOTER nooit boven onderkant vieport met weinig content var viewportHeight = $(window).height(); var footHeight = $('#footer').outerHeight(); var headHeight = $('#header').outerHeight(); var breadHeight = $('#breadCrumbs').outerHeight(); var cHeight = $('#content').height(); var sHeight = $('#sidebar #sideBlocks').height(); var viewportHeight = viewportHeight - footHeight - headHeight - breadHeight - 3; if (((viewportHeight) > cHeight) && ((viewportHeight) > sHeight)) { $('#content').height(viewportHeight); $('#account').height(viewportHeight - 72); } /* if ($('#lister div.selector').length != 0) { $('#lister').addClass('compare'); } */ }); // end ready function // Equalheights (1/2) ivm dhl2 thickbox equalheights function equalHeight(group) { tallest = 0; group.each(function() { thisHeight = $(this).height(); if(thisHeight > tallest) { tallest = thisHeight; } }); group.height(tallest); }