PageSourceSearch

https://www.jazykovky.cz/js/angularMerge.js?4.0.8

js jazykovky.cz collected 2026-10-06 10:41:47 UTC 139,359 bytes, 3,073 lines download raw bytes

1var mistaStudia = '{"items":[{"id":"12702","name":"Praha","name_search":"Praha","typeId":"gob","type":"m\u011bsto"},{"id":"1000","name":"Brno","name_search":"Brno","typeId":"gob","type":"m\u011bsto"},{"id":"11352","name":"Ostrava","name_search":"Ostrava","typeId":"gob","type":"m\u011bsto"},{"id":"12198","name":"Plze\u0148","name_search":"Plze\u0148","typeId":"gob","type":"m\u011bsto"},{"id":"11050","name":"Olomouc","name_search":"Olomouc","typeId":"gob","type":"m\u011bsto"},{"id":"8203","name":"Liberec","name_search":"Liberec","typeId":"gob","type":"m\u011bsto"},{"id":"1","name":"Hl.m. Praha","name_search":"Hl.m. Praha","typeId":"gkr","type":"kraj"},{"id":"3","name":"Jiho\u010desk\u00fd","name_search":"Jiho\u010desk\u00fd","typeId":"gkr","type":"kraj"},{"id":"11","name":"Jihomoravsk\u00fd","name_search":"Jihomoravsk\u00fd","typeId":"gkr","type":"kraj"},{"id":"5","name":"Karlovarsk\u00fd","name_search":"Karlovarsk\u00fd","typeId":"gkr","type":"kraj"},{"id":"8","name":"Kr\u00e1lov\u00e9hradeck\u00fd","name_search":"Kr\u00e1lov\u00e9hradeck\u00fd","typeId":"gkr","type":"kraj"},{"id":"7","name":"Libereck\u00fd","name_search":"Libereck\u00fd","typeId":"gkr","type":"kraj"},{"id":"13","name":"Moravskoslezsk\u00fd","name_search":"Moravskoslezsk\u00fd","typeId":"gkr","type":"kraj"},{"id":"12","name":"Olomouck\u00fd","name_search":"Olomouck\u00fd","typeId":"gkr","type":"kraj"},{"id":"9","name":"Pardubick\u00fd","name_search":"Pardubick\u00fd","typeId":"gkr","type":"kraj"},{"id":"4","name":"Plze\u0148sk\u00fd","name_search":"Plze\u0148sk\u00fd","typeId":"gkr","type":"kraj"},{"id":"2","name":"St\u0159edo\u010desk\u00fd","name_search":"St\u0159edo\u010desk\u00fd","typeId":"gkr","type":"kraj"},{"id":"6","name":"\u00dasteck\u00fd","name_search":"\u00dasteck\u00fd","typeId":"gkr","type":"kraj"},{"id":"10","name":"Vyso\u010dina","name_search":"Vyso\u010dina","typeId":"gkr","type":"kraj"},{"id":"14","name":"Zl\u00ednsk\u00fd","name_search":"Zl\u00ednsk\u00fd","typeId":"gkr","type":"kraj"}],"description":{"content":"<strong>TIP<\/strong> Zadejte po\u010d\u00e1te\u010dn\u00ed p\u00edsmena m\u00edsta - m\u011bsto, mestsk\u00e1 \u010d\u00e1st, okres, kraj","position":"bottom"}}';
2var mestaStudia = '{"items":[{"id":"12702","name":"Praha","name_search":"Praha","typeId":"gob","type":"m\u011bsto"},{"id":"1000","name":"Brno","name_search":"Brno","typeId":"gob","type":"m\u011bsto"},{"id":"11352","name":"Ostrava","name_search":"Ostrava","typeId":"gob","type":"m\u011bsto"},{"id":"12198","name":"Plze\u0148","name_search":"Plze\u0148","typeId":"gob","type":"m\u011bsto"},{"id":"11050","name":"Olomouc","name_search":"Olomouc","typeId":"gob","type":"m\u011bsto"},{"id":"8203","name":"Liberec","name_search":"Liberec","typeId":"gob","type":"m\u011bsto"},{"id":"2191","name":"\u010cesk\u00e9 Bud\u011bjovice","name_search":"\u010cesk\u00e9 Bud\u011bjovice","typeId":"gob","type":"m\u011bsto"},{"id":"4687","name":"Hradec Kr\u00e1lov\u00e9","name_search":"Hradec Kr\u00e1lov\u00e9","typeId":"gob","type":"m\u011bsto"},{"id":"17487","name":"\u00dast\u00ed nad Labem","name_search":"\u00dast\u00ed nad Labem","typeId":"gob","type":"m\u011bsto"},{"id":"11765","name":"Pardubice","name_search":"Pardubice","typeId":"gob","type":"m\u011bsto"},{"id":"3755","name":"Hav\u00ed\u0159ov","name_search":"Hav\u00ed\u0159ov","typeId":"gob","type":"m\u011bsto"},{"id":"3556","name":"Zl\u00edn","name_search":"Zl\u00edn","typeId":"gob","type":"m\u011bsto"},{"id":"6506","name":"Kladno","name_search":"Kladno","typeId":"gob","type":"m\u011bsto"},{"id":"9959","name":"Most","name_search":"Most","typeId":"gob","type":"m\u011bsto"},{"id":"6382","name":"Karvin\u00e1","name_search":"Karvin\u00e1","typeId":"gob","type":"m\u011bsto"},{"id":"3495","name":"Fr\u00fddek-M\u00edstek","name_search":"Fr\u00fddek-M\u00edstek","typeId":"gob","type":"m\u011bsto"},{"id":"11156","name":"Opava","name_search":"Opava","typeId":"gob","type":"m\u011bsto"},{"id":"6343","name":"Karlovy Vary","name_search":"Karlovy Vary","typeId":"gob","type":"m\u011bsto"},{"id":"2492","name":"D\u011b\u010d\u00edn","name_search":"D\u011b\u010d\u00edn","typeId":"gob","type":"m\u011bsto"},{"id":"5245","name":"Chomutov","name_search":"Chomutov","typeId":"gob","type":"m\u011bsto"}],"description":{"content":null,"position":null}}';
3var jazyky = '{"items":[{"id":"108","priority":"1","langabbr":"en","name":"Angli\u010dtina","search_name":"Angli\u010dtina","langimg":"gfx\/flags\/en_small.png","langimgexist":1},{"id":"92","priority":"1","langabbr":"de","name":"N\u011bm\u010dina","search_name":"N\u011bm\u010dina","langimg":"gfx\/flags\/de_small.png","langimgexist":1},{"id":"124","priority":"1","langabbr":"fr","name":"Francouz\u0161tina","search_name":"Francouz\u0161tina","langimg":"gfx\/flags\/fr_small.png","langimgexist":1},{"id":"401","priority":"1","langabbr":"es","name":"\u0160pan\u011bl\u0161tina","search_name":"\u0160pan\u011bl\u0161tina","langimg":"gfx\/flags\/es_small.png","langimgexist":1},{"id":"200","priority":"1","langabbr":"it","name":"Ital\u0161tina","search_name":"Ital\u0161tina","langimg":"gfx\/flags\/it_small.png","langimgexist":1},{"id":"478","priority":"1","langabbr":"zh","name":"\u010c\u00edn\u0161tina","search_name":"\u010c\u00edn\u0161tina","langimg":"gfx\/flags\/zh_small.png","langimgexist":1},{"id":"363","priority":"1","langabbr":"ru","name":"Ru\u0161tina","search_name":"Ru\u0161tina","langimg":"gfx\/flags\/ru_small.png","langimgexist":1},{"id":"483","priority":"1","langabbr":"cs","name":"\u010ce\u0161tina pro cizince","search_name":"\u010ce\u0161tina pro cizince","langimg":"gfx\/flags\/cs_small.png","langimgexist":1},{"id":"20","priority":"2","langabbr":"ar","name":"Arab\u0161tina","search_name":"Arab\u0161tina","langimg":"gfx\/flags\/ar_small.png","langimgexist":1},{"id":"63","priority":"2","langabbr":"bg","name":"Bulhar\u0161tina","search_name":"Bulhar\u0161tina","langimg":"gfx\/flags\/bg_small.png","langimgexist":1},{"id":"87","priority":"2","langabbr":"da","name":"D\u00e1n\u0161tina","search_name":"D\u00e1n\u0161tina","langimg":"gfx\/flags\/da_small.png","langimgexist":1},{"id":"121","priority":"2","langabbr":"fi","name":"Fin\u0161tina","search_name":"Fin\u0161tina","langimg":"gfx\/flags\/fi_small.png","langimgexist":1},{"id":"157","priority":"2","langabbr":"he","name":"Hebrej\u0161tina","search_name":"Hebrej\u0161tina","langimg":"gfx\/flags\/he_small.png","langimgexist":1},{"id":"161","priority":"2","langabbr":"hi","name":"Hind\u0161tina","search_name":"Hind\u0161tina","langimg":"gfx\/flags\/hi_small.png","langimgexist":1},{"id":"165","priority":"2","langabbr":"hr","name":"Chorvat\u0161tina","search_name":"Chorvat\u0161tina","langimg":"gfx\/flags\/hr_small.png","langimgexist":1},{"id":"193","priority":"2","langabbr":"id","name":"Indon\u00e9\u0161tina","search_name":"Indon\u00e9\u0161tina","langimg":"gfx\/flags\/id_small.png","langimgexist":1},{"id":"203","priority":"2","langabbr":"ja","name":"Japon\u0161tina","search_name":"Japon\u0161tina","langimg":"gfx\/flags\/ja_small.png","langimgexist":1},{"id":"230","priority":"2","langabbr":"ko","name":"Korej\u0161tina","search_name":"Korej\u0161tina","langimg":"gfx\/flags\/ko_small.png","langimgexist":1},{"id":"245","priority":"2","langabbr":"la","name":"Latina","search_name":"Latina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"167","priority":"2","langabbr":"hu","name":"Ma\u010far\u0161tina","search_name":"Ma\u010far\u0161tina","langimg":"gfx\/flags\/hu_small.png","langimgexist":1},{"id":"287","priority":"2","langabbr":"mn","name":"Mongol\u0161tina","search_name":"Mongol\u0161tina","langimg":"gfx\/flags\/mn_small.png","langimgexist":1},{"id":"313","priority":"2","langabbr":"nl","name":"Nizozem\u0161tina","search_name":"Nizozem\u0161tina","langimg":"gfx\/flags\/nl_small.png","langimgexist":1},{"id":"318","priority":"2","langabbr":"no","name":"Nor\u0161tina","search_name":"Nor\u0161tina","langimg":"gfx\/flags\/no_small.png","langimgexist":1},{"id":"347","priority":"2","langabbr":"pl","name":"Pol\u0161tina","search_name":"Pol\u0161tina","langimg":"gfx\/flags\/pl_small.png","langimgexist":1},{"id":"349","priority":"2","langabbr":"pt","name":"Portugal\u0161tina","search_name":"Portugal\u0161tina","langimg":"gfx\/flags\/pt_small.png","langimgexist":1},{"id":"106","priority":"2","langabbr":"el","name":"\u0158e\u010dtina","search_name":"\u0158e\u010dtina","langimg":"gfx\/flags\/el_small.png","langimgexist":1},{"id":"370","priority":"2","langabbr":"sa","name":"Sanskrt","search_name":"Sanskrt","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"414","priority":"2","langabbr":"sv","name":"\u0160v\u00e9d\u0161tina","search_name":"\u0160v\u00e9d\u0161tina","langimg":"gfx\/flags\/sv_small.png","langimgexist":1},{"id":"443","priority":"2","langabbr":"tr","name":"Ture\u010dtina","search_name":"Ture\u010dtina","langimg":"gfx\/flags\/tr_small.png","langimgexist":1},{"id":"458","priority":"2","langabbr":"vi","name":"Vietnam\u0161tina","search_name":"Vietnam\u0161tina","langimg":"gfx\/flags\/vi_small.png","langimgexist":1},{"id":"8","priority":"3","langabbr":"af","name":"Afrik\u00e1n\u0161tina","search_name":"Afrik\u00e1n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"34","priority":"3","langabbr":"ay","name":"Ajmar\u0161tina","search_name":"Ajmar\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"486","priority":"3","langabbr":"keu","name":"Akebu","search_name":"Akebu","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"402","priority":"3","langabbr":"sq","name":"Alb\u00e1n\u0161tina","search_name":"Alb\u00e1n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0}
3,{"id":"16","priority":"3","langabbr":"am","name":"Amhar\u0161tina","search_name":"Amhar\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"21","priority":"3","langabbr":"arc","name":"Aramej\u0161tina","search_name":"Aramej\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"169","priority":"3","langabbr":"hy","name":"Arm\u00e9n\u0161tina","search_name":"Arm\u00e9n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"31","priority":"3","langabbr":"av","name":"Avar\u0161tina","search_name":"Avar\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"35","priority":"3","langabbr":"az","name":"Azerbajd\u017e\u00e1n\u0161tina","search_name":"Azerjbajd\u017e\u00e1n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"40","priority":"3","langabbr":"bm","name":"Bambar\u0161tina","search_name":"Bambar\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"55","priority":"3","langabbr":"bnt","name":"Bantusk\u00e9 jazyky","search_name":"Bantusk\u00e9 jazyky","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"296","priority":"3","langabbr":"my","name":"Barm\u0161tina","search_name":"Barm\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"112","priority":"3","langabbr":"eu","name":"Baski\u010dtina","search_name":"Baski\u010dtina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"45","priority":"3","langabbr":"be","name":"B\u011bloru\u0161tina","search_name":"B\u011bloru\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"47","priority":"3","langabbr":"bn","name":"Beng\u00e1l\u0161tina","search_name":"Beng\u00e1l\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"57","priority":"3","langabbr":"bs","name":"Bosen\u0161tina","search_name":"Bosen\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"61","priority":"3","langabbr":"bua","name":"Burjat\u0161tina","search_name":"Burjat\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"173","priority":"3","langabbr":"chg","name":"\u010cagatajsk\u00e9 jazyky","search_name":"\u010cagatajsk\u00e9 jazyky","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"172","priority":"3","langabbr":"ce","name":"\u010ce\u010den\u0161tina","search_name":"\u010ce\u010den\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"384","priority":"3","langabbr":"sla","name":"\u010cernohor\u0161tina","search_name":"\u010cernohor\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"72","priority":"3","langabbr":"cs","name":"\u010ce\u0161tina","search_name":"\u010ce\u0161tina","langimg":"gfx\/flags\/cs_small.png","langimgexist":1},{"id":"484","priority":"3","langabbr":"prs","name":"Dar\u00ed","search_name":"Dar\u00ed","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"110","priority":"3","langabbr":"eo","name":"Esperanto","search_name":"Esperanto","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"111","priority":"3","langabbr":"et","name":"Eston\u0161tina","search_name":"Eston\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"116","priority":"3","langabbr":"fo","name":"Faer\u0161tina","search_name":"Faer\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"119","priority":"3","langabbr":"fj","name":"Fid\u017eij\u0161tina","search_name":"Fid\u017eij\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"344","priority":"3","langabbr":"phi","name":"Filip\u00ednsk\u00e9 jazyky","search_name":"Filip\u00ednsk\u00e9 jazyky","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"130","priority":"3","langabbr":"ff","name":"Fulb\u0161tina","search_name":"Fulb\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"138","priority":"3","langabbr":"gd","name":"Gael\u0161tina","search_name":"Gael\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"214","priority":"3","langabbr":"ka","name":"Gruz\u00edn\u0161tina","search_name":"Gruz\u00edn\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0}
3,{"id":"139","priority":"3","langabbr":"ga","name":"Ir\u0161tina","search_name":"Ir\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"199","priority":"3","langabbr":"is","name":"Island\u0161tina","search_name":"Island\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"472","priority":"3","langabbr":"yi","name":"Jidi\u0161","search_name":"Jidi\u0161","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"213","priority":"3","langabbr":"ks","name":"Ka\u0161m\u00edr\u0161tina","search_name":"Ka\u0161m\u00edr\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"68","priority":"3","langabbr":"ca","name":"Katal\u00e1n\u0161tina","search_name":"Katal\u00e1n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"217","priority":"3","langabbr":"kk","name":"Kaza\u0161tina","search_name":"Kaza\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"353","priority":"3","langabbr":"qu","name":"Ke\u010du\u00e1n\u0161tina","search_name":"Ke\u010du\u00e1n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"221","priority":"3","langabbr":"km","name":"Km\u00e9r\u0161tina","search_name":"Km\u00e9r\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"229","priority":"3","langabbr":"kg","name":"Kon\u017e\u0161tina","search_name":"Kon\u017e\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"76","priority":"3","langabbr":"co","name":"Korsi\u010dtina","search_name":"Korsi\u010dtina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"238","priority":"3","langabbr":"kum","name":"Kumyk\u0161tina","search_name":"Kumyk\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"239","priority":"3","langabbr":"ku","name":"Kurd\u0161tina","search_name":"Kurd\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"225","priority":"3","langabbr":"ky","name":"Kyrgyz\u0161tina","search_name":"Kyrgyz\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"244","priority":"3","langabbr":"lo","name":"Lao\u0161tina","search_name":"Lao\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"388","priority":"3","langabbr":"se","name":"Lapon\u0161tina","search_name":"Lapon\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"247","priority":"3","langabbr":"lez","name":"Lezgin\u0161tina","search_name":"Lezgin\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"249","priority":"3","langabbr":"ln","name":"Lingala","search_name":"Lingala","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"250","priority":"3","langabbr":"lt","name":"Litev\u0161tina","search_name":"Litev\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"246","priority":"3","langabbr":"lv","name":"Loty\u0161\u0161tina","search_name":"Loty\u0161\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"255","priority":"3","langabbr":"lu","name":"Luba","search_name":"Luba","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"278","priority":"3","langabbr":"mk","name":"Makedon\u0161tina","search_name":"Makedon\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"290","priority":"3","langabbr":"ms","name":"Malaj\u0161tina","search_name":"Malaj\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"280","priority":"3","langabbr":"mg","name":"Malga\u0161tina","search_name":"Malga\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"267","priority":"3","langabbr":"man","name":"Malin\u0161tina","search_name":"Malin\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"281","priority":"3","langabbr":"mt","name":"Malt\u0161tina","search_name":"Malt\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"289","priority":"3","langabbr":"mi","name":"Maor\u0161tina","search_name":"Maor\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"485","priority":"3","langabbr":"xmf","name":"Megrel\u0161tina","search_name":"Megrel\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0}
3,{"id":"286","priority":"3","langabbr":"mo","name":"Moldav\u0161tina","search_name":"Moldav\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"308","priority":"3","langabbr":"ne","name":"Nep\u00e1l\u0161tina","search_name":"Nep\u00e1l\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"407","priority":"3","langabbr":"ssa","name":"Nilosaharsk\u00e9 jazyky","search_name":"Nilosaharsk\u00e9 jazyky","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"331","priority":"3","langabbr":"om","name":"Orom\u0161tina","search_name":"Orom\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"346","priority":"3","langabbr":"pi","name":"P\u00e1li","search_name":"P\u00e1li","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"340","priority":"3","langabbr":"pa","name":"Pand\u017e\u00e1b\u0161tina","search_name":"Pand\u017e\u00e1b\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"352","priority":"3","langabbr":"ps","name":"Pa\u0161tun\u0161tina","search_name":"Pa\u0161tun\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"117","priority":"3","langabbr":"fa","name":"Per\u0161tina","search_name":"Per\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"358","priority":"3","langabbr":"rm","name":"Retorom\u00e1n\u0161tina","search_name":"Retorom\u00e1n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"359","priority":"3","langabbr":"rom","name":"Rom\u0161tina","search_name":"Rom\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"360","priority":"3","langabbr":"ro","name":"Rumun\u0161tina","search_name":"Rumun\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"381","priority":"3","langabbr":"si","name":"Sinhal\u0161tina","search_name":"Sinhal\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"385","priority":"3","langabbr":"sk","name":"Sloven\u0161tina","search_name":"Sloven\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"386","priority":"3","langabbr":"sl","name":"Slovin\u0161tina","search_name":"Slovin\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"398","priority":"3","langabbr":"so","name":"Som\u00e1l\u0161tina","search_name":"Som\u00e1l\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"411","priority":"3","langabbr":"sus","name":"S\u00f3\u0161tina","search_name":"S\u00f3\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"405","priority":"3","langabbr":"sr","name":"Srb\u0161tina","search_name":"Srb\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"180","priority":"3","langabbr":"cu","name":"Staroslov\u011bn\u0161tina","search_name":"Staroslov\u011bn\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"413","priority":"3","langabbr":"sw","name":"Svahil\u0161tina","search_name":"Svahil\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"424","priority":"3","langabbr":"tg","name":"T\u00e1d\u017ei\u010dtina","search_name":"T\u00e1d\u017ei\u010dtina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"416","priority":"3","langabbr":"ty","name":"Tahit\u0161tina","search_name":"Tahit\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"418","priority":"3","langabbr":"ta","name":"Tamil\u0161tina","search_name":"Tamil\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"419","priority":"3","langabbr":"tt","name":"Tatar\u0161tina","search_name":"Tatar\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"426","priority":"3","langabbr":"th","name":"Thaj\u0161tina","search_name":"Thaj\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"56","priority":"3","langabbr":"bo","name":"Tibet\u0161tina","search_name":"Tibet\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"428","priority":"3","langabbr":"ti","name":"Tigri\u0148\u0148a","search_name":"Tigri\u0148\u0148a","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"440","priority":"3","langabbr":"tk","name":"Turkm\u00e9n\u0161tina","search_name":"Turkm\u00e9n\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"450","priority":"3","langabbr":"ug","name":"Ujgur\u0161tina","search_name":"Ujgur\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"451","priority":"3","langabbr":"uk","name":"Ukrajin\u0161tina","search_name":"Ukrajin\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"454","priority":"3","langabbr":"ur","name":"Urd\u0161tina","search_name":"Urd\u0161tina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"455","priority":"3","langabbr":"uz","name":"Uzbe\u010dtina","search_name":"Uzbe\u010dtina","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"467","priority":"3","langabbr":"wo","name":"Wolof","search_name":"Wolof","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"378","priority":"3","langabbr":"sgn","name":"Znakov\u00fd jazyk","search_name":"Znakov\u00fd jazyk","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0},{"id":"480","priority":"3","langabbr":"zu","name":"Zulu","search_name":"Zulu","langimg":"gfx\/flags\/flag-default-neg.png","langimgexist":0}],"description":{"content":"","position":"top"}}';
4var druhKurzu = '{"items":[{"id":"1","name":"Skupinov\u00e9 kurzy pro ve\u0159ejnost","search_name":"Skupinov\u00e9 kurzy pro ve\u0159ejnost"},{"id":"2","name":"Individu\u00e1ln\u00ed kurzy","search_name":"Individu\u00e1ln\u00ed kurzy"},{"id":"3","name":"Firemn\u00ed jazykov\u00e9 kurzy","search_name":"Firemn\u00ed jazykov\u00e9 kurzy"},{"id":"4","name":"Pomaturitn\u00ed studium","search_name":"Pomaturitn\u00ed studium"},{"id":"12","name":"Kurzy pro d\u011bti","search_name":"Kurzy pro d\u011bti"},{"id":"13","name":"T\u00e1bory a p\u0159\u00edm\u011bstsk\u00e9 t\u00e1bory pro d\u011bti","search_name":"T\u00e1bory a p\u0159\u00edm\u011bstsk\u00e9 t\u00e1bory pro d\u011bti"},{"id":"5","name":"Pobytov\u00e9 jazykov\u00e9 kurzy v \u010cR","search_name":"Pobytov\u00e9 jazykov\u00e9 kurzy v \u010cR"},{"id":"6","name":"Online v\u00fduka (skype, e-learning)","search_name":"Online v\u00fduka (skype, e-learning)"},{"id":"7","name":"Studium v zahrani\u010d\u00ed","search_name":"Studium v zahrani\u010d\u00ed"},{"id":"8","name":"Pr\u00e1ce v zahrani\u010d\u00ed","search_name":"Pr\u00e1ce v zahrani\u010d\u00ed"},{"id":"9","name":"V\u00edkendov\u00e9 kurzy","search_name":"V\u00edkendov\u00e9 kurzy"},{"id":"10","name":"Pr\u00e1zdninov\u00e9 kurzy","search_name":"Pr\u00e1zdninov\u00e9 kurzy"},{"id":"11","name":"Intenzivn\u00ed kurzy","search_name":"Intenzivn\u00ed kurzy"}],"description":{"content":"","position":"top"}}';
5var app = angular.module('jazykovky', [], function($routeProvider, $locationProvider, $anchorScrollProvider) { 
6    $anchorScrollProvider.disableAutoScrolling();
7    if(document.addEventListener && window.requestAnimationFrame){ // check for modern browsers
8        $locationProvider.html5Mode(true).hashPrefix('!');
9    } else {
10        $locationProvider.html5Mode(false);
11    }
12}).filter('isPlaceholder', function () {
13    return function (name, placeholder) {
14        if(!name) {
15            return placeholder;
16        }
17        return name.length > 0 ? name : placeholder;          
18    }
19});
20
21app.factory('Stack', function() {
22  var items = [];
23  var Stack = new Object();
24  Stack.a = function(item) {
25    items.push(item);
26    return true;
27  };
28  Stack.getItems = function() {
29    return items;
30  }
31  
32  return Stack;
33});
34
35
36
37
38if ('function' !== typeof Array.prototype.reduce) {
39  Array.prototype.reduce = function(callback, opt_initialValue){
40    'use strict';
41    if (null === this || 'undefined' === typeof this) {
42      // At the moment all modern browsers, that support strict mode, have
43      // native implementation of Array.prototype.reduce. For instance, IE8
44      // does not support strict mode, so this check is actually useless.
45      throw new TypeError(
46          'Array.prototype.reduce called on null or undefined');
47    }
48    if ('function' !== typeof callback) {
49      throw new TypeError(callback + ' is not a function');
50    }
51    var index, value,
52        length = this.length >>> 0,
53        isValueSet = false;
54    if (1 < arguments.length) {
55      value = opt_initialValue;
56      isValueSet = true;
57    }
58    for (index = 0; length > index; ++index) {
59      if (this.hasOwnProperty(index)) {
60        if (isValueSet) {
61          value = callback(value, this[index], index, this);
62        }
63        else {
64          value = this[index];
65          isValueSet = true;
66        }
67      }
68    }
69    if (!isValueSet) {
70      throw new TypeError('Reduce of empty array with no initial value');
71    }
72    return value;
73  };
74}
75if (!Array.prototype.indexOf) {
76  Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
77    'use strict';
78    if (this == null) {
79      throw new TypeError();
80    }
81    var n, k, t = Object(this),
82        len = t.length >>> 0;
83
84    if (len === 0) {
85      return -1;
86    }
87    n = 0;
88    if (arguments.length > 1) {
89      n = Number(arguments[1]);
90      if (n != n) { // shortcut for verifying if it's NaN
91        n = 0;
92      } else if (n != 0 && n != Infinity && n != -Infinity) {
93        n = (n > 0 || -1) * Math.floor(Math.abs(n));
94      }
95    }
96    if (n >= len) {
97      return -1;
98    }
99    for (k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); k < len; k++) {
100      if (k in t && t[k] === searchElement) {
101        return k;
102      }
103    }
104    return -1;
105  };
106}
107app.directive('focus', function ($timeout) {
108        return {
109            scope: {
110                trigger: '@focus'
111            },
112            link: function (scope, element) {
113                scope.$watch('trigger', function (value) {
114                    if (value === "true") {
115                        $timeout(function () {
116                            element[0].focus();
117                        });
118                    }
119                });
120            }
121        };
122});
123        
124app.directive( [ 'focus', 'blur', 'keyup', 'keydown', 'keypress' ].reduce( function ( container, name ) {
125
126    var directiveName = 'ng' + name.substr(0,1).toUpperCase() + name.substr(1);
127    container[ directiveName ] = [ '$parse', function ( $parse ) {
128        return function ( scope, element, attr ) {
129            var fn = $parse( attr[ directiveName ] );
130            element.bind( name, function ( event ) {
131                scope.$apply( function ( ) {
132                    fn( scope, {
133                        $event : event
134                    } );
135                } );
136            } );
137        };
138    } ];
139
140    return container;
141}, { } ) );
142
143app.directive("scroll", ["$window", function($window){
144    return {
145        scope: {
146            active: '='
147        },
148        restrict : "AC",
149        compile : function(){
150            function scrollTo(element) {
151                var el = $(element);
152                if(el) {
153                    var scrollElement = $(element).closest('div.autocomplete-box-inner');
154                    scrollElement.scrollTop(scrollElement.scrollTop()+el.position().top-6);
155                }
156            }
157
158        return function(scope, element, attr) {
159            scope.$watch('active', function(active) {
160                if(active) {
161                   scrollTo(element);
162                }
163            });
164        };
165      }
166    };
167}]);
168
169app.directive('slider', function() {
170    return {
171        scope: {
172            id: '=',
173            min: '=',
174            max: '=',
175            left: '=',
176            right: '='
177        },
178        link: function(scope, elem, attrs) {
179            var left;
180            var right;
181            if(scope.left == 0) {
182                left = scope.min;// + 1600;
183            } else {
184                left = scope.left;
185            }
186            if(scope.right == 0) {
187                right = scope.max;// - 1000;
188            } else {
189                right = scope.right;
190            }
191
192            $(elem).slider({
193                range: true,
194                "min": scope.min,
195                "max": scope.max,
196                "step": 100,
197                values: [left, right],
198                slide: function( event, ui ) {
199                    scope.left = ui.values[0];
200                    scope.right = ui.values[1];                    
201                    scope.$watch("left", function(left) {
202                        if(left == 0) {
203                            left = scope.min;
204                        } else {
205                            left = left;
206                        }
207                        $(elem).slider("values", 0, left);
208                    });
209                    scope.$watch("right", function(right) {
210                        if(right == 0) {
211                            right = scope.max;
212                        } else {
213                            right = right;
214                        }
215                        $(elem).slider("values", 1, right);
216                    });
217                    scope.$apply();
218                    
219                }
220            });
221
222            
223        }
224    }
225});
226
227app.directive('slider2', function() {
228    return {
229        scope: {
230            id: '=',
231            min: '=',
232            max: '=',
233            left: '='
234        },
235        link: function(scope, elem, attrs) {
236            var left = scope.min;
237            scope.$watch("max", function(max) {
238                $(elem).slider("option", "max", max);
239            });
240            scope.$watch("left", function(left) {
241                $(elem).slider("values", 0, left);
242            });
243            $(elem).slider({
244                "min": scope.min,
245                "max": parseInt(scope.max),
246                "step": 1,
247                range: "min",
248                values: [left],
249                slide: function( event, ui ) {                 
250                    scope.left = ui.values[0];
251                    scope.$apply();
252                }
253            });
254        }
255    }
256});
257
258app.factory('demandService', function() {  
259	return {
260		searchParams : {
261		    show: 1,
262		    count: null,
263		    telefon: "",
264		    poznamka_uzivatel: "",
265		    email: "@"
266		    
267		}
268		
269	};
270});
271
272app.directive('fallbackSrc', function () {
273  var fallbackSrc = {
274    link: function postLink(scope, elem, attrs) {
275      elem.bind('error', function() {
276        angular.element(this).attr("src", attrs.fallbackSrc);
277      });
278    }
279   }
280   return fallbackSrc;
281});
282
283app.directive('datepicker', function() {
284    return {
285        scope: {
286            id: '=',
287            date: '=',
288            type: '@'
289        },
290        link: function(scope, elem, attrs, $event) {
291
292            
293            var option = "";
294            if(scope.type=="min") {
295                option = "date";
296            } else {
297                option = "date";
298            }
299            scope.$watch(option, function(date) {
300                    $(elem).datepicker( "setDate", date );
301                    //scope.date = date;
302                    //scope.$parent.item.loadItems();
303                    //scope.$parent.item.$timeout(function() {
304                    //scope.$parent.item.setActive([scope.$parent.item.name]);
305                    
306                    //}, 400);
307                });
308            
309            $(elem).datepicker({
310              defaultDate: "+1w",
311              changeMonth: true,
312              dateFormat: "d.m.yy",
313              onSelect: function( selectedDate ) {
314                scope.date = selectedDate;
315                $(elem).datepicker( "option", option, selectedDate );
316                scope.$watch(option, function(date) {
317                    $(elem).datepicker( "option", option, date );
318                    scope.date = date;
319                    scope.$parent.item.loadItems();
320                    //scope.$parent.item.$timeout(function() {
321                    //scope.$parent.item.setActive([scope.$parent.item.name]);
322                    //}, 400);
323                });
324                scope.$apply();
325              },
326              onClose: function( selectedDate ) {
327                scope.date = selectedDate;
328                /*scope.$watch(option, function(date) {
329                    $(elem).datepicker( "option", option, date );
330                    scope.date = date;
331                    scope.$parent.item.loadItems();
332                    scope.$parent.item.$timeout(function() {
333                    scope.$parent.item.setActive([scope.$parent.item.name]);
334                    }, 400);
335                });*/
336                //scope.$apply();
337              }
338            });  
339        }
340    }
341});
342
343
344app.run(function($rootScope, $location) {
345  $rootScope.$on('$routeChangeSuccess', function(newRoute, oldRoute) {
346    $location.hash($routeParams.scrollTo);
347        $anchorScroll();  
348  });
349  $rootScope.location = $location;
350  $rootScope.api =  "search/api/";
351  $rootScope.demandApi = "poptavka/api/";
352  $rootScope.delimiter =  ";;";
353  $rootScope.inputDelimiter =  ",";
354  $rootScope.removeDiacritics = function(string) {
355    if(!string) {
356        return string;
357    }
358    var map = [
359      {'base': '', 'letters':/\(/g},
360      {'base': '', 'letters':/\)/g},
361      {'base': '', 'letters': / +/g},
362      {'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},
363      {'base':'AA','letters':/[\uA732]/g},
364      {'base':'AE','letters':/[\u00C6\u01FC\u01E2]/g},
365      {'base':'AO','letters':/[\uA734]/g},
366      {'base':'AU','letters':/[\uA736]/g},
367      {'base':'AV','letters':/[\uA738\uA73A]/g},
368      {'base':'AY','letters':/[\uA73C]/g},
369      {'base':'B', 'letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},
370      {'base':'C', 'letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},
371      {'base':'D', 'letters':/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},
372      {'base':'DZ','letters':/[\u01F1\u01C4]/g},
373      {'base':'Dz','letters':/[\u01F2\u01C5]/g},
374      {'base':'E', 'letters':/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},
375      {'base':'F', 'letters':/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},
376      {'base':'G', 'letters':/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},
377      {'base':'H', 'letters':/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},
378      {'base':'I', 'letters':/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},
379      {'base':'J', 'letters':/[\u004A\u24BF\uFF2A\u0134\u0248]/g},
380      {'base':'K', 'letters':/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},
381      {'base':'L', 'letters':/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},
382      {'base':'LJ','letters':/[\u01C7]/g},
383      {'base':'Lj','letters':/[\u01C8]/g},
384      {'base':'M', 'letters':/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},
385      {'base':'N', 'letters':/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},
386      {'base':'NJ','letters':/[\u01CA]/g},
387      {'base':'Nj','letters':/[\u01CB]/g},
388      {'base':'O', 'letters':/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},
389      {'base':'OI','letters':/[\u01A2]/g},
390      {'base':'OO','letters':/[\uA74E]/g},
391      {'base':'OU','letters':/[\u0222]/g},
392      {'base':'P', 'letters':/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},
393      {'base':'Q', 'letters':/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},
394      {'base':'R', 'letters':/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},
395      {'base':'S', 'letters':/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u
395015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},
396      {'base':'T', 'letters':/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},
397      {'base':'TZ','letters':/[\uA728]/g},
398      {'base':'U', 'letters':/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},
399      {'base':'V', 'letters':/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},
400      {'base':'VY','letters':/[\uA760]/g},
401      {'base':'W', 'letters':/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},
402      {'base':'X', 'letters':/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},
403      {'base':'Y', 'letters':/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},
404      {'base':'Z', 'letters':/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},
405      {'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},
406      {'base':'aa','letters':/[\uA733]/g},
407      {'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g},
408      {'base':'ao','letters':/[\uA735]/g},
409      {'base':'au','letters':/[\uA737]/g},
410      {'base':'av','letters':/[\uA739\uA73B]/g},
411      {'base':'ay','letters':/[\uA73D]/g},
412      {'base':'b', 'letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},
413      {'base':'c', 'letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},
414      {'base':'d', 'letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},
415      {'base':'dz','letters':/[\u01F3\u01C6]/g},
416      {'base':'e', 'letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},
417      {'base':'f', 'letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},
418      {'base':'g', 'letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},
419      {'base':'h', 'letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},
420      {'base':'hv','letters':/[\u0195]/g},
421      {'base':'i', 'letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},
422      {'base':'j', 'letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},
423      {'base':'k', 'letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},
424      {'base':'l', 'letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},
425      {'base':'lj','letters':/[\u01C9]/g},
426      {'base':'m', 'letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},
427      {'base':'n', 'letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},
428      {'base':'nj','letters':/[\u01CC]/g},
429      {'base':'o', 'letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},
430      {'base':'oi','letters':/[\u01A3]/g},
431      {'base':'ou','letters':/[\u0223]/g},
432      {'base':'oo','letters':/[\uA74F]/g},
433      {'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},
434      {'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},
435      {'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},
436      {'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},
437      {'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u02
4371B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},
438      {'base':'tz','letters':/[\uA729]/g},
439      {'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},
440      {'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},
441      {'base':'vy','letters':/[\uA761]/g},
442      {'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},
443      {'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},
444      {'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},
445      {'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}
446    ];
447
448    for(var i=0; i<map.length; i++) {
449      string = string.replace(map[i].letters, map[i].base);
450    }
451
452    return string;
453
454  }
455  
456});
457
458contains = function(obj, obj2) {
459    var i = obj.length;
460    while (i--) {
461        if (obj[i] === obj2) {
462            return true;
463        }
464    }
465    return false;
466}
467
468Object.size = function(obj) {
469    var size = 0, key;
470    for (key in obj) {
471        if (obj.hasOwnProperty(key)) size++;
472    }
473    return size;
474};
475
476var RegexHelper = {};
477RegexHelper.quote = function(string) {
478  return string.replace(/([()[{*+.$^\\|?])/g, '\\$1');
479}
480
481function extend(subclass, superclass) {
482   function SuperClass() {}
483   SuperClass.prototype = superclass.prototype;
484   subclass.prototype = new SuperClass();
485   subclass.prototype.constructor = subclass;
486   subclass.superclass = superclass;
487   subclass.superproto = superclass.prototype;
488}
489
490$(document).ready(function() {
491    SearchController.prototype.type = 1;
492    angular.bootstrap($('#jazykovky-search'), ['jazykovky']);
493    SearchController.prototype.type = 1;
494    SearchController.prototype.context = '#jazykovky-search2';
495    angular.bootstrap($('#jazykovky-search2'), ['jazykovky']);
496    SearchController.prototype.type = 2;
497    SearchController.prototype.context = '#jazykovky-skola';
498    angular.bootstrap($('#jazykovky-skola'), ['jazykovky']);
499    SearchController.prototype.type = 3;
500    SearchController.prototype.context = '#jazykovky-poptavka';
501    angular.bootstrap($('#jazykovky-poptavka'), ['jazykovky']);
502});
503
504
505var AbstractModel;
506
507AbstractModel = (function() {
508  AbstractModel.prototype.id = null; 
509  AbstractModel.prototype.items = [];
510  AbstractModel.prototype.templateUrl = function() {
511  } 
512  AbstractModel.prototype.state = {};
513
514  function AbstractModel($http, $scope, $route) {
515    this.$scope = $scope;
516    this.$http = $http;
517    this.$route = $route;
518    jQuery.extend($scope, this); // JQuery magic 
519  }
520
521  return AbstractModel;
522
523})();
524
525AbstractModel.$inject = ['$http', '$scope', '$route'];
526
527
528
529    function AutocompleteModel($http, $scope, $route, $timeout) {
530        this.$scope = $scope;
531        this.$http = $http;
532        this.$route = $route;
533        this.$timeout = $timeout;
534        this.targetName = ""; 
535        this.fields = []; 
536        this.fieldsHide = ['search_name']; 
537        this.sourceName = []; 
538        this.id = null; 
539        this.name = "";
540        this.template = 'Autocomplete.html';
541        this.items = [];
542        this.apiUrl = '';
543        this.show = false;
544        this.ajaxLoad = true;
545        this.title = "";
546        this.placeholder = "vyberte";
547        this.activeItem = {};
548        this.isDataLoaded = false;
549        this.showArrow = true;
550        this.error = false;
551        this.timeout;
552        this.preload = {};
553        this.selectedItemIndex = null;
554
555        jQuery.extend(this.$scope, this); // JQuery magic 
556        
557    } 
558    
559    //populate
560    AutocompleteModel.prototype.populate = function() {
561        var value = null;
562        for(sid in this.sourceName) {
563
564            if(typeof this.sourceName[sid] === 'function') { continue; }
565            if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val() != '') {
566                value = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val();
567                
568                var rel = "";
569                
570                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel')) {
571                    rel = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel').split(this.$scope.delimiter);
572                }
573                break;
574            }
575            
576        }
577        
578        var temp = {};
579        if(value) {
580            for(id in this.fields) {
581                temp[this.fields[id]] = rel[id];
582            }
583            temp['id'] = value;
584            this.activeItem = temp;
585            this.name = temp.name;
586        }
587    } 
588
589     AutocompleteModel.prototype.loadData = function(event) {
590        
591        this.show = true;
592        var _this = this;	
593        if(this.preload.length > 0 && this.name.length <= 0) {
594            this.isDataLoaded = true;
595            this.items = JSON.parse(this.preload);
596        } else {
597            _this.$timeout.cancel(this.timeout);
598            this.timeout = _this.$timeout(function() {
599                if(_this.ajaxLoad || _this.items.length == 0) {      
600                var url = _this.$scope.api + _this.apiUrl;
601                if(_this.name) {
602                     var temp = url.split('\?');
603                    if(_this.name.length > 0 && _this.ajaxLoad) {
604                       url = temp[0] + '/' + _this.name + ((temp[1]) ? '?' + temp[1] : ''); 
605                    }
606                }
607                _this.$http.get(url).then(function(response) {
608                        if(response.status === 200) {
609                            _this.isDataLoaded = true;
610                            return _this.items = response.data;
611                        }
612                });
613                }
614            }, 250);
615        }
616        
617        var flush = true;
618        var itemsCount = 0;
619        if((typeof event) != "undefined") {
620            var items = this.getItems();
621            itemsCount = items.length;
622            var whiteList = [9, 13] // tab, enter;
623            var notEmpty = false;
624            for(var index in whiteList) {
625                if(event.keyCode == whiteList[index] || event.which == whiteList[index]) { 
626                    flush = false;
627                    if(this.selectedItemIndex === null) { 
628                        
629                        if(event.keyCode == 13 || event.which == 13) {
630                            notEmpty = true;
631                        } else {
632                            this.show = false;
633                            if(typeof(this.updateComponent) != "undefined") {
634                                this.updateComponent();
635                            }
636                        }
637                        
638  
639                        var result = this.setActive({name: this.name}, notEmpty);
640                        if(!result && (event.keyCode == 13 || event.which == 13)) {
641                            this.show = true;
642                        }
643
644                        if(itemsCount == 1) {
645                            this.setActive({name: items[0].name});
646                            this.show = false;
647                            if(typeof(this.updateComponent) != "undefined") {
648                                this.updateComponent();
649                            }
650                        }
651                    } else {
652                        this.setActive({name: items[this.selectedItemIndex].name});
653                        if(typeof(this.updateComponent) != "undefined") {
654                            this.updateComponent();
655                        };
656                    }
657                }
658            }      
659
660            // up
661            if(event.keyCode == 38 || event.which == 38) {
662                flush = false;
663               if(itemsCount > 0) {
664                    if(this.selectedItemIndex === null) {
665                        this.selectedItemIndex = itemsCount;
666                    } else if(this.selectedItemIndex-1 < 0) {
667                        this.selectedItemIndex = 0;
668                    } else {
669                        this.selectedItemIndex--;
670                    }
671                } 
672                //this.$scope.$broadcast('upDown');
673            }
674
675            // down
676            if(event.keyCode == 40 || event.which == 40) {
677                flush = false;
678                if(itemsCount > 0) {
679                    if(this.selectedItemIndex === null) {
680                        this.selectedItemIndex = 0;
681                    } else if(this.selectedItemIndex-1 > itemsCount) {
682                        this.selectedItemIndex = this.selectedItemIndex;
683                    } else if( this.selectedItemIndex+1 < itemsCount) {
684                        this.selectedItemIndex++;
685                    }
686                }
687            }
688            
689            if(flush) {
690                this.selectedItemIndex = null;
691            }
692        }
693        return true;
694    };
695    
696    AutocompleteModel.prototype.hideData = function() {
697        this.show = false;
698        var res = true;
699        if(this.name) {
700            if(this.name.length > 2 && this.activeItem.name != this.name) {
701               this.setActive({name: this.name});
702            } 
703            var items = this.getItems();
704            if(items.length == 1) {
705                this.setActive({name: items[0].name});
706            }
707        } else {
708            this.setActive('');
709        }
710        if(!this.activeItem.id) {
711            this.name = "";
712        } 
713    };
714    
715    AutocompleteModel.prototype.open = function(event, target) {
716        if(this.show) {
717            for( i in this.$scope.$parent.items) {
718                this.$scope.$parent.items[i].hideData();
719            }
720            this.show = true;
721            var _this = this;
722            
723            $(window).click(function (event) {
724                var clickedElement = event.target;
725                if (!clickedElement) return;
726
727                var elementClasses = clickedElement.classList;
728                var clickedOnComponentDrawer = (elementClasses.contains(target) && elementClasses.contains('component')) || (clickedElement.parentNode !== null && clickedElement.parentNode.classList.contains('component'));
729
730                if (!clickedOnComponentDrawer) {
731                    for( i in _this.$scope.$parent.items) {
732                        _this.$scope.$parent.items[i].hideData();
733                    }
734                    for( i in _this.$scope.$parent.itemsAdvanced) {
735                        _this.$scope.$parent.itemsAdvanced[i].showComponent = false;
736                        _this.$scope.$parent.itemsAdvanced[i].isActive = false;
737                    }
738                    for( i in _this.$scope.$parent.itemsSpecial) {
739                        _this.$scope.$parent.itemsSpecial[i].showComponent = false;
740                        _this.$scope.$parent.itemsSpecial[i].isActive = false;
741                    }
742                    for( i in _this.$scope.$parent.itemsExpert) {
743                        _this.$scope.$parent.itemsExpert[i].showComponent = false;
744                        _this.$scope.$parent.itemsExpert[i].isActive = false;
745                    }
746                    $(window).unbind('click');
747                    
748                    _this.$scope.$parent.$apply();
749                    return;
750                }
751            });
752        } 
753    }
754    
755    AutocompleteModel.prototype.getItemsRegExp = function(name) {
756        return new RegExp(".*" + name + ".*", "gi");
757    }
758    AutocompleteModel.prototype.size = function(obj) {
759        return Object.size(obj);
760    }
761    
762    AutocompleteModel.prototype.getItems = function() {
763        var re = new RegExp(".*");
764        if(!this.ajaxLoad) {
765           re = this.getItemsRegExp(this.$scope.removeDiacritics(this.name)); 
766        }
767        var temp = new Array();
768        var n = {};
769        for(id in this.items.items) {
770                var item = this.items.items[id];
771                var itemWithoutDiacritics = this.$scope.removeDiacritics(item.name);
772                if(itemWithoutDiacritics.match(re)) {
773                    for(fid in this.fields) {
774                        var iname = this.fields[fid];
775                        if(item.hasOwnProperty(iname) && !contains(this.fieldsHide, iname)) {
776                           n[this.fields[fid]] = item[this.fields[fid]]; // + this.$scope.delimiter;
777                        }
778                    }
779                    n['$$hashKey'] = function() {return JSON.stringify(n)};
780                    temp.push(n);
781                    n = {};
782                }
783            }
784            return temp;
785    }
786    AutocompleteModel.prototype.getFields = function() {
787        var fields = [];
788        var i = 0;
789        for(fid in this.fields) {
790            var iname = this.fields[fid];
791            if(!contains(this.fieldsHide, iname)) {
792                fields[i] = this.fields[fid];
793                i++;
794            }
795        }
796        return fields;
797    }
798    AutocompleteModel.prototype.equals = function(item, name) {
799        var valid = true;
800        for(fid in this.fields) {
801            var iname = this.fields[fid];
802            if(item[iname] && name[iname]) {
803                if(name[iname].length > 0) {
804                    if(this.$scope.removeDiacritics(item[iname].toLowerCase()) !== this.$scope.removeDiacritics(name[iname].toLowerCase()) && !contains(this.fieldsHide, iname)) {
805                        valid = false;
806                        break;
807                    }
808                }
809            }
810        }
811        return valid;
812    }
813    AutocompleteModel.prototype.focusDiv = function($event) {
814        var _this = this;
815        this.$timeout(function(){
816            if(!_this.show) {
817                _this.loadData();
818                _this.show = true;
819            }
820        }, 10);
821    }
822    AutocompleteModel.prototype.focusoutDiv = function($event) {
823        var _this = this;
824        this.$timeout(function(){
825            if(_this.show) {
826                _this.show = false;
827            }                 
828        }, 150);
829    }
830    
831    AutocompleteModel.prototype.setActiveSuccess = function(selector, item) {
832        return;
833    }
834
835    AutocompleteModel.prototype.setActive = function(name, notEmpty, field) {
836        if(!field) {
837            field = 'name';
838        }
839        this.name = name.name;
840
841        var selected = false;
842        for(id in this.items.items) {
843            if(this.name) {
844            if(this.equals(this.items.items[id], name)) {
845                var _this = this;
846                var selector = null;
847                
848
849                //set new value
850                if(_this.sourceName.length == 1) {
851                    selector = _this.sourceName[0];
852                } else {
853                    //delete values
854                    for(sid in _this.sourceName) {
855                        $(this.$scope.$parent.context).find('#'+_this.sourceName[sid]).val('');
856                    }
857                    for(sid in _this.sourceName) {
858                        if(_this.items.items[id].hasOwnProperty('typeId')) {
859                            if(_this.sourceName[sid] == _this.items.items[id].typeId) {
860                                selector = _this.sourceName[sid];
861                            }
862                        }
863                    }
864                }
865                if(selector !== null) {
866                    selected = true;
867                    $(this.$scope.$parent.context).find('#'+selector+'').val(_this.items.items[id].id); // jquery
868                    this.name = this.items.items[id].name;
869                    this.activeItem = this.items.items[id];
870                    this.setActiveSuccess(selector, this.items.items[id]);
871                }     
872            }
873            }
874        }
875        
876        if(!selected) {
877            for(sid in this.sourceName) {
878                $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
879                if(notEmpty !== true) {
880                    this.name = ''; 
881                }
882                this.activeItem = {};
883                
884            }
885        }
886        
887        this.show = false;
888        return selected;
889    }
890
891
892
893 
894    function WrappedAutocompleteModel($http, $scope, $route, $timeout) {
895        this.$scope = $scope;
896        this.$http = $http;
897        this.$route = $route;
898        this.$timeout = $timeout;
899        
900        this.targetName = ""; 
901        this.fields = []; 
902        this.fieldsHide = ['search_name']; 
903        this.sourceName = []; 
904        this.id = null; 
905        this.name = "";
906        this.tabName = ""; // navic oproti autocomplete
907        this.tabNameActive = ""; // navic oproti autocomplete
908        this.template = 'WrappedAutocomplete.html';
909        this.items = [];
910        this.apiUrl = '';
911        this.show = false;
912        this.showComponent = false; // navic oproti autocomplete
913        this.ajaxLoad = true;
914        this.title = "";
915        this.placeholder = "vyberte";
916        this.activeItem = {};
917        this.isActive = false;
918        this.isDataLoaded = false;
919        this.showArrow = true;
920        this.timeout;
921        this.preload = {};
922        this.selectedItemIndex = null;
923
924        jQuery.extend(this.$scope, this); // JQuery magic 
925    } 
926
927    WrappedAutocompleteModel.prototype.open = function(event, target) {
928        
929        var _this = this;
930        var temp = this.show;
931            for( i in _this.$scope.$parent.items) {
932                _this.$scope.$parent.items[i].hideData();
933            }
934                    for( i in _this.$scope.$parent.itemsAdvanced) {
935                        _this.$scope.$parent.itemsAdvanced[i].showComponent = false;
936                        _this.$scope.$parent.itemsAdvanced[i].show = false;
937                        if(!_this.$scope.$parent.itemsAdvanced[i].isActive) {
938                            _this.$scope.$parent.itemsAdvanced[i].name = "";
939                        }
940                    }
941                    for( i in _this.$scope.$parent.itemsSpecial) {
942                        _this.$scope.$parent.itemsSpecial[i].showComponent = false;
943                        _this.$scope.$parent.itemsSpecial[i].show = false;
944                        if(!_this.$scope.$parent.itemsSpecial[i].isActive) {
945                            _this.$scope.$parent.itemsSpecial[i].name = "";
946                        }
947                    }
948                    for( i in _this.$scope.$parent.itemsExpert) {
949                        _this.$scope.$parent.itemsExpert[i].showComponent = false;
950                        _this.$scope.$parent.itemsExpert[i].show = false;
951                        if(!_this.$scope.$parent.itemsExpert[i].isActive) {
952                            _this.$scope.$parent.itemsExpert[i].name = "";
953                        }
954                    }
955            this.showComponent = true;
956            if(temp) {
957                this.show = true;
958            }
959
960            $(window).unbind('click');
961            $(window).click(function (event) {
962                var clickedElement = event.target;
963
964                if (!clickedElement) return;
965                element = $(clickedElement).closest('.component');
966                var clickedOnComponentDrawer = ((element.hasClass(target) &&  element.hasClass('component')) || $('#ui-datepicker-div').css('display') == 'block');
967                
968                if (!clickedOnComponentDrawer) {
969                    for( i in _this.$scope.$parent.items) {
970                        _this.$scope.$parent.items[i].hideData();
971                    }
972                    for( i in _this.$scope.$parent.itemsAdvanced) {
973                        _this.$scope.$parent.itemsAdvanced[i].showComponent = false;
974                        _this.$scope.$parent.itemsAdvanced[i].show = false;
975                        if(!_this.$scope.$parent.itemsAdvanced[i].isActive) {
976                            _this.$scope.$parent.itemsAdvanced[i].name = "";
977                        }
978                    }
979                    for( i in _this.$scope.$parent.itemsSpecial) {
980                        _this.$scope.$parent.itemsSpecial[i].showComponent = false;
981                        _this.$scope.$parent.itemsSpecial[i].show = false;
982                        if(!_this.$scope.$parent.itemsSpecial[i].isActive) {
983                            _this.$scope.$parent.itemsSpecial[i].name = "";
984                        }
985                    }
986                    for( i in _this.$scope.$parent.itemsExpert) {
987                        _this.$scope.$parent.itemsExpert[i].showComponent = false;
988                        _this.$scope.$parent.itemsExpert[i].show = false;
989                        if(!_this.$scope.$parent.itemsExpert[i].isActive) {
990                            _this.$scope.$parent.itemsExpert[i].name = "";
991                        }
992                    }
993
994                    $(window).unbind('click');
995                    _this.$scope.$parent.$apply();
996                    return;
997                }
998            });      
999    }  
1000    
1001    WrappedAutocompleteModel.prototype.populate = function() {
1002        var value = null;
1003        for(sid in this.sourceName) {
1004            if(typeof this.sourceName[sid] === 'function') { continue; } // IE 8 
1005            if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val() != '') {
1006                value = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val();
1007                rel = "";
1008                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel')) {
1009                    rel = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel').split(this.$scope.delimiter);
1010                }
1011                break;
1012            }
1013        }
1014        var temp = {};
1015        if(value) {
1016            for(id in this.fields) {
1017                temp[this.fields[id]] = rel[id];
1018            }
1019            temp['id'] = value;
1020            this.activeItem = temp;
1021            this.name = temp.name;
1022        }
1023    } 
1024    
1025    WrappedAutocompleteModel.prototype.getTabClass = function() {
1026        if(this.isActive || this.showComponent) {
1027            return 'active';
1028        }
1029        
1030        return '';
1031    }
1032    
1033    WrappedAutocompleteModel.prototype.getTitle = function() {
1034        if(this.name) {
1035            
1036            if(this.name.length > 0 && this.activeItem.hasOwnProperty('id')) {
1037                this.isActive = true;
1038
1039                var title = this.activeItem.search_name;
1040                if((typeof title) === 'undefined') {
1041                   title = this.activeItem.name;
1042                }
1043                return this.tabNameActive.replace(new RegExp("{value}"), title);
1044            }
1045        } else {
1046            this.isActive = false;
1047        }
1048
1049        return this.tabName;
1050    }
1051     
1052    
1053    
1054    // stejne jako v autocomplete
1055    WrappedAutocompleteModel.prototype.loadData = function(event) {
1056       AutocompleteModel.prototype.loadData.call(this, event);
1057    };
1058    
1059    WrappedAutocompleteModel.prototype.getFields = function() {
1060        return AutocompleteModel.prototype.getFields.call(this);
1061    };
1062    WrappedAutocompleteModel.prototype.loadOrHideData = function() {
1063        if(this.show) {
1064            this.hideData();
1065        } else {
1066            this.loadData();
1067        }
1068    }
1069    
1070  
1071    WrappedAutocompleteModel.prototype.broadcastComponentEvent = function() {
1072        this.$scope.$parent.$broadcast('updateComponentEvent', this);
1073       
1074    }
1075    WrappedAutocompleteModel.prototype.updateComponent = function($event) {
1076        if((typeof $event) !== 'undefined') {
1077            $event.stopPropagation();
1078        }
1079
1080        if(!this.showComponent && !this.isActive) {
1081            //this.isActive = true;
1082        } else if(this.showComponent && this.isActive) {
1083            //this.isActive = false;
1084        }
1085        this.showComponent = !(this.showComponent);
1086    };
1087    
1088    // stejne jako v autocomplete
1089    WrappedAutocompleteModel.prototype.hideData = function() {
1090        var _this = this;
1091        this.$timeout(function(){
1092            _this.show = false;
1093            if(!_this.isActive) {
1094                _this.name = "";
1095            }
1096        }, 0);
1097        
1098    };
1099    
1100    WrappedAutocompleteModel.prototype.focusDiv = function($event) {
1101        var _this = this;
1102        this.$timeout(function(){
1103            if(!_this.show) {
1104                _this.loadData();
1105                _this.show = true;
1106            }
1107        }, 10);
1108    }
1109    
1110    WrappedAutocompleteModel.prototype.focusoutDiv = function($event) {
1111        var _this = this;
1112        this.$timeout(function(){
1113            if(_this.show) {
1114                _this.show = false;
1115            }
1116        }, 150);
1117    }
1118    
1119    // stejne jako v autocomplete
1120    WrappedAutocompleteModel.prototype.getItemsRegExp = function(name) {
1121        
1122        return new RegExp(".*" + name + ".*", "gi");
1123    }
1124    
1125    // stejne jako v autocomplete
1126    WrappedAutocompleteModel.prototype.getItems = function() {
1127       var re = new RegExp(".*");
1128        if(!this.ajaxLoad) {
1129           re = this.getItemsRegExp(this.$scope.removeDiacritics(this.name)); 
1130        }
1131        var temp = new Array();
1132        var n = {};
1133        for(id in this.items.items) {
1134                var item = this.items.items[id];
1135                var itemWithoutDiacritics = this.$scope.removeDiacritics(item.name);
1136                if(itemWithoutDiacritics.match(re)) {
1137                    
1138                    for(fid in this.fields) {
1139                        var iname = this.fields[fid];
1140                        if(item.hasOwnProperty(iname) && !contains(this.fieldsHide, iname)) {
1141                           n[this.fields[fid]] = item[this.fields[fid]]; // + this.$scope.delimiter;
1142                        }
1143                    }
1144                    n['$$hashKey'] = function() {return JSON.stringify(n)};
1145                    temp.push(n);
1146                    n = {};
1147                }
1148            }
1149            return temp;
1150    }
1151    
1152    // stejne jako v autocomplete
1153    WrappedAutocompleteModel.prototype.size = function(obj) {
1154        return Object.size(obj);
1155    }
1156
1157    WrappedAutocompleteModel.prototype.equals = function(item, name) {
1158        return AutocompleteModel.prototype.equals.call(this, item, name);
1159    }
1160    
1161    WrappedAutocompleteModel.prototype.setActiveSuccess = function(name) {
1162        return AutocompleteModel.prototype.setActiveSuccess.call(this, name);
1163    }
1164
1165    WrappedAutocompleteModel.prototype.setActive = function(name) {
1166        return AutocompleteModel.prototype.setActive.call(this, name);
1167    }
1168    
1169    WrappedAutocompleteModel.prototype.setInactive = function($event) {
1170        if($event) {
1171            $event.stopPropagation();
1172        }
1173    
1174        this.name = "";
1175        for(sid in this.sourceName) {
1176            $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1177        }
1178        
1179        this.isActive = false;
1180        this.showComponent = false;
1181        this.activeItem = {};
1182        
1183        return;
1184    }
1185    
1186    //return WrappedAutocompleteModel;
1187
1188
1189
1190
1191    function WrappedSelectboxModel() {
1192        WrappedAutocompleteModel.apply(this, Array.prototype.slice.call(arguments));
1193        
1194        this.targetName = ""; 
1195        this.fields = []; 
1196        this.fieldsHide = ['search_name']; 
1197        this.sourceName = []; 
1198        this.id = null; 
1199        this.name = "";
1200        this.tabName = "";
1201        this.tabNameActive = "";
1202        this.template = 'WrappedSelectbox.html'; 
1203        this.items = [];
1204        this.apiUrl = '';
1205        this.show = false;
1206        this.showComponent = false;
1207        this.ajaxLoad = false;
1208        this.title = "";
1209        this.placeholder = "vyberte";
1210        this.activeItem = {};
1211        this.isDataLoaded = false;
1212        this.isActive = false;
1213        this.showArrow = true;
1214    } 
1215    
1216    WrappedSelectboxModel.prototype.open = function(event, target) {
1217        WrappedAutocompleteModel.prototype.open.call(this, event, target);
1218    }  
1219    
1220    WrappedSelectboxModel.prototype.populate = function() {
1221        WrappedAutocompleteModel.prototype.populate.call(this);
1222    } 
1223    
1224    WrappedSelectboxModel.prototype.getTitle = function() {
1225        return WrappedAutocompleteModel.prototype.getTitle.call(this);
1226    }
1227    
1228    WrappedSelectboxModel.prototype.getTabClass = function() {
1229        return WrappedAutocompleteModel.prototype.getTabClass.call(this);
1230    }
1231    
1232    WrappedSelectboxModel.prototype.loadItems = function() {
1233        var _this = this;
1234        if(this.ajaxLoad || this.items.length == 0) {      
1235            var url = this.$scope.api + this.apiUrl;
1236            if(this.name) {
1237                if(this.name.length > 0 && this.ajaxLoad) {
1238                   url += '/' + this.name; 
1239                }
1240            }
1241            this.$http.get(url).then(function(response) {
1242                    if(response.status === 200) {
1243                        _this.isDataLoaded = true;
1244                        return _this.items = response.data;
1245                    }
1246            });
1247        }
1248        return true;
1249    };
1250    
1251    WrappedSelectboxModel.prototype.getFields = function() {
1252        return AutocompleteModel.prototype.getFields.call(this);
1253    };
1254  
1255    WrappedSelectboxModel.prototype.loadData = function() {
1256        return WrappedAutocompleteModel.prototype.loadData.call(this);
1257    };
1258    
1259    WrappedSelectboxModel.prototype.broadcastComponentEvent = function() {
1260        return WrappedAutocompleteModel.prototype.broadcastComponentEvent.call(this);
1261    }
1262    WrappedSelectboxModel.prototype.updateComponent = function($event) {
1263        return WrappedAutocompleteModel.prototype.updateComponent.call(this, $event);
1264    };
1265    
1266    WrappedSelectboxModel.prototype.loadOrHideData = function() {
1267        if(this.show) {
1268            this.hideData();
1269        } else {
1270            this.loadData();
1271        }
1272    }
1273    
1274    WrappedSelectboxModel.prototype.focusDiv = function($event) {
1275        return WrappedAutocompleteModel.prototype.focusDiv.call(this, $event);
1276    }
1277    
1278    WrappedSelectboxModel.prototype.focusoutDiv = function($event) {
1279        return WrappedAutocompleteModel.prototype.focusoutDiv.call(this, $event);
1280    }
1281    
1282    WrappedSelectboxModel.prototype.hideData = function() {
1283        return WrappedAutocompleteModel.prototype.hideData.call(this);
1284    }; 
1285    
1286    WrappedSelectboxModel.prototype.getItemsRegExp = function(name) {
1287       return new RegExp(".*", "gi");
1288    }
1289    
1290    WrappedSelectboxModel.prototype.getItems = function() {
1291        return WrappedAutocompleteModel.prototype.getItems.call(this);
1292    }
1293    
1294    WrappedSelectboxModel.prototype.setActiveSuccess = function(selector, item) {
1295        $(this.$scope.$parent.context).find('#'+selector).val(item.id); // jquery
1296    }
1297    
1298    WrappedSelectboxModel.prototype.setActiveError = function(item) {
1299        for(sid in this.sourceName) {
1300            $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1301            this.name = '';
1302        }
1303    }
1304    WrappedSelectboxModel.prototype.setActive = function(name) {
1305        return WrappedAutocompleteModel.prototype.setActive.call(this, name);
1306    }
1307    
1308    WrappedSelectboxModel.prototype.equals = function(item, name) {
1309        return  AutocompleteModel.prototype.equals.call(this, item, name);
1310    }
1311    
1312    WrappedSelectboxModel.prototype.setInactive = function($event) {
1313        return WrappedAutocompleteModel.prototype.setInactive.call(this, $event);
1314    }
1315
1316
1317
1318    function WrappedCheckboxModel($http, $scope, $route, $timeout) {
1319        WrappedAutocompleteModel.apply(this, Array.prototype.slice.call(arguments));
1320        
1321        this.targetName = ""; 
1322        this.fields = []; 
1323        this.sourceName = []; 
1324        this.id = null; 
1325        this.name = "";
1326        this.tabName = ""; 
1327        this.tabNameActive = ""; 
1328        this.template = 'WrappedCheckbox.html';
1329        this.items = [];
1330        this.apiUrl = '';
1331        this.show = false;
1332        this.showComponent = false;
1333        this.ajaxLoad = false;
1334        this.title = "";
1335        this.activeItem = {};
1336        this.checkedList = []; // new
1337        this.isDataLoaded = false;
1338        this.isActive = false;
1339        
1340
1341    } 
1342    WrappedCheckboxModel.prototype.open = function(event, target) {
1343        WrappedAutocompleteModel.prototype.open.call(this, event, target);
1344    }   
1345
1346
1347    WrappedCheckboxModel.prototype.populate = function() {
1348        var value = null;
1349        rel = "";
1350        for(sid in this.sourceName) {
1351            if(typeof this.sourceName[sid] === 'function') { continue; } // IE 8 
1352            if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val() != '') {
1353                value = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val().split(this.$scope.inputDelimiter);
1354                
1355                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel')) {
1356                    rel = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel').split(this.$scope.delimiter);
1357                }
1358                break;
1359            }
1360        }
1361        
1362        var temp = []
1363        if(value) {
1364            for(id in value) {
1365                var relName = "";
1366                if(rel[0] ) {
1367                    relName = rel[id];
1368                }
1369
1370                var obj = {"id": value[id], 'check': true};
1371                if(true) {
1372                    for(fid in this.fields) {
1373                        if(rel[fid].split(this.$scope.inputDelimiter)[id]) {
1374                            obj[this.fields[fid]] = rel[fid].split(this.$scope.inputDelimiter)[id];
1375                        }
1376                    }
1377                }
1378                this.isActive = true;
1379                this.checkedList[value[id]] = true;
1380            }
1381            this.loadData();
1382        }
1383        
1384    } 
1385    
1386    //override
1387    WrappedCheckboxModel.prototype.getTitle = function() {
1388        //;
1389        if(this.checkedList.length > 0) {
1390            //this.isActive = false;
1391            var name = '';
1392            for(id in this.checkedList) {
1393                if(this.checkedList[id]) {
1394                    for(itemId in this.items.items) {
1395                        if(this.items.items[itemId].id == id) {
1396                            name += this.items.items[itemId].search_name + ", ";
1397                        }
1398                    }
1399                }
1400            }
1401            if(name.length > 0) {
1402                
1403                return this.tabNameActive.replace(new RegExp("{value}"), name.replace(new RegExp(", $"), ""));
1404            } 
1405        }
1406        return this.tabName;
1407    }
1408    
1409    
1410    WrappedCheckboxModel.prototype.getTabClass = function() {
1411        return WrappedAutocompleteModel.prototype.getTabClass.call(this);
1412    }
1413    
1414    
1415    // stejne jako v autocomplete
1416    WrappedCheckboxModel.prototype.loadData = function() {
1417        var load = WrappedAutocompleteModel.prototype.loadData.call(this);
1418        this.getTitle();
1419        return load;
1420    };
1421    
1422    
1423    WrappedCheckboxModel.prototype.broadcastComponentEvent = function() {
1424        return WrappedAutocompleteModel.prototype.broadcastComponentEvent.call(this);
1425    }
1426
1427    WrappedCheckboxModel.prototype.updateComponent = function($event) {
1428        if((typeof $event) !== 'undefined') {
1429            $event.stopPropagation();
1430        }
1431        if(!this.showComponent && !this.isActive) {
1432            //this.isActive = true;
1433        } else if(this.showComponent && this.isActive) {
1434            //this.isActive = false;
1435        }
1436        this.showComponent = !(this.showComponent);
1437        if(this.showComponent && !this.isDataLoaded) {
1438            this.loadData();
1439        }
1440    };
1441    
1442    WrappedCheckboxModel.prototype.focusDiv = function($event) {
1443        return WrappedAutocompleteModel.prototype.focusDiv.call(this, $event);
1444    }
1445    
1446    WrappedCheckboxModel.prototype.focusoutDiv = function($event) {
1447        return WrappedAutocompleteModel.prototype.focusoutDiv.call(this, $event);
1448    }
1449    
1450    WrappedCheckboxModel.prototype.hideData = function() {
1451        return WrappedAutocompleteModel.prototype.hideData.call(this);
1452    };
1453    
1454    
1455    // new 
1456    WrappedCheckboxModel.prototype.setActiveCallback = function(checkedList) {
1457        this.isActive = false;
1458        if(checkedList.length > 0) {
1459            var name = '';
1460            for(id in checkedList) {
1461                for(iid in this.items.items) {
1462                    if(this.items.items[iid].id == id) {
1463                        if(checkedList[id]) {
1464                            this.isActive = true;
1465                            name +=this.items.items[iid].id + ",";
1466                        }
1467                    }
1468                }
1469            }
1470            
1471            if(name != '') {
1472                return name.replace(new RegExp(",$"), '');
1473            }
1474        }
1475        return '';
1476    }
1477    
1478    WrappedCheckboxModel.prototype.setActive = function() {
1479        var selector = null;
1480        var selected = false;
1481       
1482        if(this.sourceName.length == 1) {
1483            selector = this.sourceName[0];
1484        } else { 
1485            //delete values
1486            for(sid in this.sourceName) {
1487                $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1488            }
1489            for(sid in this.sourceName) {
1490                        if(this.items.items[iid].hasOwnProperty('typeId')) {
1491                            if(this.sourceName[sid] == this.items.items[id].typeId) {
1492                                selector = this.sourceName[sid];
1493                            }
1494                 }
1495            }
1496        }
1497        
1498        if(selector !== null) {
1499            
1500            $(this.$scope.$parent.context).find('#'+selector).val(this.setActiveCallback(this.checkedList)); // jquery
1501            selected = true;
1502        }   
1503     
1504        if(!selected) {
1505            for(sid in this.sourceName) {
1506                $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1507                this.activeItem = {};
1508            }
1509        }
1510        
1511        return;
1512    }
1513    
1514    WrappedCheckboxModel.prototype.setInactive = function($event) {
1515        if($event) {
1516            $event.stopPropagation();
1517        }
1518        
1519        for(cid in this.checkedList) {
1520            this.checkedList[cid] = false;
1521        }
1522       
1523        for(sid in this.sourceName) {
1524            $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1525        }
1526        
1527        this.isActive = false;
1528        this.showComponent = false;
1529        return;
1530    }
1531
1532
1533
1534
1535var WrappedRangeModel;
1536
1537function WrappedRangeModel() {
1538    WrappedAutocompleteModel.apply(this, Array.prototype.slice.call(arguments));
1539    
1540    this.targetName = ""; 
1541    this.fields = []; 
1542    this.sourceName = []; 
1543    this.id = null; 
1544    this.name = "";
1545    this.tabName = ""; // navic oproti autocomplete
1546    this.tabNameActive = ""; // navic oproti autocomplete
1547    this.template = 'WrappedRange.html';
1548    this.showComponent = false; // navic oproti autocomplete
1549    this.title = "";
1550    this.min = 10;
1551    this.max = 20000;
1552    this.left = 0;
1553    this.right = 0;
1554    this.isActive = false;
1555    
1556} 
1557    
1558
1559WrappedRangeModel.prototype.open = function(event, target) {
1560    WrappedAutocompleteModel.prototype.open.call(this, event, target);
1561}  
1562    
1563    //populate
1564    WrappedRangeModel.prototype.populate = function() {
1565        var value = null;
1566        for(sid in this.sourceName) {
1567            if(typeof this.sourceName[sid] === 'function') { continue; } // IE 8 
1568            if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val() != '') {
1569                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val()) {
1570                    value = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val().split(this.$scope.inputDelimiter);
1571                }
1572                rel = "";
1573                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel')) {
1574                    rel = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel').split(this.$scope.delimiter);
1575                }
1576                break;
1577            }
1578        }
1579        var temp = {};
1580        if(value !== null) {
1581            for(id in this.fields) {
1582                temp[this.fields[id]] = rel[id];
1583            }
1584            temp['id'] = value;
1585        }
1586        this.activeItem = temp;
1587        this.min = this.min;
1588        this.max = this.max;
1589        if(value) {
1590            this.left = value[0];
1591            this.right = value[1];
1592        }
1593    } 
1594    
1595    WrappedRangeModel.prototype.getTitle = function() {
1596
1597        if(this.left > 0 || this.right > 0) {
1598
1599            this.isActive = true;
1600            this.setActive();
1601            return this.tabNameActive.replace(new RegExp("{value1}"), ((this.left) ? this.left: this.min))
1602                                     .replace(new RegExp("{value2}"), ((this.right) ? this.right: this.max));
1603        }
1604
1605        return this.tabName;
1606    }
1607    
1608    WrappedRangeModel.prototype.getTabClass = function() {
1609       return WrappedAutocompleteModel.prototype.getTabClass.call(this);
1610    }
1611    
1612    WrappedRangeModel.prototype.broadcastComponentEvent = function() {
1613        return WrappedAutocompleteModel.prototype.broadcastComponentEvent.call(this);
1614    }
1615   
1616    WrappedRangeModel.prototype.updateComponent = function($event) {
1617        return WrappedAutocompleteModel.prototype.updateComponent.call(this, $event);
1618    };
1619    
1620    WrappedSelectboxModel.prototype.focusDiv = function($event) {
1621        return WrappedAutocompleteModel.prototype.focusDiv.call(this, $event);
1622    }
1623    
1624    WrappedSelectboxModel.prototype.focusoutDiv = function($event) {
1625        return WrappedAutocompleteModel.prototype.focusoutDiv.call(this, $event);
1626    }
1627    
1628    // stejne jako v autocomplete
1629    WrappedRangeModel.prototype.hideData = function() {
1630        return WrappedAutocompleteModel.prototype.hideData.call(this);
1631    };
1632    
1633    // stejne jako v autocomplete
1634    WrappedRangeModel.prototype.getItemsRegExp = function(name) {
1635        return new RegExp(".*" + name + ".*", "gi");
1636    }
1637    
1638    WrappedRangeModel.prototype.getLeft = function() {
1639        return ((this.left) ? this.left : this.min);
1640    }  
1641    
1642    WrappedRangeModel.prototype.getRight = function() {
1643        return ((this.right) ? this.right : this.max);
1644    }    
1645    
1646    // stejne jako v autocomplete
1647    WrappedRangeModel.prototype.setActive = function(name) {
1648        var selector = null;
1649        var selected = false;
1650       
1651        if(this.sourceName.length == 1) {
1652            selector = this.sourceName[0];
1653        } else { 
1654            //delete values
1655            for(sid in this.sourceName) {
1656                $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1657            }
1658            for(sid in this.sourceName) {
1659                if(this.items.items[id].hasOwnProperty('typeId')) {
1660                    if(this.sourceName[sid] == this.items.items[id].typeId) {
1661                        selector = this.sourceName[sid];
1662                    }
1663                 }
1664            }
1665        }
1666        if(selector !== null) {
1667            $(this.$scope.$parent.context).find('#'+selector).val(this.getLeft() + this.$scope.inputDelimiter + this.getRight()); // jquery
1668            selected = true;
1669        }   
1670     
1671        if(!selected) {
1672            for(sid in this.sourceName) {
1673                $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1674            }
1675        }
1676        
1677        return;
1678    }
1679    
1680    WrappedRangeModel.prototype.setInactive = function($event) {
1681        this.left = 0;
1682        this.right = 0;
1683        $event.stopPropagation();
1684        for(sid in this.sourceName) {
1685            $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val(''); // fuj
1686        }
1687        
1688        this.isActive = false;
1689        this.showComponent = false;
1690        this.activeItem = {};
1691        return;
1692    }
1693
1694
1695
1696
1697var WrappedClickModel;
1698
1699WrappedClickModel = (function(){
1700    WrappedClickModel.prototype.targetName = ""; 
1701    WrappedClickModel.prototype.fields = []; 
1702    WrappedClickModel.prototype.sourceName = []; 
1703    WrappedClickModel.prototype.id = null; 
1704    WrappedClickModel.prototype.name = "";
1705    WrappedClickModel.prototype.tabName = ""; // navic oproti autocomplete
1706    WrappedClickModel.prototype.tabNameActive = ""; // navic oproti autocomplete
1707    WrappedClickModel.prototype.template = 'WrappedClick.html';
1708    WrappedClickModel.prototype.showComponent = false; // navic oproti autocomplete
1709    WrappedClickModel.prototype.title = "";
1710    WrappedSelectboxModel.prototype.isActive = false;
1711    
1712  
1713    function WrappedClickModel($http, $scope, $route, $timeout) {
1714        this.$scope = $scope;
1715        this.$http = $http;
1716        this.$route = $route;
1717        this.$timeout = $timeout;
1718
1719        jQuery.extend(this.$scope, this); // JQuery magic 
1720    } 
1721    
1722    //populate
1723    WrappedClickModel.prototype.populate = function() {
1724        var value = null;
1725        for(sid in this.sourceName) {
1726            if(typeof this.sourceName[sid] === 'function') { continue; } // IE 8 
1727            if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val() != '') {
1728                value = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val();
1729                rel = "";
1730                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel')) {
1731                    rel = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel').split(this.$scope.delimiter);
1732                }
1733                break;
1734            }
1735        }
1736        
1737        var temp = {};
1738        if(value !== null) {
1739           this.setActive();
1740        }
1741    } 
1742    
1743    WrappedClickModel.prototype.getTitle = function() {
1744        if(this.isActive) {
1745            this.isActive = true;
1746            return this.tabNameActive;
1747        }
1748        return this.tabName;
1749    }
1750    
1751    WrappedClickModel.prototype.getTabClass = function() {
1752        if(this.isActive) {
1753            return 'active';
1754        }
1755        
1756        return '';
1757    }
1758    WrappedClickModel.prototype.hideData = function() {
1759    
1760    }
1761    WrappedClickModel.prototype.broadcastComponentEvent = function() {
1762        this.$scope.$parent.$broadcast('updateComponentEvent', this);
1763    }
1764    WrappedClickModel.prototype.updateComponent = function() {   
1765        if(this.isActive) {
1766            this.setInactive();
1767            return;
1768        }
1769        
1770        this.setActive();
1771        return;
1772    }
1773    
1774    // stejne jako v autocomplete
1775    WrappedClickModel.prototype.setActive = function() {
1776        var selector = null;
1777        var selected = false;
1778       
1779        if(this.sourceName.length == 1) {
1780            selector = this.sourceName[0];
1781        } else { 
1782            //delete values
1783            for(sid in this.sourceName) {
1784                $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1785            }
1786            for(sid in this.sourceName) {
1787                if(this.items.items[id].hasOwnProperty('typeId')) {
1788                    if(this.sourceName[sid] == this.items.items[id].typeId) {
1789                        selector = this.sourceName[sid];
1790                    }
1791                 }
1792            }
1793        }
1794        
1795        if(selector !== null) {
1796            this.isActive = true;
1797            this.setActiveSuccess(selector);  
1798
1799            return;
1800        }  
1801        this.isActive = false; 
1802        this.setActiveError();
1803        return;
1804    }
1805    
1806    WrappedClickModel.prototype.setActiveSuccess = function(selector) {
1807        $(this.$scope.$parent.context).find('#'+selector).val(1); // jquery
1808    }
1809    
1810    WrappedClickModel.prototype.setActiveError = function() {
1811        for(sid in this.sourceName) {
1812            $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val('');
1813            this.name = '';
1814        }
1815    }
1816    
1817    WrappedClickModel.prototype.setInactive = function($event) {
1818        $event.stopPropagation();
1819        for(sid in this.sourceName) {
1820            $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val(''); // fuj
1821        }
1822        this.isActive = false;
1823        
1824        return;
1825    }
1826    
1827    return WrappedClickModel;
1828})();
1829
1830
1831
1832var SearchController;
1833SearchController = (function() {
1834  SearchController.prototype.items = [];
1835  SearchController.prototype.itemsAdvanced = [];
1836  SearchController.prototype.itemsExpert= [];
1837  SearchController.prototype.itemsSpecial = [];
1838  SearchController.prototype.itemsEquipment = [];
1839  SearchController.prototype.isDataLoaded = false;
1840  SearchController.prototype.showAdvanced = true;
1841  SearchController.prototype.showExpert = false;
1842  SearchController.prototype.showSpecial = false;
1843  SearchController.prototype.context = "#jazykovky-search";
1844  SearchController.prototype.type = 1; // 1 - normal form, 2 - skola a pobocka form, 3 - hromadna poptavka form
1845  
1846  SearchController.prototype.setContext = function(context) {
1847    this.context = context;
1848  }
1849  
1850  SearchController.prototype.setType = function(type) {
1851    this.type = type;
1852  }
1853  
1854  SearchController.prototype.showAdvancedFunc = function() {
1855    this.showAdvanced = (!this.showAdvanced);
1856    if(!this.showAdvanced) {
1857        this.showExpert = false;
1858        this.showSpecial = false;
1859    } else {
1860        this.openTabs();
1861    }
1862    
1863    return;
1864  }
1865  
1866  SearchController.prototype.getActive = function(value) {
1867    if(value) {
1868        return 'active';
1869    }
1870    return '';
1871  }
1872  
1873  SearchController.prototype.showSpecialFunc = function() {
1874    if(this.showExpert) {
1875        this.openTabs();
1876    }
1877    this.showSpecial = !this.showSpecial;   
1878    return;
1879  }
1880  
1881  SearchController.prototype.showExpertFunc = function() {
1882    this.showExpert = !this.showExpert;
1883    if(!this.showExpert) {
1884        this.showSpecial = false;
1885    } else {
1886        this.openTabs();
1887    }
1888    return;
1889  }
1890  
1891  SearchController.prototype.updateComponentHandler = function() {
1892    for(id in this.itemsAdvanced) {
1893        this.itemsAdvanced[id].showComponent = false;
1894    }
1895  }
1896  
1897  SearchController.prototype.loadEquipment = function() {   
1898            var url = this.$scope.api + "vybaveni";
1899            if(this.type == 2) {
1900                url = url + '?skola_id='+skola_id;
1901            }
1902            var _this = this;
1903            if(!this.isDataLoaded) {
1904                this.$http.get(url).then(function(response) {
1905                    if(response.status === 200) {
1906                        var equipment = response.data;
1907                        var boolItems = { "items":[
1908                            {
1909                                "id": '',
1910                                "name": "ne",
1911                                "search_name": "ne"
1912                            },
1913                             {
1914                                "id": 1,
1915                                "name": "ano",
1916                                "search_name": "ano"
1917                            }
1918                        ],
1919                         "description": {"content": null, "position": "top"}
1920                        }
1921                        
1922                        for(id in equipment.items) {
1923                            model = new WrappedClickModel(_this.$http, _this.$scope.$new(), _this.$route, _this.$timeout);
1924                            model.targetName = "equipment"+id;
1925                            model.fields = ["name", "search_name"];
1926                            model.sourceName = ['spe'];
1927                            model.placeholder = equipment.items[id].name;
1928                            model.tabName = equipment.items[id].search_name;
1929                            model.tabNameActive = equipment.items[id].search_name;
1930                            model.isDataLoaded = true; // fake api call
1931                            model.items = boolItems;
1932                            //override
1933                            model.setActiveSuccess = function() {
1934                                _this.mapEquipment();
1935                            }
1936                            
1937                            model.setActiveError = function() {
1938                                return _this.mapEquipment();
1939                            }
1940                            
1941                            _this.itemsEquipment.push(model);
1942                            model.id = (_this.itemsEquipment.length - 1);                           
1943                        }
1944                        _this.populateEquipment();
1945                        _this.isDataLoaded = true;
1946                        _this.$scope.openTabs();
1947                    }
1948                    
1949                    
1950                    _this.$scope.$$phase || _this.$scope.$apply();
1951                    
1952                    
1953                    return equipment;
1954            });
1955            
1956            }
1957        return {};
1958  }
1959  
1960  SearchController.prototype.populateEquipment = function() {
1961    var selector = "spe";
1962    if($(this.scope.context).closest('.search_block').find('#'+selector).val()) {
1963        var values = $(this.scope.context).closest('.search_block').find('#'+selector).val().split(this.$scope.inputDelimiter);         
1964        for(id in values) {          
1965            if(values[id]) {
1966                if(this.itemsEquipment[id]) {
1967                    this.itemsEquipment[id].isActive = true;
1968                    this.$scope.showAdvanced = true;
1969                    this.$scope.showExpert = true;
1970                    this.$scope.showSpecial = true;
1971                }
1972            }
1973        }
1974    }
1975    //this.openTabs();
1976  }
1977  
1978  SearchController.prototype.openTabs = function() {
1979    var _this = this;
1980            for(id in _this.itemsAdvanced) {
1981                if(_this.itemsAdvanced[id].isActive == true) {
1982                    _this.showAdvanced = true;
1983                     break;
1984                }
1985            }
1986            for(id in _this.itemsExpert) {
1987                if(_this.itemsExpert[id].isActive == true) {
1988                    _this.showAdvanced = true;
1989                    _this.showExpert = true;
1990                     break;
1991                }
1992            }
1993            for(id in _this.itemsSpecial) {
1994                if(_this.itemsSpecial[id].isActive == true) {
1995                    _this.showAdvanced = true;
1996                    _this.showExpert = true;
1997                   _this.showSpecial = true;
1998                   break;
1999                }
2000            }
2001  }
2002  
2003  SearchController.prototype.mapEquipment = function() {
2004    var value = "";
2005    var isEmpty = true;
2006    for(id in this.itemsEquipment) {
2007        var item = this.itemsEquipment[id];
2008        var itemId = '';
2009        
2010        if(item) {
2011            
2012                if(item.isActive) {
2013                    isEmpty = false;
2014                    itemId = 1;
2015                }
2016        }
2017
2018        value += itemId + this.$scope.inputDelimiter;
2019    }
2020
2021    var selector = "spe";
2022    if(!isEmpty) {
2023        $(this.scope.context).closest('.search_block').find('#'+selector).val(value.replace(new RegExp(this.$scope.inputDelimiter + "$"), ""));
2024        return;
2025    }
2026    
2027    $(this.scope.context).closest('.search_block').find('#'+selector).val("");    
2028    return;
2029  }
2030  
2031  SearchController.prototype.validItems = function(show) {
2032        var _this = this;
2033        var valid = true;
2034        // main items
2035        if(show) {
2036            for(id in _this.items) {
2037                _this.items[id].error = false;
2038            }
2039        }
2040        for(id in _this.items) {
2041            if(_this.items[id].name == "") {
2042                if(show) {
2043                    _this.items[id].error = true;
2044                }
2045                valid = false
2046            }
2047        }
2048        return valid;
2049  }
2050  
2051  SearchController.prototype.validOtherItems = function(show) {
2052        var valid = true;
2053        // email
2054        if(show) {
2055            angular.element($('#demand-email').closest('.component')).removeClass('error');
2056        }
2057        var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
2058        if(!re.test(this.demandService.email)) {
2059            valid = false;
2060            if(show) {
2061                angular.element($('#demand-email').closest('.component')).addClass('error');
2062            }
2063        }
2064        return valid;
2065  }
2066  
2067  SearchController.prototype.submitForm = function(type, $event) {
2068    this.$timeout(function() {
2069        if (typeof fbq !== "undefined") {
2070            fbq('track', 'Search', {content_category: type} );
2071        }
2072        $($event.target).closest('.search_block').find('form.search:first input#typhledani').val(type);
2073        $($event.target).closest('.search_block').find('form.search:first').submit();
2074    }, 1000);
2075    
2076    return false;
2077  }
2078  
2079  SearchController.prototype.submitDemandForm = function($event) {
2080    var form = $($event.target).closest('.search_block').find('form.search:first');
2081    this.demandService.params = form.serialize();
2082    this.validOtherItems(true);
2083    this.validItems(true);
2084    if(this.validOtherItems(true) && this.validItems(true)) {
2085        this.demandService.show = 2;
2086    }
2087    
2088    this.$broadcast('submitDemand');
2089    
2090    return false;
2091  }
2092  
2093  SearchController.prototype.submitSchoolForm = function($event, $scope) {
2094    
2095    var form = $($event.target).closest(this.context).find('form.search:first');
2096    var params = form.serialize();
2097    var _this = this;
2098    var $psearch = $('.parametric-search');
2099    var $course = $('.skola-detail-other-course:first');
2100    var $lektor = $('.lektor-ajax-container:first');//.parent();
2101    var $ucebnice = $('.ucebnice-ajax-container:first');//.parent();
2102    
2103    //this.$scope = $scope;
2104    var url_str = "&skola_id="+skola_id;
2105    if(pobocka_id !== null) {
2106        url_str += "&pobocka_id="+pobocka_id; 
2107    }
2108    
2109    $.ajax({
2110            url: "search/getform?format=html" + url_str,
2111            data: params,
2112            context: document.body
2113        }).done(function(data) {
2114            $psearch.html('');
2115            $psearch.html(data);
2116            angular.bootstrap($psearch, ['jazykovky']);
2117            var temp = "";
2118            window.location.hash = params;
2119        });
2120    $.ajax({
2121            
2122            url: "search/gethtml?format=json" + url_str,
2123            data: params,
2124            context: document.body
2125        }).done(function(data) {
2126            data = JSON.parse(data);
2127            $course.find('.kurz-list-head').html(data.header);
2128            $course.find('.kurz-list').html('asd');
2129            $course.find('.kurz-list').html(data.kurzy);
2130            //$lektor.prev().html('');
2131            //$lektor.next().html('');
2132            $lektor.html(data.lektori);
2133            //$ucebnice.prev().html('');
2134            //$ucebnice.next().html('');
2135            $ucebnice.html(data.ucebnice);
2136
2137            var value = getCookie('table_colls');
2138            if(value.length > 1) {
2139                var $hidden_select = $('select.other-colls');
2140                $hidden_select.each(function() {
2141                    $(this).closest('table').find('td.hidden-cols').hide();
2142                    $(this).closest('table').find('td.hidden-cols.'+value).show();
2143                    $(this).val(value);
2144                });
2145            }
2146        });
2147    return false;
2148  }
2149  
2150  // constructor
2151  function SearchController($http, $scope, $window, $route, $timeout, demandService, $location) {
2152  
2153    this.scope = $scope;
2154    this.$scope = $scope;
2155    this.$http = $http;
2156    this.$route = $route;
2157    this.$window = $window;
2158    this.$timeout = $timeout;
2159    this.demandService = demandService.searchParams;
2160    this.$location = $location;
2161
2162    var _this = this;
2163    // IE 10 bug fix - 10 digest iteration - locationProvider error
2164    var old = "";
2165    var counter = 0;
2166    this.$scope.$on('$locationChangeStart', function (event, newLoc, oldLoc){
2167        if(newLoc == old && counter > 2) {
2168            event.preventDefault();
2169            counter = 0;
2170        }
2171        if(old == newLoc) {
2172            old = newLoc;
2173        } else {
2174            old = oldLoc;
2175        }
2176        counter = counter+1;
2177    });
2178
2179    
2180    this.scope.$watch(function() {
2181        if(_this.validItems(false)) {
2182            var form = $(_this.scope.context).closest('.search_block').find('form.search:first');
2183            form = form.serialize();
2184            /*jsonp123 = function(param) { // @TODO: delete when poptavka api ready
2185                return _this.demandService.count = param.count;
2186            }*/
2187
2188            if(_this.demandService.params != form) {
2189                _this.demandService.params = form;    
2190                var url = _this.$scope.demandApi + "get-count?" + form;
2191                _this.$http.get(url).then(function(response) { // @TODO: change to normal ajax call - now jsonp 
2192                        if(response.status === 200) {
2193                            return _this.demandService.count = response.data.count;
2194                        }
2195                });
2196            } 
2197        } else {
2198            _this.demandService.count = null;
2199            _this.demandService.params = "";
2200        }    
2201     });
2202    
2203        
2204        jQuery.extend($scope, this); // JQuery magic 
2205        this.itemsAdvanced = [];
2206        this.itemsExpert = [];
2207        this.itemsSpecial = [];
2208        this.itemsEquipment = [];
2209        this.items = [];
2210        this.load();
2211    }
2212    
2213    SearchController.prototype.load = function() {
2214    
2215    var _this = this;
2216        $(document).find('.controller').css('display', 'block');
2217        //listening for update component
2218        if(this.$scope) {
2219        this.$scope.$on('updateComponentEvent', function(event,item) {
2220            for(id in _this.itemsAdvanced) {
2221                if(item.id != _this.itemsAdvanced[id].id && _this.itemsAdvanced[id].showComponent == true && _this.itemsAdvanced[id].isActive == true) {
2222                    _this.itemsAdvanced[id].updateComponent();
2223                }
2224            }
2225            for(id in _this.itemsExpert) {
2226                if(item.id != _this.itemsExpert[id].id && _this.itemsExpert[id].showComponent == true && _this.itemsExpert[id].isActive == true) {
2227                    _this.itemsExpert[id].updateComponent();
2228                }
2229            }
2230            for(id in _this.itemsSpecial) {
2231                if(item.id != _this.itemsSpecial[id].id && _this.itemsSpecial[id].showComponent == true && _this.itemsSpecial[id].isActive == true) {
2232                    _this.itemsSpecial[id].updateComponent();
2233                }
2234            }
2235        });
2236        }
2237        
2238        var $http = this.$http;
2239        var $scope = this.$scope;
2240        var $route = this.$route;
2241        var $window = this.$window;
2242        var $timeout = this.$timeout;
2243        
2244        
2245        //Hlavni nabidka
2246        if(this.type == 2) {
2247        function loadDataSelect() {
2248            this.show = true;
2249            var _this = this;
2250            if(this.ajaxLoad || this.items.length == 0) {      
2251                var url = this.$scope.api + this.apiUrl;
2252                if(this.name) {
2253                     var temp = url.split('\?');
2254                    if(this.name.length > 0 && this.ajaxLoad) {
2255                       url = temp[0] + '/' + ((temp[1]) ? '?' + temp[1] : ''); 
2256                    }
2257                }
2258                this.$http.get(url).then(function(response) {
2259                        if(response.status === 200) {
2260                            _this.isDataLoaded = true;
2261                            return _this.items = response.data;
2262                        }
2263                });
2264            }
2265            return true;
2266        };
2267        
2268        model = new AutocompleteModel($http, $scope.$new(), $route, $timeout);
2269        model.template = "SelectboxSchool.html";
2270        model.targetName = "jazykove-skoly";
2271        model.fields = ["name", "search_name", "address", "place"];
2272        model.sourceName = ['sko'];
2273        model.reset = "resetovat pobočku";
2274        model.apiUrl = 'jazykove-skoly?skola_id='+skola_id;
2275        model.loadData = function() {
2276            loadDataSelect.call(this);
2277        }
2278        model.placeholder = "město, kraj, část";
2279        model.title = "Místo výuky / pobočka";
2280        model.showArrow = false;
2281        this.items.push(model);
2282        model.id = (this.items.length - 1);
2283        model.populate();
2284        
2285        //Jazyky
2286        model = new AutocompleteModel($http, $scope.$new(), $route, $timeout);
2287        model.targetName = "jazyky";
2288        model.template = "SelectboxLang.html";
2289        model.fields = ["priority", "name", "langabbr", "langimg", "langimgexist", "search_name"];
2290        model.fieldsHide = ["search_name", "priority"];
2291        model.sourceName = ['jaz'];
2292        model.reset = "resetovat jazyk";
2293        model.apiUrl = 'jazyky?skola_id='+skola_id;
2294        model.loadData = function() {
2295            loadDataSelect.call(this);
2296        }
2297        model.placeholder = "vyberte jazyk výuky";
2298        model.title = "Jazyk";
2299        model.showArrow = false;
2300        this.items.push(model);
2301        model.id = (this.items.length - 1);
2302        model.populate();
2303        
2304        
2305        //Druh kurzu
2306        model = new AutocompleteModel($http, $scope.$new(), $route, $timeout);
2307        model.targetName = "druh-kurzu";
2308        model.template = "Selectbox.html";
2309        model.fields = ["name", "search_name"];
2310        model.sourceName = ['typ'];
2311        model.apiUrl = 'druh-kurzu?skola_id='+skola_id;
2312        model.loadData = function() {
2313            loadDataSelect.call(this);
2314        }
2315        model.placeholder = "např: individuální, firemní...";
2316        model.title = "Druh kurzu";
2317        model.reset = "resetovat druh kurzu";
2318        this.items.push(model);
2319        model.id = (this.items.length - 1);
2320        model.populate();
2321        
2322        } else {
2323        // Mista kurzu
2324        
2325        model = new AutocompleteModel($http, $scope.$new(), $route, $timeout);
2326        
2327        model.targetName = "mista-kurzu";
2328        model.fields = ["name", "search_name", "type"];
2329        
2330        model.sourceName = ['gkr', 'gok', 'gob', 'gmc'];
2331        
2332        if(this.type == 3 ) {
2333            model.apiUrl = 'mesta-studia';
2334            model.preload = mestaStudia;
2335        } else {
2336            model.apiUrl = 'mista-studia';
2337            model.preload = mistaStudia;
2338        }
2339       
2340        model.placeholder = "napište město, kraj, část";
2341         
2342        model.title = "Místo studia";
2343        model.showArrow = false;
2344        
2345        
2346        //model.ajaxLoad = false; // remove 
2347        this.items.push(model);
2348        
2349        model.id = (this.items.length - 1);
2350        
2351        model.populate();
2352        
2353        //Jazyky
2354        model = new AutocompleteModel($http, $scope.$new(), $route, $timeout);
2355        model.targetName = "jazyky";
2356        model.template = "AutocompleteLang.html";
2357        model.fields = ["priority", "name", "langabbr", "langimg", "langimgexist", "search_name"];
2358        model.fieldsHide = ["search_name", "priority"];
2359        model.sourceName = ['jaz'];
2360        model.apiUrl = 'jazyky';
2361        model.preload = jazyky;
2362        
2363        model.placeholder = "napište studovaný jazyk";
2364        model.title = "Jazyk";
2365        model.showArrow = false;
2366        this.items.push(model);
2367        model.id = (this.items.length - 1);
2368        model.populate();
2369        
2370        //Druh kurzu
2371        model = new AutocompleteModel($http, $scope.$new(), $route, $timeout);
2372        model.targetName = "druh-kurzu";
2373        model.fields = ["name", "search_name"];
2374        model.sourceName = ['typ'];
2375        model.apiUrl = 'druh-kurzu';
2376        model.placeholder = "napište veřejnost, firemní...";
2377        if(this.type == 3) {
2378            model.title = "Napište, jaký kurz hledáte";
2379        } else {
2380            model.title = "Druh kurzu";
2381        }
2382        model.preload = druhKurzu;
2383        model.showArrow = false;
2384        this.items.push(model);
2385        model.id = (this.items.length - 1);
2386        model.populate();
2387        
2388        }
2389        
2390        /******************
2391         *    ADVANCED    *
2392         *****************/
2393
2394        // Pokrocilost
2395        model = new WrappedSelectboxModel($http, $scope.$new(), $route, $timeout);
2396        model.targetName = "pokrocilost-kurzu";
2397        model.fields = ["name", "search_name"];
2398        model.sourceName = ['pok'];
2399        model.apiUrl = 'pokrocilost-kurzu';
2400        if(this.type == 2) {
2401            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2402        }
2403        model.placeholder = "Vyberte pokročilost kurzu ...";
2404        model.tabName = "konkrétní pokročilosti";
2405        model.tabNameActive = "{value}";
2406        model.title = "Zvolte přesnou nebo přibližnou pokročilost kurzu.";
2407        this.itemsAdvanced.push(model);
2408        model.id = (this.itemsAdvanced.length - 1);
2409        model.populate();
2410
2411        // delka kurzu
2412        model = new WrappedSelectboxModel($http, $scope.$new(), $route, $timeout);
2413
2414        model.targetName = "delky-kurzu";
2415        model.fields = ["name", "search_name", "description"];
2416        model.sourceName = ['dlk'];
2417        model.apiUrl = 'delky-kurzu';
2418        if(this.type == 2) {
2419            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2420        }
2421        model.placeholder = "Vyberte délku kurzu ...";
2422        model.tabName = "s délkou kurzu";
2423        model.tabNameActive = "trvající {value}";
2424        model.title = "Jak dlouhý kurz chcete?";
2425        model.template = 'WrappedSelectboxLength.html';
2426        this.itemsAdvanced.push(model);
2427        model.id = (this.itemsAdvanced.length - 1);
2428        model.populate();
2429
2430        // Intenzita
2431        model = new WrappedSelectboxModel($http, $scope.$new(), $route, $timeout);
2432        model.targetName = "intenzity-vyuky";
2433        model.fields = ["name", "search_name"];
2434        model.sourceName = ['itz'];
2435        model.apiUrl = 'intenzity-vyuky';
2436        if(this.type == 2) {
2437            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2438        }
2439        model.placeholder = "Vyberte intenzitu výuky ...";
2440        model.tabName = "s konkrétní intenzitou výuky";
2441        model.tabNameActive = "{value}";
2442        model.title = "Kolik hodin týdně můžete kurzu věnovat?";
2443        this.itemsAdvanced.push(model);
2444        model.id = (this.itemsAdvanced.length - 1);
2445        model.populate();
2446
2447        // dny vyuky
2448        model = new WrappedCheckboxModel($http, $scope.$new(), $route, $timeout);
2449        model.targetName = "dny-vyuky";
2450        model.fields = ["name", "search_name"];
2451        model.sourceName = ['dny'];
2452        model.apiUrl = 'dny-vyuky';
2453        if(this.type == 2) {
2454            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2455        }
2456        model.placeholder = "Dny výuky";
2457        model.tabName = "v určitých dnech";
2458        model.tabNameActive = "ve dnech {value}";
2459        model.title = "Zatrhněte dny, kdy můžete navštěvovat výuku.";
2460        model.isDataLoaded = true; // fake api call
2461        // override  
2462        model.populate = function() {            
2463            var value = null;
2464            for(sid in this.sourceName) {
2465                if(typeof this.sourceName[sid] === 'function') { continue; } // IE 8 
2466                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val() != '') {
2467                    value = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val().split(""); 
2468                    break;
2469                }
2470            }
2471            var temp = [];
2472            if(value) {
2473                for(id in value) {
2474                    if(value[id] === '1') {
2475                        var obj = {"id": (value.length - id - 1), 'check': true};
2476                        this.checkedList[obj.id] = true;
2477                        this.isActive = true;
2478                    }
2479                }
2480                this.$scope.$$phase || this.$scope.$digest();                
2481                this.getTitle();
2482            }
2483        } 
2484        
2485        // override - returns binary value 
2486        model.setActiveCallback = function(checkedList) {
2487            this.isActive = false;
2488            if(checkedList.length > 0) {
2489                var name = '';
2490                for(id in [0,1,2,3,4,5,6]) {
2491                    if(checkedList[id]) {
2492                        this.isActive = true;
2493                        name = '1'+name;
2494                    } else {
2495                        name = '0'+name;
2496                    }
2497                }
2498                if(name != '' && this.isActive) {
2499                    return name;
2500                }
2501            }
2502            return '';
2503        }
2504        // fake api return
2505        model.items = { "items":
2506                        [
2507                            {
2508                                "id": 0,
2509                                "name": "pondělí",
2510                                "search_name": "Po"
2511                            },
2512                            {
2513                                "id": 1,
2514                                "name": "úterý",
2515                                "search_name": "Út"
2516                            },
2517                            {
2518                                "id": 2,
2519                                "name": "středa",
2520                                "search_name": "St"
2521                            },
2522                            {
2523                                "id": 3,
2524                                "name": "čtvrtek",
2525                                "search_name": "Čt"
2526                            },
2527                            {
2528                                "id": 4,
2529                                "name": "pátek",
2530                                "search_name": "Pá"
2531                            },
2532                            {
2533                                "id": 5,
2534                                "name": "sobota",
2535                                "search_name": "So"
2536                            },
2537                            {
2538                                "id": 6,
2539                                "name": "neděle",
2540                                "search_name": "Ne"
2541                            }
2542                        ],
2543                    "description": {"content": null, "position": "top"}
2544                 }
2545
2546        this.itemsAdvanced.push(model);
2547        model.id = (this.itemsAdvanced.length - 1);
2548        model.populate();
2549        
2550        //casy konani
2551        model = new WrappedCheckboxModel($http, $scope.$new(), $route, $timeout);
2552        model.targetName = "casy-konani";
2553        model.fields = ["name", "search_name"];
2554        model.sourceName = ['cas'];
2555        model.apiUrl = 'casy-konani';
2556        if(this.type == 2) {
2557            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2558        }
2559        model.placeholder = "Čas konání";
2560        model.tabName = "v určitých hodinách";
2561        model.tabNameActive = "{value}";
2562        model.title = "Kterou část dne má kurz probíhat?";
2563        this.itemsAdvanced.push(model);
2564        model.id = (this.itemsAdvanced.length - 1);
2565        model.populate();
2566        
2567        // Jazykove zkousky
2568        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2569        model.targetName = "jazykove-zkousky";
2570        model.fields = ["name", "search_name", "abbr"];
2571        model.sourceName = ['jzk'];
2572        model.apiUrl = 'jazykove-zkousky';
2573        if(this.type == 2) {
2574            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2575        }
2576        model.placeholder = "Napište zkratku nebo jméno zkoušky ...";
2577        model.tabName = "příprava na jaz. zkoušku";
2578        model.tabNameActive = "připravuje na: {value}";
2579        model.title = "Napište nebo vyberte jazykovou zkoušku, na kterou se chcete připravit";
2580        this.itemsAdvanced.push(model);
2581        model.id = (this.itemsAdvanced.length - 1);
2582        model.populate();
2583        
2584        /****************
2585         *    EXPERT    *
2586         ***************/
2587        // termin zahajeni kurzu
2588        model = new WrappedSelectboxModel($http, $scope.$new(), $route, $timeout);
2589        model.targetName = "terminy-zahajeni";
2590        model.fields = ["name", "search_name"];
2591        model.sourceName = ['trm'];
2592        model.apiUrl = 'terminy-zahajeni';
2593        if(this.type == 2) {
2594            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2595        }
2596        model.placeholder = "Vyberte termín kurzu ...";
2597        model.minDate = 0;
2598        model.maxDate = 0;
2599        model.$scope.minDate = model.minDate;
2600        model.$scope.maxDate = model.maxDate;
2601        model.tabName = "termín zahájení";
2602        model.tabNameActive = "zahájení: {value}";
2603        model.title = "Vyberte kdy má být kurz zahájen.";
2604        model.template = 'WrappedSelectboxDate.html'; 
2605        model.setActiveSuccess = function(selector, item) {
2606            var minDate = ""+this.minDate;
2607            if(this.minDate) {
2608                minDate = minDate.split('.');
2609                minDate = minDate[2] + '-' + minDate[1] + '-' + minDate[0];
2610            }
2611            
2612            var maxDate = ""+this.maxDate;
2613            if(this.maxDate) {
2614                maxDate = maxDate.split('.');
2615                maxDate = maxDate[2] + '-' + maxDate[1] + '-' + maxDate[0];
2616            }
2617            var ldate = new Date(minDate);
2618            var rdate = new Date(maxDate);
2619            if(+ldate > +rdate) {
2620                var temp = minDate;
2621                minDate = maxDate;
2622                maxDate = temp;
2623                temp = this.minDate;
2624                this.minDate = this.maxDate;
2625                this.maxDate = temp;
2626            }
2627            if((minDate == 0 || maxDate == 0) && this.showComponent == false && item.id == 1) {
2628                $(this.$scope.$parent.context).find('#'+selector).val("");
2629                this.isActive = false;
2630                this.showComponent = false;
2631                this.activeItem = {};
2632                this.minDate = 0;
2633                this.maxDate = 0;
2634                this.name = "";
2635                this.getTitle();
2636                return;
2637            }
2638
2639            if(item.id == 1) {
2640                if(minDate && maxDate) {
2641                    $(this.$scope.$parent.context).find('#'+selector).val(item.id + this.$scope.inputDelimiter + minDate + this.$scope.inputDelimiter + maxDate); // jquery
2642                } else {
2643                    //alert('nok');
2644                }
2645            } else {
2646                $(this.$scope.$parent.context).find('#'+selector).val(item.id);
2647            }
2648        }
2649        
2650        model.getTitle = function() {
2651            if(this.name) {
2652                if(this.name.length > 0) {
2653                    this.isActive = true;
2654                    var title = this.tabNameActive.replace(new RegExp("{value}"), this.activeItem.search_name);
2655                    if(this.minDate) {
2656                        title = title.replace(/od …/, 'od ' +this.minDate);
2657                    }
2658                    if(this.maxDate) {
2659                        title = title.replace(/do …/, 'do ' +this.maxDate);
2660                    }
2661
2662                    return title;
2663                }
2664            }
2665
2666            return this.tabName;
2667        }
2668        model.populate = function() {
2669            var value = null;
2670            for(sid in this.sourceName) {
2671                if(typeof this.sourceName[sid] === 'function') { continue; } // IE 8 
2672                if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val() != '') {
2673                
2674                    value = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).val();
2675                    rel = "";
2676                    if($(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel')) {
2677                        rel = $(this.$scope.$parent.context).find('#'+this.sourceName[sid]).attr('rel').split(this.$scope.delimiter);
2678                    }
2679                    break;
2680                }
2681            }
2682            var temp = {};
2683            
2684            if(value !== null) {
2685                for(id in this.fields) {
2686                    temp[this.fields[id]] = rel[id];
2687                }
2688                value = value.split(this.$scope.inputDelimiter);
2689                
2690                
2691                if(value[0] == '1') {
2692                    this.minDate = value[1];                
2693                    this.minDate = this.minDate.split('-'); 
2694                    this.minDate = this.minDate[2] + '.' + this.minDate[1] + '.' + this.minDate[0];
2695                    this.maxDate = value[2];
2696                    this.maxDate = this.maxDate.split('-');
2697                    this.maxDate = this.maxDate[2] + '.' + this.maxDate[1] + '.' + this.maxDate[0];
2698                }
2699
2700                temp['id'] = value[0];
2701                this.activeItem = temp;
2702                this.name = temp.name;
2703            }
2704            
2705        } 
2706
2707        this.itemsExpert.push(model);
2708        model.id = (this.itemsExpert.length - 1);
2709        model.populate();
2710        
2711        // periodicita
2712        model = new WrappedCheckboxModel($http, $scope.$new(), $route, $timeout);
2713        model.targetName = "periodicita";
2714        model.fields = ["name", "search_name"];
2715        model.sourceName = ['per'];
2716        model.apiUrl = 'periodicita';
2717        if(this.type == 2) {
2718            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2719        }
2720        model.placeholder = "Periodicita";
2721        model.tabName = "periodicita (docházka do kurzu)";
2722        model.tabNameActive = "probíhající: {value}";
2723        model.title = "Jak často má výuka probíhat?";
2724        this.itemsExpert.push(model);
2725        model.id = (this.itemsExpert.length - 1);
2726        model.populate();
2727        
2728        // Formy vyuky
2729        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2730        model.targetName = "formy-vyuky";
2731        model.fields = ["name", "search_name"];
2732        model.sourceName = ['frm'];
2733        model.apiUrl = 'formy-vyuky';
2734        if(this.type == 2) {
2735            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2736        }
2737        model.placeholder = "Vyberte formu výuky ...";
2738        model.tabName = "forma výuky";
2739        model.tabNameActive = "forma: {value}";
2740        model.title = "Chcete kurz se speciální formou výuky?";
2741        model.ajaxLoad = false; 
2742        this.itemsExpert.push(model);
2743        model.id = (this.itemsExpert.length - 1);
2744        model.populate();
2745        
2746        // cena kurzu
2747        model = new WrappedRangeModel($http, $scope.$new(), $route, $timeout);
2748        model.targetName = "cena";
2749        model.fields = ["name", "search_name"];
2750        model.sourceName = ['cen'];
2751        model.placeholder = "Cena kurzu";
2752        model.tabName = "cena kurzu";
2753        model.tabNameActive = "cena: {value1} - {value2}";
2754        model.title = "Zvolte cenový rozsah - kolik má kurz stát";
2755        model.min = 100;
2756        model.max = 20000;
2757        this.itemsExpert.push(model);
2758        model.id = (this.itemsExpert.length - 1);
2759        model.populate();
2760        
2761        
2762
2763
2764        // Ucebnice
2765        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2766        model.targetName = "ucebnice";
2767        model.fields = ["name", "search_name"];
2768        model.sourceName = ['uce'];
2769        model.apiUrl = 'ucebnice';
2770        if(this.type == 2) {
2771            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2772        }
2773        model.placeholder = "Napište část názvu učebnice a vyberte ...";
2774        model.tabName = "učebnice";
2775        model.tabNameActive = "učebnice: {value}";
2776        model.title = "Napište nebo vyberte název konkrétní učebnice, podle které chcete studovat";
2777        model.ajaxLoad = false; // remove
2778        this.itemsExpert.push(model);
2779        model.id = (this.itemsExpert.length - 1);
2780        model.populate();
2781        
2782        //Obsahove zamereni skupina
2783        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2784        model.targetName = "obsahova-zamereni";
2785        model.fields = ["name", "search_name"];
2786        model.sourceName = ['obs'];
2787        model.apiUrl = 'obsahova-zamereni';
2788        if(this.type == 2) {
2789            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2790        }
2791        model.placeholder = "Napište nebo vyberte zaměření ...";
2792        model.tabName = "odbornost";
2793        model.tabNameActive = "odbornost: {value}";
2794        model.title = "Napište nebo vyberte specifické obsahové zaměření kurzu";
2795        model.ajaxLoad = false; 
2796        this.itemsExpert.push(model);
2797        model.id = (this.itemsExpert.length - 1);
2798        model.populate();
2799        
2800        // vekova skupina
2801        model = new WrappedSelectboxModel($http, $scope.$new(), $route, $timeout);
2802        model.targetName = "vekove-skupiny";
2803        model.fields = ["name", "search_name"];
2804        model.sourceName = ['vek'];
2805        model.apiUrl = 'vekove-skupiny';
2806        if(this.type == 2) {
2807            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2808        }
2809        model.placeholder = "Vyberte věk ...";
2810        model.tabName = "věková skupina";
2811        model.tabNameActive = "pro: {value}";
2812        model.title = "Vyberte věkovou skupinu se kterou chcete kurz navštěvovat";
2813        this.itemsExpert.push(model);
2814        model.id = (this.itemsExpert.length - 1);
2815        model.populate();
2816        
2817        //profesni skupina
2818        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2819        model.targetName = "profesni-skupiny";
2820        model.fields = ["name", "search_name"];
2821        model.sourceName = ['prf'];
2822        model.apiUrl = 'profesni-skupiny';
2823        if(this.type == 2) {
2824            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2825        }
2826        model.placeholder = "Napište nebo vyberte profesi ...";
2827        model.tabName = "profese";
2828        model.tabNameActive = "určeno: {value}";
2829        model.title = "Vyberte profesi, pro kterou je kurz určen";
2830        model.ajaxLoad = false; 
2831        this.itemsExpert.push(model);
2832        model.id = (this.itemsExpert.length - 1);
2833        model.populate();
2834        
2835        // Jazykova skola
2836        if(this.type == 1) {
2837        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2838        model.targetName = "jazykove-skoly";
2839        model.template = "WrappedAutocompleteSchool.html";
2840        model.fields = ["name", "search_name", "address", "place"];
2841        model.sourceName = ['sko'];
2842        model.apiUrl = 'jazykove-skoly';
2843        if(this.type == 2) {
2844            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2845        }
2846        model.placeholder = "Napište část názvu školy a vyberte ...";
2847        model.tabName = "konkrétní škola";
2848        model.tabNameActive = "jen škola: {value}";
2849        model.title = "Vyberte jazykovou školu, o jejíž kurzy máte zájem";
2850        model.ajaxLoad = false; // remove 
2851        this.itemsExpert.push(model);
2852        model.id = (this.itemsExpert.length - 1);
2853        model.populate();
2854        }
2855        
2856        /*****************
2857         *    SPECIAL    *
2858         ****************/
2859
2860        // Druhy jazyk
2861        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2862        model.targetName = "druhy-jazyk";
2863        model.fields = ["priority", "name", "langabbr", "langimg", "langimgexist", "search_name"];
2864        model.fieldsHide = ['search_name', 'priority'];
2865        model.template = "WrappedAutocompleteLang.html";
2866        model.sourceName = ['ja2'];        
2867        model.apiUrl = 'jazyky';
2868        if(this.type == 2) {
2869            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2870        }
2871        model.placeholder = "Napište název jazyka a vyberte ...";
2872        model.tabName = "s druhým jazykem";
2873        model.tabNameActive = "s druhým jazykem: {value}";
2874        model.title = "Vyberte druhý jazyk, který se vyučuje v kurzu spolu s hlavním";
2875        model.ajaxLoad = false; // remove
2876        this.itemsSpecial.push(model);
2877        model.id = (this.itemsSpecial.length - 1);
2878        model.populate();
2879        
2880        
2881        // Lektori
2882        model = new WrappedAutocompleteModel($http, $scope.$new(), $route, $timeout);
2883        model.targetName = "lektori";
2884        model.fields = ["name", "search_name", "school"];
2885        model.sourceName = ['lek'];
2886        model.apiUrl = 'lektori';
2887        if(this.type == 2) {
2888            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2889        }
2890        model.placeholder = "Napište jméno lektora a vyberte ...";
2891        model.tabName = "konkrétní lektor";
2892        model.tabNameActive = "s lektorem: {value}";
2893        model.title = "Vyberte konkrétního lektora, o jehož kurzy máte zájem";
2894        model.ajaxLoad = false; // remove
2895        this.itemsSpecial.push(model);
2896        model.id = (this.itemsSpecial.length - 1);
2897        model.populate();
2898
2899        // BOOL vybery
2900        var boolItems = { "items":[
2901            {
2902                "id": '',
2903                "name": "ne",
2904                "search_name": "ne"
2905            },
2906             {
2907                "id": 1,
2908                "name": "ano",
2909                "search_name": "ano"
2910            }
2911        ],
2912         "description": {"content": null, "position": "top"}
2913        }
2914        
2915        
2916        // kurzy se slevou
2917        model = new WrappedClickModel($http, $scope.$new(), $route, $timeout);
2918        model.targetName = "se-slevou";
2919        model.fields = ["name", "search_name"];
2920        model.sourceName = ['sle'];
2921        model.apiUrl = '';
2922        if(this.type == 2) {
2923            model.apiUrl = model.apiUrl + '?skola_id='+skola_id;
2924        }
2925        model.placeholder = "Vypsat jen kurzy se slevou";
2926        model.tabName = "se slevou";
2927        model.tabNameActive = "se slevou";
2928        model.title = "Vypsat jen kurzy se slevou";
2929        model.isDataLoaded = true; // fake api call
2930        model.items = boolItems;
2931        this.itemsSpecial.push(model);
2932        model.id = (this.itemsSpecial.length - 1);
2933        model.populate();
2934
2935        this.loadEquipment();
2936        jQuery.extend($scope, this); // JQuery magic 
2937        
2938  }
2939
2940  return SearchController;
2941
2942})();
2943
2944SearchController.$inject = ['$http', '$scope', '$window', '$route', '$timeout', 'demandService', '$location'];
2945SearchController.prototype.load.$inject = ['$http', '$scope', '$window', '$route', '$timeout', 'demandService', '$location'];
2946
2947
2948var DemandController;
2949DemandController = (function() {
2950
2951    function DemandController($http, $scope, $route, $timeout, demandService) {
2952  
2953        this.$scope = $scope;
2954        this.$http = $http;
2955        this.$route = $route;
2956        this.$timeout = $timeout;
2957        this.demandService = demandService.searchParams;
2958        this.min = 1;
2959       
2960        var _this = this;
2961        this.$scope.$watch('demandService.show', function() {
2962                /*jsonp12 = function(param) { // @TODO: delete when poptavka api ready
2963                    return _this.demandService.schoolList = param.items;
2964                }*/
2965                if(_this.demandService.params.length > 0) {
2966                    var url = _this.$scope.demandApi + "get-data?" + _this.demandService.params;
2967                    _this.$http.get(url).then(function(response) { // @TODO: change to normal ajax call - now jsonp 
2968                            if(response.status === 200) {
2969                                _this.demandService.schoolList = {};
2970                                _this.demandService.schoolList = response.data.items;
2971                                _this.$scope.max = response.data.items.length;
2972                                _this.$scope.value = 3;
2973                                return true;
2974                            }
2975                    });    
2976                }
2977         });
2978         
2979         this.$scope.$watch('max', function(max) {
2980                _this.$scope.max = max;
2981                if(_this.$scope.max > 6) {
2982                    _this.$scope.max = 6;
2983                }
2984                if(_this.$scope.max < _this.$scope.value) {
2985                    _this.$scope.value = max;
2986                }
2987                
2988         });
2989         
2990         this.$scope.$watch('demandService.count', function(max) {  
2991                _this.$scope.max = max;
2992                _this.$scope.value = max;
2993         });
2994
2995        jQuery.extend($scope, this);
2996    }
2997    
2998    DemandController.prototype.switchStep = function() {
2999        this.demandService.show = !this.demandService.show;
3000    }
3001    
3002    DemandController.prototype.getPopup = function() {
3003        if($('#demand-popup').css('display') != 'block') {
3004            $('#demand-popup').css('display', 'block');
3005                $('#demand-popup').spotlight({
3006                         opacity: .8,            
3007                         speed: 400,                 
3008                         color: '#000',              
3009                         animate: true,          
3010                         easing: '',                 
3011                         exitEvent: '',          
3012                         onShow: function(){},   
3013                         onHide: function(){$('#demand-popup').css('display', 'none');}        
3014                });
3015            $('#demand-popup').find('.close').click(function() {
3016                $('#demand-popup').css('display', 'none');
3017                $('#spotlight').remove();
3018            });            
3019            $('#demand-popup').html(response);
3020            
3021        }
3022    }
3023    
3024    DemandController.prototype.deleteItem = function(id) {
3025        for(item in this.demandService.schoolList) {
3026            if(this.demandService.schoolList[item].id == id) {
3027                this.demandService.schoolList.splice(item, 1);
3028            }
3029        }
3030
3031        this.$parent.max = this.demandService.schoolList.length;
3032    }
3033    
3034    DemandController.prototype.back = function($event) {
3035        $event.preventDefault();
3036        this.$parent.demandService.show = 1;
3037        
3038        return false;
3039    }
3040    
3041    DemandController.prototype.send = function($event) {
3042        
3043        /*jsonp1 = function(param) { // @TODO: delete when poptavka api ready
3044            return true;
3045        }*/
3046        var ids = "";
3047        for(i in this.$parent.demandService.schoolList) {
3048            ids += this.$parent.demandService.schoolList[i].id + ',';
3049        }
3050        //console.log("ids: " + ids);
3051        
3052        ids = ids.slice(0, -1);
3053
3054        var url = this.$parent.demandApi + "place-search?" + this.$parent.demandService.params + '&email=' + this.demandService.email
3055                                                         + '&telefon=' + this.$parent.demandService.telefon
3056                                                         + '&poznamka_uzivatel=' + this.$parent.demandService.poznamka_uzivatel
3057                                                         + '&ids='+ids  // IDs pobociek
3058                                                         + '&obeslat_pobocek=' + this.value;
3059        var _this = this;
3060        this.$http.put(url).then(function(response) { // @TODO: change to normal ajax call - now jsonp 
3061            
3062            if(response.status === 200) {
3063                _this.$parent.demandService.show = 3;
3064                //return _this.demandService.count = response.data.count;
3065            }
3066        });  
3067        return false;
3068    }
3069    return DemandController;
3070})();
3071
3072DemandController.$inject = ['$http', '$scope', '$route', '$timeout', 'demandService'];
3073

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.