var initTabData = function () {

    var elTab = $('.dataTab'),
	elTabHeader = elTab.find('p'),
	elBtnChangeData = elTab.find('a'),
	elTabContent = elTab.next('.dataGeneralBody'),
	elTabClose = elTab.next('.dataGeneralBody').find('.closedataGenBody a'),
	elDataInput = elTabContent.find('input');

    elDataInput.attr('disabled', 'disabled');

    //LINK CHANGE DATA
    elBtnChangeData.click(function (e) {
        var el = $(this);
        elTab = el.parents('.dataTab'),
		elTabContent = elTab.next('.dataGeneralBody'),
		elDataInput = elTabContent.find('input');

        if (elDataInput.attr('disabled')) {
            elDataInput.removeAttr('disabled');
        } else {
            elDataInput.attr('disabled', 'disabled');
        }
        e.preventDefault();
        e.stopPropagation();
    });

    //TAB HEADER P
    elTabHeader.click(function (e) {
        var el = $(this),
		elTab = el.parents('.dataTab'),
		elTabContent = elTab.next('.dataGeneralBody'),
		elDataInput = elTabContent.find('input');

        if (elTabContent.css('display') == 'none') {
            elDataInput.attr('disabled', 'disabled');
            elTab.removeClass('closed');
            elTabContent.slideDown('slow');
        }
        e.preventDefault();
        e.stopPropagation();
    });

    //TAB CLOSE
    elTabClose.click(function (e) {
        var el = $(this),
		elTabContent = el.parents('.dataGeneralBody'),
		elTabHeader = elTabContent.prev('.dataGeneralTitle'),
		elDataInput = elTabContent.find('input');

        elTabContent.slideUp('slow', function () {
            elTabHeader.addClass('closed');
            elDataInput.attr('disabled', 'disabled');
        });
        e.preventDefault();
        e.stopPropagation();
    });
}



//PAYMENT SELECTION STEP 4 RADIO BUTTONS

var initPmntSelection = function () {

    var elPmntBlock = $('.listCards');

    elPmntBlock.change(function () {

        var elPmntSelection = $("input[name*='choosePayment']:checked");

        if (elPmntSelection.attr('id').indexOf('Visa') != -1 || elPmntSelection.attr('id').indexOf('MasterCard') != -1) {

            $('.textCardsMB').hide();
            $('.textCardsCreditCards').show();
            $('input[name*=btnConfirm]').attr('group', 'CD');

        } else if (elPmntSelection.attr('id').indexOf('Mb') != -1) {

            $('.textCardsCreditCards').hide();
            $('.textCardsMB').show();
            $('input[name*=btnConfirm]').attr('group', 'NIB');

        } else if (elPmntSelection.attr('id').indexOf('paypal') != -1) {

            $('.textCardsCreditCards').hide();
            $('.textCardsMB').hide();
            $('input[name*=btnConfirm]').attr('group', 'Paypal');
        }
        /*
        $('.prodCollect').hide();
        $('.collect' + $(this).val()).show();					 
        */
    });
}


//CART FORM STEP 3 SELECT

var initSltCollect = function () {
    var elSltCollect = $('.sltCollect');
    var elSltOption = elSltCollect.find('option:selected');

    elSltCollect.change(function () {
        $('.prodCollect').hide();
        $('.collect' + $(this).val()).show();
    });

    if (elSltOption.length) {
        elSltCollect.trigger('change');
    }
}

/* CART FORM REGISTER STEP 2 */

var initCartFormReg = function () {
    var elCartFormReg = $('.cartFormReg');
    var elRadTypeClient = elCartFormReg.find('.radTypeClient input');
    var elClientChk = elRadTypeClient.filter(':checked');
    var elRadCardOwner = elCartFormReg.find('.radCardOwner input');
    var elCardOwnerChk = elRadCardOwner.filter(':checked');

    elRadTypeClient.click(function () {
        var elRad = $(this);
        if (elRad.parent().hasClass('individual')) {
            elCartFormReg.find('.dataIndividual').show();
            elCartFormReg.find('.dataCompany').hide();
        } else {
            elCartFormReg.find('.dataIndividual').hide();
            elCartFormReg.find('.dataCompany').show();
        }
    });

    elRadCardOwner.click(function () {
        var elRad = $(this);

        if (elRad.hasClass('cardYes') || elRad.parent().hasClass('cardYes')) {
            elCartFormReg.find('.colCard').show();
        } else {
            elCartFormReg.find('.colCard').hide();
        }

    });

    elClientChk.trigger('click');
    elCardOwnerChk.trigger('click');
}

/* INIT LINK PROD COMMENT */

var initLinkComment = function () {
    var elLinkComment = $('.linkComment'),
	elBoxComment = $('.modBoxComment');
    elLinkComment.click(function (e) {
        if (elBoxComment.css('display') == 'none') {
            elBoxComment.show();
        } else {
            elBoxComment.hide();
        }
        e.preventDefault();
        e.stopPropagation();
    });
    $(document).mouseup(function (e) {
        if ($(e.target).parent('.modBoxComment').length == 0 && $(e.target).parents('.prodComment').length == 0) {
            elBoxComment.hide();
        }
    });
}

/* INIT CARROUSEL PRODUCT TIP */

var initProdTip = function () {
    var elLinkProdTip = $('.linkProdTip');
    var elTipInfo = $('.prodTip .modAddInfo');

    elLinkProdTip.click(function (e) {
        var elProdInfo = $(this).next('.modAddInfo');
        if (elProdInfo.css('display') == 'block') {
            elProdInfo.hide();
        } else {
            elTipInfo.hide();
            elProdInfo.show();
        }
        e.preventDefault();
        e.stopPropagation();
    });

    $(document).mouseup(function (e) {
        if ($(e.target).parent('.prodTip').length == 0 && $(e.target).parents('.modAddInfo').length == 0) {
            elTipInfo.hide();
        }
    });
}

/* INIT CARROUSEL TEMPLATE Info, CARR WITH DIVS */

