var curSub;
var timeoutNav;
var timeoutTitle;
var timeoutFeatures;
var timeoutClick;
var curNav;
var curAnim = 0;
var arActive;
var curWhich = 0;
var curToolTip = "";
var homeLink = "";
var ZOOM_STANDARD = 1;
var ZOOM_NECKLACE = 2;
var enableZoom = 0;
var zoom_top = -600;
var zoom_left = 200;
var curFooterNav;
var curFooterAnim = 0;
var curFooterWhich = 0;
var baseX = 0;
var baseY = 0;
var maxDragX = 600;
var maxDragY = 1000;
var dragOffX = 0;
var dragOffY = -200;
var idQuality, idSize, idType;
var ie = 0;
if ($j.browser.msie) {
    ie = 1
}
var ie6 = 0;
if (ie && $j.browser.version == "6.0") {
    ie6 = 1
}
var ie8 = 0;
if (ie && $j.browser.version == "8.0") {
    ie8 = 1
}
var activeFeature;
var strAssist;
var strAssistanceHandler = "/eventcms/customerservice/contact";
var map;
var mapLoaded = 0;
var mapInfos = new Array();
var newsIndex = 0;
var numItems = 0;
var aboutSubPage = 0;
var aboutSubMovieIncrement = 0;
var numSubNavCols = 0;
var numAltImages = 0;
var curAltImage = 1;
var canAdd = 1;
jQuery.fn.exists = function () {
    return jQuery(this).length > 0
};
(function (a) {
    var b = {
        ondomready: function () {
            b.init();
            b.linkLogo();
            b.buildSecondary();
            b.buildFooter();
			b.buildSearchBox();
            b.buildHomeFeatures();
            b.buildHomeCycle();
            b.buildTitleDropDown();
            b.buildListingFeatureClick();
            b.buildConfigurable();
            b.buildImageManipulators();
            b.makeDraggable();
            b.buildListingDoubleClick();
            b.buildZipPostal();
            b.buildAssistance();
            b.buildLocations();
            b.buildNewsEvents();
            b.buildHistory();
            b.buildAboutCycle();
            b.buildAboutSubPageNav();
            b.buildPearlsInMotion();
            b.buildSlider();
            b.bindEventTrackers();
            b.fixPlaceholderText();
            if (ie6) {
                b.fixIE6PNG();
                b.fixIE6CategoryListing();
                b.fixIE6Tooltips();
                b.fixIE6SelectorMenu();
                $j(".behind_navigation").bgiframe();
                $j(".listing_feature").hover(function () {
                    $j(this).addClass("hover")
                }, function () {
                    $j(this).removeClass("hover")
                })
            }
            if ($j("#shopping-cart-table").length > 0) {
                $j(document).delegate("#shopping-cart-table input", "change", function () {
                    $j("#please-save-cart").show()
                })
            }
        },
        init: function () {},
        setLocationNav: function (d) {
            var e = "location" + d;
            var c = "location" + d + "fixed";
            $j("#" + e).toggleClass(c, true);
            $j("#" + e).toggleClass("locationfixed", true)
        },
        buildAboutSubPageNav: function () {
            aboutSubMovieIncrement = $j(".colHolder div").width() * 2 + 20;
            numSubNavCols = $j(".colHolder").children("div").length / 2;
            $j(".leftPage").click(function (c) {
                c.preventDefault();
                if (aboutSubPage > 0) {
                    aboutSubPage--;
                    $j(".rightPage").show();
                    $j(".colHolder").animate({
                        left: "+=" + aboutSubMovieIncrement + "px"
                    })
                } else {} if (aboutSubPage <= 0) {
                    $j(".leftPage").hide()
                }
                return false
            });
            $j(".rightPage").click(function (c) {
                c.preventDefault();
                if (aboutSubPage < numSubNavCols) {
                    aboutSubPage++;
                    $j(".leftPage").show();
                    $j(".colHolder").animate({
                        left: "-=" + aboutSubMovieIncrement + "px"
                    })
                } else {} if (aboutSubPage >= (numSubNavCols - 1)) {
                    $j(".rightPage").hide()
                }
                return false
            })
        },
        resizeEvents: function () {
            var d = $j(".news_events").offset();
            var c = $j(window).width() - d.left;
            d = $j(".header h1").offset();
            if (ie6) {
                $j(".news_events").css("width", (c - 1) + "px")
            } else {
                $j(".news_events").css("width", (c - 1) + "px")
            }
            if (ie6) {
                $j(".rightArrow").css("left", (c - 60) + "px")
            }
            if (d.left < 70) {
                $j(".leftArrow").css("left", "10px")
            }
            if (d.left > 70) {
                $j(".leftArrow").css("left", "-60px")
            }
        },
        resizeHistory: function () {
            var d = $j(".history").offset();
            var c = $j(window).width() - d.left;
            d = $j(".header h1").offset();
            if (ie6) {
                $j(".history").css("width", (c - 1) + "px")
            } else {
                $j(".history").css("width", (c - 1) + "px")
            }
            if (ie6) {
                $j(".rightArrow").css("left", (c - 60) + "px")
            }
            if (d.left < 70) {
                $j(".leftArrow").css("left", "10px")
            }
            if (d.left > 70) {
                $j(".leftArrow").css("left", "-60px")
            }
        },
        buildNewsEvents: function () {
            var f = $j(".news_events").offset();
            if (f) {
                b.resizeEvents();
                a(window).resize(function () {
                    b.resizeEvents()
                });
                f = $j(".leftArrow").offset();
                if (f.left < 20) {
                    $j(".leftArrow").css("left", "10px")
                }
                var d = $j(".scene .item").width();
                var e = 10;
                numItems = $j(".scene .item").length;
                var c = d + e;
                $j(".rightArrow a").click(function (g) {
                    g.preventDefault();
                    if (newsIndex < (numItems - 1)) {
                        $j(".leftArrow a").show();
                        newsIndex++;
                        curPos = -1 * newsIndex * c;
                        $j(".news_events .scene").animate({
                            left: curPos + "px"
                        }, 400, "easeInOutQuad");
                        if (newsIndex >= (numItems - 1)) {
                            $j(".rightArrow a").hide()
                        }
                    }
                });
                $j(".leftArrow a").hide();
                $j(".leftArrow a").click(function (g) {
                    g.preventDefault();
                    if (newsIndex > 0) {
                        $j(".rightArrow a").show();
                        newsIndex--;
                        curPos = -1 * newsIndex * c;
                        $j(".news_events .scene").animate({
                            left: curPos + "px"
                        }, 400, "easeInOutQuad");
                        if (newsIndex <= 0) {
                            $j(".leftArrow a").hide()
                        }
                    }
                });
                $j(".news_events .item .readmore a").click(function (g) {
                    if ($j(this).parent().hasClass("on")) {
                        return true
                    } else {
                        $j(".news_events .item .readmore").each(function () {
                            a(this).toggleClass("on", false);
                            a(this).parent().children(".description").slideUp("fast")
                        });
                        g.preventDefault();
                        $j(this).parent().toggleClass("on", true);
                        $j(this).parent().parent().find(".description").slideDown("fast")
                    }
                })
            }
        },
        buildHistory: function () {
            var g = $j(".history").offset();
            if (g) {
                b.resizeHistory();
                a(window).resize(function () {
                    b.resizeHistory()
                });
                g = $j(".leftArrow").offset();
                if (g.left < 20) {
                    $j(".leftArrow").css("left", "10px")
                }
                var e = $j(".scene .item").width();
                var f = 10;
                var d = $j(".scene .item").length;
                var c = e + f;
                $j(".rightArrow a").click(function (h) {
                    h.preventDefault();
                    if (newsIndex < (d - 1)) {
                        $j(".leftArrow a").show();
                        newsIndex++;
                        curPos = -1 * newsIndex * c;
                        $j(".history .scene").animate({
                            left: curPos + "px"
                        }, 400, "easeInOutQuad");
                        if (newsIndex >= (d - 1)) {
                            $j(".rightArrow a").hide()
                        }
                        b.setDecadeNews()
                    }
                });
                $j(".leftArrow a").hide();
                $j(".leftArrow a").click(function (h) {
                    h.preventDefault();
                    if (newsIndex > 0) {
                        $j(".rightArrow a").show();
                        newsIndex--;
                        curPos = -1 * newsIndex * c;
                        $j(".history .scene").animate({
                            left: curPos + "px"
                        }, 400, "easeInOutQuad");
                        if (newsIndex <= 0) {
                            $j(".leftArrow a").hide()
                        }
                        b.setDecadeNews()
                    }
                });
                $j(".history .item .readmore a").click(function (h) {
                    if (a(this).parent().hasClass("on")) {
                        a(".history .item .readmore").each(function () {
                            $j(this).toggleClass("on", false);
                            $j(this).parent().children(".description").slideUp("fast");
                            $j(this).show()
                        });
                        return false
                    } else {
                        $j(".history .item .readmore").each(function () {
                            $j(this).toggleClass("on", false);
                            $j(this).parent().children(".description").slideUp("fast");
                            $j(this).show()
                        });
                        $j(this).parent().toggleClass("on", true);
                        $j(this).parent().parent().find(".description").slideDown("fast");
                        $j(this).parent().hide();
                        return false
                    }
                })
            }
            $j(".timeline ul li:not(.inactive) a").click(function (h) {
                b.setDecade(a(this).html());
                b.loadDecadeNews(a(this).html());
                return false
            });
            $j(".timeline ul li.inactive a").click(function (h) {
                return false
            })
        },
        setDecade: function (c) {
            c = parseInt(c);
            var d = (c - (c % 10));
            var e = $j(".timeline ul li a:contains('" + d + "')").position();
            $j(".highlight").animate({
                left: e.left + "px"
            }, 500)
        },
        setDecadeNews: function () {
            var c = $j(".scene .item:nth-child(" + (newsIndex + 1) + ")");
            b.setDecade(c.find(".title span").html())
        },
        loadDecadeNews: function (d) {
            var h = $j(".scene .item").width();
            var j = 10;
            var f = $j(".scene .item").length;
            var c = h + j;
            var e = 0;
            var g = 0;
            $j(".scene .item").each(function () {
                if (parseInt($j(this).find(".title span").html()) >= d) {
                    g = 1;
                    return
                } else {
                    g = 0;
                    e++
                }
            });
            if (g) {
                newsIndex = e;
                curPos = -1 * newsIndex * c;
                $j(".history .scene").animate({
                    left: curPos + "px"
                }, 400, "easeInOutQuad");
                if (newsIndex <= 0) {
                    $j(".leftArrow a").hide();
                    $j(".rightArrow a").show()
                } else {
                    if (newsIndex >= (f - 1)) {
                        $j(".rightArrow a").hide();
                        $j(".leftArrow a").show()
                    } else {
                        $j(".rightArrow a").show();
                        $j(".leftArrow a").show()
                    }
                }
            }
        },
        loadMap: function (f, e) {
            mapLoaded = 1;
            var d = new google.maps.LatLng(f, e);
            var c = {
                zoom: 14,
                center: d,
                mapTypeControl: true,
                navigationControl: true,
                navigationControlOptions: {
                    style: google.maps.NavigationControlStyle.ZOOM_PAN
                },
                scaleControl: true,
                scaleControlOptions: {
                    position: google.maps.ControlPosition.BOTTOM_LEFT
                },
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map(document.getElementById("map_canvas"), c)
        },
        setMap: function (j, g, f, c) {
            if (mapLoaded == 0) {
                b.loadMap(j, g)
            }
            for (var e = 0; e < mapInfos.length; ++e) {
                mapInfos[e].close()
            }
            var h = new google.maps.InfoWindow({
                content: '<div class="popup"><h4>' + f + "</h4>" + c + "</div>"
            });
            mapInfos.push(h);
            var d = new google.maps.Marker({
                position: new google.maps.LatLng(j, g),
                title: f,
                clickable: true,
                map: map
            });
            h.open(map, d);
            google.maps.event.addListener(d, "click", function () {
                for (var k = 0; k < mapInfos.length; ++k) {
                    mapInfos[k].close()
                }
                h.open(map, d)
            });
            map.setCenter(new google.maps.LatLng(j, g))
        },
        buildLocations: function () {
            if (ie8) {
                $j("#USLocations select").css("top", "3px");
                $j("#USLocations input").css("top", "0px");
                $j("#USLocations img").css("top", "8px")
            }
            $j(".locationsImage .location").hover(function () {
                $j(this).children("div").show();
                id = $j(this).attr("id");
                $j(this).toggleClass(id + "active", true)
            }, function () {
                if ($j(this).hasClass("locationfixed")) {} else {
                    $j(this).children("div").hide();
                    id = $j(this).attr("id");
                    $j(this).toggleClass(id + "active", false)
                }
            });
            $j(".activeDropdown").each(function () {
                $j(this).show()
            });
            $j(".locationDropdown").click(function (c) {
                c.preventDefault();
                if (ie) {
                    if ($j(this).next(".locationDropdownContent").hasClass("activeDropdown")) {
                        $j(this).next(".locationDropdownContent").toggleClass("activeDropdown", false);
                        $j(this).next(".locationDropdownContent").hide()
                    } else {
                        $j(".locationDropdownContent").not(this).not(".alwaysOpen").hide().toggleClass("activeDropdown", false);
                        $j(this).next(".locationDropdownContent").toggleClass("activeDropdown", true);
                        $j(this).next(".locationDropdownContent").show()
                    }
                } else {
                    if ($j(this).next(".locationDropdownContent").hasClass("activeDropdown")) {
                        $j(this).next(".locationDropdownContent").toggleClass("activeDropdown", false);
                        $j(this).next(".locationDropdownContent").slideUp("fast")
                    } else {
                        $j(".locationDropdownContent").not(this).not(".alwaysOpen").hide().toggleClass("activeDropdown", false);
                        $j(this).next(".locationDropdownContent").toggleClass("activeDropdown", true);
                        $j(this).next(".locationDropdownContent").slideDown("fast")
                    }
                }
                return false
            });
            strZipcode = "Enter Zip Code";
            $j("#zipcode").focus(function () {
                if ($j(this).val() == strZipcode) {
                    $j(this).val("")
                }
            });
            $j("#zipcode").blur(function () {
                if ($j(this).val() == "") {
                    $j(this).val(strZipcode)
                }
            });
            $j("#USLocations a").click(function (c) {
                c.preventDefault();
                $j("#USLocations").submit()
            });
			$j("#USLocations button").click(function (c) {
                c.preventDefault();
                $j("#USLocations").submit()
            });
            $j(".mapLayer .close").click(function (c) {
                c.preventDefault();
                $j(this).parent().fadeOut("fast");
                if (ie6) {
                    $j("#USLocations").show()
                }
            });
            $j(".resultLocation .map").click(function (c) {
                c.preventDefault();
                if (ie6) {
                    $j("#USLocations").hide()
                }
                $j(".mapLayer").css({
                    top: ($j(this).parent().position().top - 10) + "px"
                });
                plat = $j(this).parent().children(".meta").children(".lat").html();
                plng = $j(this).parent().children(".meta").children(".lng").html();
                title = $j(this).parent().children("h4").html();
                desc = $j(this).parent().children(".meta").children(".info").html();
                b.setMap(plat, plng, title, desc);
                $j(".mapLayer").fadeIn("fast");
                $j(document).keyup(function (d) {
                    if (d.keyCode === 27) {
                        $j(".mapLayer .close").click()
                    }
                });
                return false
            })
        },
        buildAssistance: function () {
            $j(".assistance_section").hide();
            $j("#assist_assistance").hide();
            $j("#assist_form").hide();
            objSelect = $j("#assist_nav select");
            $j(".assistance_section").each(function () {
                strName = a(this).children("h2").html();
                strSlug = toSlug(strName);
                $j(this).attr("id", strSlug);
                objSelect.append("<option value='" + strSlug + "'>" + strName + "</option>");
                $j(this).children("span").after("<ul class='faq'></ul>");
                faq = a(this).children("ul.faq");
                if (faq.length > 0) {
                    $j(this).children("body.lang-en h3").not("h3:first").each(function () {
                        a(this).before("<a href='#top' class='top'>Back to top<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
                    });
					$j(this).children("body.lang-fr h3").not("h3:first").each(function () {
                        a(this).before("<a href='#top' class='top'>Retour en haut de la page<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
                    });
					$j(this).children("body.lang-de h3").not("h3:first").each(function () {
                        a(this).before("<a href='#top' class='top'>Zum Seitenanfang<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
                    });
					$j(this).children("body.lang-it h3").not("h3:first").each(function () {
                        a(this).before("<a href='#top' class='top'>Torna all'inizio<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
                    });
					$j(this).children("body.lang-es h3").not("h3:first").each(function () {
                        a(this).before("<a href='#top' class='top'>Volver arriba<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
                    });
                    $j(this).children("h3").each(function () {
                        childName = a(this).html();
                        childSlug = toSlug(childName);
                        $j(this).before("<hr><a name='" + childSlug + "'></a>");
                        faq.append("<li><a href='#" + childSlug + "'>" + childName + "<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.down.gif' alt=''/></a></li>")
                    });
                    $j(this).children("body.lang-en p").last().after("<a href='#top' class='top'>Back to top<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
					$j(this).children("body.lang-fr p").last().after("<a href='#top' class='top'>Retour en haut de la page<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
					$j(this).children("body.lang-de p").last().after("<a href='#top' class='top'>Zum Seitenanfang<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
					$j(this).children("body.lang-it p").last().after("<a href='#top' class='top'>Torna all'inizio<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
					$j(this).children("body.lang-es p").last().after("<a href='#top' class='top'>Volver arriba<img src='/skin/frontend/enterprise/mikimoto/img/icon.arrow.up.gif' alt=''/></a>")
                }
            });
            objSelect.change(function () {
                $j(".assistance_section").hide();
                $j("#assist_form").hide();
                objActive = $j(this).children("option:selected");
                strLink = objActive.attr("value");
                $j("#" + strLink).show();
                strAssist = $j("#" + strLink).children("div:last").html();
                if (strLink != "SELECT A TOPIC") {
                    if ($j("#" + strLink + " .faq").length === 0) {
                        $j("#assist_assistance").hide();
                        $j("#assist_form").show()
                    } else {
                        $j("#assist_assistance").show()
                    }
                } else {
                    $j("#assist_assistance").hide()
                }
            });
            $j("#assist_assistance a").click(function (f) {
                f.preventDefault();
                $j("#assist_assistance").hide();
                $j(".assistance_section").hide();
                $j("#assist_form").show();
                $j("#assist_form span").html(strAssist)
            });
            var c = "This is a required field.";
            $j("#assistance").validate({
                rules: {
                    email2: {
                        required: true,
                        equalTo: "#email"
                    }
                },
                messages: {
                    first: c,
                    last: c,
                    email: {
                        required: c,
                        email: "A valid email address is required."
                    },
                    email2: {
                        required: c,
                        equalTo: "Email addresses must match"
                    },
                    comments: c
                }
            });
            $j("#assist_form .submit").click(function (f) {
                f.preventDefault();
                if ($j("#assistance").valid()) {
                    pInquiry = $j("#assist_nav select").val();
                    pTitle = $j("#title").val();
                    pFirst = $j("#first").val();
                    pLast = $j("#last").val();
                    pEmail = $j("#email").val();
                    pEmail2 = $j("#email2").val();
                    pPhone = $j("#phone").val();
                    pComments = $j("#comments").val();
                    a.post(strAssistanceHandler, {
                        inquiry: pInquiry,
                        title: pTitle,
                        first: pFirst,
                        last: pLast,
                        email: pEmail,
                        email2: pEmail2,
                        phone: pPhone,
                        comments: pComments
                    }, function (g, e) {
                        if (g == "OK") {
                            $j("#assist_form span").html($j("#assist_form_thankyouSuccess").html());
                            $j("#assist_form .form").hide()
                        }
                    })
                } else {}
                return false
            });
            var d = window.location.hash;
            if (d) {
                d = d.toString().substring(1);
                $j("#assist_nav select").val(d).change()
            }
        },
        setAttributeId: function (c, d) {
            switch (c.toLowerCase()) {
            case "metal_type":
                idType = d;
                break;
            case "pearl_quality":
                idQuality = d;
                break;
            case "pearl_size":
                idSize = d;
                break
            }
        },
        getAttributeId: function (c) {
            switch (c.toLowerCase()) {
            case "data_type":
                return idType;
                break;
            case "data_quality":
                return idQuality;
                break;
            case "data_size":
                return idSize;
                break
            }
        },
        buildConfigurable: function () {
            if ($j('#product_addtocart_form select, #product_addtocart_form input').length) {
                $j('#product_addtocart_form select, #product_addtocart_form input').change(function () {
                    setTimeout(b.updateAddAction, 250)
                })
            }
            $j(".action .add:not(.disabledAdd)").click(function () {
                $j("#product_addtocart_form").submit();
                a(this).addClass("disabledAdd").unbind("click")
            })
        },
        updateAddAction: function () {
            if ($j("#product_addtocart_form select.required-entry:not(.validation-passed)").length === 0) {
                $j(".action .add").removeClass("disabledAdd").click(function () {
                    $j("#product_addtocart_form").submit();
                    a(this).addClass("disabledAdd").unbind("click")
                })
            } else {
                $j(".action .add").addClass("disabledAdd")
            }
        },
        fixIE6SelectorMenu: function () {
            $j("#slider_select").change(function () {
                var c = $j("#slider_select option:selected");
                b.handleSliderSlide(c.text())
            })
        },
        fixIE6Tooltips: function () {
            $j("img").attr("title", "");
            $j("img").attr("alt", "")
        },
        fixIE6PNG: function () {
            DD_belatedPNG.fix(".titleMenu img");
            DD_belatedPNG.fix(".tooltip");
            DD_belatedPNG.fix(".homeBg div");
            DD_belatedPNG.fix(".pimDrop img, .pimCopyHeader")
        },
        setZoomType: function (c) {
            switch (c) {
            case ZOOM_NECKLACE:
                zoom_top = -600;
                zoom_left = 200;
                enableZoom = 1;
                $j(".drag img").css("width", "910px").css("height", "1140px").css("left", "-200px").css("top", "-600px");
                break;
            case ZOOM_STANDARD:
            default:
                dragOffX = 500;
                dragOffY = 0;
                maxDragX = 600;
                maxDragY = 450;
                zoom_top = -50;
                zoom_left = 400;
                enableZoom = 0;
                break
            }
        },
        fixIE6CategoryListing: function () {
            $j(".category .listing .thumb").hover(function () {
                $j(this).children(".description").show()
            }, function () {
                $j(".category .listing .thumb").children(".description").hide()
            });
            $j(".category .listing .large_listing").hover(function () {
                $j(this).find(".link").toggle()
            })
        },
        buildZipPostal: function () {
            defaultString = "Enter Zip Code";
            $j("#postcode").focus(function () {
                if ($j(this).val() == defaultString) {
                    $j(this).val("")
                }
            });
            $j("#postcode").blur(function () {
                if ($j(this).val() == "") {
                    $j(this).val(defaultString)
                }
            });
            $j("#shipping-zip-form").submit(function () {
                b.trackEvent("Shopping Bag", "Calculate Shipping", $j("#postcode").val())
            })
        },
        TEMP_checkoutClicks: function () {
            $j("#checkoutSteps .step-title h2").click(function (c) {
                c.preventDefault();
                if ($j(this).parent().parent().hasClass("active")) {
                    $j("#checkoutSteps .section").toggleClass("active", false)
                } else {
                    $j("#checkoutSteps .section").toggleClass("active", false);
                    $j(this).parent().parent().toggleClass("active", true)
                }
            })
        },
        buildTwinkles: function () {
            var c = 25;
            if (!ie) {
                for (i = 0; i < c; i++) {
                    $j(".container").append("<div class='twinkle' id='twinkle" + i + "'></div>")
                }
                $j(".twinkle").each(function () {
                    var C = 1;
                    var v = 2;
                    var z = 3;
                    var t = 15;
                    var g = 3;
                    var n = 15;
                    var j = 1;
                    var m = 1;
                    var q = 25;
                    var E = 50;
                    var B = 400;
                    var p = 200;
                    var D = 760;
                    var u = D - p;
                    var s = $j(document).width();
                    var F = $j(document).height();
                    var o = 0;
                    var G = (s - u) / 2;
                    var k = s - G;
                    var h = s - 50;
                    var f = getRandom(1, 2);
                    var A = getRandom(0, G);
                    var x = getRandom(E, B);
                    var y = (f == 1) ? A : k + A;
                    var l = getRandom(0, j);
                    $j(this).css("left", y + "px");
                    $j(this).css("top", x + "px");
                    $j(this).html("<img src='img/twinkle/twinkle" + l + ".png'/>");
                    var d = getRandom(m, q) * 1000;
                    var r = getRandom(C, v) * 1000;
                    var e = getRandom(z, t) * 1000;
                    var w = getRandom(g, n) * 1000;
                    $j(this).delay(d).fadeIn(e).delay(r).fadeOut(w)
                })
            }
        },
        buildSlider: function () {
            var c = $j("#slider").width();
            var d = $j("#slider").children().size();
            var f = $j(".sliderPoint").width();
            var e = (c - (d * f)) / (d - 1);
            $j(".sliderPoint").not(":last").each(function () {
                $j(this).css("margin-right", e + "px")
            });
            $j(".sliderPoint").click(function (h) {
                var g = $j(this).children("span").html();
                b.trackEvent("Category", "Selector", g);
                h.preventDefault();
                $j(".sliderPoint").toggleClass("sliderActive", false);
                $j(this).toggleClass("sliderActive", true);
                b.handleSliderSlide(g);
                return false
            });
            $j(".sliderPoint[title]").tooltip()
        },
        handleSliderSlide: function (g) {
			$j("#slider_data").html("Displaying <span>" + g + "</span>");
			$j("body.lang-fr #slider_data").html("<span>" + g + "</span>");
			$j("body.lang-de #slider_data").html("Anzeige <span>" + g + "</span>");
			$j("body.lang-es #slider_data").html("Mostrar <span>" + g + "</span>");
			$j("body.lang-ru #slider_data").html("<span>" + g + "</span>");
			$j("body.lang-it #slider_data").html("Categoria selezionata <span>" + g + "</span>");
			
			
            $j(".thumb.extra").remove();
            $j(".thumb").filter(function () {
                if ($j(this).children(".filter_value").html() == g || g.indexOf("All ") != -1) {
                    $j(this).show()
                } else {
                    $j(this).hide()
                }
            });
            var f = $j(".thumb:visible").length;
            var c = f % 4;
            if (c > 0) {
                var e;
                if (c < 3 && f < 4) {
                    e = 2
                } else {
                    e = 4
                }
                for (var d = c; d < e; ++d) {
                    $j(".listing").append('<div class="thumb extra"></div>')
                }
            }
            return true
        },
        setDoubleFeature: function (c) {
            switch (c) {
            case 0:
                $j(".double_feature").toggleClass("double_active_left", true);
                $j(".double_feature").toggleClass("double_active_right", false);
                break;
            case 1:
                $j(".double_feature").toggleClass("double_active_right", true);
                $j(".double_feature").toggleClass("double_active_left", false);
                break
            }
        },
        buildListingDoubleClick: function () {
            $j(".double_feature_header .left").click(function (c) {
                c.preventDefault();
                if ($j(this).parent().parent().hasClass("double_active_right")) {
                    $j(this).parent().parent().toggleClass("double_active_left", true);
                    $j(this).parent().parent().toggleClass("double_active_right", false)
                }
                return false
            });
            $j(".double_feature_header .right").click(function (c) {
                c.preventDefault();
                if ($j(this).parent().parent().hasClass("double_active_left")) {
                    $j(this).parent().parent().toggleClass("double_active_left", false);
                    $j(this).parent().parent().toggleClass("double_active_right", true)
                }
                return false
            })
        },
        buildListingFeatureClick: function () {
            $j(".listing_feature").click(function (c) {
                c.preventDefault();
                tagId = $j(this).attr("id");
                toOpen = tagId + "_detail";
                if (ie6 && !timeoutFeatures) {
                    $j(".listing_feature_detail").hide().show()
                }
                if (!$j(this).hasClass("active")) {
                    $j(".listing_feature .photo").not($j(this).children(".photo")).animate({
                        opacity: 1
                    }, 200).parent().toggleClass("active", false);
                    $j(".feature_detail").not($j("#" + toOpen)).fadeOut("slow");
                    $j(".listing_feature h3").toggleClass("active", false);
                    $j("#" + toOpen).fadeIn("slow");
                    $j(this).toggleClass("active", true);
                    $j(this).children("h3").toggleClass("active", true);
                    $j(this).children(".photo").animate({
                        opacity: 1
                    }, 200);
                    $j(".listing_feature:not(.active)").children(".photo").animate({
                        opacity: 0.5
                    }, 200);
                    clearTimeout(timeoutFeatures);
                    timeoutFeatures = setTimeout("resetFeatures();", 8000)
                } else {
                    clearTimeout(timeoutFeatures);
                    $j(".listing_feature .photo").animate({
                        opacity: 1
                    }, 200).parent().toggleClass("active", false);
                    $j(".feature_detail").fadeOut("slow");
                    $j(".listing_feature h3").toggleClass("active", false);
                    $j(this).toggleClass("active", false);
                    $j(this).children("h3").toggleClass("active", false);
                    $j(".listing_feature").children(".photo").animate({
                        opacity: 1
                    }, 200)
                }
                return false
            });
            $j(".feature_detail .feature_close").click(function (c) {
                c.preventDefault();
                tagId = $j(this).parent().attr("id");
                tagId = tagId.replace("_detail", "");
                $j("#" + tagId).click()
            });
            $j(".feature_detail").hover(function () {
                clearTimeout(timeoutFeatures)
            }, function () {
                clearTimeout(timeoutFeatures);
                setTimeout("resetFeatures();", 8000)
            })
        },
        buildTitleDropDown: function () {
            $j(".category .titleMenu h2").click(function (d) {
                $j(".moreCategory a").trigger("click")
            });
            $j(".moreCategory a").click(function (d) {
                d.preventDefault();
                if (!$j(this).hasClass("active")) {
                    $j(this).toggleClass("active", 1);
                    timeoutTitle = setTimeout("resetTitle();", 8000);
                    targetOpacity = 0.15;
                    timeAnimate = 200;
                    if (!ie) {
                        $j(".titleDropDown").fadeIn("slow");
                        $j(".info").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .description").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .slider_holder").fadeTo(timeAnimate, targetOpacity);
                        $j(".listing").fadeTo(timeAnimate, targetOpacity);
                        $j(".listing_feature").fadeTo(timeAnimate, targetOpacity);
                        $j(".double_feature").fadeTo(timeAnimate, targetOpacity);
                        $j(".info h3").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .selector").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .other_information").fadeTo(timeAnimate, targetOpacity);
                        $j(".controls").fadeTo(timeAnimate, targetOpacity);
                        $j(".product_images").fadeTo(timeAnimate, targetOpacity)
                    } else {
                        $j(".backgroundFade, .titleDropDown").show().focus();
                        $j(".header, .footer").css({
                            "z-index": "1"
                        })
                    }
                } else {
                    $j(this).toggleClass("active", 0);
                    clearTimeout(timeoutTitle);
                    targetOpacity = 1;
                    timeAnimate = "slow";
                    if (!ie) {
                        $j(".titleDropDown").fadeOut("slow");
                        $j(".info").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .description").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .slider_holder").fadeTo(timeAnimate, targetOpacity);
                        $j(".listing").fadeTo(timeAnimate, targetOpacity);
                        $j(".listing_feature").fadeTo(timeAnimate, targetOpacity);
                        $j(".double_feature").fadeTo(timeAnimate, targetOpacity);
                        $j(".info h3").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .selector").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .other_information").fadeTo(timeAnimate, targetOpacity);
                        $j(".controls").fadeTo(timeAnimate, targetOpacity);
                        $j(".product_images").fadeTo(timeAnimate, targetOpacity)
                    } else {
                        $j(".backgroundFade, .titleDropDown").hide();
                        $j(".header, .footer").css({
                            "z-index": "1000"
                        })
                    }
                }
                return false
            });
            var c = {
                over: function () {
                    clearTimeout(timeoutTitle)
                },
                out: function () {
                    $j(".moreCategory a").toggleClass("active", 0);
                    targetOpacity = 1;
                    timeAnimate = "slow";
                    if (!ie) {
                        $j(this).fadeOut("slow");
                        $j(".info").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .description").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .slider_holder").fadeTo(timeAnimate, targetOpacity);
                        $j(".listing").fadeTo(timeAnimate, targetOpacity);
                        $j(".listing_feature").fadeTo(timeAnimate, targetOpacity);
                        $j(".double_feature").fadeTo(timeAnimate, targetOpacity);
                        $j(".info h3").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .selector").fadeTo(timeAnimate, targetOpacity);
                        $j(".info .other_information").fadeTo(timeAnimate, targetOpacity);
                        $j(".controls").fadeTo(timeAnimate, targetOpacity);
                        $j(".product_images").fadeTo(timeAnimate, targetOpacity)
                    } else {
                        $j(".titleDropDown").hide();
                        $j(".backgroundFade").hide()
                    }
                },
                timeout: 700,
                interval: 50,
                sensitivity: 7
            };
            $j(".titleDropDown").hoverIntent(c)
        },
        allowDragX: function (c) {
            minX = dragOffX - maxDragX / 2;
            maxX = dragOffX + maxDragX / 2;
            if (c < minX) {
                c = minX
            }
            if (c > maxX) {
                c = maxX
            }
            return c
        },
        allowDragY: function (c) {
            minY = dragOffY - maxDragY / 2;
            maxY = dragOffY + maxDragY / 2;
            if (c < minY) {
                c = minY
            }
            if (c > maxY) {
                c = maxY
            }
            return c
        },
        enableDrag: function () {
            var c = $j(".product_images div.image img");
            $j("#draggable").css("left", c.position().left).css("top", c.position().top);
            $j("#draggable").attr("width", c.width()).attr("height", c.height());
            $j("#draggable").show()
        },
        disableDrag: function () {
            $j("#draggable").hide()
        },
        makeDraggable: function () {
            if (enableZoom) {
                $j("#draggable").toggleClass("draggableDiv", true);
                $j("#draggable").draggable({
                    drag: function () {
                        dX = b.allowDragX($j(this).position().left);
                        dY = b.allowDragY($j(this).position().top);
                        $j(this).css("left", dX + "px").css("top", dY + "px");
                        $j(".product_images div.image img").css("left", dX + "px").css("top", dY + "px")
                    },
                    stop: function () {
                        $j(this).css("left", b.allowDragX($j(this).position().left)).css("top", b.allowDragY($j(this).position().top))
                    }
                })
            }
        },
        buildImageManipulators: function () {
            var d = $j(".product_images div.image img");
            var c = $j(".product_images div.click_drag img");
            var e = $j(".copy .info h3").html();
            $j(".zoom a").click(function (f) {
                f.preventDefault();
                if (!$j(this).parent().hasClass("disabled")) {
                    if ($j(this).hasClass("activated")) {
                        b.trackEvent("Product", "Zoom Out", e);
                        clearTimeout(timeoutClick);
                        c.hide();
                        b.disableDrag();
                        $j(this).toggleClass("activated", false);
                        d.fadeOut("fast", function () {
                            $j(this).attr("src", $j(".controls .normal a").attr("href"));
                            $j(".product_images div.image img").css("left", "400px").css("top", "-45px");
                            d.delay(200).fadeIn("fast")
                        });
                        $j(this).parent().parent().children("div").not($j(this).parent()).toggleClass("disabled", false);
                        $j(this).parent().parent().children("div").not($j(this).parent()).animate({
                            opacity: 1
                        }, 500)
                    } else {
                        b.trackEvent("Product", "Zoom In", e);
                        $j(this).toggleClass("activated", true);
                        d.fadeOut("fast", function () {
                            $j(this).attr("src", $j(".zoom a").attr("href")).css("left", zoom_left + "px").css("top", zoom_top + "px");
                            d.delay(200).fadeIn("fast", function () {
                                if (enableZoom) {
                                    b.enableDrag();
                                    if (ie) {
                                        timeoutClick = setTimeout('$j(".product_images div.click_drag img").show()', 500);
                                        setTimeout('$j(".product_images div.click_drag img").hide()', 3000)
                                    } else {
                                        c.delay(500).fadeIn("slow").delay(2500).fadeOut("slow")
                                    }
                                }
                            })
                        });
                        $j(this).parent().animate({
                            opacity: 1
                        }, 500);
                        $j(this).parent().parent().children("div").not($j(this).parent()).animate({
                            opacity: 0.2
                        }, 500);
                        $j(this).parent().parent().children("div").not($j(this).parent()).toggleClass("disabled", true)
                    }
                }
                return false
            });
            numAltImages = $j(".change_view a").length;
            curAltImage = 0;
            $j(".change_view:gt(0)").hide();
            $j(".change_view a").click(function (f) {
                f.preventDefault();
                if (!$j(this).parent().hasClass("disabled")) {
                    if ($j(this).hasClass("activated") && curAltImage >= numAltImages) {
                        curAltImage = 0;
                        $j(this).toggleClass("activated", false);
                        d.fadeOut("fast", function () {
                            $j(this).attr("src", $j(".controls .normal a").attr("href"));
                            $j(".product_images div.image").css("left", "0px").css("top", "0px");
                            d.delay(200).fadeIn("fast")
                        });
                        $j(this).parent().parent().children("div").not($j(this).parent()).toggleClass("disabled", false);
                        $j(this).parent().parent().children("div").not($j(this).parent()).animate({
                            opacity: 1
                        }, 500)
                    } else {
                        strImage = $j(".change_view a:eq(" + (curAltImage + 0) + ")").attr("href");
                        $j(this).toggleClass("activated", true);
                        d.fadeOut("fast", function () {
                            $j(this).attr("src", strImage);
                            $j(".product_images div.image").css("left", "0px").css("top", "-45px");
                            d.delay(200).fadeIn("fast")
                        });
                        if (curAltImage == 0) {
                            $j(this).parent().animate({
                                opacity: 1
                            }, 500);
                            $j(this).parent().parent().children("div").not($j(this).parent()).animate({
                                opacity: 0.2
                            }, 500);
                            $j(this).parent().parent().children("div").not($j(this).parent()).toggleClass("disabled", true)
                        }
                        curAltImage++
                    }
                }
                return false
            })
        },
		
		buildSearchBox: function() {
			// show search box on hover
			$j("#search_input input").val("");
			$j(".header").hover(function() {
				$j("#search_input input").fadeIn("slow");
			}, function() {
				$j("#search_input input").stop(true,true).fadeOut("slow");
			});
		},
		
        linkLogo: function () {
            $j(".header h1").click(function (c) {
                c.preventDefault();
                window.location = "/";
                return false
            })
        },
        buildHomeCycle: function () {
            $j(".home .bgs").cycle({
                fx: "fade",
                speed: 2000,
                timeout: 6400,
                before: function () {},
                after: function () {
                    $j(".homeBg div").hide();
                    $j(this).find("div:not(.coords)").fadeIn(2000);
                    homeLink = $j(this).find("a").attr("href")
                }
            });
            $j(".home .homeBg>div").each(function () {
                $j(this).css({
                    left: $j(this).find(".x").html() + "px",
                    top: $j(this).find(".y").html() + "px"
                })
            }); //.append('<a href="#" class="shopnow">Shop Now</a>');
            $j(".home .bgs, .home .twinkle, .home .copy").click(function (c) {
                c.preventDefault();
                b.toggleShopMenu();
                return false
            })
        },
        toggleShopMenu: function (c) {
            if (b.shop_timeout) {
                clearTimeout(b.shop_timeout)
            }
            var d = $j("#shop");
            if (c || d.hasClass("over")) {
                b.navHoverOut(d);
                d.removeClass("over")
            } else {
                b.navHover(d);
                d.addClass("over");
                b.shop_timeout = setTimeout("MM.toggleShopMenu(true);", 8000)
            }
        },
        buildAboutCycle: function () {
            $j(".about .sectionImages").cycle({
                fx: "cover",
                speed: 1000,
                timeout: 6000,
                before: function () {},
                after: function () {}
            });
            $j(".about_feature:not(.current_feature)").hover(function () {
                $j(this).stop().animate({
                    top: "-150px"
                }, 500, "easeInOutQuint").toggleClass("activeFeature", true)
            }, function () {
                $j(this).stop().animate({
                    top: "0px"
                }, 500, "easeInOutQuint", function () {
                    $j(this).toggleClass("activeFeature", false)
                })
            })
        },
        navHover: function (j) {
            curAnim++;
            preNav = curNav;
            curNav = $j(j).attr("id");
            var g = $j(j).find("ul:first");
            $j(j).attr("name", curAnim);
            $j("#nav>ul>li").not(g).stop(true, true).fadeOut("fast");
            if (ie6) {
                $j(".slider_holder").hide()
            }
            var f;
            var d = g.children("li").length;
            var e = 0;
            if (curNav === "shopping_bag") {
                e = 300;
                f = 262
            } else {
                f = d * 25;
                var c = 1;
                var h = g.find("ul");
                if (h.length > 0) {
                    h.each(function () {
                        var k = $j(this).find("li").length;
                        if (k > c) {
                            c = k + 1
                        }
                    });
                    f += c * 13
                }
            }
            g.delay(300).fadeIn("slow");
            $j(".behind_navigation").delay(e).animate({
                height: f
            }, 300).toggleClass("behind_active", true)
        },
        navHoverOut: function (c) {
            $j(c).find("ul:first").fadeOut("slow");
            curWhich += 0.01;
            setTimeout("handleNav('" + ($j(c).attr("name")) + "', " + curWhich + ");", 600)
        },
        buildSecondary: function () {
            var c = {
                over: function () {
                    b.navHover($j(this))
                },
                out: function () {
                    b.navHoverOut($j(this))
                },
                timeout: 550,
                interval: 100,
                sensitivity: 4
            };
            $j("#nav>li:has(ul)").hoverIntent(c)
        },
        buildFooter: function () {
            var d = {
                over: function () {
                    b.toggleShopMenu(true);
                    curFooterAnim++;
                    $j(".footer ul.snav>li>ul").hide();
                    preFooterNav = curFooterNav;
                    curFooterNav = $j(this).attr("id");
                    var e = $j(this).children("div.subnav").height();
                    e += 2;
                    $j(this).attr("name", curFooterAnim);
                    $j(".footer .nav>ul>li").not($j(this)).children("div.subnav").stop(true, true).fadeOut("fast");
                    $j(this).children("div.subnav").delay(300).fadeIn("slow");
                    $j(".behind_footer").animate({
                        height: e
                    }, 300);
                    $j(".behind_footer").toggleClass("behind_footer_active", true)
                },
                out: function () {
                    $j(this).children("div.subnav").fadeOut("slow");
                    curFooterWhich += 0.01;
                    setTimeout("handleFooterNav('" + ($j(this).attr("name")) + "', " + curFooterWhich + ");", 800)
                },
                timeout: 200,
                interval: 300,
                sensitivity: 4
            };
            $j("#about_mikimoto, #customer_service").hoverIntent(d);
            var c = {
                over: function () {
                    $j(this).toggleClass("active", true);
                    $j(".footer ul.snav>li>a").not($j(this)).toggleClass("active", false);
                    $j(".footer ul.snav>li>ul").not($j(this).parent().children("ul")).animate({
                        opacity: "0"
                    }, 300, function () {
                        $j(this).css("left", "60px");
                        $j(this).hide()
                    });
                    $j(this).parent().children("ul").show();
                    $j(this).parent().children("ul").css("left", "60px").css("opacity", 0);
                    $j(this).parent().children("ul").animate({
                        left: "170px",
                        opacity: "1"
                    }, 500, "easeOutQuad")
                },
                out: function () {},
                timeout: 200,
                interval: 100,
                sensitivity: 3
            };
            $j(".footer ul.snav>li>a").hoverIntent(c)
        },
        buildHomeFeatures: function () {
            $j(".features .feature .photo").fadeOut(1);
            $j(".features .feature").hover(function () {
                b.toggleShopMenu(true);
                $j(this).stop();
                $j(this).css({
                    background: "#042545"
                });
                $j(this).children(".photo").fadeIn(1000);
                $j(this).animate({
                    marginTop: "0px"
                }, 800, "easeInOutQuint")
            }, function () {
                $j(this).stop();
                $j(this).css({
                    background: ""
                });
                $j(this).animate({
                    marginTop: "146px"
                }, 800, "easeInOutQuint");
                $j(this).children(".photo").fadeOut(500)
            });
            $j(".features .feature a").click(function () {
                var c = $j(".features .feature").index($j(this).parent().parent());
                b.trackEvent("Home Feature", "Feature " + (c + 1), $j(this).attr("href"))
            })
        },
        buildPearlsInMotion: function () {
            if ($j(".pearlsinmotion").length) {
                var c = function () {
                        $j("#pearlmid").delay(2000).animate({
                            top: "200px"
                        }, 4000, function () {
                            $j("#pearltop").delay(2000).animate({
                                top: "73px"
                            }, 2000, function () {
                                $j("#pearlmid,#pearltop").delay(5000).fadeOut(1000, function () {
                                    a(this).css({
                                        display: "block",
                                        opacity: "",
                                        top: "-60px"
                                    });
                                    if (a(this).attr("id") === "pearltop") {
                                        c()
                                    }
                                })
                            })
                        })
                    };
                c();
                $j(".pimNecklace").cycle({
                    fx: "fade",
                    speed: 3000,
                    timeout: 1000
                });
                $j(document).delegate(".pimDescriptionContainer, .bgs .pim", "click", function (d) {
                    d.preventDefault();
                    $j("html, body").animate({
                        scrollTop: "620px"
                    }, 1500, "easeInOutQuad")
                }).delegate(".pimCopyText > div", "click", function (d) {
                    d.stopPropagation();
                    return false
                })
            }
        },
        fixPlaceholderText: function () {
            var e = document.createElement("input");
            if (!("placeholder" in e)) {
                var d = a("#search_input input");
                var c = d.attr("placeholder");
                d.focus(function () {
                    if (d.val() === c) {
                        d.val("").removeClass("placehold")
                    }
                }).blur(function () {
                    if (d.val() === "") {
                        d.val(c).addClass("placehold")
                    }
                }).trigger("blur")
            }
        },
        bindEventTrackers: function () {
            $j(".category .description .link a").click(function () {
                b.trackEvent("Prodouct", $j(this).html(), $j(this).parent().parent().find("h3").text())
            })
        },
		trackEvent: function (d, c, e) {
            _gaq.push(["_trackEvent", d, c, e])
       }
    };
    window.MM = b;
    $j(document).ready(function () {
        b.ondomready()
    })
})(jQuery);

function handleNav(b, a) {
    if (b == curAnim && a >= curWhich) {
        $j("#nav>ul>li>ul").fadeOut("fast");
        $j(".behind_navigation").animate({
            height: 0
        }, 500, function () {
            $j(".behind_navigation").toggleClass("behind_active", false)
        });
        $j("#nav ul>li>a").toggleClass("active", false);
        if (ie6) {
            $j(".slider_holder").show()
        }
    }
}

function handleFooterNav(b, a) {
    if (b == curFooterAnim && a >= curFooterWhich) {
        $j(".footer>ul>li>ul").fadeOut("fast");
        $j(".behind_footer").animate({
            height: 0
        }, 500, function () {
            $j(".behind_footer").toggleClass("behind_footer_active", false).hide()
        });
        $j(".footer ul.snav>li>a").toggleClass("active", false)
    }
}

function resetFeatures() {
    $j(".listing_feature .photo").animate({
        opacity: 1
    }, 200).parent().toggleClass("active", false);
    $j(".feature_detail").fadeOut("slow");
    $j(".listing_feature h3").toggleClass("active", false);
    clearTimeout(timeoutFeatures)
}

function getRandom(b, a) {
    return Math.floor(Math.random() * (a - b + 1)) + b
}

function resetTitle() {
    $j(".moreCategory a").click();
    clearTimeout(timeoutTitle)
}

function toSlug(c) {
    c = c.replace(/^\s+|\s+$/g, "");
    var e = "ÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛàáäâèéëêìíïîòóöôùúüûÑñÇç·/_,:;";
    var d = "aaaaeeeeiiiioooouuuuaaaaeeeeiiiioooouuuunncc------";
    for (var b = 0, a = e.length; b < a; b++) {
        c = c.replace(e[b], d[b])
    }
    c = c.replace(/[^a-zA-Z0-9 -]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").toLowerCase();
    return c
};
