function JsApi(){

     // смена региона пользователя
     this.change_loc = function(id, handl) {
         this.query({'id': id, 'act': 'change_loc'}, handl);
     }

     // информация о регионе
     this.get_loc_info = function(id, handl) {
         this.query({'id': id, 'act': 'get_loc_info'}, handl);
     }

     // информация о стране
     this.get_country_info = function(id, handl) {
         this.query({'id': id, 'act': 'get_country_info'}, handl);
     }

     // информация о магазине
     this.get_stock_info = function(handl) {
         this.query({'act': 'get_stock_info'}, handl);
     }

     // выбор фильтров по цвету
     this.get_filters_by_color = function(id, handl) {
         this.query({'act': 'get_filters', 'color': id}, handl);
     }

     
     this.get_filters_by_volume = function(id, handl) {
         this.query({'act': 'get_filters', 'volume': id}, handl);
     }

     this.reg_filter = function(name, filter, phone, email, date, d, a, b, c, captcha, handl) {
         this.query({'act': 'reg_filter', 'name': name, 'filter': filter, 'phone': phone, 'email': email, 'date': date, 'days': d, 'a': a, 'b': b, 'c': c, 'captcha': captcha}, handl);
     }

     this.check_nick = function(nick, email, handl) {
         this.query({'act': 'check_nick', 'nick': nick, 'email': email}, handl);
     }

     this.reg_user = function(name, nick, pass, email, captcha, handl, from_filter) {
         jQuery.get('/registration', {'n': name, 'nc': nick, 'pass': pass, 'e': email}, function(data) { handl(data); });
     }

     this.install_filter = function(name, filter, phone, adres, region, captcha, handl) {
         this.query({'act': 'install_filter', 'name': name, 'adres': adres, 'filter': filter, 'phone': phone, 'region': region, 'captcha': captcha}, handl);
     }

     this.login = function(login, pass, handl) {
         jQuery.get('/login', {'login': login, 'pass': pass}, function(data) { handl(data); });
     }

     this.diller_reg = function(name, geo, phone, email, person, quote, info, country, captcha, handl) {
         this.query({'act': 'diller_reg', 'name': name, 'geo': geo, 'email': email, 'person': person, 'country': country, 'quote': quote, 'info': info, 'phone': phone, 'captcha': captcha}, handl);
     }

     this.order_call = function(name, phone, date, time, captcha, handl) {
         this.query({'act': 'order_call', 'name': name, 'date': date, 'time': time, 'phone': phone, 'captcha': captcha}, handl);
     }

     this.conf_user = function(code, handl) {
         this.query({'act': 'conf_user', 'code': code}, handl);
     }

     this.conf_filter = function(code, handl) {
         this.query({'act': 'conf_filter', 'code': code}, handl);
     }

     this.set_filter_notice = function(c, e, i, date, mod_filter, d, handl) {
         this.query({'act': 'set_filter_notice', 'c': c, 'e': e, 'i': i, 'date': date, 'days': d, 'filter': mod_filter}, handl);
     }

     this.get_filter_capacity = function(filter, handl) {
         this.query({'act': 'get_filter_capacity', 'filter': filter}, handl);
     }

     this.no_notification = function(phone, handl) {
         this.query({'act': 'no_notification', 'phone': phone}, handl);
     }

     this.notification_conf = function(code, handl) {
         this.query({'act': 'notification_conf', 'code': code}, handl);
     }

     this.update_filter_notice = function(c, e, i, handl) {
         this.query({'act': 'update_filter_notice', 'c': c, 'e': e, 'i': i}, handl);
     }
     
     this.check_captcha = function(captcha, handl) {
         this.query({'act': 'check_captcha', 'captcha': captcha}, handl);
     }

     this.get_filters_by_id = function(filters, ctrdgs, handl) {
         this.query({'act': 'get_filters_by_id', 'filters': filters, 'catridges' : ctrdgs}, handl);
     }

     this.minus_comment_mark = function(id,handl) {
         this.query({'act': 'minus_comment_mark', 'id': id}, handl);
     }

     this.plus_comment_mark = function(id, handl) {
         this.query({'act': 'plus_comment_mark', 'id': id}, handl);
     }

     this.add_comment = function(text, rel_id, elem_id, handl) {
         this.query({'act': 'add_comment', 'rel_id': rel_id, 'text': text, 'elem_id': elem_id}, handl);
     }

     this.load_tpl = function(name, handl) {
         this.query({'act': 'load_tpl', 'name': name}, handl);
     }

     this.load_filters = function(handl) {
         this.query({'act': 'load_filters'}, handl);
     }

     this.load_cities = function(handl) {
         this.query({'act': 'load_cities'}, handl);
     }

     this.get_modifications = function(filter, phone, handl) {
         this.query({'act': 'get_modifications', 'filter': filter, 'phone': phone}, handl);
     }

     this.reg_user_with_filter = function(name, nick, pass, email, filter, phone, date, d, a, b, c,
        captcha, handl, from_filter) {
         jQuery.get('/registration', {'act': 'with_filter', 'n': name, 'nc': nick, 'pass': pass, 'e': email, 'f': filter, 'p': phone,
             'dt': date, 'ds': d, 'a': a, 'b': b, 'c': c}, function(data) { handl(data); });
     }

     this.trackCatalogPage = function(id) {
         this.query({'act': 'trackCatalogPage', 'id': id}, function(data){});
     }

     this.query = function(args, handl) {
        jQuery.post('/js_api', args, function(data) { handl(data); });
     }
}

var js_api = new JsApi();