var initCarrTemplateInfo = function () {
    var elCarrTemplateInfo = $('.carrTemplateInfo');

    elCarrTemplateInfo.each(function () {

        var sCarouselId = $(this).find('.carrContainer').attr('id');
        var elCarrouselHolder = $('#' + sCarouselId);

        var elCarousel = elCarrouselHolder.find('.jCarouselLite');

        var elCarouselItems = elCarousel.find('.liCarr');
        var elCarouselPagination = elCarrouselHolder.find('.carouselPagination');

        var aItemsPagination = ['<ul>'];

        for (var i = 1; i <= elCarouselItems.length; i++) {
            if (i == 1) {
                aItemsPagination.push('<li class="selected"><a href="#" class="' + i + '" >' + i + '</a></li>');
            } else {
                aItemsPagination.push('<li><a href="#" class="' + i + '" >' + i + '</a></li>');
            }
        }
        aItemsPagination.push('</ul>')

        elCarouselPagination.append(aItemsPagination.join(''));

        //PAGINATION LINKS EVENT HANDLER

        var elCarrPaginationLinks = elCarouselPagination.find('a');
        elCarrPaginationLinks.click(function () {
            var index = $(this).parent().index();
            initPaginationSelect(index, sCarouselId);
        });

        //CONVERT JQUERY OBJ TO ARRAY

        var aCarrPaginationLinks = $.makeArray(elCarrPaginationLinks);

        elCarousel.jCarouselLite({
            visible: 1,
            start: 0,
            auto: false,
            circular: false,
            speed: 2000,
            btnNext: "#" + sCarouselId + " .forward",
            btnPrev: "#" + sCarouselId + " .back",
            btnGo: aCarrPaginationLinks,
            afterEnd: function (a) {
                initPaginationSelect(a, sCarouselId);
            }
        });




    });



    $("#date_1989").tooltip();
    $("#date_1990").tooltip();
    $("#date_1992").tooltip();
    $("#date_1993").tooltip();
    $("#date_1996").tooltip();
    $("#date_1997").tooltip();
    $("#date_1998").tooltip();
    $("#date_2000").tooltip();
    $("#date_2001").tooltip();
    $("#date_2002").tooltip();
    $("#date_2004").tooltip();
    $("#date_2005").tooltip();
    $("#date_2006").tooltip();
    $("#date_2007").tooltip();
    $("#date_2008").tooltip();
    $("#date_2009").tooltip();
    $("#date_2010").tooltip();
    $("#date_2011").tooltip();


}
/* INIT CARROUSEL PRODUCT TIP */

var initProdTip = function () {
    var elLinkProdTip = $('.linkProdTip');
    var elTipInfo = $('.prodTip .modAddInfo');

    elLinkProdTip.hover(function (e) {

        var elProdInfo = $('[carr=' + $(this).parents('.liCarr').attr('index') + '][index=' + $(this).attr('index') + ']'); //;$(this).next('.modAddInfo');


        if (elProdInfo.length == 0) {
            elProdInfo = $(this).siblings('.modAddInfo');
        }

        if (elProdInfo.css('display') == 'block') {

        } else {


            elTipInfo.hide();
            elProdInfo.show();

            if (elProdInfo.attr('carr') == null) {

                elProdInfo.attr('carr', elProdInfo.parents('.liCarr').attr('index'));

                var left, top;
                left = elProdInfo.offset().left;
                top = elProdInfo.offset().top;
                elProdInfo.appendTo('body').css({
                    'position': 'absolute',
                    'left': left + 'px',
                    'top': top + 20 + 'px'
                });
            }


        }


        e.preventDefault();
        e.stopPropagation();
    });

    $('.modAddInfo').mouseleave(
        function () {
            if ($(this).css('display') == 'block') {
                $(this).hide();
            }
        }
    );

    //elProdInfo.hide();) {

    //elProdInfo.hide();});


    $(document).mouseup(function (e) {

        if ($(e.target).parent('.prodTip').length == 0 && $(e.target).parents('.modAddInfo').length == 0) {
            elTipInfo.hide();


            //            elProdInfo
            //            .appendTo('body');
        }
    });

}




/* INIT CARROUSEL TEMPLATE 1, CARR WITH DIVS */

var initCarrTemplate1 = function () {
    var elCarrTemplate1 = $('.carrTemplate1');

    elCarrTemplate1.each(function () {

        var sCarouselId = $(this).find('.carrContainer').attr('id');
        var elCarrouselHolder = $('#' + sCarouselId);

        var elCarousel = elCarrouselHolder.find('.jCarouselLite');

        var elCarouselItems = elCarousel.find('.liCarr');
        var elCarouselPagination = elCarrouselHolder.find('.carouselPagination');

        var aItemsPagination = ['<ul>'];

        for (var i = 1; i <= elCarouselItems.length; i++) {
            if (i == 1) {
                aItemsPagination.push('<li class="selected"><a href="#" class="' + i + '" >' + i + '</a></li>');
            } else {
                aItemsPagination.push('<li><a href="#" class="' + i + '" >' + i + '</a></li>');
            }
        }
        aItemsPagination.push('</ul>')

        elCarouselPagination.append(aItemsPagination.join(''));

        //PAGINATION LINKS EVENT HANDLER

        var elCarrPaginationLinks = elCarouselPagination.find('a');
        elCarrPaginationLinks.click(function () {
            var index = $(this).parent().index();
            initPaginationSelect(index, sCarouselId);
        });

        //CONVERT JQUERY OBJ TO ARRAY

        var aCarrPaginationLinks = $.makeArray(elCarrPaginationLinks);

        if (elCarouselItems.length > 1) {

            elCarousel.jCarouselLite({
                visible: 1,
                start: 0,
                auto: 2000,
                speed: 2000,
                btnNext: "#" + sCarouselId + " .forward",
                btnPrev: "#" + sCarouselId + " .back",
                btnGo: aCarrPaginationLinks,
                afterEnd: function (a) {
                    initPaginationSelect(a, sCarouselId);
                }

            });
        }
        else {
            
        }
    });
}

/* INIT CARROUSEL TEMPLATE 2, CARROUCEL WITH TOOLTIP AND FANCY BOX */

