﻿jQuery(document).ready(function () {
    jQuery("img.lightbox").each(function () {
        jQuery(this).wrap("<a class=\"lightboxImage noIcon\" title=\"" + jQuery(this).attr("alt") + "\" href=\"" + jQuery(this).attr("src").replace(new RegExp("\\bmw=[^&;]+[&;]?", "gi"), "").replace(new RegExp("\\bmh=[^&;]+[&;]?", "gi"), "").replace(new RegExp("\\bh=[^&;]+[&;]?", "gi"), "").replace(new RegExp("\\bw=[^&;]+[&;]?", "gi"), "") + "?&mh=1200&mw=1600\" />");
    });

    jQuery("a.lightboxImage").fancybox({ 'type': 'image', 'titlePosition': 'inside' });


    jQuery("#cssdropdown li, #cssdropdown ul").hover(
        function () {
            jQuery(this).addClass("hover").parent().addClass("hover").parent().addClass("hover").parent().addClass("hover");
        },
        function () {
            jQuery(this).removeClass("hover").parent().not(":hover").removeClass("hover").parent().not(":hover").removeClass("hover").parent().not(":hover").removeClass("hover");
        });

    jQuery("#cssdropdown > li").bind("mouseenter", function () {
        jQuery("#cssdropdown .current").removeClass("current").addClass("wasCurrent");
    });

    jQuery("#cssdropdown > li").bind("mouseleave mouseout", function () {
        if (!jQuery(this).is(".hover")) jQuery("#cssdropdown .wasCurrent").addClass("current");
    });

    jQuery("#cssdropdown > li").each(function () {
        jQuery(this).css("width", jQuery(this).width() + 12 + "px");
    });

    jQuery("span.mailto").each(function () {
        jQuery(this).wrap("<a href=\"mailto:" + jQuery(this).attr("title").replace(".wewantnospam.","@") + "\"></a>");
    })
});
