(function($){ //
    var pool = {
          'ru':{
              "club":"/ru/club/",
              "sport":"/ru/sportscomplex/",
              "golffield":"/ru/golfclub/",
              "habitation":"/ru/accommodation/"},
          'en':{
              "club":"/en/club/",
              "sport":"/en/sportscomplex/",
              "golffield":"/en/golfclub/",
              "habitation":"/en/accommodation/"
          }};
          //var path = window.location.pathname;
          //      console.log(path.match("(^/ru|^/en)"));
    $.fn.mpClick=function(){
        return this.each(function(){
            $(this).click(function(){
                var cls = $(".box").attr('class');
                var pathname = window.location.pathname;
                var lang = '';

                try {
                    lang = pathname.match("^/(ru|en)")[1];
                }
                catch(e) {
                    lang = 'ru';
                }
                re = /(club)+|(sport)+|(golffield)+|(habitation)+/
                cls = re.exec(cls);                

                if(cls.length>0){
                    cls = cls[0];                    
                    try{
                       window.location=pool[lang][cls];
                    }
                    catch(e){

                    }
                }
            });
            
        });
    };
})(jQuery);

jQuery(function(){
    jQuery(".collage .c").mpClick();
});