var initCarrTemplate2 = function () {
    var elCarrTemplate2 = $('.blockCarrouselProduct');

    elCarrTemplate2.each(function () {

        var sCarouselId = $(this).find('.prodCarroucel').attr('id'),
		elCarrouselHolder = $('#' + sCarouselId),
		elCarousel = elCarrouselHolder.find('.jCarouselLite'),
		elCarouselItems = elCarousel.find('li'),
		elCarouselPagination = elCarrouselHolder.find('.carouselPagination'),
		aItemsPagination = ['<ul>'];

        for (var i = 1; i <= elCarouselItems.length; i++) {
            //IF REL ATTR THEN TOOLTIP TO PAGINATION LINK
            var tooltipImg = elCarouselItems.eq(i - 1).find('a').attr('rel');
            if (tooltipImg.length) {
                if (i == 1) {
                    aItemsPagination.push('<li class="selected"><a href="#" class="' + i + '" rel="' + tooltipImg + '">' + i + '</a></li>');
                } else {
                    aItemsPagination.push('<li><a href="#" class="' + i + '" rel="' + tooltipImg + '">' + i + '</a></li>');
                }
            } else {
                if (i == 1) {
                    aItemsPagination.push('<li class="selected"><a href="#" class="' + i + '" >' + i + '</a></li>');
                } else {
                    aItemsPagination.push('<li><a href="#" class="' + i + '" >' + i + '</a></li>');
                }
            }

        }
        aItemsPagination.push('</ul>')

        elCarouselPagination.append(aItemsPagination.join(''));

        //PAGINATION LINKS EVENT HANDLER

        var elCarrPaginationLinks = elCarouselPagination.find('a');
        elCarrPaginationLinks.click(function () {
            var index = $(this).parent().index();
            initPaginationSelect(index, sCarouselId);
        });

        //PAGINATION LINK MOUSEOVER SHOW CUSTOM TOOLTIP

        elCarrPaginationLinks.mouseover(function () {
            var elImgRel = $(this).attr('rel');
            if (elImgRel.length) {
                var aTooltipDom = [
					'<div class="prodToolTip">',
					'<div class="tipTop"></div>',
					'<div class="tipMain"><img src="' + elImgRel + '" alt=""/></div>',
					'<div class="tipEnd"></div>',
					'</div>'
				];
                $(this).parent().append(aTooltipDom.join(''));
            }
        });
        elCarrPaginationLinks.mouseout(function () {
            jQuery('.prodToolTip').remove();
        });

        //CONVERT JQUERY OBJ TO ARRAY

        var aCarrPaginationLinks = $.makeArray(elCarrPaginationLinks);

        elCarousel.jCarouselLite({
            visible: 1,
            start: 0,
            btnNext: "#" + sCarouselId + " .forward",
            btnPrev: "#" + sCarouselId + " .back",
            btnGo: aCarrPaginationLinks,
            afterEnd: function (a) {
                initPaginationSelect(a, sCarouselId);
            }
        });

        //FANCY BOX FOR PROD LINK ZOOM
        elCarrouselHolder.find('.linkZoom').fancybox({
            'transitionIn': 'none',
            'transitionOut': 'none'
        });

        elCarrouselHolder.find('.linkImg').click(function () {
            return false;
        });
    });
}

//THIS IS THE NEW CARROUSEL GENERIC 2

var carroucelStart2 = function (objToStart, caroucelToStar) {

    var elCarousel = objToStart.find('.highlightCarrocelContent');

    if (!elCarousel.length) {
        elCarousel = objToStart.find('.latestNewsCarrocelContent');
    }

    var sCarouselId = caroucelToStar;
    var sCarrId = sCarouselId.substr(1);

    var sUlId = 'ul_' + sCarrId;
    var elUl = objToStart.find('ul.carr').attr('id', sUlId);

    var elCarouselItems = elCarousel.find('li');
    var elCarouselPagination = $(sCarouselId).next().find('.pagination');

    var elCarrId = $(sCarouselId);
    var iVisible = elCarrId.data('visible');

    var sCarrArrows = '<a href="#" class="arrow back">&lt;</a> <a href="#" class="arrow forward">&gt;</a>';
    elCarrId.append(sCarrArrows);

    singleWidth = elCarouselItems.outerWidth(),
    visible = Math.ceil(elCarousel.innerWidth() / singleWidth),
    pages = Math.ceil(elCarouselItems.length / visible);

    var plusPage = 1;
    var aItemsPagination = ['<ul>'];

    for (var i = 1; i <= pages; i++) {
        if (i == 1) {
            aItemsPagination.push('<li class="selected"><a href="#" class="' + i + '" >' + i + '</a></li>');
            /*}else if(i == pages){
            aItemsPagination.push('<li><a href="#" class="' + elCarouselItems.length + '" >' + elCarouselItems.length + '</a></li>');*/
        } else {
            plusPage += pages;
            aItemsPagination.push('<li><a href="#" class="' + plusPage + '" >' + plusPage + '</a></li>');
        }
    }
    aItemsPagination.push('</ul>')

    elCarouselPagination.append(aItemsPagination.join(''));

    var elCarrPaginationLinks = elCarouselPagination.find('a');
    elCarrPaginationLinks.click(function () {
        var index = $(this).parent().index();
        initPaginationSelect2(index, sCarrId);
    });

    var aCarrPaginationLinks = $.makeArray(elCarrPaginationLinks);

    if (elCarouselItems.length > 1) {

        elCarousel.jCarouselLite({
            visible: iVisible,
            scroll: iVisible,
            start: 0,
            speed: 2000,
            btnNext: sCarouselId + " .forward",
            btnPrev: sCarouselId + " .back",
            btnGo: aCarrPaginationLinks,
            pagerRange: true,
            afterEnd: function (a) {
                //console.log(a);
                //initPaginationSelect2(a,sCarrId);
            }
        });
    } 
    else {

    }

    objToStart.find('.back').click(function () {
        initPagerArrows(objToStart, 'back')
    });
    objToStart.find('.forward').click(function () {
        initPagerArrows(objToStart, 'forward')
    });
}

//CARROUSEL ARROW LINKS PAGINATION 2 FOR carroucelStart2

var initPagerArrows = function (el, dir) {
    var sDir = dir;
    var elPagination = el.next().find('.pagination li');
    var iPages = elPagination.length;
    var iSelected = parseInt(elPagination.filter('.selected').index()) + 1;

    if (dir == 'forward') {
        iSelected += 1;
    } else {
        iSelected -= 1;
    }

    if (iSelected > iPages) {
        iSelected = 1;
    } else if (iSelected < 1) {
        iSelected = iPages;
    }

    iSelected -= 1;
    elPagination.removeClass('selected');
    elPagination.eq(iSelected).addClass('selected');
}

//CARROUSEL PAGER LINKS PAGINATION 2 FOR carroucelStart2

var initPaginationSelect2 = function (index, id) {
    var elCarr = $('#' + id);
    var sCarrClass = elCarr.attr('class');
    var elCarouselPagination = $('#' + id).next().find('.pagination li');
    index = index;
    elCarouselPagination.removeClass('selected');
    elCarouselPagination.eq(index).addClass('selected');
}

