﻿$(document).ready(function() {


    $('a.popup').click(function(e) {
        e.preventDefault();
        $(this).nyroModalManual(
        {
          css: { wrapper: {top: '30%' } }
        });
    });

    $('div.image').hover(function() {
        $(this).find('span.enlarge').show();
    }, function() {
        $(this).find('span.enlarge').hide();
    });

    $('a.helpline').hover(function() {
        $(this).addClass('helpline-on');
    }, function() {
        $(this).removeClass('helpline-on');
    });

    $('#viewer a').nyroModal({
        gallery: 'lightbox',
        addImageDivTitle: false,
        galleryCounts: NoCount
    });

     $('ul.tabs li a').click(function(e) {
        e.preventDefault();
    });
    $('ul.tabs').tabs('div.panes > div', { tabs: 'li',
        current: 'selected',
        event: 'mouseover'
    });

    $('#thumbnails a').each(function() {
        (new Image()).src = $(this).attr('href');
    });

    var link = $(lnkFirstThumbnailImageClientId);
    $('#thumbnails a').click(function(e) {
        e.preventDefault();

        var img = new Image();
        img.src = $(this).find('img').attr('src').split("?z=")[1];
        var holder = this;

        $(img).load(function() {
            $(img).hide();
            $(link).attr('rel', 'lightbox nofollow');
            link = holder;
            $(imgProductClientId).stop('true').animate({ opacity: 0 }, 'fast', '', function() {
                $(imgProductClientId).hide();
                $(imgProductClientId).attr('src', $(link).find('img').attr('src').split("?z=")[1]).animate({ opacity: 1 }, 'slow');
                $(lnkMainImageClientId).attr('href', $(link).attr('href'));
                $(link).attr('rel', 'nofollow');
                $(imgProductClientId).show();
            });

        });





    });

    $(ddlQuantityClientId).change();

    $(ddlQuantityClientId).change(function() {
        var rfvEl = document.getElementById(rfvQuantityClientId);
        var revEl = document.getElementById(revQuantityClientId);
        if ($(this).val() == '6+') {
            $(this).hide();
            $(txtQuantityClientId).show().focus().select();
            ValidatorEnable(rfvEl, true);
            ValidatorEnable(revEl, true);
        }
        else {
            ValidatorEnable(rfvEl, false);
            ValidatorEnable(revEl, false);
        }
    });
});

function NoCount(nb, total, elts, settings) {

}
        