$(document).ready(function () {
    $('a.product-image-preview').jqzoom({
        zoomType: 'standard',
        alwaysOn: false,
        zoomWidth: 430,
        zoomHeight: 370,
        xOffset: 30,
        yOffset: 0,
        showEffect: 'fadein'
    });
    $('.wear-select li a').click(function () {
        //alert('ads');
        img = $(this).children();
        $('.product-image-preview').remove();
        $('#product').append('<a href="' + $(img).attr('alt') + '" class="product-image-preview"  rel="gal1">  <img src="http://www.southpole-usa.com/images/thumb/phpThumb.php?src=' + $(img).attr('alt') + '&w=392&h=460&q=90&far=C&bg=FFFFFF" ></a>');
 //		$('#product a img').attr('src', $(this).attr('alt'));
        $('a.product-image-preview').jqzoom({
            zoomType: 'standard',
            alwaysOn: false,
            zoomWidth: 430,
            zoomHeight: 370,
            xOffset: 30,
            yOffset: 0,
            showEffect: 'fadein'
        });
    });
    $(".accordeon-link").click(function () {
        thisel = 0;
        if ($(this).parent().children('.accordion-text-elem').css('display') != 'none') {
            thisel = 1;
            //	alert('a');
        }
        $('.accordion-text-elem').removeClass('hide');
        $('.accordion-text-elem').slideUp();
        $(".accordeon-link").removeClass('active');
        now = $(this).parent().children('.accordion-text-elem');
        if (thisel == 1) {
            flag = 0;
            $('.accordion-text-elem').each(function () {
                if (flag == 1) {
                    activel = this;
                    flag = 0;
                }
                //console.log($(this));		
                if ($(this).attr('id') == $(now).attr('id')) {
                    flag = 1;
                    if ($(this).parent().hasClass('last')) activel = $('#accordion-wrapper ul li:first-child').children('.accordion-text-elem');
                    //alert(thisel);
                }
            });
            $(activel).slideDown();
            $(activel).parent().children('a').addClass('active');
        }
        else {
            $(this).parent().children('.accordion-text-elem').slideDown();
            $(this).addClass('active');
        }
    });
});