var initProdZoom = function () {
    $('.productZoom').mouseout(function () {
        $('#listTabsContent .productZoom').attr('style', 'display:none;');
    });
}

var initListTabsHover = function () {
    $('#listTabsContent div li').mouseover(function () {
        $('#listTabsContent .productZoom').attr('style', 'display:none;');
        $(this).find('.productZoom').attr('style', 'display:block;');
    });
}

var initTabsIdeiasCont = function () {
    $('.tabsIdeiasContent .ui-tabs-nav a').click(function () {

        if ($(this).attr('id') != "tabButton03") {

            var whatTab = $(this).parent().prevAll().length;
            var whatPanel = $('#tabsIdeias .ui-tabs-panel:eq(' + whatTab + ')');

            $('.tabsIdeiasContent .highlightCarrocel').remove();
            $('.tabsIdeiasContent .navBar').remove();

            whatTab = Number(whatTab);
            whatPanel.empty().prepend(carrouselDom[whatTab]);

            var objCarroucel = whatPanel.find('.highlightCarrocel');

            if ($('#tabsIdeias .highlightCarrocelContent ul > li').length < 6) {
                $('.highlightCarrocelContent').css('overflow', 'hidden');
            } else {
                carroucelStart(objCarroucel, '#highlightCarrocel2');
            }
        }
    });
}

//THIS FUNCTION INITS TABS AND CARROUSEL INSIDE TABS

var initGenericTabs = function (el) {
    el.tabs({
        show: function (e, ui) {
            var carr = $('.highlightCarrocel', ui.panel);
            if (carr.length && carr.data('init') != true) {
                var carrId = carr.attr('id');
                //$('#' + carrId).data('visible',3);
                //carroucelStart2($('#' + carrId), '#' + carrId);
                carr.data('init', true);
            }
        }
    });
}

//THIS FUNCTION INITS TABS WITH PAGINATION INSIDE TABS

var initTabsInsideTabs = function (el) {
    el.tabs({
        select: function (e, ui) {
            var list = $('#listTabsContent', ui.panel);
            if (list.length) {
                list.tabs();

                nItems = 3;

                if ($('.blockTabsPromo').length || $('.blockTabsIdeas').length) {
                    nItems = 4;
                }

                //INIT PAGINATION ON FIRST ELEMENT OF SELECTED TAB
                firstTabContent = list.find('div:first');

                tabContent = firstTabContent.find('ul:first');
                tabContentId = tabContent.attr('id');

                pContent = firstTabContent.find('.pagination');
                pTabContent = pContent.attr('id');

                //initTabsPagination('#tabContent01', '#pTabContent01', nItems);		
                initTabsPagination('#' + tabContentId + '', '#' + pTabContent + '', nItems);

                //ONCLICK BUTTON ID
                firstUl = list.find('ul:first');
                liOfLeftNav = $('li', firstUl);
                aOfLeftNav = $('a', liOfLeftNav);

                aOfLeftNav.unbind('click', leftTabMenuItem);
                aOfLeftNav.bind('click', leftTabMenuItem);

                //$('' + list + '.ui-tabs-nav a').click(function() {
                //TRIGGER THE PAGINATION FOR THE ACTUAL FIRST ELEMENT OF TAB
                /*var elUl = list.find('ul:first');
                var firstA = elUl.find('a:first');
                var idFirstA = firstA.attr('id');
                var button = '#' + idFirstA + '';
                $('' + button +'').trigger('click');*/
            }
        }
    });

    var leftTabMenuItem = function () {
        var idContentToPaginat = $(this).attr('id');

        if (idContentToPaginat != null && tabContentId != null) {
            var elTabSize = tabContentId.length;
            var elPagSize = pTabContent.length;

            initTabsPagination('#' + tabContentId.slice(0, elTabSize - 2) + idContentToPaginat.substring(9), '#' + pTabContent.slice(0, elPagSize - 2) + idContentToPaginat.substring(9), nItems);
        }

    }
}

var initTabsPaginator = function () {

    $('#listTabsContent').tabs();

    var nItems = 3;

    if ($('.blockTabsPromo').length || $('.blockTabsIdeas').length) {
        nItems = 4;
    }

    initTabsPagination('#tabContent01', '#pTabContent01', nItems);

    $('#listTabsContent .ui-tabs-nav a').click(function () {

        var idContentToPaginat = $(this).attr('id');
        if (idContentToPaginat != null) {
            initTabsPagination('#tabContent' + idContentToPaginat.substring(9), '#pTabContent' + idContentToPaginat.substring(9), nItems);
        }
    });

    $('#tabButton01').trigger('click');
}


var initClientSuport = function () {
    var clientSuport = false;
    $('#clientSuport').click(function () {
        if (clientSuport == false) {
            $('.clientSuportSmallBox').addClass('clientSuportOpen');
            clientSuport = true;
        } else {
            $('.clientSuportSmallBox').removeClass('clientSuportOpen');
            clientSuport = false;
        }
        return false;
    });
}

var initUserAcount = function () {
    var userMenu = false;
    $('#acount dt a').click(function () {
        if (userMenu == false) {
            $('#acount').addClass('userMenuOpen');
            userMenu = true;
        } else {
            $('#acount').removeClass('userMenuOpen');
            userMenu = false;
        }
        return false;
    });
}

var initTipsPagination = function () {
    $("#pTips").pagination($('#tips'), {
        items_per_page: 8,
        num_edge_entries: 2,
        num_display_entries: 100,
        callback: pageselectCallback
    });
}

var initDescriptionPagination = function () {
    $("#pDescription").pagination($('#description'), {
        items_per_page: 2,
        num_edge_entries: 2,
        num_display_entries: 100,
        callback: pageselectCallback
    });
}

var initCommentsPagination = function () {
    $("#pComments").pagination($('#comments'), {
        items_per_page: 10,
        num_edge_entries: 2,
        num_display_entries: 100,
        callback: pageselectCallback
    });
}

var initFaqsPagination = function () {
    $("#pFaqs").pagination($('#faqs'), {
        items_per_page: 10,
        num_edge_entries: 2,
        num_display_entries: 100,
        callback: pageselectCallback
    });
}

/*var initTipsPagination = function(){
$("#pListTabsItems").pagination($('#listTabsItems'), {
items_per_page:3,
num_edge_entries: 2,
num_display_entries: 100,
callback: pageselectCallback	
});
}*/

