var cssFix = function(){

var u = navigator.userAgent.toLowerCase(),

addClass = function(el, val){

if(! el.className) {

el.className = val;

} else {

var newCl = el.className;

newCl+=(" "+val);

el.className = newCl;

}

},

is = function(t){return (u.indexOf(t)!=-1)};

addClass(document.getElementsByTagName('html')[0],[

(!(/opera|webtv/i.test(u))&&/msie (\d)/.test(u))?('ie ie'+RegExp.$1)

: is('firefox/2')?'gecko ff2'

: is('firefox/3.5')?'gecko ff35'

: is('firefox/3')?'gecko ff3'

: is('gecko/')?'gecko'

: is('chrome/')?'chrome'

: is('opera/9')?'opera opera9':/opera (\d)/.test(u)?'opera opera'+RegExp.$1

: is('konqueror')?'konqueror'

: is('applewebkit/')?'webkit safari'

: is('mozilla/')?'gecko':'',

(is('x11')||is('linux'))?' linux'

: is('mac')?' mac'

: is('win')?' win':''

].join(" "));

}();

(function($) {
    $(function() {

        $("img[align=left]").addClass("alignleft");
        $("img[align=right]").addClass("alignright");
        $(".middleBlock ul li:last").css("margin-right", "0");
        $(".bagItem:nth-child(5n)").css("margin-right", "0");
        $(".orderTable tbody tr:odd").addClass("second");
        $(".orderTable thead tr:odd").addClass("second");

        $(".orderTable thead th:first").addClass("first");
        $(".orderTable thead th:last").addClass("second");

        $(".productItem:nth-child(4n)").css("margin-right", "0");

        $(".curtInterface .infoFormItem:odd").css("margin-right", "0");

        $(".priceBlock").each(function() {
            relationship = $(this).parent(".productItem").find("img");
            $(this).position({ my: 'center top', at: 'right top', of: relationship, collision: 'none', offset: '0 5px' })
        });

        $(".bestProductBlock").position({ my: 'top top', at: 'top top', of: $(".bestProduct"), collision: 'none' });
        $(".bestQualityBlock").position({ my: 'top top', at: 'top top', of: $(".bestQuality"), collision: 'none' });
        $(".commentBlock ul li:odd").css("background", "#f5f5f5");

        $(".zoomLink").bind("click", function() {
            $(".wGallery").overlay({
                top: "center",
                api: true
            }).load();

            return false;
        });

        $(".selectImage").bind("click", function() {
            $(".wGallery").overlay({
                top: "center",
                api: true
            }).load();

            return false;
        });

    });
})(jQuery);