﻿$(function () {
    $("img.ref_to_title[title]").each(function () {
        $(this).wrap("<a href='" + $(this).attr("title") + "'></a>");
        $(this).attr("title", $(this).attr("alt"));
    });
    $("i.ref_to_title[title]").each(function () {
        $(this).replaceWith("<a href='" + $(this).attr("title") + "'>" + $(this).html() + "</a>");
    });
    $("i.goods_count[title]").each(function () {
        $(this).replaceWith(" <span style='color: red;'>(" + $(this).attr("title") + ")</span>");
    });
    $("i.home_link[title]").each(function () {
        $(this).replaceWith("<a href='" + $(this).attr("title") + "'>" + $(this).html() + "</a>");
    });
    $("i.price[title]").each(function () {
        $(this).replaceWith($(this).attr("title"));
    });
    $("i.ref_to_basket[title]").each(function () {
        $(this).replaceWith("<a href='" + $(this).attr("title") + "'><img src='../special/buy.png' alt='' border='0'></a>");
    });
    $("i.photo_exists").each(function () {
        $(this).replaceWith("<img src='../special/pho_m.png' alt='' border='0' style='margin-left: 5px;'>");
    });
    $("i.instock_exists").each(function () {
        $(this).replaceWith("<img src='../special/str_m.png' alt='' border='0' style='margin-left: 5px;'>");
    });
    $("i.sample_exists").each(function () {
        $(this).replaceWith("<img src='../special/eye_m.png' alt='' border='0' style='margin-left: 5px;'>");
    });
    $("i.ref_to_factory[title]").each(function () {
        $(this).replaceWith("<img src='../special/resFactory.gif' border='0' /> <a href='" + $(this).attr("title") + "'>" + $(this).html() + "</a>");
    });
    var number_of_array = {};
    $("i.number_of[title]").each(function (i) {
        number_of_array[i] = $(this).attr("title");
    });
    $("a.menu_left").each(function (i) {
        if (number_of_array[i] != undefined) {
            $(this).append(" <span style='color: red; font-weight: normal;'>(" + number_of_array[i] + ")</span>");
        }
    });
});