var initTabsPagination = function (itemToPaginate, showPaginator, nItems) {
    $(showPaginator).pagination($(itemToPaginate), {
        items_per_page: nItems,
        num_edge_entries: 2,
        num_display_entries: 10,
        callback: pageselectCallback
    });
}

var initMainHpCarr = function () {
    initHpCarousel();
    $('.carouselPagination .1').trigger('click');
    $('.carouselPagination .1').trigger('mouseout');
}

function initInputValue() {
    var inputSelectors = jQuery('input[type="text"], input[type="password"], textarea');

    inputSelectors.each(function () {
        $(this).data('defaultValue', $(this).val());
    });
    inputSelectors.focus(function () {
        if ($(this).val() == $(this).data('defaultValue')) {
            $(this).val("");
        }
    });
    inputSelectors.blur(function () {
        if ($(this).val() == "") {
            $(this).val($(this).data('defaultValue'));
        }
    });
}

var carrouselDom = [];

var initCarrouselDom = function (paramDom) {
    paramDom.find('.ui-tabs-panel').each(function () {
        carrouselDom.push($(this).children().clone());
    });
    paramDom.find('#tabsIdeias .ui-tabs-panel').empty();
    window.setTimeout(function () {
        $('#tabButton01').trigger('click');
    }, 0);
}

var initDynamicPagination = function (motherParam) {
    var tabs = motherParam;
    var objPagination = tabs.find('.pagination');
    var objToPaginate = tabs.find('.newsItems');

    objPagination.pagination(objToPaginate, {
        items_per_page: 5,
        num_edge_entries: 4,
        num_display_entries: 6,
        callback: pageselectCallback
    });
}

//INIT HP CAROUSEL
var initHpCarousel = function () {

    var elSingleCarousel = $('.blockSingleCarousel');
    var sCarouselId = elSingleCarousel.attr('id');

    elSingleCarousel.each(function () {

        var elCarousel = $(this).find('.jCarouselLite');
        var elCarouselItems = elCarousel.find('li');

        //BUILD PAGINATION LINKS

        var elCarouselPagination = elSingleCarousel.find('.carouselPagination');
        /*
        var aItemsPagination = ['<ul>']; 
		
        for(var i = 1; i <= elCarouselItems.length; i++){
        if(i == 1){
        aItemsPagination.push('<li class="selected"><a href="#" class="' + i + '" >' + i + '</a></li>');
        }else{
        aItemsPagination.push('<li><a href="#" class="' + i + '" >' + i + '</a></li>');
        }
        }
        aItemsPagination.push('</ul>')
	
        elCarouselPagination.append(aItemsPagination.join(''));*/

        //PAGINATION LINKS EVENT HANDLER

        var elCarrPaginationLinks = elCarouselPagination.find('a');
        elCarrPaginationLinks.click(function () {
            var index = $(this).parent().index();
            initPaginationSelect(index, sCarouselId);
        });

        //CONVERT JQUERY OBJ TO ARRAY

        var aCarrPaginationLinks = $.makeArray(elCarrPaginationLinks);

        //INIT CAROUSEL

        elCarousel.jCarouselLite({
            visible: 1,
            start: 0,
            btnNext: ".blockSingleCarousel .next",
            btnPrev: ".blockSingleCarousel .prev",
            auto: 8000,
            speed: 2000,
            btnGo: aCarrPaginationLinks,
            afterEnd: function (a) {
                initPaginationSelect(a, sCarouselId);
            }
        });

    });

}

//HP CAROUSEL PAGINATION LINKS STATE SELECTED

var initPaginationSelect = function (index, id) {

    if (typeof id == 'undefined' || typeof id == null) {
        var elCarouselPagination = $('.carouselPagination li');
    } else {
        var elCarouselPagination = $('#' + id).find('.carouselPagination li');
    }
    elCarouselPagination.removeClass('selected');

    var carrLiLength = elCarouselPagination.length - 1;
    if (index > carrLiLength) {
        index = 0;
    }

    elCarouselPagination.eq(index).addClass('selected');

}

var carroucelStart = function (objToStart, caroucelToStar) {
    // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
    var autoscrolling = false;

    onPage(1, caroucelToStar);

    var autoscrolling = false;

    objToStart.infiniteCarousel().mouseover(function () {
        autoscrolling = false;
    }).mouseout(function () {
        autoscrolling = false;
    });

    onPage(1, caroucelToStar);

    objToStart.find('.back').hide();

    setInterval(function () {
        if (autoscrolling) {
            objToStart.trigger('next');
        }
    }, 15000);

}

var onPage = function (pageNumber, caroucelNumber) {
    $(caroucelNumber).next().find('.forCarroucel > a').removeClass();
    $(caroucelNumber).next().find('.forCarroucel #carroucelpage' + pageNumber).addClass('current');
};

/****************
################# HOME ACCORDION SEARCH  ################# 
****************/

var initCustomAcc = function () {
    var elCat = $('.listCat');

    $('.customAccLink').click(function () {
        if ($(this).next().is('.open')) {
            $(this).next().slideUp('slow', function () {
            }).removeClass('open');
            $('.rowBlock a').removeClass('active');
        } else {
            $(this).next().find('.open').slideUp('slow');
            //$('.customAccLink').removeClass('active').parents('.rowBlock').find('.open').slideUp('slow').removeClass('open');

            //THIS IS TO OPEN 1 PANEL AT 1 TIME ONLY, ELSE IT ALLOWS MULTIPLE PANELS TO BE OPEN
            if (!elCat.length) {
                $('.customAccLink').removeClass('active').parents('.rowBlock').find('.open').slideUp('slow').removeClass('open');
            }

            $(this).addClass('active');
            $(this).next().slideDown('slow', function () {
            }).addClass('open');
        }
        return false;
    })

    $('.active').trigger('click');
}

/****************
################# INIT SHOPPING CART  ################# 
****************/

var initShoppingCart = function () {
    if ($('.shoppingCartTick').length > 0) {
        var shoppingCart = $('.shoppingCartTick').attr('class').indexOf('shoppingCartTickOpen') != -1;

        $('#shoppingCart').click(function () {
            if (shoppingCart == false) {
                $('.shoppingCartTick').addClass('shoppingCartTickOpen');
                shoppingCart = true;
            } else {
                $('.shoppingCartTick').removeClass('shoppingCartTickOpen');
                shoppingCart = false;
            }
            return false;
        });
    }
}

////INIT INCREMENT AND DECREMENT NUMBER OF PRODUCTS IN SHOPPING CART

