(function($) {
    $.fn.cn_malp = function() {
        this.each(function(){
            var obj = $(this);
            var txt = obj.html().replace(RegExp('-at-','i'), '@');
            obj.html('<a href="mailto:' + txt + '">' + txt + '</a>');
        });
    };    
})(jQuery);

function keyUpHandler(e) {
    alt = e.altKey;
    key = e.charCode || e.keyCode || 0;
    keyHuman = String.fromCharCode(key).toLowerCase();
    
    if (keyHuman == 'g' && alt == true) {
        toggleGrid();
    };                  
}

function toggleGrid(){
    if ($('#sizer').hasClass('show-grid')) { 
        $('#sizer').removeClass('show-grid');
        $.cookie('grid', null); 
    } else {
        $('#sizer').addClass('show-grid');
        $.cookie('grid', 'on'); 
    }
}   

function productGallery(x) {
    $('.gallery-thumbnails a').removeClass('current');    
    $('#gallery-blowup img').attr('src', x.href);
    $(x).addClass('current');
}

