﻿$(document).ready(function () {

    var formatedPrice = function ($price) {
        if ($price.html().indexOf('€') > -1) {
            var formatedPriceValue = '€' + $price.html().replace('€', '').replace(',', '.');
            formatedPriceValue = formatedPriceValue.replace(' ', '');
            $price.html(formatedPriceValue);
        }
    }

    $('.price span').each(function () {
        formatedPrice($(this));
    });

    $('.price-large span').each(function () {
        formatedPrice($(this));
    });

    $('.add-basket .float-left strong').each(function () {
        formatedPrice($(this));
    });

    $('.tdprice strong').each(function () {
        formatedPrice($(this));
    });

    $('.tdprice span').each(function () {
        formatedPrice($(this));
    });

    $('.donate-bg').each(function () {
        formatedPrice($(this));
    });

    $('.basket-price span').each(function () {
        formatedPrice($(this));
    });

    $('.tabsli li h2 a span').each(function () {
        formatedPrice($(this));
        if ($(this).html().indexOf('€') > -1) {
            var newVal = $(this).html().replace(' €', '').replace('to ', 'to €');
            $(this).html(newVal);
        }
    });

    $('.sub-nav > ul > li > a').each(function () {
        formatedPrice($(this));
        if ($(this).html().indexOf('€') > -1) {
            var newVal = $(this).html().replace(' €', '').replace('- ', '- €');
            $(this).html(newVal);
        }
    });

    $('.breadcrumb > ul > li').each(function () {
        formatedPrice($(this));
        if ($(this).html().indexOf('€') > -1) {
            var newVal = $(this).html().replace(' €', '').replace('- ', '- €');
            $(this).html(newVal);
        }
    });
});