//var initShopCounter = function (e) {
//    var elBtn = $(e.target),
//	elBtnClass = elBtn.attr('class'),
//	elQuant = elBtn.parent().find('.quantity'),
//	elPrice = elBtn.parent().find('.cost'),
//	elPriceVal = elPrice.html(),
//	iQuant;

//    if (IsNumeric(elQuant.val())) {
//        iQuant = parseInt(elQuant.val());
//    } else {
//        iQuant = 1;
//    }

//    //IF LESS AND QUANT IS 1 RETURN
//    if (iQuant == 1 && elBtnClass == 'less') { return; }

//    //IF QUANT = 1 ASSIGN QUANT TO 1
//    if (iQuant < 1) { iQuant = 1; }

//    //INCREMENT OR DECREMENT COUNTER
//    if (elBtnClass == 'more') {
//        iQuant++;
//    } else if (elBtnClass == 'less') {
//        iQuant--;
//    }

//    //REMOVE FROM PRICE THE EURO CHAR, THE , AND THE .
//    elPriceVal = eval(initCleanPrice(elPriceVal));

//    if (elBtnClass == 'more') {
//        elPriceVal = eval(elPriceVal) + eval(elPrice.data('price'));
//    } else if (elBtnClass == 'less') {
//        elPriceVal = eval(elPriceVal) - eval(elPrice.data('price'));
//    } else if (elBtnClass == 'quantity') {
//        elPriceVal = eval(elPrice.data('price')) * iQuant;
//    }

//    //PLACE THE . BEFORE THE 2 DECIMAL HOUSES 10000.00
//    elPriceVal = initFormatPrice(elPriceVal);

//    elPrice.html('&euro;' + elPriceVal)
//    elQuant.val(iQuant);

//    //INIT SHOPING TOTAL ITEMS AND PRICE
//    initShopTotal();
//}

////INIT SHOPPING CART TOTAL ITEMS AND TOTAL PRICE

//var initShopTotal = function () {
//    var elShopCart = $('.shoppingCartTick'),
//	elQuant = elShopCart.find('.quantity'),
//	elPrice = elShopCart.find('.cost'),
//	elCartPrice = elShopCart.find('.cartPrice'),
//	elCartItems = elShopCart.find('.cartItems'),
//	iTotalItems = 0,
//	iTotalPrice = 0;

//    //ITERATE TO TOTAL ITEMS
//    elQuant.each(function () {
//        iTotalItems += parseInt($(this).val());
//    });

//    //ITERATE TO KNOW TOTAL PRICE
//    elPrice.each(function () {
//        iTotalPrice += eval(initCleanPrice($(this).html()));
//    });

//    if (iTotalPrice != 0) {
//        iTotalPrice = initFormatPrice(iTotalPrice);
//    } else {
//        iTotalPrice = '';
//    }

//    elCartPrice.html(iTotalPrice);
//    elCartItems.html(iTotalItems);
//}

///****************
//################# INIT MAIN SHOPPING CART  ################# 
//****************/

////var initMainShoppingCart = function () {

////    var elProdRow = $('.shoppingItems .cartTabProductBlock');
////    elProdRow.each(function () {
////        var elThis = $(this),
////		elQuant = elThis.find('.quantity'),
////		elPrice = elThis.find('.cost'),
////		elPriceVal = elPrice.html(),
////		elBtnMore = elThis.find('.more'),
////		elBtnLess = elThis.find('.less'),
////		elBtnRemove = elThis.find('.unitDel a');

////        //PLACE QUANTITY READ ONLY
////        //elQuant.attr('readonly','true');

////        //REMOVE FROM PRICE EURO(FIRST CHAR) AND , AND .
////        elPriceVal = eval(initCleanPrice(elPriceVal));

////        //RESET TOTAL ITEMS ON DOM STARTUP
////        elQuant.val('1');

////        //STORE IN DATA DOM THE ORIGINAL PRICE
////        elPrice.data('price', elPriceVal);

////        //EVENT HANDLERS FOR INCREMENTE DECREMENT PROD
////        elBtnMore.bind('click', initMainShopCounter);
////        elBtnLess.bind('click', initMainShopCounter);

////        elQuant.bind('keyup', initMainShopCounter);

////        //EVENT HANDLER TO REMOVE PROD
////        elBtnRemove.click(function (e) {
////            elThis.remove();
////            initMainShopTotal();
////            e.preventDefault();
////            e.stopPropagation();
////        });
////    });
////    initMainShopTotal();
////}

//////INIT INCREMENT AND DECREMENT NUMBER OF PRODUCTS IN SHOPPING CART

////var initMainShopCounter = function (e) {
////    var elBtn = $(e.target),
////	elBtnClass = elBtn.attr('class'),
////	elPrice = elBtn.parents('.cartProductRightTop').find('.cost'),
////	elQuant = elBtn.parent().find('.quantity'),
////	elPrice = elBtn.parent().parent().parent().parent().find('.cartProductResultTwo .cost'),
////	elPriceVal = elPrice.html(),
////	iQuant;

////    if (IsNumeric(elQuant.val())) {
////        iQuant = parseInt(elQuant.val());
////    } else {
////        iQuant = 1;
////    }

////    //IF LESS AND QUANT IS 1 RETURN
////    if (iQuant == 1 && elBtnClass == 'less') { return; }

////    //IF QUANT = 1 ASSIGN QUANT TO 1
////    if (iQuant < 1) { iQuant = 1; }

////    //INCREMENT OR DECREMENT COUNTER
////    if (elBtnClass == 'more') {
////        iQuant++;
////    } else if (elBtnClass == 'less') {
////        iQuant--;
////    }

////    //REMOVE FROM PRICE THE EURO CHAR, THE , AND THE .
////    elPriceVal = eval(initCleanPrice(elPriceVal));

////    if (elBtnClass == 'more') {
////        elPriceVal = eval(elPriceVal) + eval(elPrice.data('price'));
////    } else if (elBtnClass == 'less') {
////        elPriceVal = eval(elPriceVal) - eval(elPrice.data('price'));
////    } else if (elBtnClass == 'quantity') {
////        elPriceVal = eval(elPrice.data('price')) * iQuant;
////    }

////    //PLACE THE . BEFORE THE 2 DECIMAL HOUSES 10000.00
////    elPriceVal = initFormatPrice(elPriceVal);
////    var elPriceValSize = elPriceVal.length;

////    elPrice.html('<strong><sub>&euro;</sub>' + elPriceVal.substr(0, elPriceValSize - 2) + '<sup>' + elPriceVal.substr(elPriceValSize - 2, elPriceValSize) + '</sup></strong>');

////    elQuant.val(iQuant);

////    //INIT SHOPING TOTAL ITEMS AND PRICE
////    initMainShopTotal();
////}

//////INIT SHOPPING CART TOTAL ITEMS AND TOTAL PRICE

////var initMainShopTotal = function () {
////    var elShopCart = $('.cartTabBlock'),
////	elQuant = elShopCart.find('.cartTabProductBlock .quantity'),
////	elPrice = elShopCart.find('.cartTabProductBlock .cost'),
////	elCartPrice = elShopCart.find('.cartPrice'),
////    //elCartItems = elShopCart.find('.cartItems'),
////	elCartAmount = elShopCart.find('.addAmount'),
////	elCartReduce = elShopCart.find('.reducePrice'),
////	elFinalPrice = elShopCart.find('.finalPrice'),
////	iTotalItems = 0,
////	iTotalPrice = 0;
////    iFinalPrice = 0;

////    //ITERATE TO TOTAL ITEMS
////    elQuant.each(function () {
////        iTotalItems += parseInt($(this).val());
////    });

////    //ITERATE TO KNOW TOTAL PRICE
////    elPrice.each(function () {
////        iTotalPrice += eval(initCleanPrice($(this).html()));
////    });

////    if (iTotalPrice != 0) {
////        iTotalPrice = initFormatPrice(iTotalPrice);
////    } else {
////        iTotalPrice = '';
////    }

////    iFinalPrice = eval(initCleanPrice2(iTotalPrice));
////    //iFinalPrice = eval(iTotalPrice.replace(',',''));

////    //addAmount
////    var elCartAmountLength = elCartAmount.length;
////    for (i = 0; i < elCartAmountLength; i++) {
////        iFinalPrice += eval(initCleanPrice2(elCartAmount[i].innerHTML));
////        //iFinalPrice += eval(elCartAmount[i].innerHTML.replace(',',''));
////    }

////    //reduceAmount
////    var elCartReduceLength = elCartReduce.length;
////    for (i = 0; i < elCartReduceLength; i++) {
////        iFinalPrice -= eval(initCleanPrice2(elCartReduce[i].innerHTML));
////        //iFinalPrice -= eval(elCartReduce[i].innerHTML.replace(',',''));
////    }

////    if (iFinalPrice != 0) {
////        iFinalPrice = initFormatPrice(iFinalPrice);
////    } else {
////        iFinalPrice = '';
////    }

////    elCartPrice.html(iTotalPrice);
////    //elCartItems.html(iTotalItems);
////    elFinalPrice.html(iFinalPrice);
////}

//THIS FUNCTION REMOVES FROM STR, THE EURO CHAR AT FIRST INDEX, THE . AND THE ,

var initCleanPrice = function (str) {
    //    if (str.substr(0, 8) == '<STRONG>' || str.substr(0, 8) == '<strong>') {
    //        str = str.substr(20),
    //		str = str.replace(',<SUP>', ''),
    //		str = str.replace('</SUP></STRONG>', '');
    //        str = str.replace(',<sup>', ''),
    //		str = str.replace('</sup></strong>', '');
    //        str = str.replace(',', ''),
    //		str = str.replace('.', '');
    //    } else {
    //        str = str.substr(1),
    //		str = str.replace(',', ''),
    //		str = str.replace('.', '');
    //    }
    return str;
}

var initCleanPrice2 = function (str) {
    //    str = str.replace(',', ''),
    //	str = str.replace('.', '');
    return str;
}

//THIS FUNCTION FORMATS A STR TO BE 1.000.000,00

var initFormatPrice = function (str) {

    //    str = String(str),
    //	str = str.splice((str.length - 2), 0, ",");

    //    //PLACE THE , BEFORE THE 6 DECIMAL HOUSES 1,000.00
    //    if (str.length > 6) {
    //        str = str.splice((str.length - 6), 0, ".");
    //    }
    //    //PLACE THE , BEFORE THE 10 DECIMAL HOUSES 1,000,000.00
    //    if (str.length > 10) {
    //        str = str.splice((str.length - 10), 0, ".");
    //    }

    return str;
}

/*THIS IS A FUNCTION TO EXTEND STRING SPLICE
USAGE:
var result = "foo baz".splice( 4, 0, "bar " );
alert(result); // "foo bar baz */

String.prototype.splice = function (idx, rem, s) {
    return (this.slice(0, idx) + s + this.slice(idx + Math.abs(rem)));
};

//SHOW MESSAGE AFTER REQUEST ON SHOPPING CART
var shoppingCartRequestMessage = function () {

    $('.shoppingCartCheck').click(function () {
        var parent = $(this).parent();
        var actualCheck = $(this).attr('checked');

        if (actualCheck == true) {
            parent.next().show();
        }
        else {
            parent.next().hide();
        }
    });
};


//FUNCTION THAT RETURNS A BOOLEAN, DETECTS IF IS DIGIT OR NOT

var IsNumeric = function (b) { if (!b.match(/^\d+$/i)) { return false; } else { return true; } }


//POP UP ENCOMENDAS
var initPopEnc = function () {

    $(".addToCart,.shopCar").click(function () {
        var posicaoTop = $(this).offset().top;
        var posicaoLeft = $(this).offset().left;

        $('.addToCartInfo').css({
            'top': posicaoTop - 50,
            'left': posicaoLeft + 35
        }).show();
        return false;
    });
    $(".productDetailList,.shopList").click(function () {

        var posicaoTop = $(this).offset().top;
        var posicaoLeft = $(this).offset().left;

        $('.prodMoreInfo').css({
            'top': posicaoTop - 28,
            'left': posicaoLeft + 25
        }).show();

        var valorProduto = $(this).attr('rel');
        $('.GetProdutoID').attr('value', valorProduto);
        return false;
    });


    $('.blockLeft').mouseover(function () {
        $(this).parent().find('.prodMoreInfo').show();
    });
    $('.blockLeft').mouseout(function () {
        $(this).parent().find('.prodMoreInfo').hide();
    });
    $('#cardInfo').mouseover(function () {
        $(this).parent().parent().find('.prodMoreInfo').show();
    });
    $('.formCardsBlock').mouseout(function () {
        $(this).find('.prodMoreInfo').hide();
    });
    $('.productDetailList').click(function () {
        $(this).parent().parent().find('.prodMoreInfo').show();
        $(this).parent().parent().find('.addToCartInfo').hide();

        return false;
    });
    

    $('.blockRightContent').mouseleave(function () {
        $(this).find('.prodMoreInfo').hide();
        $(this).find('.addToCartInfo').hide();
    });
    $('.fecharLayer').click(function () {
        $('.prodMoreInfo').hide();
        $('.GetProdutoID').removeAttr('value');
        return false;
    });
    $('.addToCartInfo').mouseleave(function () {
        $(this).hide();
    });
    $('.addToCartContinue').click(function () {
        $(this).parents().find('.addToCartInfo').hide();
        return false;
    });
    $('.blockTabsIdeas .productDetailList').click(function () {
        $('.prodMoreInfo').hide();
        $(this).parent().parent().find('.prodMoreInfo').show();
        $(this).parent().parent().find('.addToCartInfo').hide();
        $(this).parents('li').addClass('superiorIndex');

        clearTimeout(leaveBox);
        return false;
    });
    $('.blockTabsIdeas .prodMoreInfo').mouseout(function () {
        leaveBox = setTimeout(function () {
            $('.prodMoreInfo').hide();
        }, 500);
    });
    var leaveBox;

    $('.blockTabsIdeas .prodMoreInfo').mouseover(function () {
        //$(this).parent().parent().find('.prodMoreInfo').hide();
        clearTimeout(leaveBox);
    });
    $('.blockTabsIdeas .productDetailList').mouseleave(function () {
        leaveBox = setTimeout(function () {
            $('.prodMoreInfo').hide();
            $('.prodMoreInfo').parents('li').removeClass('superiorIndex');
        }, 500);
    });
}

//LINE LAST LI IN SITE MAP
function mapLastLi() {

    $(".customAcc li:last ").css({ 'border-bottom': 'solid 1px #E5E5E5' });

}


// 12/08/2011 BY CDEEP
///****************
//################# INIT MAIN PRODUCT CART  ################# 
//****************/

var initCleanProductPrice = function (str) {
    if (str.substr(0, 8) == '<STRONG>' || str.substr(0, 8) == '<strong>') {
        str = str.substr(20),
    	str = str.replace(',<SUP>', ''),
    	str = str.replace('</SUP></STRONG>', '');
        str = str.replace(',<sup>', ''),
    	str = str.replace('</sup></strong>', '');
        str = str.replace(',', ''),
    	str = str.replace('.', '');
    } else {
        str = str.substr(1),
    	str = str.replace(',', ''),
    	str = str.replace('.', '');
    }
    return str;
}

var initFormatProductPrice = function (str) {
    str = String(str),
    str = str.splice((str.length - 2), 0, ",");

    //PLACE THE , BEFORE THE 6 DECIMAL HOUSES 1,000.00
    if (str.length > 6) {
        str = str.splice((str.length - 6), 0, ".");
    }
    //PLACE THE , BEFORE THE 10 DECIMAL HOUSES 1,000,000.00
    if (str.length > 10) {
        str = str.splice((str.length - 10), 0, ".");
    }

    return str;
}

var initMainProductCart = function () {

    var elProdRow = $('.shoppingItems .cartTabProductBlock');    
    elProdRow.each(function () {
        var elThis = $(this),
		elQuant = elThis.find('.quantity'),
		elPrice = elThis.find('.cost'),
		elPriceVal = elPrice.html(),
		elBtnMore = elThis.find('.more'),
		elBtnLess = elThis.find('.less'),
		
        //REMOVE FROM PRICE EURO(FIRST CHAR) AND , AND .
        elPriceVal = eval(initCleanProductPrice(elPriceVal));

        //RESET TOTAL ITEMS ON DOM STARTUP
        elQuant.val('1');

        //STORE IN DATA DOM THE ORIGINAL PRICE
        elPrice.data('price', elPriceVal);

        //EVENT HANDLERS FOR INCREMENTE DECREMENT PROD
        elBtnMore.bind('click', initProductCounter);
        elBtnLess.bind('click', initProductCounter);

        elQuant.bind('keyup', initProductCounter);

        //EVENT HANDLER TO REMOVE PROD
        // elBtnRemove.click(function (e) {
            // elThis.remove();            
            // e.preventDefault();
            // e.stopPropagation();
        // });
    });    
}

//INIT INCREMENT AND DECREMENT NUMBER OF PRODUCTS IN PRODUCT PAGE

var initProductCounter = function (e) {
    var elBtn = $(e.target),
	elBtnClass = elBtn.attr('class'),
	elPrice = elBtn.parents('.ProductRightTop').find('.cost'),
	elQuant = elBtn.parent().find('.quantity'),
	elPrice = elBtn.parent().parent().parent().parent().find('.cartProductResultTwo .cost'),
	elPriceVal = elPrice.html(),
	iQuant;

    if (IsNumeric(elQuant.val())) {
        iQuant = parseInt(elQuant.val());
    } else {
        iQuant = 1;
    }

    //IF LESS AND QUANT IS 1 RETURN
    if (iQuant == 1 && elBtnClass == 'less') { return; }

    //IF QUANT = 1 ASSIGN QUANT TO 1
    if (iQuant < 1) { iQuant = 1; }

    //INCREMENT OR DECREMENT COUNTER
    if (elBtnClass == 'more') {
        iQuant++;
    } else if (elBtnClass == 'less') {
        iQuant--;
    }
    
    //REMOVE FROM PRICE THE EURO CHAR, THE , AND THE .
    elPriceVal = eval(initCleanProductPrice(elPriceVal));

    if (elBtnClass == 'more') {        
        elPriceVal = eval(elPriceVal) + eval(elPrice.data('price'));
    } else if (elBtnClass == 'less') {
        elPriceVal = eval(elPriceVal) - eval(elPrice.data('price'));
    } else if (elBtnClass == 'quantity') {        
        elPriceVal = eval(elPrice.data('price')) * iQuant;
    }

    //PLACE THE . BEFORE THE 2 DECIMAL HOUSES 10000.00
    elPriceVal = initFormatProductPrice(elPriceVal);
    var elPriceValSize = elPriceVal.length;

    elPrice.html('<strong><sub>&euro;</sub>' + elPriceVal.substr(0, elPriceValSize - 2) + '<sup>' + elPriceVal.substr(elPriceValSize - 2, elPriceValSize) + '</sup></strong>');
        
    elQuant.val(iQuant);
    
}

