{"id":4305,"date":"2022-11-11T12:42:28","date_gmt":"2022-11-11T12:42:28","guid":{"rendered":"https:\/\/quartocrescente.org\/?page_id=4305"},"modified":"2023-06-23T20:42:54","modified_gmt":"2023-06-23T20:42:54","slug":"outlearn-score","status":"publish","type":"page","link":"https:\/\/quartocrescente.org\/pt\/outlearn-score\/","title":{"rendered":"Pontua\u00e7\u00e3o OutLearn"},"content":{"rendered":"<!-- Google Maps -->\n<script src=\"https:\/\/maps.googleapis.com\/maps\/api\/js?key=AIzaSyDh92u6fcrU95FZBVn8vPDEME8aRbHZus0&libraries=places,geometry&callback=initMap\" async defer><\/script>\n\n\n<!-- Moment\/Moment-Range.js -->\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment.js\/2.29.4\/moment.js\" integrity=\"sha512-CTSrPIDxxtTdaIYlTKHEyvHa+70TOhC1pY3PLDgrUqCFifFtV7KrucZCvPy2K7hB0HtKgt0r4INTGBISqnaLNg==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"><\/script>\n\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment-range\/2.1.0\/moment-range.js\" integrity=\"sha512-X2CoKTJbjjAouYq0GOj08Qvl8\/JsZuJdw+zhmNShrDa1PVyHb0M+oeBpNRZ4AAePyo3CHo13jIV\/M3Y8pyUXvg==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"><\/script>\n\n<!-- Money.js -->\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/money.js\/0.2.0\/money.min.js\" integrity=\"sha512-Uv+htgH6sOoowXXo7l7iieSRizHDNwYor+RZVc4\/HQ340\/yDCeXvdJebdReUk7LgWzxIrRRUM1T+MvLCHFbsHQ==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"><\/script>\n\n<!-- Firebase -->\n<script type=\"module\">\n\t\/\/ Import the functions you need from the SDKs you need\n\timport { initializeApp } from \"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-app.js\";\n\timport { getAnalytics } from \"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-analytics.js\";\n\timport { getFirestore } from \"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-firestore.js\";\n\t\n\t\/\/ TODO: Add SDKs for Firebase products that you want to use\n\t\/\/ https:\/\/firebase.google.com\/docs\/web\/setup#available-libraries\n\n\t\/\/ Your web app's Firebase configuration\n\t\/\/ For Firebase JS SDK v7.20.0 and later, measurementId is optional\n\tconst firebaseConfig = {\n\t\tapiKey: \"AIzaSyDAPPLFJkrrfHFZehRRVh-MC9CdD4h_0Ao\",\n\t\tauthDomain: \"quarto-crescente-firedb.firebaseapp.com\",\n\t\tprojectId: \"quarto-crescente-firedb\",\n\t\tstorageBucket: \"quarto-crescente-firedb.appspot.com\",\n\t\tmessagingSenderId: \"609373727675\",\n\t\tappId: \"1:609373727675:web:7f02ea6c351757027df29e\",\n\t\tmeasurementId: \"G-9B9BEP80DD\"\n\t};\n\n\t\/\/ Initialize Firebase\n\tvar firedb_app = initializeApp(firebaseConfig);\n\tvar firedb_analytics = getAnalytics(firedb_app);\n\tvar db = getFirestore(firedb_app);\n<\/script>\n<script src=\"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-app-compat.js\"><\/script>\n<script src=\"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-firestore-compat.js\"><\/script>\n\n<!-- DATA -->\n<script src=\"https:\/\/quartocrescente.org\/wp-content\/themes\/quartocrescente\/assets\/data\/countries\/countries.js\"><\/script>\n<script src=\"https:\/\/quartocrescente.org\/wp-content\/themes\/quartocrescente\/assets\/data\/currencies\/currencies.js\"><\/script>\n<script src=\"https:\/\/quartocrescente.org\/wp-content\/themes\/quartocrescente\/assets\/data\/postal\/postal.js\"><\/script>\n\n<script type=\"module\">\n\t\/\/ Import the Firebase functions\n\timport { initializeApp } from \"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-app.js\";\n\timport { getAnalytics } from \"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-analytics.js\";\n\timport { getFirestore, doc, setDoc } from \"https:\/\/www.gstatic.com\/firebasejs\/9.23.0\/firebase-firestore.js\";\n\n\t\/\/ TODO: Add SDKs for Firebase products that you want to use\n\t\/\/ https:\/\/firebase.google.com\/docs\/web\/setup#available-libraries\n\n\t\/\/ Your web app's Firebase configuration\n\t\/\/ For Firebase JS SDK v7.20.0 and later, measurementId is optional\n\tvar firebaseConfig = {\n\t\tapiKey: \"AIzaSyDAPPLFJkrrfHFZehRRVh-MC9CdD4h_0Ao\",\n\t\tauthDomain: \"quarto-crescente-firedb.firebaseapp.com\",\n\t\tprojectId: \"quarto-crescente-firedb\",\n\t\tstorageBucket: \"quarto-crescente-firedb.appspot.com\",\n\t\tmessagingSenderId: \"609373727675\",\n\t\tappId: \"1:609373727675:web:7f02ea6c351757027df29e\",\n\t\tmeasurementId: \"G-9B9BEP80DD\"\n\t};\n\ttry {\n\t\t\/\/ Initialize Firebase\n\t\tvar firedb_app = initializeApp(firebaseConfig);\n\t\tvar firedb_analytics = getAnalytics(firedb_app);\n\t\tvar database = getFirestore(firedb_app);\n\t}\n\tcatch(err){\n\t\tconsole.log(\"ERROR: \" + err);\n\t\tsendEmailMessage(\"Erro em OutLearn Score\", err);\n\n\t\tsendEmailMessage(\"Erro em OutLearn Score - Firebase Init\", err);\n\t}\n\n\tvar outlearn_geocoder;\n\n\twindow.outlearn_geo_data = {\n\t\tmap: null,\n\t\tcenter: null,\n\t\tcenter_marker: null,\n\t\tcenter_zip: null,\n\t\tcenter_country: null,\n\t\tmax_radius: 0,\n\t\tview: \"union\",\n\t\tarea: {\n\t\t\twalking: 0,\n\t\t\tpublic_transport: 0,\n\t\t\tdriving: 0,\n\t\t\tunion: 0,\n\t\t\tnocar_union: 0\n\t\t},\n\t\tpolygons: {\n\t\t\twalking: [],\n\t\t\tpublic_transport: [],\n\t\t\tdriving: [],\n\t\t\tunion: [],\n\t\t\tnocar_union: []\n\t\t},\n\t\tplaces: {\n\t\t\twalking: {},\n\t\t\tpublic_transport: {},\n\t\t\tdriving: {},\n\t\t\tunion: {},\n\t\t\tnocar_union: {},\n\t\t\texcluded: {},\n\t\t\ttypes: {\n\t\t\t\tunion: {},\n\t\t\t\tnocar_union: {}\n\t\t\t},\n\t\t\tuser:{}\n\t\t},\n\t\tplace_types: [\"cultural_center\", \"recreative_center\", \"sports_field\", \"sports_club\", \"sports_facility\", \"library\", \"museum\", \"auditorium\", \"concert_hall\", \"theater\", \"park\", \"garden\", \"playground\", \"after_school\", \"study_center\", \"music_school\", \"university\", \"college\"],\n\t\tprocessed_place_types: {},\n\t\tbulk_processing: {\n\t\t\tis: false,\n\t\t\tindex: outlearn_bulk_zips.length - 1\n\t\t},\n\t\tscore_params: {\n\t\t\tarea: { \n\t\t\t\tunion: [ 4676169.930039204, 4703296.237380825, 5183294.879514392, 5483762.460707798, 6225097.939399817, 6730970.43280613, 8633657.291995926, 8910781.009155137, 10662301.964561801, 13990270.892585125, 14834077.559022821, 16923882.994225927, 17024846.203912746, 17632263.815262854, 18446084.29579487, 18500035.4639706, 19313184.54738356, 20506183.009913653, 20761355.973749846, 21313149.477845985, 21328603.5058776, 21383029.52927749, 21903819.46386322, 23119951.886010032, 23237417.43260671, 23487879.27981848, 24372944.700546313, 24381239.43391306, 24599403.25002703, 25697135.15140824, 26257635.95097003, 26342046.233496517, 26343529.895957634, 27054675.995261077, 28868224.037756804, 30024515.08281753, 31208226.173568446, 31379657.647234924, 31634594.78213183, 32065968.821381677, 32087765.595308606, 32127141.45721841, 32568382.5211815, 33207867.318161145, 34712758.3350886, 35701299.24319688, 35785056.30620151, 36654445.735370785, 38317146.80385634, 38497125.03146982, 39323460.34686177, 41035229.95762487, 41179949.57592183, 42160682.901284404, 43293697.92134783, 45192685.29605431, 46981834.7897638, 49638654.873704985, 50719541.65600867, 55813073.1060042, 61727539.86715608, 62660149.56999335, 70293489.00144501, 70519075.36006707, 80943796.0361815, 82834459.69281459, 84279379.68937725, 86925316.1911818, 96873728.79031342, 103957130.61357777 ], \n\t\t\t\tnocar_union: [ 341036.89331302524, 445509.2669934126, 575915.7289843919, 746097.6950044803, 996501.810377142, 1016212.667117227, 1016482.994926178, 1021485.9242398102, 1026202.5874394312, 1046381.5478454082, 1116288.1983320257, 1176734.7725292593, 1186515.3436255287, 1186693.2589081777, 1196712.6150369896, 1226880.3266937393, 1235515.3062034193, 1306906.8429191243, 1326833.6697318743, 1337055.9995042954, 1375068.2473434345, 1397131.601775361, 1417140.6146084717, 1447179.752127026, 1456921.7571341998, 1477104.0562087144, 1487260.1448597654, 1497075.8779202448, 1506942.1305581096, 1507357.1754863963, 1517055.472726652, 1547353.3574329626, 1577142.7983249337, 1606883.5688676478, 1657274.5230966397, 1666333.213973868, 1677623.7554799651, 1687196.3183926623, 1707611.0166942768, 1853620.1636446689, 1857546.687362414, 1892029.642192165, 1896763.427247423, 1937284.425069687, 1937649.333411569, 1947686.5967422987, 1987650.2251518054, 2057568.1526990181, 2067891.996026661, 2078439.0740973416, 2124321.6499524466, 2167773.0240026917, 2177699.2400714937, 2177825.052253148, 2293521.5048766406, 2310155.8910644418, 2345514.7737131068, 2457924.8258620505, 2518486.100275064, 2588396.78556965, 2593644.6645265613, 2679991.039884913, 2795755.9990220647, 2848778.084494719, 3387685.8905894095, 3504655.38585265, 3514958.9004772184, 3748544.1671497268, 4129998.5730124023, 4183058.858287229 ] \n\t\t\t}, \n\t\t\tplaces: { \n\t\t\t\tunion: {\n\t\t\t\t\tcultural_center: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 8, 8, 10, 11, 11, 14, 14, 14, 14, 14, 16, 19 ], \n\t\t\t\t\trecreative_center: [ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14, 15, 16, 17, 19, 19 ], \n\t\t\t\t\tsports_field: [ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 11, 11, 12, 12, 12, 13, 14, 14, 14, 14, 15, 17, 17, 22, 22 ], \n\t\t\t\t\tsports_club: [ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 16, 16, 16, 17, 18, 18, 19, 19, 20, 21, 22 ], \n\t\t\t\t\tsports_facility: [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 17, 18, 20, 20, 24 ], \n\t\t\t\t\tlibrary: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 11, 11, 11, 11, 11, 14, 15, 16, 16, 16, 18, 22 ], \n\t\t\t\t\tmuseum: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 13, 14, 18, 18, 20, 20, 22, 22, 23 ], \n\t\t\t\t\tauditorium: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 10, 11, 13 ], \n\t\t\t\t\tconcert_hall: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 12 ], \n\t\t\t\t\ttheater: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 13, 13, 16, 16, 19, 20, 22, 23, 24 ], \n\t\t\t\t\tpark: [ 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 12, 12, 12, 13, 13, 13, 13, 14, 15, 15, 15, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 20, 20, 20, 21, 22, 23, 24, 24, 25, 25, 26, 26, 26, 27 ], \n\t\t\t\t\tgarden: [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 18, 18, 19 ], \n\t\t\t\t\tplayground: [ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 6, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12, 13, 14, 14, 14, 14, 14, 14, 15, 15, 17, 17, 17, 18, 19, 19, 21, 23 ], \n\t\t\t\t\tafter_school: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 15, 16 ], \n\t\t\t\t\tstudy_center: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7 ], \n\t\t\t\t\tmusic_school: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 10, 11, 12, 12, 12, 12, 13, 14, 15, 15, 15, 16, 17, 18, 22, 25, 26 ], \n\t\t\t\t\tuniversity: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 10, 10, 11, 11, 11, 12, 13, 13, 13, 14, 15, 15, 16, 21, 22, 28 ], \n\t\t\t\t\tcollege: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 7, 7, 7, 7, 8, 8, 9, 10, 10, 12, 12, 12, 12, 13, 14, 14, 15, 17, 21 ], \n\t\t\t\t\ttotal: [ 0, 1, 1, 3, 8, 8, 11, 12, 14, 15, 18, 18, 18, 20, 21, 22, 22, 36, 38, 40, 40, 42, 48, 51, 53, 54, 55, 56, 57, 63, 65, 67, 67, 72, 73, 74, 76, 77, 79, 80, 81, 85, 90, 94, 103, 110, 140, 143, 147, 157, 168, 170, 170, 172, 176, 186, 195, 195, 198, 201, 201, 210, 213, 213, 215, 236, 239, 261, 281, 333 ] \n\t\t\t\t}, \n\t\t\t\tnocar_union: { \n\t\t\t\t\tcultural_center: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 6 ], \n\t\t\t\t\trecreative_center: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 7, 7 ], \n\t\t\t\t\tsports_field: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 5, 6 ], \n\t\t\t\t\tsports_club: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6 ], \n\t\t\t\t\tsports_facility: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 5, 7 ], \n\t\t\t\t\tlibrary: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 5, 5, 6 ], \n\t\t\t\t\tmuseum: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 10, 14 ], \n\t\t\t\t\tauditorium: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 6 ], \n\t\t\t\t\tconcert_hall: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3 ], \n\t\t\t\t\ttheater: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 6, 7, 8, 10 ], \n\t\t\t\t\tpark: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 14 ], \n\t\t\t\t\tgarden: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 6, 6, 7 ], \n\t\t\t\t\tplayground: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 8 ], \n\t\t\t\t\tafter_school: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 5 ], \n\t\t\t\t\tstudy_center: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ], \n\t\t\t\t\tmusic_school: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 5, 6 ], \n\t\t\t\t\tuniversity: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 4, 4, 5 ], \n\t\t\t\t\tcollege: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 9 ], \n\t\t\t\t\ttotal: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 7, 7, 7, 7, 7, 9, 13, 13, 13, 14, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 23, 25, 25, 25, 26, 27, 28, 30, 30, 31, 31, 31, 33, 36, 47, 52, 58, 61, 71, 76 ] \n\t\t\t\t} \n\t\t\t} \n\t\t},\n\t\tloaded: false,\n\t\tscore: null,\n\t\tscored: false\n\t};\n\n\twindow.outlearn_human_data = {\n\t\tcenter: null,\n\t\tcenter_zip: null,\n\t\tcenter_country: null,\n\t\tpolygons: {\n\t\t\twalking: [],\n\t\t\tpublic_transport: [],\n\t\t\tdriving: []\n\t\t},\n\t\tcaregivers: [],\n\t\tchildren: [],\n\t\tsupport: [],\n\t\tprocessing: {\n\t\t\tinterval: null,\n\t\t\tis: false\n\t\t},\n\t\tscore: null,\n\t\tscored: false\n\t};\n\n\twindow.outlearn_spatial_data = {\n\t\thome_type: null,\n\t\thome_area: 0,\n\t\tresidents_num: 0,\n\t\tconditions: {\n\t\t\tindividual_rooms: false,\n\t\t\toffice_stations: false,\n\t\t\tpatio: false,\n\t\t\tbackyard: false,\n\t\t\tterrain: false\n\t\t},\n\t\tscore: null,\n\t\tscored: false\n\t};\n\n\twindow.outlearn_material_data = {\n\t\tcountry: null,\n\t\tproviders_num: 0,\n\t\tdependants_num: 0,\n\t\tproviders: [],\n\t\ttotal_gross: 0,\n\t\tscore: null,\n\t\tscored: false\n\t};\n\n\twindow.outlearn_overall_data = {\n\t\tgenerated_scores: {\n\t\t\tgeographic: null,\n\t\t\thuman: null,\n\t\t\tspatial: null,\n\t\t\tmaterial: null\n\t\t},\n\t\tself_assessed_scores:{\n\t\t\tgeographic: null,\n\t\t\thuman: null,\n\t\t\tspatial: null,\n\t\t\tmaterial: null,\n\t\t\tcommentary: \"\"\n\t\t},\n\t\tprocessing: false,\n\t\tscore: null\n\t};\n\n\tvar home_marker_icon;\n\tvar place_marker_icon;\n\tvar excluded_marker_icon;\n\n\tvar traveltime_url = \"https:\/\/api.traveltimeapp.com\/v4\/time-map\";\n\n\tvar traveltime_cred = {\n\t\tapp_id: \"a7289aba\",\n\t\tapi_key: \"c663d62e5c1e8a3d0fe99de6212a8883\"\n\t};\n\n\tvar traveltime_params = {\n\t\tdeparture_searches: [\n\t\t\t{\n\t\t\t\tid: \"outlearn-public-transport\",\n\t\t\t\tcoords: {\n\t\t\t\t\tlat: 0,\n\t\t\t\t\tlng: 0\n\t\t\t\t},\n\t\t\t\tdeparture_time: getDateLastOccurence(\"Wed\", \"ISO\"),\n\t\t\t\ttravel_time: 900,\n\t\t\t\ttransportation: {\n\t\t\t\t\ttype: \"public_transport\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"outlearn-walking\",\n\t\t\t\tcoords: {\n\t\t\t\t\tlat: 0,\n\t\t\t\t\tlng: 0\n\t\t\t\t},\n\t\t\t\tdeparture_time: getDateLastOccurence(\"Wed\", \"ISO\"),\n\t\t\t\ttravel_time: 900,\n\t\t\t\ttransportation: {\n\t\t\t\t\ttype: \"walking\"\n\t\t\t\t}\n\t\t\t}\n\t\t],\n\t\tunions: [\n\t\t\t{\n\t\t\t\tid: \"outlearn-nocar-union\",\n\t\t\t\tsearch_ids: [\n\t\t\t\t\t\"outlearn-public-transport\",\n\t\t\t\t\t\"outlearn-walking\"\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tvar traveltime_data;\n\n\tvar user_country;\n\tvar user_currency;\n\n\t$(document).ready(function() {\n\t\tinitOutlearn();\n\n\t\tif(outlearn_geo_data.map == null){\n\t\t\ttry {\n\t\t\t\tinitMap();\n\t\t\t} catch (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t\tsendEmailMessage(\"Erro em OutLearn Score - Map Rendering\", err);\n\t\t\t}\n\t\t}\n\t});\n\n\tfunction initOutlearn(){\n\t\t$(\"input\").on(\"keypress\", function(event) {\n\t\t\t\/\/ If the user presses the \"Enter\" key on the keyboard\n\t\t\tif (event.key === \"Enter\") {\n\t\t\t\t\/\/ Cancel the default action, if needed\n\t\t\t\tevent.preventDefault();\n\t\t\t\t\/\/ Trigger the button element with a click\n\t\t\t\t$(this).closest('form').find(\"button.submit\").click();\n\t\t\t}\n\t\t});\n\n\t\t$('form').on('focus', 'input[type=number]', function (e) {\n\t\t  \t$(this).on('wheel.disableScroll', function (e) {\n\t\t\t    e.preventDefault()\n\t\t\t  })\n\t\t});\n\n\t\t$('form').on('blur', 'input[type=number]', function (e) {\n\t\t  \t$(this).off('wheel.disableScroll')\n\t\t});\n\n\t\tinitCountrySelects();\n\n\t\t$(\".outlearn-section-wrapper.geographic .title-group span.datestring\").text(getDateLastOccurence(\"Wed\", \"datestring\"));\n\t}\n\n\tfunction initCountrySelects(){\n\t\tvar selects_array = $(\"select.country_select\");\n\n\t\tvar timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\t\tuser_country = countries_timezones[timezone].c[0];\n\n\t\tfor(var i = 0; i < selects_array.length; i++){\n\t\t\t$(selects_array[i]).append(\"<option value='unselected'>(Select)<\/option>\");\n\n\t\t\tfor(var j = 0; j < Object.keys(countries).length; j++){\n\t\t\t\t$(selects_array[i]).append(\"<option \" + (Object.keys(countries)[j] == user_country ? \"selected='selected'\" : \"\") + \" value='\" + Object.keys(countries)[j] + \"'>\" + countries[Object.keys(countries)[j]] + \"<\/option>\");\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction initCurrencySelects(){\n\t\tvar selects_array = $(\"select.currency_select\");\n\n\t\tvar timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\t\tuser_country = countries_timezones[timezone].c[0];\n\n\t\tvar user_currency_code = countries_currencies[user_country];\n\n\t\tfor(var i = 0; i < selects_array.length; i++){\n\t\t\tif(!$(selects_array[i]).find(\"option\").length){\n\t\t\t\t$(selects_array[i]).append(\"<option value='unselected'>(Select)<\/option>\");\n\n\t\t\t\tfor(var j = 0; j < Object.keys(currencies).length; j++){\n\t\t\t\t\tif(Object.keys(currencies)[j] == user_currency_code)\n\t\t\t\t\t\tuser_currency = currencies[Object.keys(currencies)[j]];\n\n\t\t\t\t\t$(selects_array[i]).append(\"<option \" + (Object.keys(currencies)[j] == user_currency_code ? \"selected='selected'\" : \"\") + \" value='\" + Object.keys(currencies)[j] + \"'>\" + currencies[Object.keys(currencies)[j]].symbol + \"<\/option>\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction initMap(){\n\t\toutlearn_geo_data.map = new google.maps.Map(document.querySelector(\".outlearn-geo-map\"), {\n\t\t\tcenter: {lat: 38.72375561905019, lng: -9.141343081012447},\n\t\t\tzoom: 1.5,\n\t\t\tdisableDefaultUI: true,\n\t\t\tzoomControl: true,\n\t\t\tdisableDoubleClickZoom: true\n\t\t});\n\n\t\thome_marker_icon = {\n\t\t\tfillOpacity: 0.8,\n\t\t\turl: \"http:\/\/quartocrescente.org\/wp-content\/uploads\/2022\/12\/home_pin.svg\",\n\t\t\tscaledSize: new google.maps.Size(50, 50), \/\/ scaled size\n\t\t\torigin: new google.maps.Point(0,0), \/\/ origin\n\t\t\tanchor: new google.maps.Point(25, 50) \/\/ anchor\n\t\t};\n\n\t\tplace_marker_icon = {\n\t\t\tpath: \"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0\",\n\t\t\tfillColor: '#000000',\n\t\t\tfillOpacity: .6,\n\t\t\tanchor: new google.maps.Point(0,0),\n\t\t\tstrokeWeight: 0,\n\t\t\tscale: 0.2\n\t\t};\n\n\t\texcluded_marker_icon = {\n\t\t\tpath: \"M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0\",\n\t\t\tfillColor: '#FF0000',\n\t\t\tfillOpacity: 1,\n\t\t\tanchor: new google.maps.Point(0,0),\n\t\t\tstrokeWeight: 0,\n\t\t\tscale: 0.25\n\t\t};\n\t}\n\n\tfunction getOutlearnGeoData(){\n\t\t\/\/Public Transportation query config\n\t\ttraveltime_params.departure_searches[0].coords.lat = outlearn_geo_data.center.lat();\n\t\ttraveltime_params.departure_searches[0].coords.lng = outlearn_geo_data.center.lng();\n\n\t\t\/\/Walking query config\n\t\ttraveltime_params.departure_searches[1].coords.lat = outlearn_geo_data.center.lat();\n\t\ttraveltime_params.departure_searches[1].coords.lng = outlearn_geo_data.center.lng();\n\n\t\t\/\/Driving query config\n\t\tif($('input[name=household_car]:checked').val() == \"yes\" || outlearn_geo_data.bulk_processing.is){\n\t\t\tvar car_departure_search_params = {\n\t\t\t\tid: \"outlearn-driving\",\n\t\t\t\tcoords: {\n\t\t\t\t\tlat: outlearn_geo_data.center.lat(),\n\t\t\t\t\tlng: outlearn_geo_data.center.lng()\n\t\t\t\t},\n\t\t\t\tdeparture_time: getDateLastOccurence(\"Wed\", \"ISO\"),\n\t\t\t\ttravel_time: 900,\n\t\t\t\ttransportation: {\n\t\t\t\t\ttype: \"driving\"\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar car_union_params = {\n\t\t\t\tid: \"outlearn-car-union\",\n\t\t\t\tsearch_ids: [\n\t\t\t\t\t\"outlearn-public-transport\",\n\t\t\t\t\t\"outlearn-walking\",\n\t\t\t\t\t\"outlearn-driving\"\n\t\t\t\t]\n\t\t\t};\n\n\t\t\ttraveltime_params.departure_searches.push(car_departure_search_params);\t\n\t\t\ttraveltime_params.unions.push(car_union_params);\n\t\t}\n\n\t\t$(\".outlearn-section-wrapper.geographic\").removeClass(\"error\");\n\n\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-score span\").text(\"-\");\n\n\t\t$.ajax({ \n\t\t\turl: traveltime_url, \n\t\t\tdata: JSON.stringify(traveltime_params),\n\t\t\ttype: 'POST',\n\t\t\tbeforeSend: function(xhr) {\n\t\t\t\txhr.setRequestHeader(\"X-Host-Override\", \"api.traveltimeapp.com\");\n\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application\/json\");\n\t\t\t\txhr.setRequestHeader(\"Accept\", \"application\/json\");\n\t\t\t\txhr.setRequestHeader(\"X-Application-Id\", traveltime_cred.app_id);\n\t\t\t\txhr.setRequestHeader(\"X-Api-Key\", traveltime_cred.api_key);\n\t\t\t},\n\t\t\tsuccess: function (data) {\n\t\t\t\ttraveltime_data = data.results;\n\n\t\t\t\tvar draw_data;\n\n\t\t\t\t\/\/ Union data processing --------------------------------------------------------------------------------------\n\n\t\t\t\tif(traveltime_params.unions.some(el => el.id === \"outlearn-car-union\")){\n\t\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-car-union' })[0];\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-nocar-union' })[0];\n\t\t\t\t}\n\n\t\t\t\tdrawPolygons(draw_data, outlearn_geo_data.map, outlearn_geo_data.polygons, \"union\");\n\n\t\t\t\toutlearn_geo_data.area.union = calcPolygonsArea(outlearn_geo_data.polygons, \"union\");\n\n\t\t\t\toutlearn_geo_data.max_radius = calcGeoMaxRadius(draw_data);\n\n\t\t\t\tadjustZoomtoGeoMaxRadius();\n\n\t\t\t\tif(traveltime_params.unions.some(el => el.id === \"outlearn-car-union\")){\n\t\t\t\t\t\/\/Queries for places within the proximity max-radius;\n\t\t\t\t\t\/\/(Because of incomplete results in the proximity range when querying for the absolute max-radius)\n\t\t\t\t\tvar nocar_union_max_radius = calcGeoMaxRadius(traveltime_data.filter(obj => { return obj.search_id === 'outlearn-nocar-union' })[0])\n\n\t\t\t\t\tfor(var i = 0; i < outlearn_geo_data.place_types.length; i++){\n\t\t\t\t\t\t(function (place_type, i) {\n\t\t\t\t\t\t\tvar places_request = {\n\t\t\t\t\t\t\t\tlocation: outlearn_geo_data.center,\n\t\t\t\t\t\t\t\tradius: nocar_union_max_radius,\n\t\t\t\t\t\t\t\tkeyword: outlearn_geo_data.place_types[i].replace(\"_\", \" \")\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\tvar places_service = new google.maps.places.PlacesService(outlearn_geo_data.map);\n\t\t\t\t\t\t\t\tplaces_service.nearbySearch(places_request, function(results, status) {\n\t\t\t\t\t\t\t\t\tplacesCallback(results, status, place_type);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}, 1000*i);\n\t\t\t\t\t\t})(outlearn_geo_data.place_types[i], i)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t\/\/Queries for places within the max-radius;\n\t\t\t\tfor(var i = 0; i < outlearn_geo_data.place_types.length; i++){\n\t\t\t\t\t(function (place_type, i) {\n\t\t\t\t\t\tvar places_request = {\n\t\t\t\t\t\t\tlocation: outlearn_geo_data.center,\n\t\t\t\t\t\t\tradius: outlearn_geo_data.max_radius,\n\t\t\t\t\t\t\tkeyword: outlearn_geo_data.place_types[i].replace(\"_\", \" \")\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\tvar places_service = new google.maps.places.PlacesService(outlearn_geo_data.map);\n\t\t\t\t\t\t\tplaces_service.nearbySearch(places_request, function(results, status) {\n\t\t\t\t\t\t\t\tplacesCallback(results, status, place_type);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}, 1000*i);\n\t\t\t\t\t})(outlearn_geo_data.place_types[i], i)\n\t\t\t\t}\n\n\t\t\t\t\/\/ Sub data processing ----------------------------------------------------------------------------------------\n\n\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-walking' })[0];\n\t\t\t\tdrawPolygons(draw_data, false, outlearn_geo_data.polygons, \"walking\");\n\n\t\t\t\toutlearn_geo_data.area.walking = calcPolygonsArea(outlearn_geo_data.polygons, \"walking\");\n\n\t\t\t\t\/\/ ---\n\n\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-public-transport' })[0];\n\t\t\t\tdrawPolygons(draw_data, false, outlearn_geo_data.polygons, \"public_transport\");\n\n\t\t\t\toutlearn_geo_data.area.public_transport = calcPolygonsArea(outlearn_geo_data.polygons, \"public_transport\");\n\n\t\t\t\t\/\/ ---\n\n\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-nocar-union' })[0];\n\t\t\t\tdrawPolygons(draw_data, false, outlearn_geo_data.polygons, \"nocar_union\");\n\n\t\t\t\toutlearn_geo_data.area.nocar_union = calcPolygonsArea(outlearn_geo_data.polygons, \"nocar_union\");\n\n\t\t\t\t\/\/ ---\n\n\t\t\t\tif(traveltime_data.filter(obj => { return obj.search_id === 'outlearn-driving' })[0]){\n\t\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-driving' })[0];\n\t\t\t\t\tdrawPolygons(draw_data, false, outlearn_geo_data.polygons, \"driving\");\n\n\t\t\t\t\toutlearn_geo_data.area.driving = calcPolygonsArea(outlearn_geo_data.polygons, \"driving\");\n\t\t\t\t}\n\n\t\t\t\t\/\/ DOM updates ------------------------------------------------------------------------------------------------\n\n\t\t\t\t\/\/Hides the Geograpic results section;\n\t\t\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-results\").addClass(\"hidden\");\n\n\t\t\t\t\/\/Adds the driving view filter;\n\t\t\t\tif(traveltime_params.unions.some(el => el.id === \"outlearn-car-union\"))\n\t\t\t\t\t$(\".outlearn-geoview-filter form\").append('<div class=\"input-wrapper\"><input type=\"radio\" id=\"outlearn-geoview-driving\" name=\"outlearn-geoview\" value=\"driving\"><label for=\"outlearn-geoview-driving\"><i class=\"fa-solid fa-car\"><\/i><\/label><\/div>');\n\n\t\t\t\t\/\/Converts the total area size from m2 to ha and outputs it;\n\t\t\t\t$(\".outlearn-map-overall-data-wrapper span.area-span\").text(Math.round(outlearn_geo_data.area.union\/10000) + \" ha\");\n\n\t\t\t\t\/\/Sets loader visible\n\t\t\t\t$(\".outlearn-map-wrapper.geo-map-wrapper .loader\").removeClass(\"hidden\");\n\n\t\t\t},\n\t\t\terror: function (xhr, ajaxOptions, thrownError) {\n\t\t\t\tconsole.log(xhr);\n\t\t\t\t$(\".outlearn-section-wrapper.geographic\").addClass(\"error\");\n\n\t\t\t\tif(outlearn_geo_data.bulk_processing.is){\n\t\t\t\t\tif(outlearn_geo_data.bulk_processing.index > 0){\n\t\t\t\t\t\toutlearn_geo_data.bulk_processing.index--;\n\t\t\t\t\t\t\n\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\tcodeAddress(outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"code\"], outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"country\"], \"geo\", true);\n\t\t\t\t\t\t}, 2000);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tgetScoreParamsFromBulkGeoData();\n\n\t\t\t\t\t\toutlearn_geo_data.bulk_processing.is = false;\n\t\t\t\t\t\toutlearn_geo_data.bulk_processing.index = outlearn_bulk_zips.length - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction placesCallback(results, status, place_type){\n\t\tif (status == google.maps.places.PlacesServiceStatus.OK) {\n\t\t\tfor (var i = 0; i < results.length; i++) {\n\t\t\t\tif(!Object.values(outlearn_geo_data.places.union).some(el => el.place.place_id === results[i].place_id)){\n\t\t\t\t\tvar is_under = {\n\t\t\t\t\t\twalking: checkLocationUnderPolygons(outlearn_geo_data.polygons.walking, results[i].geometry.location),\n\t\t\t\t\t\tpublic_transport: checkLocationUnderPolygons(outlearn_geo_data.polygons.public_transport, results[i].geometry.location),\n\t\t\t\t\t\tdriving: checkLocationUnderPolygons(outlearn_geo_data.polygons.driving, results[i].geometry.location),\n\t\t\t\t\t\tunion: checkLocationUnderPolygons(outlearn_geo_data.polygons.union, results[i].geometry.location),\n\t\t\t\t\t\tnocar_union: checkLocationUnderPolygons(outlearn_geo_data.polygons.nocar_union, results[i].geometry.location)\n\t\t\t\t\t};\n\n\t\t\t\t\tvar marker = new google.maps.Marker({\n\t\t\t\t\t\tposition: results[i].geometry.location,\n\t\t\t\t\t\ticon: place_marker_icon\n\t\t\t\t\t});\n\n\t\t\t\t\tvar marker_infowindow = new google.maps.InfoWindow();\n\n\t\t\t\t\tvar place_obj = {\n\t\t\t\t\t\tid:  Object.keys(outlearn_geo_data.places.union).length + Object.keys(outlearn_geo_data.places.excluded).length + Object.keys(outlearn_geo_data.places.user).length,\n\t\t\t\t\t\tmarker: marker,\n\t\t\t\t\t\tinfo_window: marker_infowindow,\n\t\t\t\t\t\tplace: results[i],\n\t\t\t\t\t\tquery_type: place_type,\n\t\t\t\t\t\tis_under: is_under,\n\t\t\t\t\t\tsource: \"google\"\n\t\t\t\t\t};\n\n\t\t\t\t\t(function (place_obj) {\n\t\t\t\t\t\tgoogle.maps.event.addListener(place_obj.marker, \"click\", function (e) {\n\t\t\t\t\t\t\tplace_obj.info_window.setContent(\"<div class='outlearn_marker_infowindow' marker-id='\" + place_obj.id  + \"' source='\" + place_obj.source  + \"'><span><b>\" + place_obj.place.name + \"<\/b><\/span><span>\" + place_obj.query_type.replace(\"_\", \" \").replace(\/\\b[a-z]\/g, function(letter) {return letter.toUpperCase(); }) + \"<\/span><button class='place_remove_btn infowindow_remove_btn' onclick='onClickRemovePlace(this)'><i class='fa-solid fa-xmark'><\/i> Remove<\/button><\/div>\");\n\t\t\t\t\t\t\tplace_obj.info_window.open(outlearn_geo_data.map, place_obj.marker);\n\t\t\t\t\t\t});\n\t\t\t\t\t})(place_obj);\n\n\t\t\t\t\tif(is_under.union){\n\t\t\t\t\t\tmarker.setMap(outlearn_geo_data.map);\n\n\t\t\t\t\t\toutlearn_geo_data.places.union[place_obj.id] = place_obj;\n\n\t\t\t\t\t\tif(is_under.walking)\n\t\t\t\t\t\t\toutlearn_geo_data.places.walking[place_obj.id] = place_obj;\n\n\t\t\t\t\t\tif(is_under.public_transport)\n\t\t\t\t\t\t\toutlearn_geo_data.places.public_transport[place_obj.id] = place_obj;\n\n\t\t\t\t\t\tif(is_under.driving)\n\t\t\t\t\t\t\toutlearn_geo_data.places.driving[place_obj.id] = place_obj;\n\n\t\t\t\t\t\tif(!outlearn_geo_data.places.types.union[place_type])\n\t\t\t\t\t\t\toutlearn_geo_data.places.types.union[place_type] = {\n\t\t\t\t\t\t\t\tlist: {}, \n\t\t\t\t\t\t\t\tlength: 0\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\toutlearn_geo_data.places.types.union[place_type].list[place_obj.id] = place_obj;\n\t\t\t\t\t\toutlearn_geo_data.places.types.union[place_type].length = Object.keys(outlearn_geo_data.places.types.union[place_type].list).length;\n\n\t\t\t\t\t\tif(is_under.nocar_union){\n\t\t\t\t\t\t\toutlearn_geo_data.places.nocar_union[place_obj.id] = place_obj;\n\n\t\t\t\t\t\t\tif(!outlearn_geo_data.places.types.nocar_union[place_type])\n\t\t\t\t\t\t\t\toutlearn_geo_data.places.types.nocar_union[place_type] = {\n\t\t\t\t\t\t\t\t\tlist: {}, \n\t\t\t\t\t\t\t\t\tlength: 0\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\toutlearn_geo_data.places.types.nocar_union[place_type].list[place_obj.id] = place_obj;\n\t\t\t\t\t\t\toutlearn_geo_data.places.types.nocar_union[place_type].length = Object.keys(outlearn_geo_data.places.types.nocar_union[place_type].list).length;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar is_under_icons = (is_under.walking ? \"<i class='fa-solid fa-person-walking'><\/i>\" : \"\") + (is_under.public_transport ? (is_under.walking ? \"|\" : \"\") + \"<i class='fa-solid fa-bus'><\/i>\" : \"\") + (is_under.driving ? (is_under.walking || is_under.public_transport ? \"|\" : \"\") + \"<i class='fa-solid fa-car'><\/i>\" : \"\");\n\n\t\t\t\t\t\t$(\".outlearn-placestype-wrapper.\" + place_type + \" .outlearn-placestype-list\").append(\"<li marker-id='\" + place_obj.id + \"' source='\" + place_obj.source + \"' \" + (is_under.walking ? \"walking\" : \"\") + \" \" + (is_under.public_transport ? \"public-transport\" : \"\") + \" \" + (is_under.driving ? \"driving\" : \"\") + \" ><a onclick='centerOnPlaceMarker(this)'><p>\" + place_obj.place.name + \"<\/p><\/a><span class='is-under-icons'>\" + is_under_icons + \"<\/span><button class='place_remove_btn list_remove_btn' onclick='onClickRemovePlace(this)'><i class='fa-solid fa-xmark'><\/i><\/button><\/li>\");\n\n\t\t\t\t\t\t$(\".outlearn-placestype-wrapper.\" + place_type + \" .outlearn-placestype-list\").attr(\"n\", parseInt($(\".outlearn-placestype-wrapper.\" + place_type + \" .outlearn-placestype-list\").attr(\"n\"))+1);\n\t\t\t\t\t\t$(\".outlearn-placestype-wrapper.\" + place_type + \" h4 span\").text(\"(\" + $(\".outlearn-placestype-wrapper.\" + place_type + \" .outlearn-placestype-list\").attr(\"n\") + \")\");\t\t   \t\t\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tplace_obj.marker.icon = excluded_marker_icon;\n\t\t\t\t\t\toutlearn_geo_data.places.excluded[place_obj.id] = place_obj;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\/*\n\t\t\t\telse{\n\t\t\t\t\tconsole.log(\"WARNING: Ignored repeated result with ID '\" + results[i].place_id + \"', named '\" + results[i].name + \"'.\");\n\t\t\t\t}\n\t\t\t\t*\/\n\t\t\t}\n\n\t\t\tvar places_n = Object.keys(outlearn_geo_data.places.union).length + Object.keys(outlearn_geo_data.places.user).length;\n\t\t\t$(\".outlearn-map-overall-data-wrapper span.n-span\").text(places_n); \n\t\t}\n\t\telse{\n\t\t\tconsole.log(\"WARNING: Places NearbySearch query '\" + place_type + \"' returned the status '\" + status + \"'.\");\n\t\t}\n\t\t\n\t\tif(outlearn_geo_data.processed_place_types[place_type] == undefined)\n\t\t\toutlearn_geo_data.processed_place_types[place_type] = 1;\n\t\telse\n\t\t\toutlearn_geo_data.processed_place_types[place_type]++;\n\n\t\tif(Object.keys(outlearn_geo_data.processed_place_types).length == outlearn_geo_data.place_types.length && ( (traveltime_params.unions.some(el => el.id === \"outlearn-car-union\") && Object.values(outlearn_geo_data.processed_place_types).every((v) => v === 2)) || (!traveltime_params.unions.some(el => el.id === \"outlearn-car-union\") && Object.values(outlearn_geo_data.processed_place_types).every((v) => v === 1)) )){\n\t\t\t\/\/Sets loader invisible\n\t\t\t$(\".outlearn-map-wrapper.geo-map-wrapper .loader\").addClass(\"hidden\");\n\n\t\t\t\/\/Unveils the Geograpic results section;\n\t\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-results\").removeClass(\"hidden\");\n\n\t\t\toutlearn_geo_data.loaded = true;\n\n\t\t\tif(outlearn_geo_data.bulk_processing.is){\n\t\t\t\toutlearn_bulk_zips[outlearn_geo_data.bulk_processing.index].max_radius = outlearn_geo_data.max_radius;\n\t\t\t\toutlearn_bulk_zips[outlearn_geo_data.bulk_processing.index].area = Object.assign({}, outlearn_geo_data.area);\n\n\t\t\t\tvar places_count_obj = {\n\t\t\t\t\tunion: {\n\t\t\t\t\t\ttotal: 0\n\t\t\t\t\t},\n\t\t\t\t\tnocar_union: {\n\t\t\t\t\t\ttotal: 0\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tfor(var i = 0; i < outlearn_geo_data.place_types.length; i++){\n\t\t\t\t\tif(outlearn_geo_data.places.types.union[outlearn_geo_data.place_types[i]] !== undefined)\n\t\t\t\t\t\tplaces_count_obj.union[outlearn_geo_data.place_types[i]] = outlearn_geo_data.places.types.union[outlearn_geo_data.place_types[i]].length;\n\t\t\t\t\telse\n\t\t\t\t\t\tplaces_count_obj.union[outlearn_geo_data.place_types[i]] = 0;\n\n\t\t\t\t\tif(outlearn_geo_data.places.types.nocar_union[outlearn_geo_data.place_types[i]] !== undefined)\n\t\t\t\t\t\tplaces_count_obj.nocar_union[outlearn_geo_data.place_types[i]] = outlearn_geo_data.places.types.nocar_union[outlearn_geo_data.place_types[i]].length;\n\t\t\t\t\telse\n\t\t\t\t\t\tplaces_count_obj.nocar_union[outlearn_geo_data.place_types[i]] = 0;\n\n\t\t\t\t\tplaces_count_obj.union.total = places_count_obj.union.total + places_count_obj.union[outlearn_geo_data.place_types[i]];\n\t\t\t\t\tplaces_count_obj.nocar_union.total = places_count_obj.nocar_union.total + places_count_obj.nocar_union[outlearn_geo_data.place_types[i]];\n\t\t\t\t}\n\n\t\t\t\toutlearn_bulk_zips[outlearn_geo_data.bulk_processing.index].places = places_count_obj;\n\n\t\t\t\tif(outlearn_geo_data.bulk_processing.index > 0){\n\t\t\t\t\toutlearn_geo_data.bulk_processing.index--;\n\n\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\tvar elem_num = outlearn_bulk_zips.length - outlearn_geo_data.bulk_processing.index;\n\t\t\t\t\t\tconsole.log(\"INFO: Processing element #\" + elem_num + \"\/\" + outlearn_bulk_zips.length + \", zip-code \" + outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"code\"] + \".\");\n\n\t\t\t\t\t\t$(\".outlearn-form .postal_input\").val(outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"code\"]);\n\n\t\t\t\t\t\tcodeAddress(outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"code\"], outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"country\"], \"geo\", true);\n\t\t\t\t\t}, 2000);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tgetScoreParamsFromBulkGeoData();\n\n\t\t\t\t\t$(\".outlearn-form .postal_input\").val(\"\");\n\n\t\t\t\t\toutlearn_geo_data.bulk_processing.is = false;\n\t\t\t\t\toutlearn_geo_data.bulk_processing.index = outlearn_bulk_zips.length - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcalcGeoScore();\n\t\t\t}\n\t\t}\n\t}\n\n\twindow.onClickRemovePlace = function(clicked_elem){\t\t\n\t\tvar place_id = parseInt($(clicked_elem).parent().attr(\"marker-id\"));\n\t\tvar place_source = $(clicked_elem).parent().attr(\"source\");\n\n\t\tvar place;\n\n\t\tif(place_source == \"google\"){\n\t\t\tplace = outlearn_geo_data.places.union[place_id];\n\t\t\tdelete outlearn_geo_data.places.union[place_id];\n\t\t}\n\n\t\tif(place_source == \"user\"){\n\t\t\tplace = outlearn_geo_data.places.user[place_id];\n\t\t\tdelete outlearn_geo_data.places.user[place_id];\n\t\t}\n\n\t\tdelete outlearn_geo_data.places.types.union[place.query_type].list[place_id];\n\t\toutlearn_geo_data.places.types.union[place.query_type].length = Object.keys(outlearn_geo_data.places.types.union[place.query_type].list).length;\n\n\t\tif(place.is_under.nocar_union){\n\t\t\tdelete outlearn_geo_data.places.nocar_union[place_id];\n\n\t\t\tdelete outlearn_geo_data.places.types.nocar_union[place.query_type].list[place_id];\n\t\t\toutlearn_geo_data.places.types.nocar_union[place.query_type].length = Object.keys(outlearn_geo_data.places.types.nocar_union[place.query_type].list).length;\n\t\t}\n\n\t\tif(place.is_under.walking)\n\t\t\tdelete outlearn_geo_data.places.walking[place_id];\n\n\t\tif(place.is_under.public_transport)\n\t\t\tdelete outlearn_geo_data.places.public_transport[place_id];\n\n\t\tif(place.is_under.driving)\n\t\t\tdelete outlearn_geo_data.places.driving[place_id];\n\n\t\toutlearn_geo_data.places.excluded[place_id] = place;\n\n\t\tplace.marker.setMap(null);\n\n\t\tplace.info_window.close();\n\n\t\tcalcGeoScore();\n\n\t\tvar place_list_elem = $(\".outlearn-placestype-list li[marker-id='\" + place.id + \"']\");\n\t\tplace_list_elem.remove(); \n\n\t\t$(\".outlearn-map-overall-data-wrapper span.n-span\").text(Object.keys(outlearn_geo_data.places[outlearn_geo_data.view]).length);\n\n\t\t$(\".outlearn-placestype-wrapper.\" + place.query_type + \" .outlearn-placestype-list\").attr(\"n\", parseInt($(\".outlearn-placestype-wrapper.\" + place.query_type + \" .outlearn-placestype-list\").attr(\"n\"))-1);\n\n\t\tvar dom_handle = outlearn_geo_data.view == \"public_transport\" ? \"public-transport\" : outlearn_geo_data.view;\n\n\t\tif(dom_handle == \"union\")\n\t\t\t$(\".outlearn-placestype-wrapper.\" + place.query_type + \" h4 span\").text(\"(\" + $(\".outlearn-placestype-wrapper.\" + place.query_type + \" .outlearn-placestype-list li\").length  + \")\");\n\t\telse\n\t\t\t$(\".outlearn-placestype-wrapper.\" + place.query_type + \" h4 span\").text(\"(\" + $(\".outlearn-placestype-wrapper.\" + place.query_type + \" .outlearn-placestype-list li[\" + dom_handle + \"]\").length  + \")\");\n\t}\n\n\tfunction checkLocationUnderPolygons(polygon_array, location){\n\t\tvar is_under = false;\n\n\t\tfor(var i = 0; i < polygon_array.length; i++){\n\t\t\tif(google.maps.geometry.poly.containsLocation(location, polygon_array[i])){\n\t\t\t\tis_under = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn is_under;\n\t}\n\n\tfunction drawPolygons(draw_data, map, polygons_obj, collection_id){\n\t\tpolygons_obj[collection_id] = [];\n\n\t\tfor(var i = 0; i < draw_data.shapes.length; i++){\n\t\t\tvar outerCoords = draw_data.shapes[i].shell;\n\n\t\t\tvar innerCoords = [];\n\n\t\t\tfor(var j = 0; j < draw_data.shapes[i].holes.length; j++)\n\t\t\t\tfor(var k = 0; k < draw_data.shapes[i].holes[j].length; k++)\n\t\t\t\t\tinnerCoords.push(draw_data.shapes[i].holes[j][k]);\n\n\t\t\tvar strokeOpacity = 0;\n\t\t\tvar fillOpacity = 0;\n\n\t\t\tvar i_polygon = new google.maps.Polygon({\n\t\t\t\tpaths: [outerCoords, innerCoords],\n\t\t\t\tstrokeColor: \"#FF0000\",\n\t\t\t\tstrokeOpacity: 0.8,\n\t\t\t\tstrokeWeight: 2,\n\t\t\t\tfillColor: \"#FF0000\",\n\t\t\t\tfillOpacity: 0.35,\n\t\t\t});\n\n\t\t\tif(map)\n\t\t\t\ti_polygon.setMap(map);\n\n\t\t\tgoogle.maps.event.addListener(i_polygon, 'dblclick', function(event){\n\t\t\t\tif(outlearn_geo_data.loaded)\n\t\t\t\t\tplaceUserMarker(event.latLng, outlearn_geo_data.map);\n\t\t\t});\n\n\t\t\tpolygons_obj[collection_id].push(i_polygon);\n\t\t}\n\t}\n\n\tfunction placeUserMarker(location, map) {\n\t\tvar marker = new google.maps.Marker({\n\t\t\tposition: location, \n\t\t\tmap: map,\n\t\t\ticon: place_marker_icon\n\t\t});\n\n\t\tvar is_under = {\n\t\t\twalking: checkLocationUnderPolygons(outlearn_geo_data.polygons.walking, location),\n\t\t\tpublic_transport: checkLocationUnderPolygons(outlearn_geo_data.polygons.public_transport, location),\n\t\t\tdriving: checkLocationUnderPolygons(outlearn_geo_data.polygons.driving, location),\n\t\t\tunion: checkLocationUnderPolygons(outlearn_geo_data.polygons.union, location),\n\t\t\tnocar_union: checkLocationUnderPolygons(outlearn_geo_data.polygons.nocar_union, location)\n\t\t};\n\n\t\tvar place_obj = {\n\t\t\tid:  Object.keys(outlearn_geo_data.places.union).length + Object.keys(outlearn_geo_data.places.excluded).length + Object.keys(outlearn_geo_data.places.user).length,\n\t\t\tmarker: marker,\n\t\t\tinfo_window: new google.maps.InfoWindow(),\n\t\t\tplace: {\n\t\t\t\tname: null,\n\t\t\t\tgeometry: {\n\t\t\t\t\tlocation: location\n\t\t\t\t}\n\t\t\t},\n\t\t\tquery_type: null,\n\t\t\tis_under: is_under,\n\t\t\tsource: \"user\"\n\t\t};\n\n\t\toutlearn_geo_data.places.user[place_obj.id] = place_obj;\n\n\t\tvar infowindow_content = \"<div class='user_marker_infowindow'><span class='infowindow_title'><b>Add Place<\/b><\/span><form><div class='input-wrapper'><label for='usermarker_name'>Name:<\/label><input type='text'id='usermarker_name' name='usermarker_name'\/><\/div><div class='input-wrapper'><label for='usermarker_placetype'>Type:<\/label><select id='usermarker_placetype' name='usermarker_placetype'>\";\n\n\t\tfor(var i = 0; i < outlearn_geo_data.place_types.length; i++){\n\t\t\tinfowindow_content += \"<option value=\" + outlearn_geo_data.place_types[i] + \">\" + outlearn_geo_data.place_types[i].replace(\"_\", \" \").replace(\/\\b[a-z]\/g, function(letter) {return letter.toUpperCase(); }) + \"<\/option>\";\n\t\t}\n\n\t\tinfowindow_content += \"<\/select><\/div><button class='infowindow_save_btn' type='button' onclick='saveUserMarker(this, \" + place_obj.id + \")'><i class='fa-solid fa-floppy-disk'><\/i>Save<\/button><\/form><\/div>\";\n\n\t\tplace_obj.info_window.setContent(infowindow_content);\n\t\tplace_obj.info_window.open(outlearn_geo_data.map, marker);\n\n\t\tgoogle.maps.event.addListener(place_obj.info_window,'closeclick',function(){\n\t\t\tmarker.setMap(null);\n\t\t\tdelete outlearn_geo_data.places.user[place_obj.id];\n\t\t});\n\t}\n\n\twindow.saveUserMarker = function(clicked_elem, place_id){\n\t\tvar place_obj = outlearn_geo_data.places.user[place_id];\n\n\t\tplace_obj.place.name = $($(clicked_elem).closest(\"form\")[0]).find(\"input#usermarker_name\").val();\n\t\tplace_obj.query_type = $($(clicked_elem).closest(\"form\")[0]).find(\"select#usermarker_placetype\").val();\n\n\t\tif(place_obj.is_under.walking)\n\t\t\toutlearn_geo_data.places.walking[place_id] = place_obj;\n\n\t\tif(place_obj.is_under.public_transport)\n\t\t\toutlearn_geo_data.places.public_transport[place_id] = place_obj;\n\n\t\tif(place_obj.is_under.driving)\n\t\t\toutlearn_geo_data.places.driving[place_id] = place_obj;\n\n\t\tif(!outlearn_geo_data.places.types.union[place_obj.query_type])\n\t\t\toutlearn_geo_data.places.types.union[place_obj.query_type] = {\n\t\t\t\tlist: {}, \n\t\t\t\tlength: 0\n\t\t\t};\n\n\t\toutlearn_geo_data.places.types.union[place_obj.query_type].list[place_id] = place_obj;\n\t\toutlearn_geo_data.places.types.union[place_obj.query_type].length = Object.keys(outlearn_geo_data.places.types.union[place_obj.query_type].list).length;\n\n\t\tif(place_obj.is_under.nocar_union){\n\t\t\tif(!outlearn_geo_data.places.types.nocar_union[place_obj.query_type])\n\t\t\t\toutlearn_geo_data.places.types.nocar_union[place_obj.query_type] = {\n\t\t\t\t\tlist: {}, \n\t\t\t\t\tlength: 0\n\t\t\t\t};\n\n\t\t\toutlearn_geo_data.places.types.nocar_union[place_obj.query_type].list[place_obj.id] = place_obj;\n\t\t\toutlearn_geo_data.places.types.nocar_union[place_obj.query_type].length = Object.keys(outlearn_geo_data.places.types.nocar_union[place_obj.query_type].list).length;\n\t\t}\n\t\t\n\t\tvar is_under_icons = (place_obj.is_under.walking ? \"<i class='fa-solid fa-person-walking'><\/i>\" : \"\") + (place_obj.is_under.public_transport ? (place_obj.is_under.walking ? \"|\" : \"\") + \"<i class='fa-solid fa-bus'><\/i>\" : \"\") + (place_obj.is_under.driving ? (place_obj.is_under.walking || place_obj.is_under.public_transport ? \"|\" : \"\") + \"<i class='fa-solid fa-car'><\/i>\" : \"\");\n\n\t\t$(\".outlearn-placestype-wrapper.\" + place_obj.query_type + \" .outlearn-placestype-list\").append(\"<li marker-id='\" + place_obj.id + \"' source='\" + place_obj.source + \"' \" + (place_obj.is_under.walking ? \"walking\" : \"\") + \" \" + (place_obj.is_under.public_transport ? \"public-transport\" : \"\") + \" \" + (place_obj.is_under.driving ? \"driving\" : \"\") + \" ><a onclick='centerOnPlaceMarker(this)'><p>\" + place_obj.place.name + \"<\/p><\/a><span class='is-under-icons'>\" + is_under_icons + \"<\/span><button class='place_remove_btn list_remove_btn' onclick='onClickRemovePlace(this)'><i class='fa-solid fa-xmark'><\/i><\/button><\/li>\");\n\n\t\t$(\".outlearn-placestype-wrapper.\" + place_obj.query_type + \" .outlearn-placestype-list\").attr(\"n\", parseInt($(\".outlearn-placestype-wrapper.\" + place_obj.query_type + \" .outlearn-placestype-list\").attr(\"n\"))+1);\n\t\t$(\".outlearn-placestype-wrapper.\" + place_obj.query_type + \" h4 span\").text(\"(\" + $(\".outlearn-placestype-wrapper.\" + place_obj.query_type + \" .outlearn-placestype-list\").attr(\"n\") + \")\");\t\n\n\t\tvar places_n = Object.keys(outlearn_geo_data.places.union).length + Object.keys(outlearn_geo_data.places.user).length;\n\t\t$(\".outlearn-map-overall-data-wrapper span.n-span\").text(places_n); \n\n\t\tgoogle.maps.event.clearListeners(place_obj.info_window, 'closeclick');\n\n\t\t(function (place_obj) {\n\t\t\tgoogle.maps.event.addListener(place_obj.marker, \"click\", function (e) {\n\t\t\t\tplace_obj.info_window.setContent(\"<div class='outlearn_marker_infowindow' marker-id='\" + place_obj.id  + \"' source='\" + place_obj.source  + \"'><span><b>\" + place_obj.place.name + \"<\/b><\/span><span>\" + place_obj.query_type.replace(\"_\", \" \").replace(\/\\b[a-z]\/g, function(letter) {return letter.toUpperCase(); }) + \"<\/span><button class='place_remove_btn infowindow_remove_btn' onclick='onClickRemovePlace(this)'><i class='fa-solid fa-xmark'><\/i> Remove<\/button><\/div>\");\n\t\t\t\tplace_obj.info_window.open(outlearn_geo_data.map, place_obj.marker);\n\t\t\t});\n\t\t})(place_obj);\n\n\t\tplace_obj.info_window.close();\n\n\t\tcalcGeoScore();\n\n\t\treturn false;\n\t}\n\n\tfunction calcPolygonsArea(polygons_obj, collection_id){\n\t\tvar area = 0;\n\n\t\tfor(var i = 0; i < polygons_obj[collection_id].length; i++){\n\t\t\tarea += google.maps.geometry.spherical.computeArea(polygons_obj[collection_id][i].getPath());\n\t\t}\n\n\t\treturn area;\n\t}\n\n\tfunction calcGeoMaxRadius(draw_data){\n\t\tvar max_radius = 0;\n\n\t\tfor(var i = 0; i < draw_data.shapes.length; i++){\n\t\t\t\/\/Calculates the most distant vertice of the polygon for determining a max-radius;\n\t\t\tfor(var j = 0; j < draw_data.shapes[i].shell.length; j++){\n\t\t\t\tvar vertice_distance = geopointsDistance(outlearn_geo_data.center.lat(), outlearn_geo_data.center.lng(), draw_data.shapes[i].shell[j].lat, draw_data.shapes[i].shell[j].lng);\n\n\t\t\t\tif(vertice_distance > max_radius)\n\t\t\t\t\tmax_radius = vertice_distance;\n\t\t\t}\n\t\t}\n\n\t\treturn max_radius;\n\t}\n\n\tfunction drawGeoMaxRadius(){\n\t\tvar maxradius_circle = new google.maps.Circle({\n\t\t\tstrokeColor: \"#000000\",\n\t\t\tstrokeOpacity: 0.8,\n\t\t\tstrokeWeight: 2,\n\t\t\tfillColor: \"#000000\",\n\t\t\tfillOpacity: 0.35,\n\t\t\tmap: outlearn_geo_data.map,\n\t\t\tcenter: outlearn_geo_data.center,\n\t\t\tradius: outlearn_geo_data.max_radius,\n\t\t});\n\t}\n\n\tfunction drawExcludedMarkers(){\n\t\tfor(var i = 0; i < outlearn_geo_data.places.excluded.length; i++){\n\t\t\toutlearn_geo_data.places.excluded[i].marker.setMap(outlearn_geo_data.map);\n\t\t}\n\n\t\treturn outlearn_geo_data.places.excluded.length;\n\t}\n\n\tfunction adjustZoomtoGeoMaxRadius(){\n\t\tvar maxradius_circle = new google.maps.Circle({\n\t\t\tstrokeColor: \"#000000\",\n\t\t\tstrokeOpacity: 0,\n\t\t\tstrokeWeight: 2,\n\t\t\tfillColor: \"#000000\",\n\t\t\tfillOpacity: 0,\n\t\t\tmap: outlearn_geo_data.map,\n\t\t\tcenter: outlearn_geo_data.center,\n\t\t\tradius: outlearn_geo_data.max_radius,\n\t\t});\n\n\t\toutlearn_geo_data.map.fitBounds(maxradius_circle.getBounds());\n\n\t\tmaxradius_circle.setMap(null);\n\t}\n\n\twindow.centerOnPlaceMarker = function(clicked_elem){\n\t\tvar marker = outlearn_geo_data.places.union[parseInt($(clicked_elem).parent().attr(\"marker-id\"))].marker;\n\t\toutlearn_geo_data.map.setCenter(marker.getPosition());\n\t\toutlearn_geo_data.map.setZoom(18);\n\n\t\tgoogle.maps.event.trigger(marker, 'click', {\n\t\t\tlatLng: marker.getPosition()\n\t\t});\n\n\t\t$([document.documentElement, document.body]).animate({\n\t\t\tscrollTop: $(\".outlearn-map-wrapper.geo-map-wrapper\").offset().top - 100\n\t\t}, 500);\n\t}\n\n\twindow.onGeoScoreCalcClick = function(){\n\t\tsetFormEditable(\"geographic\", false);\n\t\t$(\".outlearn-section-wrapper.geographic\").removeClass(\"error\");\n\n\t\tif(checkGeoForm()){\n\t\t\ttry{\n\t\t\t\tcodeAddress($('.outlearn-section-wrapper.geographic #postal_input').val(), $('.outlearn-section-wrapper.geographic #country_select').val(), \"geo\", true);\n\t\t\t}\n\t\t\tcatch(err){\n\t\t\t\tconsole.log(\"ERROR: \" + err);\n\t\t\t\t$(\".outlearn-section-wrapper.geographic\").addClass(\"error\");\n\t\t\t\tsetFormEditable(\"geographic\", true);\n\n\t\t\t\tsendEmailMessage(\"Erro em OutLearn Score - Geographic\", err);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tsetFormEditable(\"geographic\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.geographic .unanswered\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t}\n\n\tfunction checkGeoForm(){\n\t\tvar ready = true;\n\n\t\tif($('.outlearn-section-wrapper.geographic #country_select').val() === \"unselected\"){\n\t\t\tready = false;\n\t\t\t$('.outlearn-section-wrapper.geographic #country_select').addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$('.outlearn-section-wrapper.geographic #country_select').removeClass(\"unanswered\");\n\t\t}\n\n\t\tif($('.outlearn-section-wrapper.geographic #postal_input').val() === \"\"){\n\t\t\tready = false;\n\t\t\t$('.outlearn-section-wrapper.geographic #postal_input').addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$('.outlearn-section-wrapper.geographic #postal_input').removeClass(\"unanswered\");\n\t\t}\n\n\t\tif(!$('.outlearn-section-wrapper.geographic input[name=household_car]:checked').length){\n\t\t\tready = false;\n\t\t\t$('.outlearn-section-wrapper.geographic input[name=household_car]').addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$('.outlearn-section-wrapper.geographic input[name=household_car]').removeClass(\"unanswered\");\n\t\t}\n\n\t\treturn ready;\n\t}\n\n\twindow.onAddressChange = function(changed_elem){\n\t\tvar country_selects = $(\".country_select\");\n\t\tvar postal_inputs = $(\".postal_input\");\n\n\t\tif($(changed_elem).is(\"select\")){\n\t\t\tfor(var i = 0; i < country_selects.length; i++){\n\t\t\t\t$(country_selects[i]).val($(changed_elem).val());\n\t\t\t}\n\t\t} \n\n\t\tif($(changed_elem).is(\"input\")){\n\t\t\tfor(var i = 0; i < postal_inputs.length; i++){\n\t\t\t\t$(postal_inputs[i]).val($(changed_elem).val());\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction codeAddress(zip_code, country_code, context = \"geo\", submit = false) {\n\t\tif(typeof zip_code == 'number'){\n\t\t   zip_code = zip_code.toString();\n\t\t}\n\n\t\toutlearn_geocoder = new google.maps.Geocoder();\t\n\t\t\t\t\t\n\t\toutlearn_geocoder.geocode({\n\t\t\t'address': 'c\u00f3digo postal  '+ zip_code, \"componentRestrictions\":{\"country\":country_code}\n\t\t}, function (results, status) {\n\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\tif(context == \"geo\"){\n\t\t\t\t\tresetOutlearnGeoData();\n\n\t\t\t\t\toutlearn_geo_data.center_zip = zip_code;\n\t\t\t\t\toutlearn_geo_data.center_country = country_code;\n\n\t\t\t\t\toutlearn_geo_data.center = results[0].geometry.location;\n\n\n\t\t\t\t\toutlearn_geo_data.map.setCenter(outlearn_geo_data.center);\n\t\t\t\t\toutlearn_geo_data.map.setZoom(14);\n\n\t\t\t\t\toutlearn_geo_data.center_marker = new google.maps.Marker({\n\t\t\t\t\t\tmap: outlearn_geo_data.map,\n\t\t\t\t\t\tposition: outlearn_geo_data.center,\n\t\t\t\t\t\ticon: home_marker_icon\n\t\t\t\t\t});\n\n\t\t\t\t\tif(submit){\n\t\t\t\t\t\tif(outlearn_geo_data.bulk_processing.is){\n\t\t\t\t\t\t\toutlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"coords\"] = {\n\t\t\t\t\t\t\t\tlat: 0,\n\t\t\t\t\t\t\t\tlng: 0\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\toutlearn_bulk_zips[outlearn_geo_data.bulk_processing.index].coords.lat = outlearn_geo_data.center.lat();\n\t\t\t\t\t\t\toutlearn_bulk_zips[outlearn_geo_data.bulk_processing.index].coords.lng = outlearn_geo_data.center.lng();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tgetOutlearnGeoData();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(context == \"human\"){\n\t\t\t\t\tresetOutlearnHumanData();\n\n\t\t\t\t\toutlearn_human_data.center_zip = zip_code;\n\t\t\t\t\toutlearn_human_data.center_country = country_code;\n\n\t\t\t\t\toutlearn_human_data.center = results[0].geometry.location;\n\n\t\t\t\t\tif(submit){\n\t\t\t\t\t\tgetOutlearnHumanData();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tif(context == \"geo\"){\n\t\t\t\t\toutlearn_geo_data.center = null;\n\t\t\t\t\t$(\".outlearn-section-wrapper.geographic\").addClass(\"error\");\n\t\t\t\t}\n\n\t\t\t\tif(context == \"human\"){\n\t\t\t\t\toutlearn_human_data.center = null;\n\t\t\t\t\t$(\".outlearn-section-wrapper.geographic\").addClass(\"error\");\n\t\t\t\t}\n\n\t\t\t\tconsole.log(\"ERROR: Geocode was not successful: \" + status);\n\t\t\t}\n\t\t});\n\t}\n\n\twindow.toggleResultsSection = function(clicked_elem){\n\t\t$($(clicked_elem).closest(\".outlearn-section-results\")[0]).find(\".outlearn-section-results-body\").toggleClass(\"hidden\");\n\n\t\t$(clicked_elem).toggleClass(\"opened\");\n\t}\n\n\twindow.onGeoViewChange = function(form_elem){\n\t\tvar checked_input = $(form_elem).find(\"input:checked\");\n\t\tvar data_handle = checked_input.val() == \"public-transport\" ? \"public_transport\" : checked_input.val();\n\n\t\toutlearn_geo_data.view = data_handle;\n\n\t\tclearGeoMapDrawings();\n\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons[data_handle].length; i++){\n\t\t\toutlearn_geo_data.polygons[data_handle][i].setMap(outlearn_geo_data.map);\n\t\t}\n\n\t\tfor (const id in outlearn_geo_data.places[data_handle]) {\n\t\t\toutlearn_geo_data.places[data_handle][id].marker.setMap(outlearn_geo_data.map);\n\t\t}\n\n\t\t$(\".outlearn-map-overall-data-wrapper h5 span\").text(Math.round(outlearn_geo_data.area[data_handle]\/10000) + \" ha\");\n\n\t\tif(checked_input.val() == \"union\"){\n\t\t\tvar places_n = Object.keys(outlearn_geo_data.places.union).length + Object.keys(outlearn_geo_data.places.user).length;\n\t\t\t$(\".outlearn-map-overall-data-wrapper span.n-span\").text(places_n);\n\t\t}\n\t\telse\n\t\t\t$(\".outlearn-map-overall-data-wrapper span.n-span\").text(Object.keys(outlearn_geo_data.places[data_handle]).length);\n\n\t\tif(checked_input.val() == \"union\"){\n\t\t\t$(\".outlearn-placestype-list li\").removeClass(\"hidden\");\n\n\t\t\tfor(var i = 0; i < outlearn_geo_data.place_types.length; i++){\n\t\t\t\t$(\".outlearn-placestype-wrapper.\" + outlearn_geo_data.place_types[i] + \" h4 span\").text(\"(\" + $(\".outlearn-placestype-wrapper.\" + outlearn_geo_data.place_types[i] + \" .outlearn-placestype-list li\").length  + \")\");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-placestype-list li\").addClass(\"hidden\");\n\t\t\t$(\".outlearn-placestype-list li[\" + checked_input.val() + \"]\").removeClass(\"hidden\");\n\n\t\t\tfor(var i = 0; i < outlearn_geo_data.place_types.length; i++){\n\t\t\t\t$(\".outlearn-placestype-wrapper.\" + outlearn_geo_data.place_types[i] + \" h4 span\").text(\"(\" + $(\".outlearn-placestype-wrapper.\" + outlearn_geo_data.place_types[i] + \" .outlearn-placestype-list li[\" + checked_input.val() + \"]\").length  + \")\");\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction clearGeoMapDrawings(){\n\t\t\/\/ Geo Map -----------------------------------------------------------------------------\n\t\t\/\/Markers\/Places\n\t\tfor(const id in outlearn_geo_data.places.union) {\n\t\t\toutlearn_geo_data.places.union[id].marker.setMap(null);\n\t\t}\n\n\t\tfor(const id in outlearn_geo_data.places.excluded) {\n\t\t\toutlearn_geo_data.places.excluded[id].marker.setMap(null);\n\t\t}\n\n\t\t\/\/Polygons\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.union.length; i++){\n\t\t\toutlearn_geo_data.polygons.union[i].setMap(null);\n\t\t}\n\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.walking.length; i++){\n\t\t\toutlearn_geo_data.polygons.walking[i].setMap(null);\n\t\t}\n\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.public_transport.length; i++){\n\t\t\toutlearn_geo_data.polygons.public_transport[i].setMap(null);\n\t\t}\n\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.driving.length; i++){\n\t\t\toutlearn_geo_data.polygons.driving[i].setMap(null);\n\t\t}\n\t}\n\n\tfunction resetOutlearnGeoData(){\n\t\t\/\/ General --------------------------------------------------------------------------\n\t\ttraveltime_data = {};\n\t\toutlearn_geo_data.loaded = false;\n\n\t\t\/\/ Geo Map -----------------------------------------------------------------------------\n\t\t\/\/Markers\/Places\n\t\tif(outlearn_geo_data.center_marker)\n\t\t\toutlearn_geo_data.center_marker.setMap(null);\n\t\toutlearn_geo_data.center_marker = null;\n\n\t\tfor(const id in outlearn_geo_data.places.union) {\n\t\t\toutlearn_geo_data.places.union[id].marker.setMap(null);\n\t\t}\n\t\toutlearn_geo_data.places.union = {};\n\t\toutlearn_geo_data.places.walking = {};\n\t\toutlearn_geo_data.places.public_transport = {};\n\t\toutlearn_geo_data.places.driving = {};\n\n\t\tfor(const id in outlearn_geo_data.places.excluded) {\n\t\t\toutlearn_geo_data.places.excluded[id].marker.setMap(null);\n\t\t}\n\t\toutlearn_geo_data.places.excluded = {};\n\n\t\toutlearn_geo_data.places.types.union = {};\n\t\toutlearn_geo_data.places.types.nocar_union = {};\n\n\t\t\/\/Polygons\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.union.length; i++){\n\t\t\toutlearn_geo_data.polygons.union[i].setMap(null);\n\t\t}\n\t\toutlearn_geo_data.polygons.union = [];\n\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.walking.length; i++){\n\t\t\toutlearn_geo_data.polygons.walking[i].setMap(null);\n\t\t}\n\t\toutlearn_geo_data.polygons.walking = [];\n\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.public_transport.length; i++){\n\t\t\toutlearn_geo_data.polygons.public_transport[i].setMap(null);\n\t\t}\n\t\toutlearn_geo_data.polygons.public_transport = [];\n\n\t\tfor(var i = 0; i < outlearn_geo_data.polygons.driving.length; i++){\n\t\t\toutlearn_geo_data.polygons.driving[i].setMap(null);\n\t\t}\n\t\toutlearn_geo_data.polygons.driving = [];\n\n\t\t\/\/Data\n\t\toutlearn_geo_data.center = null;\n\t\toutlearn_geo_data.max_radius = 0;\n\t\toutlearn_geo_data.area.union = 0;\n\t\toutlearn_geo_data.processed_place_types = {};\n\n\t\tif(traveltime_params.departure_searches.some(el => el.id === \"outlearn-driving\")){\n\t\t\tvar arr_index = traveltime_params.departure_searches.findIndex(el => el.id === \"outlearn-driving\");\n\t\t\ttraveltime_params.departure_searches.splice(arr_index, 1);\n\t\t}\n\n\t\tif(traveltime_params.unions.some(el => el.id === \"outlearn-car-union\")){\t\n\t\t\tvar arr_index = traveltime_params.unions.findIndex(el => el.id === \"outlearn-car-union\");\n\t\t\ttraveltime_params.unions.splice(arr_index, 1);\n\t\t}\n\n\t\t\/\/ DOM Elements ---------------------------------------------------------------------\n\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-score span\").text(\"-\");\n\n\t\t$(\".outlearn-map-overall-data-wrapper span.area-span\").text(0 + \" ha\");\n\t\t$(\".outlearn-map-overall-data-wrapper span.n-span\").text(0);\n\t\t$(\".outlearn-geoview-filter form #outlearn-geoview-driving\").parent().remove();\n\n\t\t$(\".outlearn-placestype-wrapper .outlearn-placestype-list\").attr(\"n\", 0);\n\t\t$(\".outlearn-placestype-wrapper .outlearn-placestype-list\").html(\"\");\n\t\t$(\".outlearn-placestype-wrapper h4 span\").text(\"(\" + 0 + \")\");\n\t}\n\n\tfunction getBulkOutlearnGeoData(){\n\t\toutlearn_geo_data.bulk_processing.is = true;\n\n\t\tvar elem_num = outlearn_bulk_zips.length - outlearn_geo_data.bulk_processing.index;\n\t\tconsole.log(\"INFO: Processing element #\" + elem_num + \"\/\" + outlearn_bulk_zips.length + \", zip-code \" + outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"code\"] + \".\");\n\n\t\t$(\".outlearn-form .postal_input\").val(outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"code\"]);\n\n\t\tcodeAddress(outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"code\"], outlearn_bulk_zips[outlearn_geo_data.bulk_processing.index][\"country\"], \"geo\", true);\n\t}\n\n\tfunction getScoreParamsFromBulkGeoData(){\n\t\toutlearn_geo_data.score_params = {\n\t\t\tarea: {\n\t\t\t\tunion: [],\n\t\t\t\tnocar_union: []\n\t\t\t},\n\t\t\tplaces: {\n\t\t\t\tunion: {},\n\t\t\t\tnocar_union: {}\n\t\t\t}\n\t\t};\n\n\t\tfor(var i = 0; i < outlearn_bulk_zips.length; i++){\n\t\t\tif(outlearn_bulk_zips[i].area !== undefined){\n\t\t\t\toutlearn_geo_data.score_params.area.union.push(outlearn_bulk_zips[i].area.union);\n\t\t\t\toutlearn_geo_data.score_params.area.nocar_union.push(outlearn_bulk_zips[i].area.nocar_union);\n\n\t\t\t\tfor(var j = 0; j < outlearn_geo_data.place_types.length; j++){\n\t\t\t\t\tif(!(outlearn_geo_data.place_types[j] in outlearn_geo_data.score_params.places.union))\n\t\t\t\t\t\toutlearn_geo_data.score_params.places.union[outlearn_geo_data.place_types[j]] = [];\n\n\t\t\t\t\toutlearn_geo_data.score_params.places.union[outlearn_geo_data.place_types[j]].push(outlearn_bulk_zips[i].places.union[outlearn_geo_data.place_types[j]]);\n\t\t\t\t\t\n\n\t\t\t\t\tif(!(outlearn_geo_data.place_types[j] in outlearn_geo_data.score_params.places.nocar_union))\n\t\t\t\t\t\toutlearn_geo_data.score_params.places.nocar_union[outlearn_geo_data.place_types[j]] = [];\n\n\t\t\t\t\toutlearn_geo_data.score_params.places.nocar_union[outlearn_geo_data.place_types[j]].push(outlearn_bulk_zips[i].places.nocar_union[outlearn_geo_data.place_types[j]]);\n\t\t\t\t}\n\n\t\t\t\tif(!(\"total\" in outlearn_geo_data.score_params.places.union))\n\t\t\t\toutlearn_geo_data.score_params.places.union.total = [];\n\n\t\t\t\toutlearn_geo_data.score_params.places.union.total.push(outlearn_bulk_zips[i].places.union.total);\n\n\t\t\t\tif(!(\"total\" in outlearn_geo_data.score_params.places.nocar_union))\n\t\t\t\t\toutlearn_geo_data.score_params.places.nocar_union.total = [];\n\n\t\t\t\toutlearn_geo_data.score_params.places.nocar_union.total.push(outlearn_bulk_zips[i].places.nocar_union.total);\n\t\t\t}\n\t\t}\n\n\t\toutlearn_geo_data.score_params.area.union.sort(function(a, b){return a-b});\n\t\toutlearn_geo_data.score_params.area.nocar_union.sort(function(a, b){return a-b});\n\n\t\tfor(var j = 0; j < outlearn_geo_data.place_types.length; j++){\n\t\t\toutlearn_geo_data.score_params.places.union[outlearn_geo_data.place_types[j]].sort(function(a, b){return a-b});\n\t\t\toutlearn_geo_data.score_params.places.nocar_union[outlearn_geo_data.place_types[j]].sort(function(a, b){return a-b});\n\t\t}\n\n\t\toutlearn_geo_data.score_params.places.union.total.sort(function(a, b){return a-b});\n\t\toutlearn_geo_data.score_params.places.nocar_union.total.sort(function(a, b){return a-b});\n\t}\n\n\tfunction calcGeoScore(){\n\t\tvar score_obj = {\n\t\t\tarea_percentile: {\n\t\t\t\tunion: 0,\n\t\t\t\tnocar_union: 0,\n\t\t\t\tavg: 0\n\t\t\t},\n\t\t\tplaces_percentil_avg: {\n\t\t\t\tunion: 0,\n\t\t\t\tnocar_union: 0\n\t\t\t},\n\t\t\tscore_percentile: 0,\n\t\t\tlikert_val: 0\n\t\t};\n\n\t\tscore_obj.area_percentile.union = percentRank(outlearn_geo_data.score_params.area.union, outlearn_geo_data.area.union);\n\t\tscore_obj.area_percentile.nocar_union = percentRank(outlearn_geo_data.score_params.area.nocar_union, outlearn_geo_data.area.nocar_union);\n\t\t\n\t\tscore_obj.area_percentile.avg = (score_obj.area_percentile.union + score_obj.area_percentile.nocar_union)\/2;\n\n\t\tvar union_places_percentiles = [];\n\t\tvar nocar_union_places_percentiles = [];\n\n\t\tfor(var j = 0; j < outlearn_geo_data.place_types.length; j++){\n\t\t\tif(outlearn_geo_data.places.types.union[outlearn_geo_data.place_types[j]] !== undefined){\n\t\t\t\tif(outlearn_geo_data.places.types.union[outlearn_geo_data.place_types[j]].length > 0)\n\t\t\t\t\tunion_places_percentiles.push(percentRank(outlearn_geo_data.score_params.places.union[outlearn_geo_data.place_types[j]], outlearn_geo_data.places.types.union[outlearn_geo_data.place_types[j]].length));\n\t\t\t\telse\n\t\t\t\t\tunion_places_percentiles.push(0);\n\t\t\t}\n\t\t\telse\n\t\t\t\tunion_places_percentiles.push(0);\n\n\n\t\t\tif(outlearn_geo_data.places.types.nocar_union[outlearn_geo_data.place_types[j]] !== undefined){\n\t\t\t\tif(outlearn_geo_data.places.types.nocar_union[outlearn_geo_data.place_types[j]].length > 0)\n\t\t\t\t\tnocar_union_places_percentiles.push(percentRank(outlearn_geo_data.score_params.places.nocar_union[outlearn_geo_data.place_types[j]], outlearn_geo_data.places.types.nocar_union[outlearn_geo_data.place_types[j]].length));\n\t\t\t\telse\n\t\t\t\t\tnocar_union_places_percentiles.push(0);\n\t\t\t}\n\t\t\telse\n\t\t\t\tnocar_union_places_percentiles.push(0);\n\t\t}\n\n\t\tscore_obj.places_percentil_avg.union = average(union_places_percentiles);\n\n\t\tscore_obj.places_percentil_avg.nocar_union = average(nocar_union_places_percentiles);\n\n\t\tscore_obj.score_percentile = (score_obj.area_percentile.avg + score_obj.places_percentil_avg.union + score_obj.places_percentil_avg.nocar_union)\/3;\n\n\t\tif(score_obj.score_percentile < 0.2){\n\t\t\tscore_obj.likert_val = 1;\n\t\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-score span\").text(\"E\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.geographic span\").text(\"E\");\n\t\t}\n\t\tif(score_obj.score_percentile >= 0.2){\n\t\t\tscore_obj.likert_val = 2;\n\t\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-score span\").text(\"D\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.geographic span\").text(\"D\");\n\t\t}\n\t\t\n\t\tif(score_obj.score_percentile > 0.4){\n\t\t\tscore_obj.likert_val = 3;\n\t\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-score span\").text(\"C\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.geographic span\").text(\"C\");\n\t\t}\n\t\t\n\t\tif(score_obj.score_percentile > 0.6){\n\t\t\tscore_obj.likert_val = 4;\n\t\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-score span\").text(\"B\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.geographic span\").text(\"B\");\n\t\t}\n\t\t\n\t\tif(score_obj.score_percentile > 0.8){\n\t\t\tscore_obj.likert_val = 5;\n\t\t\t$(\".outlearn-section-wrapper.geographic .outlearn-section-score span\").text(\"A\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.geographic span\").text(\"A\");\n\t\t}\n\n\t\toutlearn_geo_data.scored = true;\n\t\toutlearn_overall_data.generated_scores.geographic = score_obj.likert_val;\n\n\t\tconsole.log(\"INFO: Calculated the Geo Score, resulting in the overall value of '\" + score_obj.score_percentile + \"'.\");\n\n\t\tif(outlearn_overall_data.processing){\n\t\t\t\/\/Trigger Human Sub-Score Calc\n\t\t\tcodeAddress($(\".outlearn-section-wrapper.human #postal_input\").val(), $(\".outlearn-section-wrapper.human #country_select\").val(), \"human\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.human .outlearn-section-score\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t\telse{\n\t\t\tcalcOverallScore();\n\n\t\t\tsetFormEditable(\"geographic\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.geographic .outlearn-section-score\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\n\t\toutlearn_geo_data.score = score_obj;\n\n\t\treturn score_obj;\n\t}\n\n\twindow.onHumanScoreCalcClick = function(){\n\t\tsetFormEditable(\"human\", false);\n\t\t$(\".outlearn-section-wrapper.human\").removeClass(\"error\");\n\n\t\tif(checkHumanForm()){\n\t\t\ttry{\n\t\t\t\tcodeAddress($(\".outlearn-section-wrapper.human #postal_input\").val(), $(\".outlearn-section-wrapper.human #country_select\").val(), \"human\", true);\n\t\t\t}\n\t\t\tcatch(err){\n\t\t\t\tconsole.log(\"ERROR: \" + err);\n\t\t\t\t$(\".outlearn-section-wrapper.human\").addClass(\"error\");\n\t\t\t\tsetFormEditable(\"human\", true);\n\n\t\t\t\tsendEmailMessage(\"Erro em OutLearn Score - Human\", err);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tsetFormEditable(\"human\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.human .unanswered\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t}\n\n\tfunction checkHumanForm(){\n\t\tvar ready = true;\n\n\t\tif($('.outlearn-section-wrapper.human #country_select').val() === \"unselected\"){\n\t\t\tready = false;\n\t\t\t$('.outlearn-section-wrapper.human #country_select').addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$('.outlearn-section-wrapper.human #country_select').removeClass(\"unanswered\");\n\t\t}\n\n\t\tif($(\".outlearn-section-wrapper.human #postal_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.human #postal_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse\n\t\t\t$(\".outlearn-section-wrapper.human #postal_input\").removeClass(\"unanswered\");\n\n\n\t\tif($(\".outlearn-section-wrapper.human #caregivers_num_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.human #caregivers_num_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.human #caregivers_num_input\").removeClass(\"unanswered\");\n\n\t\t\tvar caregivers_num = parseInt($(\".outlearn-section-wrapper.human #caregivers_num_input\").val());\n\n\t\t\n\t\t\tfor(var i = 1; i <= caregivers_num; i++){\n\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_education\").val() == \"unselected\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_education\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_education\").removeClass(\"unanswered\");\n\n\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_occupation\").val() == \"unselected\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_occupation\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_occupation\").removeClass(\"unanswered\");\n\n\t\t\t\tvar occupation = $(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_occupation\").val();\n\n\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workhours\").val() == \"\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workhours\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workhours\").removeClass(\"unanswered\");\t\n\n\t\t\t\tif(occupation == \"employed\" || occupation == \"self-employed\" || occupation == \"student\"){\t\t\t\n\t\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workstart\").val() == \"\"){\n\t\t\t\t\t\tready = false;\n\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workstart\").addClass(\"unanswered\");\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workstart\").removeClass(\"unanswered\");\n\n\t\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workend\").val() == \"\"){\n\t\t\t\t\t\tready = false;\n\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workend\").addClass(\"unanswered\");\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workend\").removeClass(\"unanswered\");\n\n\t\t\t\t\tif(!$(\"#caregiver_\" + i + \"_li .caregiver_workday_checkbox:checked\").length){\n\t\t\t\t\t\tready = false;\n\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li .caregiver_workday_checkbox\").addClass(\"unanswered\");\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li .caregiver_workday_checkbox\").removeClass(\"unanswered\");\n\n\t\t\t\t\tif(occupation == \"employed\" || occupation == \"self-employed\"){\n\t\t\t\t\t\t\/*\n\t\t\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_employed_occupation\").val() == \"unselected\"){\n\t\t\t\t\t\t\tready = false;\n\t\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_employed_occupation\").addClass(\"unanswered\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_employed_occupation\").removeClass(\"unanswered\");\n\t\t\t\t\t\t*\/\n\n\t\t\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_worklocation\").val() == \"unselected\"){\n\t\t\t\t\t\t\tready = false;\n\t\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_worklocation\").addClass(\"unanswered\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_worklocation\").removeClass(\"unanswered\");\n\n\t\t\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_traveldays\").val() == \"\"){\n\t\t\t\t\t\t\tready = false;\n\t\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_traveldays\").addClass(\"unanswered\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_traveldays\").removeClass(\"unanswered\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($(\".outlearn-section-wrapper.human #children_num_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.human #children_num_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.human #children_num_input\").removeClass(\"unanswered\");\n\n\t\t\tvar children_num = parseInt($(\".outlearn-section-wrapper.human #children_num_input\").val());\n\n\t\t\tfor(var i = 1; i <= children_num; i++){\n\t\t\t\tif($(\"#child_\" + i + \"_li #child_\" + i + \"_age\").val() == \"\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#child_\" + i + \"_li #child_\" + i + \"_age\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#child_\" + i + \"_li #child_\" + i + \"_age\").removeClass(\"unanswered\");\n\n\t\t\t\tif($(\"#child_\" + i + \"_li #child_\" + i + \"_custody\").val() == \"unselected\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#child_\" + i + \"_li #child_\" + i + \"_custody\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#child_\" + i + \"_li #child_\" + i + \"_custody\").removeClass(\"unanswered\");\n\t\t\t}\n\t\t}\n\n\t\tif($(\".outlearn-section-wrapper.human #support_num_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.human #support_num_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.human #support_num_input\").removeClass(\"unanswered\");\n\n\t\t\tvar support_num = parseInt($(\".outlearn-section-wrapper.human #support_num_input\").val());\n\n\t\t\tfor(var i = 1; i <= support_num; i++){\n\t\t\t\tif($(\"#support_\" + i + \"_li #support_\" + i + \"_education\").val() == \"unselected\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_education\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_education\").removeClass(\"unanswered\");\n\n\t\t\t\tif($(\"#support_\" + i + \"_li #support_\" + i + \"_relationship\").val() == \"unselected\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_relationship\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_relationship\").removeClass(\"unanswered\");\n\n\t\t\t\tif($(\"#support_\" + i + \"_li #support_\" + i + \"_supporthours\").val() == \"\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_supporthours\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_supporthours\").removeClass(\"unanswered\");\n\n\t\t\t\tif($(\"#support_\" + i + \"_li #support_\" + i + \"_address\").val() == \"\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_address\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#support_\" + i + \"_li #support_\" + i + \"_address\").removeClass(\"unanswered\");\n\t\t\t}\n\t\t}\n\n\t\treturn ready;\n\t}\n\n\tfunction getOutlearnHumanData(){\n\t\tvar caregivers_num = parseInt($(\".outlearn-section-wrapper.human #caregivers_num_input\").val());\n\t\tvar children_num = parseInt($(\".outlearn-section-wrapper.human #children_num_input\").val());\n\t\tvar support_num = parseInt($(\".outlearn-section-wrapper.human #support_num_input\").val());\n\n\t\tvar caregiver_data = {};\n\t\tvar child_data = {};\n\t\tvar supporter_data = {};\n\n\t\toutlearn_human_data.center_zip = $('#postal_input').val();\n\n\t\t$(\".outlearn-section-wrapper.human\").removeClass(\"error\");\n\t\t\n\t\tfor(var i = 1; i <= caregivers_num; i++){\n\t\t\tcaregiver_data = {};\n\n\t\t\tcaregiver_data.education = $(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_education\").val();\n\t\t\tcaregiver_data.occupation = $(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_occupation\").val();\n\n\t\t\tcaregiver_data.workhours = parseInt($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workhours\").val());\n\n\t\t\tif(caregiver_data.occupation == \"employed\" || caregiver_data.occupation == \"self-employed\" || caregiver_data.occupation == \"student\"){\n\t\t\t\tcaregiver_data.workschedule = {\n\t\t\t\t\tstart: $(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workstart\").val(),\n\t\t\t\t\tend: $(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workend\").val()\n\t\t\t\t};\n\n\t\t\t\tcaregiver_data.workweekdays = {\n\t\t\t\t\tnum: 0,\n\t\t\t\t\tlist: []\n\t\t\t\t};\n\t\t\t\tvar workday_codes = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"];\n\t\t\t\t\n\t\t\t\tfor(var j = 0; j < 7; j++){\n\t\t\t\t\tif($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workday_\" +workday_codes[j]).is(\":checked\"))\n\t\t\t\t\t\tcaregiver_data.workweekdays.num++;\n\n\t\t\t\t\tcaregiver_data.workweekdays.list.push($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_workday_\" +workday_codes[j]).is(\":checked\"));\n\t\t\t\t}\n\n\t\t\t\tcaregiver_data.worklocation = $(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_worklocation\").val();\n\n\t\t\t\tcaregiver_data.traveldays = parseInt($(\"#caregiver_\" + i + \"_li #caregiver_\" + i + \"_traveldays\").val());\n\t\t\t}\n\n\t\t\toutlearn_human_data.caregivers.push(caregiver_data);\n\t\t}\n\n\t\tfor(var i = 1; i <= children_num; i++){\n\t\t\tchild_data = {};\n\n\t\t\tchild_data.age = parseInt($(\"#child_\" + i + \"_li #child_\" + i + \"_age\").val());\n\t\t\tchild_data.custody = $(\"#child_\" + i + \"_li #child_\" + i + \"_custody\").val();\n\n\t\t\toutlearn_human_data.children.push(child_data);\n\t\t}\n\n\t\tif((outlearn_human_data.center == outlearn_geo_data.center && (outlearn_geo_data.polygons.walking.length && outlearn_geo_data.polygons.public_transport.length && outlearn_geo_data.polygons.driving.length)) || (outlearn_human_data.polygons.walking.length && outlearn_human_data.polygons.public_transport.length && outlearn_human_data.polygons.driving.length)){\n\t\t\tvar past_data_source = \"\";\n\n\t\t\tif((outlearn_human_data.center == outlearn_geo_data.center && (outlearn_geo_data.polygons.walking.length && outlearn_geo_data.polygons.public_transport.length && outlearn_geo_data.polygons.driving.length)) && (!outlearn_human_data.polygons.walking.length || !outlearn_human_data.polygons.public_transport.length || !outlearn_human_data.polygons.driving.length)){\n\t\t\t\toutlearn_human_data.polygons = Object.assign({}, outlearn_geo_data.polygons);\n\t\t\t\tpast_data_source = \"geographic\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\tpast_data_source = \"human\";\n\t\t\t}\n\n\t\t\tfor(var i = 1; i <= support_num; i++){\n\t\t\t\tsupporter_data = {};\n\n\t\t\t\tsupporter_data.education = $(\"#support_\" + i + \"_li #support_\" + i + \"_education\").val();\n\t\t\t\tsupporter_data.relationship = $(\"#support_\" + i + \"_li #support_\" + i + \"_relationship\").val();\n\t\t\t\tsupporter_data.supporthours = parseInt($(\"#support_\" + i + \"_li #support_\" + i + \"_supporthours\").val());\n\t\t\t\tsupporter_data.address_zip = $(\"#support_\" + i + \"_li #support_\" + i + \"_address\").val();\n\n\t\t\t\toutlearn_human_data.support.push(supporter_data);\n\t\t\t\t\n\t\t\t\t(function (i) {\t\n\t\t\t\t\tvar supporter_geocoder = new google.maps.Geocoder();\n\n\t\t\t\t\tsupporter_geocoder.geocode({\n\t\t\t\t\t\t'address': 'c\u00f3digo postal  '+ outlearn_human_data.support[i-1].address_zip, \"componentRestrictions\":{\"country\": outlearn_human_data.center_country}\n\t\t\t\t\t}, function (results, status) {\n\t\t\t\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\t\t\toutlearn_human_data.support[i-1].center = results[0].geometry.location;\n\n\t\t\t\t\t\t\toutlearn_human_data.support[i-1].is_under = {\n\t\t\t\t\t\t\t\twalking: checkLocationUnderPolygons(outlearn_human_data.polygons.walking, outlearn_human_data.support[i-1].center),\n\t\t\t\t\t\t\t\tpublic_transport: checkLocationUnderPolygons(outlearn_human_data.polygons.public_transport, outlearn_human_data.support[i-1].center),\n\t\t\t\t\t\t\t\tdriving: checkLocationUnderPolygons(outlearn_human_data.polygons.driving, outlearn_human_data.support[i-1].center)\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\tconsole.log(\"INFO: Support Caregiver #\"+i+\" human data processed.\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$(\".outlearn-section-wrapper.human\").addClass(\"error\");\n\n\t\t\t\t\t\t\tconsole.log(\"ERROR: Geocode was not successful: \" + status);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t})(i);\n\n\t\t\t\tconsole.log(\"INFO: Human data TravelTime polygons (walking, public transport and driving) retrieved from previously collected \" + past_data_source +\" data.\");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tvar aux_traveltime_params = Object.assign({}, traveltime_params);\n\n\t\t\t\/\/Public Transportation query config\n\t\t\taux_traveltime_params.departure_searches[0].coords.lat = outlearn_human_data.center.lat();\n\t\t\taux_traveltime_params.departure_searches[0].coords.lng = outlearn_human_data.center.lng();\n\n\t\t\t\/\/Walking query config\n\t\t\taux_traveltime_params.departure_searches[1].coords.lat = outlearn_human_data.center.lat();\n\t\t\taux_traveltime_params.departure_searches[1].coords.lng = outlearn_human_data.center.lng();\n\n\t\t\t\/\/Driving query config\n\t\t\tif(!aux_traveltime_params.departure_searches.filter(obj => { return obj.id === 'outlearn-driving' }).length){\n\t\t\t\tvar car_departure_search_params = {\n\t\t\t\t\tid: \"outlearn-driving\",\n\t\t\t\t\tcoords: {\n\t\t\t\t\t\tlat: outlearn_human_data.center.lat(),\n\t\t\t\t\t\tlng: outlearn_human_data.center.lng()\n\t\t\t\t\t},\n\t\t\t\t\tdeparture_time: getDateLastOccurence(\"Wed\", \"ISO\"),\n\t\t\t\t\ttravel_time: 900,\n\t\t\t\t\ttransportation: {\n\t\t\t\t\t\ttype: \"driving\"\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\taux_traveltime_params.departure_searches.push(car_departure_search_params);\n\t\t\t}\n\n\t\t\tif(aux_traveltime_params.unions){\n\t\t\t\tdelete aux_traveltime_params.unions;\n\t\t\t}\n\n\t\t\t$.ajax({ \n\t\t\t\turl: traveltime_url, \n\t\t\t\tdata: JSON.stringify(aux_traveltime_params),\n\t\t\t\ttype: 'POST',\n\t\t\t\tbeforeSend: function(xhr) {\n\t\t\t\t\txhr.setRequestHeader(\"X-Host-Override\", \"api.traveltimeapp.com\");\n\t\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application\/json\");\n\t\t\t\t\txhr.setRequestHeader(\"Accept\", \"application\/json\");\n\t\t\t\t\txhr.setRequestHeader(\"X-Application-Id\", traveltime_cred.app_id);\n\t\t\t\t\txhr.setRequestHeader(\"X-Api-Key\", traveltime_cred.api_key);\n\t\t\t\t},\n\t\t\t\tsuccess: function (data) {\n\t\t\t\t\tvar traveltime_data = data.results;\n\t\t\t\t\tvar draw_data;\n\n\t\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-walking' })[0];\n\t\t\t\t\tdrawPolygons(draw_data, false, outlearn_human_data.polygons, \"walking\");\n\n\t\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-public-transport' })[0];\n\t\t\t\t\tdrawPolygons(draw_data, false, outlearn_human_data.polygons, \"public_transport\");\n\n\t\t\t\t\tdraw_data = traveltime_data.filter(obj => { return obj.search_id === 'outlearn-driving' })[0];\n\t\t\t\t\tdrawPolygons(draw_data, false, outlearn_human_data.polygons, \"driving\");\n\n\t\t\t\t\tfor(var i = 1; i <= support_num; i++){\n\t\t\t\t\t\tsupporter_data = {};\n\n\t\t\t\t\t\tsupporter_data.education = $(\"#support_\" + i + \"_li #support_\" + i + \"_education\").val();\n\t\t\t\t\t\tsupporter_data.relationship = $(\"#support_\" + i + \"_li #support_\" + i + \"_relationship\").val();\n\t\t\t\t\t\tsupporter_data.supporthours = parseInt($(\"#support_\" + i + \"_li #support_\" + i + \"_supporthours\").val());\n\t\t\t\t\t\tsupporter_data.address_zip = $(\"#support_\" + i + \"_li #support_\" + i + \"_address\").val();\n\n\t\t\t\t\t\toutlearn_human_data.support.push(supporter_data);\n\t\t\t\t\t\n\t\t\t\t\t\t(function (i) {\t\n\t\t\t\t\t\t\tvar supporter_geocoder = new google.maps.Geocoder();\n\n\t\t\t\t\t\t\tsupporter_geocoder.geocode({\n\t\t\t\t\t\t\t\t'address': 'c\u00f3digo postal  '+ outlearn_human_data.support[i-1].address_zip, \"componentRestrictions\":{\"country\": outlearn_human_data.center_country}\n\t\t\t\t\t\t\t}, function (results, status) {\n\t\t\t\t\t\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\t\t\t\t\toutlearn_human_data.support[i-1].center = results[0].geometry.location;\n\n\t\t\t\t\t\t\t\t\toutlearn_human_data.support[i-1].is_under = {\n\t\t\t\t\t\t\t\t\t\twalking: checkLocationUnderPolygons(outlearn_human_data.polygons.walking, outlearn_human_data.support[i-1].center),\n\t\t\t\t\t\t\t\t\t\tpublic_transport: checkLocationUnderPolygons(outlearn_human_data.polygons.public_transport, outlearn_human_data.support[i-1].center),\n\t\t\t\t\t\t\t\t\t\tdriving: checkLocationUnderPolygons(outlearn_human_data.polygons.driving, outlearn_human_data.support[i-1].center)\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\tconsole.log(\"INFO: Support Caregiver #\"+i+\" human data processed.\");\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$(\".outlearn-section-wrapper.human\").addClass(\"error\");\n\n\t\t\t\t\t\t\t\t\tconsole.log(\"ERROR: Geocode was not successful: \" + status);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})(i);\n\t\t\t\t\t}\n\n\t\t\t\t\tconsole.log(\"INFO: Human data TravelTime polygons (walking, public transport and driving) retrieved from an API call.\");\n\t\t\t\t},\n\t\t\t\terror: function(equestObject, error, errorThrown){\n\t\t\t\t\tconsole.log(\"ERROR: \" + errorThrown);\n\t\t\t\t\n\t\t\t\t\tclearInterval(outlearn_human_data.processing.interval);\n\t\t\t\t\t\n\t\t\t\t\t$(\".outlearn-section-wrapper.human\").addClass(\"error\");\n\t\t\t\t\tsetFormEditable(\"human\", true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\toutlearn_human_data.processing.interval = setInterval(function(support_num){\n\t\t\ttry{\n\t\t\t\tvar processed = 0;\n\t\t\t\t\n\t\t\t\tfor(var i = 0; i < support_num; i++){\n\t\t\t\t\tif(outlearn_human_data.support[i]){\n\t\t\t\t\t\tif(outlearn_human_data.support[i].is_under){\n\t\t\t\t\t\t\tif(outlearn_human_data.support[i].is_under.walking != null && outlearn_human_data.support[i].is_under.public_transport != null && outlearn_human_data.support[i].is_under.driving != null)\n\t\t\t\t\t\t\t\tprocessed++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(processed == support_num){\n\t\t\t\t\tclearInterval(outlearn_human_data.processing.interval);\n\t\t\t\t\tcalcHumanScore();\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(err){\n\t\t\t\tconsole.log(\"ERROR: \" + err);\n\t\t\t\t\n\t\t\t\tclearInterval(outlearn_human_data.processing.interval);\n\t\t\t\t\n\t\t\t\t$(\".outlearn-section-wrapper.human\").addClass(\"error\");\n\t\t\t\tsetFormEditable(\"human\", true);\n\n\t\t\t\tsendEmailMessage(\"Erro em OutLearn Score - Human\", err);\n\t\t\t}\n\t\t}, 500, support_num);\n\t}\n\n\tfunction resetOutlearnHumanData(){\n\t\tvar current_zip = $(\".outlearn-section-wrapper.human #postal_input\").val();\n\t\tvar current_country = $(\".outlearn-section-wrapper.human #country_select\").val();\n\t\t\n\t\tif(current_zip != outlearn_human_data.center_zip || current_country != outlearn_human_data.center_country){\n\t\t\toutlearn_human_data.center = null;\n\t\t\toutlearn_human_data.center_zip = null;\n\t\t\toutlearn_human_data.center_country = null;\n\t\t\toutlearn_human_data.polygons = {\n\t\t\t\twalking: [],\n\t\t\t\tpublic_transport: [],\n\t\t\t\tdriving: []\n\t\t\t};\n\t\t}\n\n\t\toutlearn_human_data.caregivers = [];\n\t\toutlearn_human_data.children = [];\n\t\toutlearn_human_data.support = [];\n\t\toutlearn_human_data.processing.interval = null;\n\t\toutlearn_human_data.processing.is = false;\n\t}\n\n\twindow.onHumanNumInput = function(input_elem, target){\n\t\tvar selected_n = parseInt($(input_elem).val());\n\n\t\tvar ul = $($(input_elem).closest(\".form-row.human-row\")[0]).find(\"ul.\" + target + \"-list\");\n\n\t\tvar current_n = ul.find(\"li.human_li\").length;\n\n\t\tvar diff_n = selected_n - current_n;\n\n\t\tif(diff_n > 0){\n\t\t\tfor(var i = current_n + 1; i <= selected_n; i++){\n\t\t\t\tif(target == \"caregivers\"){\n\t\t\t\t\tvar li = \"<li class='human_li' id='caregiver_\" + i + \"_li'><div class='title'><label><b>Caregiver (#<span>\" + i + \"<\/span>)<\/b><\/label><a class='viewtoggle-button' onclick='onHumanCardViewToggleClick(this)'><i class='fa-solid fa-chevron-up'><\/i><\/a><a class='remove-button' onclick='onHumanCardRemoveClick(this, \\\"\" + target + \"\\\")'><i class='fa-solid fa-xmark'><\/i><\/a><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='caregiver_\" + i + \"_education'>Education:<\/label><select id='caregiver_\" + i + \"_education' class='caregiver_education_select' name='caregiver_\" + i + \"_education'><option value='unselected'>(Select)<\/option><option value='primary'>Primary<\/option><option value='secondary'>Secondary<\/option><option value='tertiary'>Tertiary<\/option><option value='bachelor'>Bachelor's or Equivalent<\/option><option value='master'>Master's or Equivalent<\/option><option value='doctoral'>Doctoral or Equivalent<\/option><\/select><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='caregiver_\" + i + \"_occupation'>Occupation:<\/label><select id='caregiver_\" + i + \"_occupation' class='caregiver_occupation_select' name='caregiver_\" + i + \"_occupation' onchange='onOccupationChange(this)'><option value='unselected'>(Select)<\/option><option value='employed'>Employed<\/option><option value='self-employed'>Self-Employed<\/option><option value='unemployed'>Unemployed<\/option><option value='retired'>Retired<\/option><option value='student'>Student<\/option><\/select><\/div>\";\n\n\t\t\t\t\t\/\/li += \"<div class='input-wrapper hidden'><select id='caregiver_\" + i + \"_employed_occupation' class='caregiver_employed_occupation_select' name='caregiver_\" + i + \"_employed_occupation'> <option value='unselected'>(Select)<\/option> <optgroup label='Armed Forces Occupation' value='0'> <option value='1'>Commissioned Armed Forces Officer<\/option> <option value='2'>Non-commissioned Armed Forces Officer<\/option> <option value='3'>Armed Forces Occupation, Other Ranks<\/option> <\/optgroup> <optgroup label='Manager' value='1'> <option value='11'>Chief Executive, Senior Official or Legislator<\/option> <option value='12'>Administrative or Commercial Manager<\/option> <option value='13'>Production or Specialized Services Manager<\/option> <option value='14'>Hospitality, Retail or Other Services Manager<\/option> <\/optgroup> <optgroup label='Professional' value='2'> <option value='21'>Science or Engineering Professional<\/option> <option value='22'>Health Professional<\/option> <option value='23'>Teaching Professional<\/option> <option value='24'>Business and Administration Professional<\/option> <option value='25'>Information and Communications Technology Professional<\/option> <option value='26'>Legal, Social or Cultural Professional<\/option> <\/optgroup> <optgroup label='Technicians or Associate Professional' value='3'> <option value='31'>Science or Engineering Associate Professional<\/option> <option value='32'>Health Associate Professional<\/option> <option value='33'>Business and Administration Associate Professional<\/option> <option value='34'>Legal, Social, Cultural or Related Associate Professional<\/option> <option value='35'>Information and Communications Technician<\/option> <\/optgroup> <optgroup label='Clerical Support Worker' value='4'> <option value='41'>General or Keyboard Clerk<\/option> <option value='42'>Customer Services Clerk<\/option> <option value='43'>Numerical or Material Recording Clerk<\/option> <option value='44'>Other Clerical Support Worker<\/option> <\/optgroup> <optgroup label='Services or Sales Worker' value='5'> <option value='51'>Personal Services Worker<\/option> <option value='52'>Sales Worker<\/option> <option value='53'>Personal Care Worker<\/option> <option value='54'>Protective Services Worker<\/option> <\/optgroup> <optgroup label='Skilled Agricultural, Forestry or Fishery Worker' value='6'> <option value='61'>Market-oriented Skilled Agricultural Worker<\/option> <option value='62'>Market-oriented Skilled Forestry, Fishery or Hunting Worker<\/option> <option value='63'>Subsistence Farmer, Fisher, Hunter or Gatherer<\/option> <\/optgroup> <optgroup label='Craft or Related Trades Worker' value='7'> <option value='71'>Building or Related Trades Worker (excluding Electricians)<\/option> <option value='72'>Metal, Machinery or Related Trades Worker<\/option> <option value='73'>Handicraft or Printing Worker<\/option> <option value='74'>Electrical and Electronics Trades Worker<\/option> <option value='75'>Food Processing, Woodworking, Garment or Other Craft and Related Trades Worker<\/option> <\/optgroup> <optgroup label='Plant or Machine Operator or Assembler' value='8'> <option value='81'>Stationary Plant or Machine Operator<\/option> <option value='82'>Assembler<\/option> <option value='83'>Driver or Mobile Plant Operator<\/option> <\/optgroup> <optgroup label='Elementary Occupation' value='9'> <option value='91'>Cleaner or Helper<\/option> <option value='92'>Agricultural, Forestry or Fishery Labourer<\/option> <option value='93'>Labourer in Mining, Construction, Manufacturing or Transport<\/option> <option value='94'>Food Preparation Assistant<\/option> <option value='95'>Street and Related Sales or Services Worker<\/option> <option value='96'>Refuse Worker or Other Elementary Worker<\/option> <\/optgroup> <\/select> <\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-row-wrapper'><label>Hours of Occupation per Week:<\/label><p>( <i class='fa-solid fa-circle-exclamation'><\/i> Account also any time spent with recurring medical assistance and\/or other priority occupation, excluding children caregiving)<\/p><input type='number' min='0' id='caregiver_\" + i + \"_workhours' class='caregiver_workhours_input' name='caregiver_\" + i + \"_workhours'\/><\/div>\";\n\t\t\t\t\t\n\t\t\t\t\tli += \"<div class='work-details-form hidden'>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label>Typical Schedule of Occupation:<\/label><div class='input-row-wrapper'><div class='input-wrapper'><label for='caregiver_\" + i + \"_workstart'>Start Time:<\/label><input type='time' id='caregiver_\" + i + \"_workstart' class='caregiver_workstart_input' name='caregiver_\" + i + \"_workstart'\/><\/div><div class='input-wrapper'><label for='caregiver_\" + i + \"_workend'>End Time:<\/label><input type='time' id='caregiver_\" + i + \"_workend' class='caregiver_workend_input' name='caregiver_\" + i + \"_workend'\/><\/div><\/div><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-row-wrapper'><label>Weekdays with Occupation:<\/label><div class='input-wrapper checkbox'><label for='caregiver_\" + i + \"_workday_mon'>Mon<\/label><input type='checkbox' class='caregiver_workday_checkbox' id='caregiver_\" + i + \"_workday_mon' name='caregiver_\" + i + \"_workdays' value='mon'><\/div><div class='input-wrapper checkbox'><label for='caregiver_\" + i + \"_workday_tue'>Tue<\/label><input type='checkbox' class='caregiver_workday_checkbox' id='caregiver_\" + i + \"_workday_tue' name='caregiver_\" + i + \"_workdays' value='tue'><\/div><div class='input-wrapper checkbox'><label for='caregiver_\" + i + \"_workday_wed'>Wed<\/label><input type='checkbox' class='caregiver_workday_checkbox' id='caregiver_\" + i + \"_workday_wed' name='caregiver_\" + i + \"_workdays' value='wed'><\/div><div class='input-wrapper checkbox'><label for='caregiver_\" + i + \"_workday_thu'>Thu<\/label><input type='checkbox' class='caregiver_workday_checkbox' id='caregiver_\" + i + \"_workday_thu' name='caregiver_\" + i + \"_workdays' value='thu'><\/div><div class='input-wrapper checkbox'><label for='caregiver_\" + i + \"_workday_fri'>Fri<\/label><input type='checkbox' class='caregiver_workday_checkbox' id='caregiver_\" + i + \"_workday_fri' name='caregiver_\" + i + \"_workdays' value='fri'><\/div><div class='input-wrapper checkbox'><label for='caregiver_\" + i + \"_workday_sat'>Sat<\/label><input type='checkbox' class='caregiver_workday_checkbox' id='caregiver_\" + i + \"_workday_sat' name='caregiver_\" + i + \"_workdays' value='sat'><\/div><div class='input-wrapper checkbox'><label for='caregiver_\" + i + \"_workday_sun'>Sun<\/label><input type='checkbox' class='caregiver_workday_checkbox' id='caregiver_\" + i + \"_workday_sun' name='caregiver_\" + i + \"_workdays' value='sun'><\/div><\/div>\";\n\t\t\t\t\t\n\t\t\t\t\tli += \"<div class='input-wrapper hidden'><label for='caregiver_\" + i + \"_worklocation'>Occupation Location:<\/label><select id='caregiver_\" + i + \"_worklocation' class='caregiver_worklocation_select' name='caregiver_\" + i + \"_worklocation'><option value='unselected'>(Select)<\/option><option value='home'>Home<\/option><option value='work-place'>Work Place<\/option><option value='hybrid'>Hybrid (Home\/Work Place)<\/option><\/select><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-row-wrapper'><div class='input-wrapper fullwidth hidden'><label for='caregiver_\" + i + \"_traveldays'>Days on Occupation-Related Travel per Year<\/label><input type='number' min='0' id='caregiver_\" + i + \"_traveldays' class='caregiver_traveldays_input' name='caregiver_\" + i + \"_traveldays'\/><\/div><\/div>\";\n\n\t\t\t\t\tli += \"<\/div>\";\n\n\t\t\t\t\tli += \"<\/li>\";\n\t\t\t\t}\n\n\t\t\t\tif(target == \"children\"){\n\t\t\t\t\tvar li = \"<li class='human_li' id='child_\" + i + \"_li'><div class='title'><label><b>Child (#<span>\" + i + \"<\/span>)<\/b><\/label><a class='viewtoggle-button' onclick='onHumanCardViewToggleClick(this)'><i class='fa-solid fa-chevron-up'><\/i><\/a><a class='remove-button' onclick='onHumanCardRemoveClick(this, \\\"\" + target + \"\\\")'><i class='fa-solid fa-xmark'><\/i><\/a><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='child_\" + i + \"_age'>Age:<\/label><input type='number' min='0' id='child_\" + i + \"_age' class='child_age_input' name='child_\" + i + \"_age'\/><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='child_\" + i + \"_custody'>Custody:<\/label><select id='child_\" + i + \"_custody' class='child_custody_select' name='child_\" + i + \"_custody'><option value='unselected'>(Select)<\/option><option value='full'>Full<\/option><option value='shared'>Shared<\/option><\/select><\/div>\";\n\n\t\t\t\t\tli += \"<\/li>\";\n\t\t\t\t}\n\n\t\t\t\tif(target == \"support\"){\n\t\t\t\t\tvar li = \"<li class='human_li' id='support_\" + i + \"_li'><div class='title'><label><b>Support Caregiver (#<span>\" + i + \"<\/span>)<\/b><\/label><a class='viewtoggle-button' onclick='onHumanCardViewToggleClick(this)'><i class='fa-solid fa-chevron-up'><\/i><\/a><a class='remove-button' onclick='onHumanCardRemoveClick(this, \\\"\" + target + \"\\\")'><i class='fa-solid fa-xmark'><\/i><\/a><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='support_\" + i + \"_relationship'>Relationship:<\/label><select id='support_\" + i + \"_relationship' class='support_relationship_select' name='support_\" + i + \"_relationship'><option value='unselected'>(Select)<\/option><option value='family'>Family\/Friend<\/option><option value='contracted'>Contracted<\/option><\/select><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='support_\" + i + \"_education'>Education:<\/label><select id='support_\" + i + \"_education' class='support_education_select' name='support_\" + i + \"_education'><option value='unselected'>(Select)<\/option><option value='primary'>Primary<\/option><option value='secondary'>Secondary<\/option><option value='tertiary'>Tertiary<\/option><option value='bachelor'>Bachelor's or Equivalent<\/option><option value='master'>Master's or Equivalent<\/option><option value='doctoral'>Doctoral or Equivalent<\/option><\/select><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-row-wrapper'><label>Hours of Support per Week:<\/label><input type='number' min='0' id='support_\" + i + \"_supporthours' class='support_supporthours_input' name='support_\" + i + \"_supporthours'\/><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='support_\" + i + \"_address'>Address Zip-Code:<\/label><input type='text' id='support_\" + i + \"_address' class='support_address_input' name='support_\" + i + \"_address'\/><\/div>\";\n\n\t\t\t\t\tli += \"<\/li>\";\n\t\t\t\t}\n\n\t\t\t\tif(target == \"provider\"){\n\t\t\t\t\tvar li = \"<li class='human_li' id='provider_\" + i + \"_li'><div class='title'><label><b>Income Provider (#<span>\" + i + \"<\/span>)<\/b><\/label><a class='viewtoggle-button' onclick='onHumanCardViewToggleClick(this)'><i class='fa-solid fa-chevron-up'><\/i><\/a><a class='remove-button' onclick='onHumanCardRemoveClick(this, \\\"\" + target + \"\\\")'><i class='fa-solid fa-xmark'><\/i><\/a><\/div>\";\n\n\t\t\t\t\tli += \"<div class='form-row'>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><label for='provider_\" + i + \"_gross'>Monthly Gross Income:<\/label><input type='number' min='0' id='provider_\" + i + \"_gross' class='provider_gross_input currency' name='provider_\" + i + \"_gross' oninput='onProviderIncomeInput(this)' \/><\/div>\";\n\n\t\t\t\t\tli += \"<div class='input-wrapper'><select id='provider_\" + i + \"_gross_currency' class='provider_gross_currency_select currency_select' name='provider_\" + i + \"_gross_currency' onchange='onCurrencySelectChange(this)'><\/select><\/div>\";\n\n\t\t\t\t\tli += \"<\/div>\";\n\n\t\t\t\t\tli += \"<\/li>\";\n\t\t\t\t}\n\n\t\t\t\tul.append(li);\n\n\t\t\t\tif(target == \"provider\"){\n\t\t\t\t\tinitCurrencySelects();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(diff_n < 0){\n\t\t\tfor(var i = current_n - 1; i > selected_n - 1; i--){\n\t\t\t\tul.find(\"li.human_li\")[i].remove();\n\t\t\t}\n\t\t}\n\t}\n\n\twindow.onOccupationChange = function(input_elem){\n\t\t$($(input_elem).closest(\"li\")[0]).find(\".caregiver_worklocation_select\").val(\"unselected\");\n\n\t\tif($(input_elem).val() == \"self-employed\" || $(input_elem).val() == \"employed\" || $(input_elem).val() == \"student\"){\n\t\t\t$($(input_elem).closest(\"li\")[0]).find(\".work-details-form\").removeClass(\"hidden\");\n\t\t\t$($(input_elem).closest(\"li\")[0]).find(\".caregiver_traveldays_input\").parent().removeClass(\"hidden\");\n\n\t\t\tif($(input_elem).val() == \"self-employed\" || $(input_elem).val() == \"employed\"){\n\t\t\t\t\/\/$($(input_elem).closest(\"li\")[0]).find(\".caregiver_employed_occupation_select\").parent().removeClass(\"hidden\");\n\n\t\t\t\t$($(input_elem).closest(\"li\")[0]).find(\".caregiver_worklocation_select\").parent().removeClass(\"hidden\");\n\t\t\t}\n\n\t\t\tif($(input_elem).val() == \"student\"){\n\t\t\t\t\/\/$($(input_elem).closest(\"li\")[0]).find(\".caregiver_employed_occupation_select\").parent().addClass(\"hidden\");\n\n\t\t\t\t$($(input_elem).closest(\"li\")[0]).find(\".caregiver_worklocation_select\").parent().addClass(\"hidden\");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t\/\/$($(input_elem).closest(\"li\")[0]).find(\".caregiver_employed_occupation_select\").parent().addClass(\"hidden\");\n\n\t\t\t$($(input_elem).closest(\"li\")[0]).find(\".work-details-form\").addClass(\"hidden\");\n\t\t\t$($(input_elem).closest(\"li\")[0]).find(\".caregiver_worklocation_select\").parent().addClass(\"hidden\");\n\t\t}\n\t}\n\n\twindow.onHumanCardRemoveClick = function(clicked_elem, card_type){\n\t\tvar li = $($(clicked_elem).closest(\"li\")[0]);\n\n\t\tvar num_input = $(li.closest(\".form-row.human-row\")[0]).find(\"input#\" + card_type + \"_num_input\");\n\n\t\tvar current_n = parseInt(num_input.val());\n\t\tvar updated_n = current_n - 1;\n\n\t\tif(current_n > parseInt(num_input.attr(\"min\"))){\t\n\t\t\tvar ul = li.parent();\n\n\t\t\tli.remove();\n\t\t\tnum_input.val(updated_n);\n\n\t\t\tvar title_label = \"\";\n\t\t\tswitch(card_type){\n\t\t\t\tcase \"caregivers\": \n\t\t\t\t\ttitle_label = \"Caregiver\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"children\":\n\t\t\t\t\ttitle_label = \"Child\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"support\":\n\t\t\t\t\ttitle_label = \"Support Caregiver\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"provider\":\n\t\t\t\t\ttitle_label = \"Provider Caregiver\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tfor(var i = 0; i < updated_n; i++){\n\t\t\t\tvar i_n = i + 1;\n\t\t\t\t$(ul.find(\"li\")[i]).find(\".title label\").html(\"<b>\" + title_label + \" (#\" + i_n + \")\" + \"<\/b>\");\n\t\t\t}\n\t\t}\n\n\t\tif(card_type == \"provider\")\n\t\t\tsetDiscretionaryOptions();\n\t}\n\n\twindow.onHumanCardViewToggleClick = function(clicked_elem){\n\t\tvar li = $($(clicked_elem).closest(\"li\")[0]);\n\n\t\tif(!li.hasClass(\"closed\")){\n\t\t\tli.addClass(\"closed\");\n\t\t}\n\t\telse{\n\t\t\tli.removeClass(\"closed\");\n\t\t}\n\t}\n\n\tfunction bulkHumanCardClose(context){\n\t\t$(\".outlearn-section-wrapper.\" + context + \" .human_li\").addClass(\"closed\");\n\t}\n\n\tfunction calcHumanScore(){\n\t\tvar score_obj = {\n\t\t\tcaregivers: {\n\t\t\t\tcount: {\n\t\t\t\t\tvalue: outlearn_human_data.caregivers.length\n\t\t\t\t},\n\t\t\t\ttime: {\n\t\t\t\t\tvalue: 0,\n\t\t\t\t\tscore: 1\n\t\t\t\t},\n\t\t\t\tquality: {\n\t\t\t\t\tvalues: [],\n\t\t\t\t\tscore: 1\n\t\t\t\t}\n\t\t\t},\n\t\t\tsupport: {\n\t\t\t\tcount: {\n\t\t\t\t\tvalue: outlearn_human_data.support.length\n\t\t\t\t},\n\t\t\t\ttime: {\n\t\t\t\t\tvalue: 0\n\t\t\t\t},\n\t\t\t\tquality: {\n\t\t\t\t\tvalues: [],\n\t\t\t\t\tscore: 1\n\t\t\t\t}\n\t\t\t},\n\t\t\toverall: {\n\t\t\t\tcount: {\n\t\t\t\t\tvalue: outlearn_human_data.caregivers.length + outlearn_human_data.support.length\n\t\t\t\t},\n\t\t\t\ttime: {\n\t\t\t\t\tvalue: 0,\n\t\t\t\t\tscore: 1\n\t\t\t\t},\n\t\t\t\tquality:{\n\t\t\t\t\tscore: 1\n\t\t\t\t},\n\t\t\t\tscore: 1\n\t\t\t} \n\t\t};\n\n\t\tvar time_per_child_ref = 35 + 15;\n\n\t\tvar human_count_ref = {\n\t\t\tcaregivers: 1,\n\t\t\tsupport: outlearn_human_data.children.length\n\t\t}\n\n\t\tvar children_denominator = 0;\n\t\tvar children_ages = [];\n\n\t\tfor(var i = 0; i < outlearn_human_data.children.length; i++){\n\t\t\tif(outlearn_human_data.children[i].custody == \"full\")\n\t\t\t\tchildren_denominator = children_denominator + 1;\n\n\t\t\tif(outlearn_human_data.children[i].custody == \"shared\")\n\t\t\t\tchildren_denominator = children_denominator + 0.5;\n\n\t\t\tchildren_ages.push(outlearn_human_data.children[i].age); \n\t\t}\n\n\t\tif(Math.max(children_ages) - Math.min(children_ages) > 5)\n\t\t\tchildren_denominator = children_denominator + 0.5;\n\n\t\tvar caregivers_relevant_time = 0;\n\n\t\tfor(var i = 0; i < outlearn_human_data.caregivers.length; i++){\n\t\t\tif(outlearn_human_data.caregivers[i].occupation == \"employed\" || outlearn_human_data.caregivers[i].occupation == \"self-employed\" || outlearn_human_data.caregivers[i].occupation == \"student\"){\n\t\t\t\toutlearn_human_data.caregivers[i].relevant_freetime = getsRelevantFreetime(outlearn_human_data.caregivers[i].workweekdays.list, outlearn_human_data.caregivers[i].workschedule.start, outlearn_human_data.caregivers[i].workschedule.end, outlearn_human_data.caregivers[i].traveldays);\n\t\t\t\t\n\t\t\t\toutlearn_human_data.caregivers[i].offschedule_worktime = outlearn_human_data.caregivers[i].workhours > getsWorkscheduleTime(outlearn_human_data.caregivers[i].workweekdays.list, outlearn_human_data.caregivers[i].workschedule.start, outlearn_human_data.caregivers[i].workschedule.end) ? outlearn_human_data.caregivers[i].workhours - getsWorkscheduleTime(outlearn_human_data.caregivers[i].workweekdays.list, outlearn_human_data.caregivers[i].workschedule.start, outlearn_human_data.caregivers[i].workschedule.end) : 0;\n\t\t\t\t\n\t\t\t\tif(outlearn_human_data.caregivers[i].worklocation == \"work-place\")\n\t\t\t\t\toutlearn_human_data.caregivers[i].nocommute_bonus = 0;\n\n\t\t\t\tif(outlearn_human_data.caregivers[i].worklocation == \"hybrid\")\n\t\t\t\t\toutlearn_human_data.caregivers[i].nocommute_bonus = 0.5 * outlearn_human_data.caregivers[i].workweekdays.list.filter(Boolean).length;\n\n\t\t\t\tif(outlearn_human_data.caregivers[i].worklocation == \"home\")\n\t\t\t\t\toutlearn_human_data.caregivers[i].nocommute_bonus = 1 * outlearn_human_data.caregivers[i].workweekdays.list.filter(Boolean).length;\n\t\t\t}\n\t\t\telse{\n\t\t\t\toutlearn_human_data.caregivers[i].relevant_freetime = {\n\t\t\t\t\tper_weekday: [3, 3, 3, 3, 3, 10, 10],\n\t\t\t\t\ttotal: 35\n\t\t\t\t};\n\n\t\t\t\toutlearn_human_data.caregivers[i].offschedule_worktime = 0;\n\n\t\t\t\toutlearn_human_data.caregivers[i].nocommute_bonus = 0;\n\t\t\t}\n\n\t\t\tswitch(outlearn_human_data.caregivers[i].education){\n\t\t\t\tcase \"primary\":\n\t\t\t\t\tscore_obj.caregivers.quality.values.push(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"secondary\":\n\t\t\t\t\tscore_obj.caregivers.quality.values.push(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"tertiary\":\n\t\t\t\t\tscore_obj.caregivers.quality.values.push(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bachelor\":\n\t\t\t\t\tscore_obj.caregivers.quality.values.push(4);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"master\":\n\t\t\t\t\tscore_obj.caregivers.quality.values.push(5);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"doctoral\":\n\t\t\t\t\tscore_obj.caregivers.quality.values.push(5);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log(\"WARNING: Unknown education label with value '\" + outlearn_human_data.caregivers[i].education + \"'.\");\n\t\t\t}\n\n\t\t\tscore_obj.caregivers.time.value = score_obj.caregivers.time.value + outlearn_human_data.caregivers[i].relevant_freetime.total + outlearn_human_data.caregivers[i].nocommute_bonus - outlearn_human_data.caregivers[i].offschedule_worktime;\n\t\t}\n\n\t\tscore_obj.caregivers.time.value = score_obj.caregivers.time.value\/children_denominator;\n\t\tscore_obj.caregivers.quality.score = Math.floor(average(score_obj.caregivers.quality.values));\n\n\t\tif(score_obj.caregivers.time.value > 0.5 * time_per_child_ref)\n\t\t\tscore_obj.caregivers.time.score = 1;\n\n\t\tif(score_obj.caregivers.time.value > 0.8 * time_per_child_ref)\n\t\t\tscore_obj.caregivers.time.score = 2;\n\n\t\tif(score_obj.caregivers.time.value >= 1 * time_per_child_ref)\n\t\t\tscore_obj.caregivers.time.score = 3;\n\n\t\tif(score_obj.caregivers.time.value > 1.5 * time_per_child_ref)\n\t\t\tscore_obj.caregivers.time.score = 4;\n\n\t\tif(score_obj.caregivers.time.value > 2 * time_per_child_ref)\n\t\t\tscore_obj.caregivers.time.score = 5;\n\n\t\tfor(var i = 0; i < outlearn_human_data.support.length; i++){\n\t\t\tscore_obj.support.time.value = score_obj.support.time.value + outlearn_human_data.support[i].supporthours;\n\n\t\t\tif(outlearn_human_data.support[i].is_under.driving || outlearn_human_data.support[i].is_under.public_transport)\n\t\t\t\tscore_obj.support.time.value = score_obj.support.time.value + 0.1 * outlearn_human_data.support[i].supporthours;\n\n\t\t\tif(outlearn_human_data.support[i].is_under.walking)\n\t\t\t\tscore_obj.support.time.value = score_obj.support.time.value + 0.05 * outlearn_human_data.support[i].supporthours;\n\n\t\t\tif(outlearn_human_data.support[i].relationship == \"family\")\n\t\t\t\tscore_obj.support.time.value = score_obj.support.time.value + 0.1 * outlearn_human_data.support[i].supporthours;\n\n\t\t\tswitch(outlearn_human_data.support[i].education){\n\t\t\t\tcase \"primary\":\n\t\t\t\t\tscore_obj.support.quality.values.push(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"secondary\":\n\t\t\t\t\tscore_obj.support.quality.values.push(2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"tertiary\":\n\t\t\t\t\tscore_obj.support.quality.values.push(3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bachelor\":\n\t\t\t\t\tscore_obj.support.quality.values.push(4);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"master\":\n\t\t\t\t\tscore_obj.support.quality.values.push(5);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"doctoral\":\n\t\t\t\t\tscore_obj.support.quality.values.push(5);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log(\"WARNING: Unknown education label with value '\" + outlearn_human_data.caregivers[i].education + \"'.\");\n\t\t\t}\n\t\t}\n\n\t\tif(outlearn_human_data.support.length > 0){\n\t\t\tscore_obj.support.time.value = score_obj.support.time.value\/children_denominator;\n\t\t\tscore_obj.support.quality.score = Math.floor(average(score_obj.support.quality.values));\n\n\t\t\tif(score_obj.support.time.value > 0.5 * time_per_child_ref)\n\t\t\t\tscore_obj.support.time.score = 1;\n\n\t\t\tif(score_obj.support.time.value > 0.8 * time_per_child_ref)\n\t\t\t\tscore_obj.support.time.score = 2;\n\n\t\t\tif(score_obj.support.time.value >= 1 * time_per_child_ref)\n\t\t\t\tscore_obj.support.time.score = 3;\n\n\t\t\tif(score_obj.support.time.value > 1.5 * time_per_child_ref)\n\t\t\t\tscore_obj.support.time.score = 4;\n\n\t\t\tif(score_obj.support.time.value > 2 * time_per_child_ref)\n\t\t\t\tscore_obj.support.time.score = 5;\n\t\t}\n\t\telse{\n\t\t\tscore_obj.support.time.value = 0;\n\t\t\tscore_obj.support.time.score = 0;\n\t\t\tscore_obj.support.quality.score = 0;\n\t\t}\n\n\t\tscore_obj.overall.time.value = score_obj.caregivers.time.value + score_obj.support.time.value;\n\n\t\tif(score_obj.overall.time.value > 0.5 * time_per_child_ref)\n\t\t\tscore_obj.overall.time.score = 1;\n\n\t\tif(score_obj.overall.time.value > 0.8 * time_per_child_ref)\n\t\t\tscore_obj.overall.time.score = 2;\n\n\t\tif(score_obj.overall.time.value >= 1 * time_per_child_ref)\n\t\t\tscore_obj.overall.time.score = 3;\n\n\t\tif(score_obj.overall.time.value > 1.5 * time_per_child_ref)\n\t\t\tscore_obj.overall.time.score = 4;\n\n\t\tif(score_obj.overall.time.value > 2 * time_per_child_ref)\n\t\t\tscore_obj.overall.time.score = 5;\n\n\t\tif(score_obj.support.quality.score)\n\t\t\tscore_obj.overall.quality.score = Math.round((score_obj.caregivers.quality.score + score_obj.support.quality.score)\/2);\n\t\telse\n\t\t\tscore_obj.overall.quality.score = score_obj.caregivers.quality.score;\n\n\t\tif(score_obj.overall.time.score == 5)\n\t\t\tscore_obj.overall.score = Math.round((0.5 * score_obj.overall.time.score) + (0.5 * score_obj.overall.quality.score));\n\t\telse\n\t\t\tscore_obj.overall.score = score_obj.overall.time.score;\n\n\t\tswitch(score_obj.overall.score){\n\t\t\tcase 1:\n\t\t\t\t$(\".outlearn-section-wrapper.human .outlearn-section-score span\").text(\"E\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.human span\").text(\"E\");\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$(\".outlearn-section-wrapper.human .outlearn-section-score span\").text(\"D\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.human span\").text(\"D\");\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$(\".outlearn-section-wrapper.human .outlearn-section-score span\").text(\"C\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.human span\").text(\"C\");\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\t$(\".outlearn-section-wrapper.human .outlearn-section-score span\").text(\"B\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.human span\").text(\"B\");\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\t$(\".outlearn-section-wrapper.human .outlearn-section-score span\").text(\"A\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.human span\").text(\"A\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$(\".outlearn-section-wrapper.human .outlearn-section-score span\").text(\"-\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.human span\").text(\"-\");\n\t\t\t\tbreak;\n\t\t};\n\n\t\toutlearn_human_data.scored = true;\n\t\toutlearn_overall_data.generated_scores.human = score_obj.overall.score;\n\n\t\tbulkHumanCardClose(\"human\");\n\n\t\tif(outlearn_overall_data.processing){\n\t\t\t\/\/Trigger Spatial Sub-Score Calc\n\t\t\tgetOutlearnSpatialData();\n\t\t}\n\t\telse{\n\t\t\tcalcOverallScore();\n\n\t\t\tsetFormEditable(\"human\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.human .outlearn-section-score\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\n\t\toutlearn_human_data.score = score_obj;\n\n\t\treturn score_obj;\n\t}\n\n\tfunction getsRelevantFreetime(workweekdays, start_time, end_time, days_out){\n\t\tvar relevant_freetime = {\n\t\t\tper_weekday: [],\n\t\t\ttotal: 0\n\t\t};\n\t\t\n\t\tvar start_time_d = new Date();\n\t\tstart_time_d.setHours(start_time.split(\":\")[0],start_time.split(\":\")[1],0);\n\t\t\n\t\tvar end_time_d = new Date();\n\t\tend_time_d.setHours(end_time.split(\":\")[0],end_time.split(\":\")[1],0);\n\n\t\tif(start_time_d >= end_time_d)\n\t\t\tstart_time_d.setDate(end_time_d.getDate() - 1);\n\n\t\tvar ref_weekday_start_d = new Date();\n\t\tref_weekday_start_d.setHours(17,0,0);\n\n\t\tvar ref_weekend_start_d = new Date();\n\t\tref_weekend_start_d.setHours(10,0,0);\n\n\t\tvar ref_end_d = new Date();\n\t\tref_end_d.setHours(20,0,0);\n\n\t\tvar schedule_range = moment.range(start_time_d, end_time_d);\n\n\t\tvar ref_weekday_range = moment.range(ref_weekday_start_d, ref_end_d);\n\t\tvar weekday_intersection = schedule_range.intersect(ref_weekday_range);\n\n\t\tvar ref_weekend_range = moment.range(ref_weekend_start_d, ref_end_d);\n\t\tvar weekend_intersection = schedule_range.intersect(ref_weekend_range);\n\n\t\tvar days_out_tax = (365 - days_out)\/365;\n\n\t\tfor(var i = 0; i < 7; i++){\n\t\t\tif(i < 5){\n\t\t\t\tif(workweekdays[i] && weekday_intersection){\n\t\t\t\t\trelevant_freetime.per_weekday.push(days_out_tax * (3 - weekday_intersection.end.diff(weekday_intersection.start, \"minutes\")\/60));\n\t\t\t\t\trelevant_freetime.total = relevant_freetime.total + (days_out_tax * (3 - weekday_intersection.end.diff(weekday_intersection.start, \"minutes\")\/60));\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\trelevant_freetime.per_weekday.push(days_out_tax * 3);\n\t\t\t\t\trelevant_freetime.total = relevant_freetime.total + (days_out_tax * 3);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i >= 5){\n\t\t\t\tif(workweekdays[i]){\n\t\t\t\t\tif(weekend_intersection){\n\t\t\t\t\t\trelevant_freetime.per_weekday.push(days_out_tax * (10 - weekend_intersection.end.diff(weekend_intersection.start, \"minutes\")\/60));\n\t\t\t\t\t\trelevant_freetime.total = relevant_freetime.total + (days_out_tax * (10 - weekend_intersection.end.diff(weekend_intersection.start, \"minutes\")\/60));\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\trelevant_freetime.per_weekday.push(days_out_tax * 3);\n\t\t\t\t\t\trelevant_freetime.total = relevant_freetime.total + (days_out_tax * 3);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\trelevant_freetime.per_weekday.push(days_out_tax * 10);\n\t\t\t\t\trelevant_freetime.total = relevant_freetime.total + (days_out_tax * 10);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn relevant_freetime;\n\t}\n\n\tfunction drawSupportersOnGeoMap(data_handle){\n\t\tclearGeoMapDrawings();\n\n\t\tfor(var i = 0; i < outlearn_human_data.polygons.walking.length; i++){\n\t\t\toutlearn_human_data.polygons.walking[i].setMap(null);\n\t\t}\n\n\t\tfor(var i = 0; i < outlearn_human_data.polygons.public_transport.length; i++){\n\t\t\toutlearn_human_data.polygons.public_transport[i].setMap(null);\n\t\t}\n\n\t\tfor(var i = 0; i < outlearn_human_data.polygons.driving.length; i++){\n\t\t\toutlearn_human_data.polygons.driving[i].setMap(null);\n\t\t}\n\n\t\tif(outlearn_human_data.center_marker)\n\t\t\toutlearn_human_data.center_marker.setMap(null);\n\n\t\tfor(var i = 0; i < outlearn_human_data.support.length; i++){\n\t\t\tif(outlearn_human_data.support[i].center_marker)\n\t\t\t\toutlearn_human_data.support[i].center_marker.setMap(null);\n\t\t}\n\n\t\toutlearn_geo_data.map.setCenter(outlearn_human_data.center);\n\t\toutlearn_geo_data.map.setZoom(14);\n\n\t\toutlearn_human_data.center_marker = new google.maps.Marker({\n\t\t\tmap: outlearn_geo_data.map,\n\t\t\tposition: outlearn_human_data.center,\n\t\t\ticon: home_marker_icon\n\t\t});\n\n\t\tfor(var i = 0; i < outlearn_human_data.polygons[data_handle].length; i++){\n\t\t\toutlearn_human_data.polygons[data_handle][i].setMap(outlearn_geo_data.map);\n\t\t}\n\n\t\tfor(var i = 0; i < outlearn_human_data.support.length; i++){\n\t\t\toutlearn_human_data.support[i].center_marker = new google.maps.Marker({\n\t\t\t\tmap: outlearn_geo_data.map,\n\t\t\t\tposition: outlearn_human_data.support[i].center,\n\t\t\t\tlabel: \"#\" + (i+1).toString()\n\t\t\t});\n\t\t}\n\t}\n\n\tfunction getsWorkscheduleTime(workweekdays, start_time, end_time){\n\t\tvar workschedule_time = 0;\n\n\t\tvar start_time_d = new Date();\n\t\tstart_time_d.setHours(start_time.split(\":\")[0],start_time.split(\":\")[1],0);\n\t\t\n\t\tvar end_time_d = new Date();\n\t\tend_time_d.setHours(end_time.split(\":\")[0],end_time.split(\":\")[1],0);\n\n\t\tvar workday_hours = Math.abs(end_time_d - start_time_d) \/ 36e5;\n\n\t\tfor(var i = 0; i < 7; i++){\n\t\t\tif(workweekdays[i]){\n\t\t\t\tworkschedule_time = workschedule_time + workday_hours;\n\t\t\t}\n\t\t}\n\n\t\treturn workschedule_time;\n\t}\n\n\twindow.onSpatialScoreCalcClick = function(){\n\t\tsetFormEditable(\"spatial\", false);\n\t\t$(\".outlearn-section-wrapper.spatial\").removeClass(\"error\");\n\n\t\tif(checkSpatialForm()){\n\t\t\ttry{\n\t\t\t\tgetOutlearnSpatialData();\n\t\t\t}\n\t\t\tcatch(err){\n\t\t\t\tconsole.log(\"ERROR: \" + err);\n\t\t\t\t$(\".outlearn-section-wrapper.spatial\").addClass(\"error\");\n\t\t\t\tsetFormEditable(\"spatial\", true);\n\n\t\t\t\tsendEmailMessage(\"Erro em OutLearn Score - Spatial\", err);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tsetFormEditable(\"spatial\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.spatial .unanswered\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t}\n\n\tfunction checkSpatialForm(){\n\t\tvar ready = true;\n\n\t\tif($(\".outlearn-section-wrapper.spatial #spatial_home_type\").val() == \"unselected\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.spatial #spatial_home_type\").addClass(\"unanswered\");\n\t\t}\n\t\telse\n\t\t\t$(\".outlearn-section-wrapper.spatial #spatial_home_type\").removeClass(\"unanswered\");\n\n\t\tif($(\".outlearn-section-wrapper.spatial #spatial_home_area\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.spatial #spatial_home_area\").addClass(\"unanswered\");\n\t\t}\n\t\telse\n\t\t\t$(\".outlearn-section-wrapper.spatial #spatial_home_area\").removeClass(\"unanswered\");\n\n\t\tif($(\".outlearn-section-wrapper.spatial #spatial_residents_num\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.spatial #spatial_residents_num\").addClass(\"unanswered\");\n\t\t}\n\t\telse\n\t\t\t$(\".outlearn-section-wrapper.spatial #spatial_residents_num\").removeClass(\"unanswered\");\n\n\t\tvar radio_select_entries = $(\".outlearn-section-wrapper.spatial ul.dot-leader-list li\");\n\n\t\tfor(var i = 0; i < radio_select_entries.length; i++){\n\t\t\tif(!$(radio_select_entries[i]).find(\"input:checked\").length){\n\t\t\t\tready = false;\n\t\t\t\t$(radio_select_entries[i]).find(\"input\").addClass(\"unanswered\");\n\t\t\t}\n\t\t\telse\n\t\t\t\t$(radio_select_entries[i]).find(\"input\").removeClass(\"unanswered\");\n\t\t}\n\n\t\treturn ready;\n\t}\n\n\tfunction getOutlearnSpatialData(){\n\t\toutlearn_spatial_data.home_type = $(\".outlearn-section-wrapper.spatial #spatial_home_type\").val();\n\t\t\n\t\tvar area_unit = $(\".outlearn-section-wrapper.spatial #spatial_home_area_unit\").val();\n\t\t\n\t\tif(area_unit === \"ft2\")\n\t\t\toutlearn_spatial_data.home_area = parseInt($(\".outlearn-section-wrapper.spatial #spatial_home_area\").val()) * 0.09290304;\n\t\telse\n\t\t\toutlearn_spatial_data.home_area = parseInt($(\".outlearn-section-wrapper.spatial #spatial_home_area\").val());\n\n\t\toutlearn_spatial_data.residents_num = parseInt($(\".outlearn-section-wrapper.spatial #spatial_residents_num\").val());\n\t\toutlearn_spatial_data.area_per_resident = outlearn_spatial_data.home_area \/ outlearn_spatial_data.residents_num;\n\n\t\toutlearn_spatial_data.conditions.individual_rooms = ($(\"[name=spatial_childrooms]:checked\").val() === 'true');\n\t\toutlearn_spatial_data.conditions.office_stations = ($(\"[name=spatial_officestation]:checked\").val() === 'true');\n\t\toutlearn_spatial_data.conditions.patio = ($(\"[name=spatial_patio]:checked\").val() === 'true');\n\t\toutlearn_spatial_data.conditions.backyard = ($(\"[name=spatial_backyard]:checked\").val() === 'true');\n\t\toutlearn_spatial_data.conditions.terrain = ($(\"[name=spatial_terrain]:checked\").val() === 'true');\n\n\t\tcalcSpatialScore();\n\t}\n\n\tfunction calcSpatialScore(){\n\t\tvar score_obj = {\n\t\t\ttype_score: 1,\n\t\t\tarea_score: 1,\n\t\t\tconditions_score: 1,\n\t\t\toverall: 1\n\t\t};\n\n\t\tif(outlearn_spatial_data.home_type == \"single-family\" || outlearn_spatial_data.home_type == \"multi-family\")\n\t\t\tscore_obj.type_score = 4;\n\n\t\tif(outlearn_spatial_data.home_type == \"apartment\" || outlearn_spatial_data.home_type == \"mobile\")\n\t\t\tscore_obj.type_score = 3;\n\n\t\tif(outlearn_spatial_data.home_type == \"camp\")\n\t\t\tscore_obj.type_score = 1;\n\n\n\t\tvar reference_area = 30;\n\n\t\tif(outlearn_spatial_data.area_per_resident > 0.5 * reference_area){\n\t\t\tscore_obj.area_score = 2;\n\t\t}\n\n\t\tif(outlearn_spatial_data.area_per_resident > 1 * reference_area){\n\t\t\tscore_obj.area_score = 3;\n\t\t}\n\n\t\tif(outlearn_spatial_data.area_per_resident > 1.5 * reference_area){\n\t\t\tscore_obj.area_score = 4;\n\t\t}\n\n\n\t\tif(outlearn_spatial_data.conditions.individual_rooms)\n\t\t\tscore_obj.conditions_score = score_obj.conditions_score + 2;\n\n\t\tif(outlearn_spatial_data.conditions.office_stations)\n\t\t\tscore_obj.conditions_score = score_obj.conditions_score + 0.5;\n\n\t\tif(outlearn_spatial_data.conditions.patio || outlearn_spatial_data.conditions.backyard || outlearn_spatial_data.conditions.terrain)\n\t\t\tscore_obj.conditions_score = score_obj.conditions_score + 0.5;\n\n\t\tif(outlearn_spatial_data.conditions.patio && outlearn_spatial_data.conditions.backyard && outlearn_spatial_data.conditions.terrain)\n\t\t\tscore_obj.conditions_score = score_obj.conditions_score + 1;\n\n\t\tscore_obj.overall = Math.round((0.2 * score_obj.type_score) + (0.3 * score_obj.area_score) + (0.5 * score_obj.conditions_score));\n\n\t\tswitch(score_obj.overall){\n\t\t\tcase 1:\n\t\t\t\t$(\".outlearn-section-wrapper.spatial .outlearn-section-score span\").text(\"E\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.spatial span\").text(\"E\");\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$(\".outlearn-section-wrapper.spatial .outlearn-section-score span\").text(\"D\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.spatial span\").text(\"D\");\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$(\".outlearn-section-wrapper.spatial .outlearn-section-score span\").text(\"C\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.spatial span\").text(\"C\");\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\t$(\".outlearn-section-wrapper.spatial .outlearn-section-score span\").text(\"B\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.spatial span\").text(\"B\");\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\t$(\".outlearn-section-wrapper.spatial .outlearn-section-score span\").text(\"A\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.spatial span\").text(\"A\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$(\".outlearn-section-wrapper.spatial .outlearn-section-score span\").text(\"-\");\n\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.spatial span\").text(\"-\");\n\t\t\t\tbreak;\n\t\t};\n\n\t\toutlearn_spatial_data.scored = true;\n\t\toutlearn_overall_data.generated_scores.spatial = score_obj.overall;\n\n\t\tif(outlearn_overall_data.processing){\n\t\t\t\/\/Trigger Material Sub-Score Calc\n\t\t\tgetOutlearnMaterialData();\n\t\t}\n\t\telse{\n\t\t\tcalcOverallScore();\n\t\t\t\n\t\t\tsetFormEditable(\"spatial\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.spatial .outlearn-section-score\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\n\t\toutlearn_spatial_data.score = score_obj;\n\n\t\treturn score_obj;\n\t}\n\n\twindow.onMaterialScoreCalcClick = function(){\n\t\tsetFormEditable(\"material\", false);\n\t\t$(\".outlearn-section-wrapper.material\").removeClass(\"error\");\n\n\t\tif(checkMaterialForm()){\n\t\t\ttry{\n\t\t\t\tgetOutlearnMaterialData();\n\t\t\t}\n\t\t\tcatch(err){\n\t\t\t\tconsole.log(\"ERROR: \" + err);\n\t\t\t\t$(\".outlearn-section-wrapper.material\").addClass(\"error\");\n\t\t\t\tsetFormEditable(\"material\", true);\n\n\t\t\t\tsendEmailMessage(\"Erro em OutLearn Score - Material\", err);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tsetFormEditable(\"material\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.material .unanswered\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t}\n\n\tfunction checkMaterialForm(){\n\t\tvar ready = true;\n\n\t\tif($(\".outlearn-section-wrapper.material #provider_num_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.material #provider_num_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.material #provider_num_input\").removeClass(\"unanswered\");\n\n\t\t\tvar provider_num = parseInt($(\".outlearn-section-wrapper.material #provider_num_input\").val());\n\t\t\t\n\t\t\tfor(var i = 1; i <= provider_num; i++){\n\t\t\t\tif($(\"#provider_\" + i + \"_li #provider_\" + i + \"_gross\").val() == \"\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#provider_\" + i + \"_li #provider_\" + i + \"_gross\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#provider_\" + i + \"_li #provider_\" + i + \"_gross\").removeClass(\"unanswered\");\n\n\t\t\t\tif($(\"#provider_\" + i + \"_li #provider_\" + i + \"_gross_currency\").val() == \"unselected\"){\n\t\t\t\t\tready = false;\n\t\t\t\t\t$(\"#provider_\" + i + \"_li #provider_\" + i + \"_gross_currency\").addClass(\"unanswered\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t$(\"#provider_\" + i + \"_li #provider_\" + i + \"_gross_currency\").removeClass(\"unanswered\");\t\t\n\t\t\t}\n\t\t}\n\n\t\tif($(\".outlearn-section-wrapper.material #dependant_num_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.material #dependant_num_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.material #dependant_num_input\").removeClass(\"unanswered\");\n\t\t}\n\n\t\treturn ready;\n\t}\n\n\tfunction getOutlearnMaterialData(){\n\t\t$(\".outlearn-section-wrapper.material .outlearn-section-score span\").text(\"-\");\n\n\t\toutlearn_material_data.country = $(\".outlearn-section-wrapper.material #country_select\").val();\n\t\toutlearn_material_data.providers_num = parseInt($(\".outlearn-section-wrapper.material #provider_num_input\").val());\n\t\toutlearn_material_data.dependants_num = parseInt($(\".outlearn-section-wrapper.material #dependant_num_input\").val());\n\t\toutlearn_material_data.providers = [];\n\t\toutlearn_material_data.total_gross = 0;\n\n\t\t\/\/money.js rates setup\n\t\tfx.rates = fxSetup.rates;\n\t    fx.base = fxSetup.base;\n\n\t    var providers_array = $(\".outlearn-section-wrapper.material .human_li\");\n\n\t    for(var i = 0; i < providers_array.length; i++){\n\t    \tvar provider_data = {\n\t    \t\tgross_income: $(providers_array[i]).find(\"input.provider_gross_input\").val(),\n\t    \t\tcurrency: $(providers_array[i]).find(\"select.currency_select\").val()\n\t    \t};\n\n\t    \toutlearn_material_data.providers.push(provider_data);\n\n\t\t\toutlearn_material_data.total_gross = outlearn_material_data.total_gross + parseInt(fx.convert($(providers_array[i]).find(\"input.provider_gross_input\").val(), {from: $(providers_array[i]).find(\"select.currency_select\").val(), to: \"USD\"}));\n\t\t}\n\n\t\tcalcMaterialScore();\n\t}\n\n\twindow.onProviderIncomeInput = function(elem){\n\t\tvar changed_elem = $(elem);\n\t\tvar selected_currency = $(changed_elem.closest(\"li\")[0]).find(\"select.currency_select\").val();\n\n\t\tsetDiscretionaryOptions(selected_currency);\n\t}\n\n\twindow.onCurrencySelectChange = function(elem){\n\t\tvar selected_currency = $(elem).val();\n\n\t\tsetDiscretionaryOptions(selected_currency);\n\t}\n\n\tfunction setDiscretionaryOptions(selected_currency = false){\n\t\tvar providers_array = $(\".outlearn-section-wrapper.material .human_li\");\n\t\tvar total_gross = 0;\n\n\t\t\/\/money.js rates setup\n\t\tfx.rates = fxSetup.rates;\n\t    fx.base = fxSetup.base;\n\t \t\n\t \tif(!selected_currency)\n\t \t\tselected_currency = $(providers_array[0]).find(\"select.currency_select\").val();\n\n\t\tfor(var i = 0; i < providers_array.length; i++){\n\t\t\ttotal_gross = total_gross + parseInt(fx.convert($(providers_array[i]).find(\"input.provider_gross_input\").val(), {from: $(providers_array[i]).find(\"select.currency_select\").val(), to: selected_currency}));\n\t\t}\n\n\t\tvar discretionary_select = $(\".outlearn-section-wrapper.material .providers_discretionary_select\");\n\t\tvar options_array = discretionary_select.find(\"option\");\n\n\t\tfor(var i = 1; i <= options_array.length; i++){\n\t\t\tif(total_gross > 0){\n\t\t\t\tvar initial_percent = $(options_array[i]).attr(\"min\");\n\t\t\t\tvar final_percent = $(options_array[i]).attr(\"max\");\n\n\t\t\t\tvar initial_percent_value = parseInt((initial_percent\/100)*total_gross);\n\t\t\t\tvar final_percent_value = parseInt((final_percent\/100)*total_gross);\n\n\t\t\t\t$(options_array[i]).html((initial_percent > 0 && final_percent < 100 ? initial_percent_value + currencies[selected_currency].symbol : \"\") + (final_percent < 100 ? \" < \" + final_percent_value + currencies[selected_currency].symbol : \"> \" + initial_percent_value + currencies[selected_currency].symbol));\n\t\t\t\t$(options_array[i]).removeClass(\"hidden\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif($(options_array[i]).attr(\"min\") !== \"0\")\n\t\t\t\t\t$(options_array[i]).addClass(\"hidden\");\n\t\t\t\telse{\n\t\t\t\t\t$(options_array[i]).html(0);\n\t\t\t\t\tdiscretionary_select.val(\"0-10\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar discretionary_currency_select = $(\".outlearn-section-wrapper.material .providers_discretionary_currency_select\");\n\t\tdiscretionary_currency_select.find(\"option\").remove();\n\n\t\tfor(var i = 0; i < providers_array.length; i++){\n\t\t\tif(!$(\".outlearn-section-wrapper.material .providers_discretionary_currency_select option[value='\" + $(providers_array[i]).find(\"select.currency_select\").val() +\"']\").length){\n\t\t\t\tif($(providers_array[i]).find(\"select.currency_select\").val() == selected_currency)\n\t\t\t\t\tdiscretionary_currency_select.append(\"<option selected='selected' value='\" + $(providers_array[i]).find(\"select.currency_select\").val() + \"'>\" + currencies[$(providers_array[i]).find(\"select.currency_select\").val()].symbol + \"<\/option>\");\n\t\t\t\telse\n\t\t\t\t\tdiscretionary_currency_select.append(\"<option value='\" + $(providers_array[i]).find(\"select.currency_select\").val() + \"'>\" + currencies[$(providers_array[i]).find(\"select.currency_select\").val()].symbol + \"<\/option>\");\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction calcMaterialScore(){\n\t\tif(outlearn_material_data.providers_num == 1){\n\t\t\tif(countries_wages[outlearn_material_data.country]){\n\t\t\t\toutlearn_material_data.reference_income = countries_wages[outlearn_material_data.country].single_provider_family\/countries_wages[outlearn_material_data.country].wage_months;\n\t\t\t\toutlearn_material_data.minimum_income = (countries_wages[outlearn_material_data.country].minimum\/12) * outlearn_material_data.providers_num;\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\toutlearn_material_data.reference_income = countries_wages[\"PT\"].single_provider_family\/countries_wages[\"PT\"].wage_months;\n\t\t\t\tconsole.log(\"WARNING: Using the default referance income data of PT.\");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tif(countries_wages[outlearn_material_data.country]){\n\t\t\t\toutlearn_material_data.reference_income = (countries_wages[outlearn_material_data.country].standard_family * 1.8)\/countries_wages[outlearn_material_data.country].wage_months;\n\t\t\t\toutlearn_material_data.minimum_income = (countries_wages[outlearn_material_data.country].minimum\/12) * outlearn_material_data.providers_num;\n\t\t\t}\n\t\t\telse{\n\t\t\t\toutlearn_material_data.reference_income = (countries_wages[\"PT\"].standard_family * 1.8)\/countries_wages[outlearn_material_data.country].wage_months;\n\t\t\t\tconsole.log(\"WARNING: Using the default referance income data of PT.\");\n\t\t\t}\n\t\t}\n\n\t\toutlearn_material_data.reference_income = outlearn_material_data.reference_income + ((outlearn_material_data.providers_num - 2) + (outlearn_material_data.dependants_num - 2)) * 0.2 * outlearn_material_data.reference_income;\n\n\t\tvar likert_val = 0;\n\n\t\tif(outlearn_material_data.total_gross <= 0.5 * outlearn_material_data.reference_income || outlearn_material_data.total_gross <= outlearn_material_data.minimum_income){\n\t\t\tlikert_val = 1;\n\t\t\t$(\".outlearn-section-wrapper.material .outlearn-section-score span\").text(\"E\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.material span\").text(\"E\");\n\t\t}\n\n\t\tif(outlearn_material_data.total_gross > 0.5 * outlearn_material_data.reference_income && outlearn_material_data.total_gross > outlearn_material_data.minimum_income){\n\t\t\tlikert_val = 2;\n\t\t\t$(\".outlearn-section-wrapper.material .outlearn-section-score span\").text(\"D\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.material span\").text(\"D\");\n\t\t}\n\n\t\tif(outlearn_material_data.total_gross > 1 * outlearn_material_data.reference_income){\n\t\t\tlikert_val = 3;\n\t\t\t$(\".outlearn-section-wrapper.material .outlearn-section-score span\").text(\"C\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.material span\").text(\"C\");\n\t\t}\n\n\t\tif(outlearn_material_data.total_gross > 1.5 * outlearn_material_data.reference_income){\n\t\t\tlikert_val = 4;\n\t\t\t$(\".outlearn-section-wrapper.material .outlearn-section-score span\").text(\"B\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.material span\").text(\"B\");\n\t\t}\n\n\t\tif(outlearn_material_data.total_gross > 2 * outlearn_material_data.reference_income){\n\t\t\tlikert_val = 5;\n\t\t\t$(\".outlearn-section-wrapper.material .outlearn-section-score span\").text(\"A\");\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-subscore-tile.material span\").text(\"A\");\n\t\t}\n\n\t\toutlearn_material_data.scored = true;\n\t\toutlearn_overall_data.generated_scores.material = likert_val;\n\n\t\tif(outlearn_overall_data.processing){\n\t\t\tcalcOverallScore();\n\t\t}\n\t\telse{\n\t\t\tcalcOverallScore();\n\n\t\t\tsetFormEditable(\"material\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.material .outlearn-section-score\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\n\t\toutlearn_material_data.score = likert_val;\n\n\t\treturn likert_val;\n\t}\n\n\twindow.onOverallScoreCalcClick = function(){\n\t\tsetFormEditable(\"all\", false);\n\n\t\tif(checkGeoForm() && checkHumanForm() && checkSpatialForm() && checkMaterialForm()){\n\t\t\toutlearn_geo_data.scored = false;\n\t\t\toutlearn_human_data.scored = false;\n\t\t\toutlearn_spatial_data.scored = false;\n\t\t\toutlearn_material_data.scored = false;\n\t\t\t\n\t\t\toutlearn_overall_data.processing = true;\n\n\t\t\t\/\/Trigger First Sub-Score Calc - Geographic\n\t\t\tcodeAddress($('.outlearn-section-wrapper.geographic #postal_input').val(), $('.outlearn-section-wrapper.geographic #country_select').val(), \"geo\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.geographic .outlearn-section-score\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t\telse{\n\t\t\tsetFormEditable(\"all\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper .unanswered\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t}\n\n\tfunction calcOverallScore(){\n\t\tif(outlearn_geo_data.scored && outlearn_human_data.scored && outlearn_spatial_data.scored && outlearn_material_data.scored){\n\t\t\toutlearn_overall_data.score = Math.round((outlearn_geo_data.scored + outlearn_human_data.scored + outlearn_spatial_data.scored + outlearn_material_data.scored)\/4);\n\t\t\t\n\t\t\tswitch(outlearn_overall_data.score){\n\t\t\t\tcase 1:\n\t\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-section-score span\").text(\"E\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-section-score span\").text(\"D\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-section-score span\").text(\"C\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-section-score span\").text(\"B\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-section-score span\").text(\"A\");\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-section-score span\").text(\"-\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$(\".outlearn-section-wrapper.overall .outlearn-form\").removeClass(\"hidden\");\n\n\t\t\toutlearn_overall_data.processing = false;\n\n\t\t\tsetFormEditable(\"all\", true);\n\n\t\t\t$('html, body').animate({\n\t\t\t   scrollTop: $(\".outlearn-section-wrapper.overall .outlearn-section-score\").offset().top - 100\n\t\t\t}, 1000);\n\t\t}\n\t}\n\n\twindow.onSelfAssessmentChange = function(elem){\n\t\tvar changed_elem = $(elem);\n\n\t\tif(changed_elem.parent().hasClass(\"geographic\"))\n\t\t\toutlearn_overall_data.self_assessed_scores.geographic = parseInt(changed_elem.val());\n\n\t\tif(changed_elem.parent().hasClass(\"human\"))\n\t\t\toutlearn_overall_data.self_assessed_scores.human = parseInt(changed_elem.val());\n\n\t\tif(changed_elem.parent().hasClass(\"spatial\"))\n\t\t\toutlearn_overall_data.self_assessed_scores.spatial = parseInt(changed_elem.val());\n\n\t\tif(changed_elem.parent().hasClass(\"material\"))\n\t\t\toutlearn_overall_data.self_assessed_scores.material = parseInt(changed_elem.val());\n\t}\n\n\tfunction checkSubmissionForm(){\n\t\tvar ready = true;\n\n\t\tif($(\".outlearn-section-wrapper.overall #firstname_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.overall #firstname_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.overall #firstname_input\").removeClass(\"unanswered\");\n\t\t}\n\n\t\tif($(\".outlearn-section-wrapper.overall #lastname_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.overall #lastname_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.overall #lastname_input\").removeClass(\"unanswered\");\n\t\t}\n\n\t\tif($(\".outlearn-section-wrapper.overall #email_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.overall #email_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.overall #email_input\").removeClass(\"unanswered\");\n\t\t}\n\n\t\tif($(\".outlearn-section-wrapper.overall #school_input\").val() == \"\"){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.overall #school_input\").addClass(\"unanswered\");\n\t\t}\n\t\telse{\n\t\t\t$(\".outlearn-section-wrapper.overall #school_input\").removeClass(\"unanswered\");\n\t\t}\n\n\t\tif(!$(\".outlearn-section-wrapper.overall .consent_checkbox:checked\").length){\n\t\t\tready = false;\n\t\t\t$(\".outlearn-section-wrapper.overall .consent_checkbox\").addClass(\"unanswered\");\n\t\t}\n\t\telse\n\t\t\t$(\".outlearn-section-wrapper.overall .consent_checkbox\").removeClass(\"unanswered\");\n\n\t\treturn ready;\n\t}\n\n\twindow.onOverallSubmitClick = function(){\n\t\tif(checkSubmissionForm())\n\t\t\tsubmitOutlearnData();\n\t}\n\n\tasync function submitOutlearnData(){\n\t\tvar save_button = $(\".outlearn-section-wrapper.overall button.save\");\n\t\tvar respondant_id = encodeURIComponent($(\".outlearn-section-wrapper.overall #email_input\").val()).replace(\/\\.\/g, '%2E');\n\n\t\tsave_button.prop(\"disabled\", true);\n\t\tsave_button.html(\"<div class='loader'><div><\/div><div><\/div><div><\/div><div><\/div><\/div>\");\n\n\t\t\/\/ Add a new document in collection \"cities\"\n\t\tawait setDoc(doc(database, \"outlearn\", respondant_id), getOutlearnDatabaseData());\n\n\t\t$(\".outlearn-section-wrapper.overall button.save\").addClass(\"success\");\n\t\t$(\".outlearn-section-wrapper.overall button.save\").html(\"<i class='fa-solid fa-check'><\/i>\");\n\n\t\t$(\".outlearn-floating-infobox\").html(\"<i class='fa-solid fa-check'><\/i><p>Submitted successfully!<\/p>\");\n\t\t$(\".outlearn-floating-infobox\").removeClass(\"hidden\");\n\n\t\tsetTimeout(function(){\n\t\t\t$(\".outlearn-section-wrapper.overall button.save\").html(\"Submit\");\n\t\t\t$(\".outlearn-section-wrapper.overall button.save\").removeClass(\"success\");\n\t\t\t$(\".outlearn-floating-infobox\").addClass(\"hidden\");\n\t\t\t$(\".outlearn-section-wrapper.overall button.save\").prop(\"disabled\", false);\n\t\t}, 3000);\n\t}\n\n\tfunction getOutlearnDatabaseData(){\n\t\tvar output_data = {};\n\n\t\toutput_data.geographic = {};\n\t\toutput_data.geographic.max_radius = outlearn_geo_data.max_radius;\n\t\toutput_data.geographic.area = Object.assign({}, outlearn_geo_data.area);\n\n\t\toutput_data.geographic.places = {\n\t\t\tunion: {\n\t\t\t\ttotal: 0\n\t\t\t},\n\t\t\tnocar_union: {\n\t\t\t\ttotal: 0\n\t\t\t}\n\t\t};\n\n\t\tfor(var i = 0; i < outlearn_geo_data.place_types.length; i++){\n\t\t\tif(outlearn_geo_data.places.types.union[outlearn_geo_data.place_types[i]] !== undefined)\n\t\t\t\toutput_data.geographic.places.union[outlearn_geo_data.place_types[i]] = outlearn_geo_data.places.types.union[outlearn_geo_data.place_types[i]].length;\n\t\t\telse\n\t\t\t\toutput_data.geographic.places.union[outlearn_geo_data.place_types[i]] = 0;\n\n\t\t\tif(outlearn_geo_data.places.types.nocar_union[outlearn_geo_data.place_types[i]] !== undefined)\n\t\t\t\toutput_data.geographic.places.nocar_union[outlearn_geo_data.place_types[i]] = outlearn_geo_data.places.types.nocar_union[outlearn_geo_data.place_types[i]].length;\n\t\t\telse\n\t\t\t\toutput_data.geographic.places.nocar_union[outlearn_geo_data.place_types[i]] = 0;\n\n\t\t\toutput_data.geographic.places.union.total = output_data.geographic.places.union.total + output_data.geographic.places.union[outlearn_geo_data.place_types[i]];\n\t\t\toutput_data.geographic.places.nocar_union.total = output_data.geographic.places.nocar_union.total + output_data.geographic.places.nocar_union[outlearn_geo_data.place_types[i]];\n\t\t}\n\n\t\toutput_data.geographic.score = Object.assign({}, outlearn_geo_data.score);\n\n\t\toutput_data.human = {\n\t\t\tcaregivers: Object.assign({}, outlearn_human_data.caregivers),\n\t\t\tchildren: Object.assign({}, outlearn_human_data.children),\n\t\t\tsupporters: Object.assign({}, outlearn_human_data.support),\n\t\t\tscore: Object.assign({}, outlearn_human_data.score)\n\t\t};\n\n\t\tfor (var key in output_data.human.supporters) {\n\t\t\tdelete output_data.human.supporters[key].center;\n\t\t}\n\n\t\toutput_data.spatial = Object.assign({}, outlearn_spatial_data);\n\t\tdelete output_data.spatial.scored;\n\n\t\toutput_data.material = Object.assign({}, outlearn_material_data);\n\t\tdelete output_data.material.country;\n\t\tdelete output_data.material.scored;\n\n\t\toutput_data.scores = {\n\t\t\tgenerated: Object.assign({}, outlearn_overall_data.generated_scores),\n\t\t\tself_assessed: Object.assign({}, outlearn_overall_data.self_assessed_scores)\n\t\t};\n\n\t\toutput_data.scores.self_assessed.commentary = $(\".outlearn-section-wrapper.overall #commentary_textarea\").val();\n\n\t\toutput_data.respondant = {\n\t\t\tfirst_name: $(\".outlearn-section-wrapper.overall #firstname_input\").val(),\n\t\t\tlast_name: $(\".outlearn-section-wrapper.overall #lastname_input\").val(),\n\t\t\temail: $(\".outlearn-section-wrapper.overall #email_input\").val(),\n\t\t\tschool: $(\".outlearn-section-wrapper.overall #school_input\").val(),\n\t\t\tcountry: outlearn_geo_data.center_country,\n\t\t\tzip_code: outlearn_geo_data.center_zip\n\t\t};\n\n\t\toutput_data.date = Date.now();\n\n\t\treturn output_data;\n\t}\n\n\tfunction setFormEditable(context, enable = true){\n\t\tvar contexts = [];\n\n\t\tif(context == \"all\"){\n\t\t\tcontexts = [\"geographic\", \"human\", \"spatial\", \"material\", \"overall\"];\n\t\t}\n\t\telse\n\t\t\tcontexts.push(context);\n\n\t\tfor(var i = 0; i < contexts.length; i++){\n\t\t\tvar submit_button = $(\".outlearn-section-wrapper.\" + contexts[i] + \" button.submit\");\n\n\t\t\tif(!enable){\n\t\t\t\tsubmit_button.prop(\"disabled\", true);\n\t\t\t\tsubmit_button.html(\"<div class='loader'><div><\/div><div><\/div><div><\/div><div><\/div><\/div>\");\n\n\t\t\t\t$(\".outlearn-floating-infobox\").html(\"<div class='loader'><div><\/div><div><\/div><div><\/div><div><\/div><\/div><p>Processing...<\/p>\");\n\t\t\t\t$(\".outlearn-floating-infobox\").removeClass(\"hidden\");\n\n\t\t\t\t$(\".outlearn-section-wrapper.\" + contexts[i] + \" input\").prop(\"disabled\", true);\n\t\t\t\t$(\".outlearn-section-wrapper.\" + contexts[i] + \" select\").prop(\"disabled\", true);\n\t\t\t\t$(\".outlearn-section-wrapper.\" + contexts[i] + \" checkbox\").prop(\"disabled\", true);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tsubmit_button.prop(\"disabled\", false);\n\t\t\t\tsubmit_button.html(\"Calculate\");\n\n\t\t\t\t$(\".outlearn-floating-infobox\").addClass(\"hidden\");\n\n\t\t\t\t$(\".outlearn-section-wrapper.\" + contexts[i] + \" input\").prop(\"disabled\", false);\n\t\t\t\t$(\".outlearn-section-wrapper.\" + contexts[i] + \" select\").prop(\"disabled\", false);\n\t\t\t\t$(\".outlearn-section-wrapper.\" + contexts[i] + \" checkbox\").prop(\"disabled\", false);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction geopointsDistance(lat1, lng1, lat2, lng2) {\n\t\tvar R = 6371; \/\/ Radius of the earth in km\n\t\tvar dLat = deg2rad(lat2-lat1);  \/\/ deg2rad below\n\t\tvar dLng = deg2rad(lng2-lng1); \n\n\t\tvar a = Math.sin(dLat\/2) * Math.sin(dLat\/2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLng\/2) * Math.sin(dLng\/2);\n\t\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\t\tvar d = R * c; \/\/ Distance in km\n\n\t\treturn d*1000; \/\/ Distance in m\n\t}\n\n\tfunction deg2rad(deg) {\n\t\treturn deg * (Math.PI\/180)\n\t}\n\n\tfunction getDateLastOccurence(strDay, queryType){\n\t\tvar weekdays = [ \"Sun\", \"Sat\", \"Fri\", \"Thu\", \"Wed\", \"Tue\", \"Mon\" ];\n\n\t\tvar index = weekdays.indexOf(strDay);\n\t\tvar outputDateObj = new Date();\n\t\toutputDateObj.setDate(outputDateObj.getDate() - (outputDateObj.getDay() + index) % 7);\n\n\t\toutputDateObj.setHours(17, 0, 0);\n\n\t\tif(queryType == \"ISO\")\n\t\t\treturn outputDateObj.toISOString();\n\n\t\tif(queryType == \"datestring\")\n\t\t\treturn outputDateObj.toISOString().substring(0, 10);\n\t}\n\n\tfunction objectToUrlParams(obj){\n\t\tvar str = \"\";\n\t\tfor (var key in obj) {\n\t\t\tif (str != \"\") {\n\t\t\t\tstr += \"&\";\n\t\t\t}\n\t\t\tstr += key + \"=\" + encodeURIComponent(obj[key]);\n\t\t}\n\t}\n\n\t\/\/ Returns the value at a given percentile in a sorted numeric array.\n\t\/\/ \"Linear interpolation between closest ranks\" method\n\tfunction percentile(arr, p) {\n\t    if (arr.length === 0) return 0;\n\t    if (typeof p !== 'number') throw new TypeError('p must be a number');\n\t    if (p <= 0) return arr[0];\n\t    if (p >= 1) return arr[arr.length - 1];\n\n\t    var index = (arr.length - 1) * p,\n\t        lower = Math.floor(index),\n\t        upper = lower + 1,\n\t        weight = index % 1;\n\n\t    if (upper >= arr.length) return arr[lower];\n\t    return arr[lower] * (1 - weight) + arr[upper] * weight;\n\t}\n\n\t\/\/ Returns the percentile of the given value in a sorted numeric array.\n\tfunction percentRank(arr, v) {\n\t    if (typeof v !== 'number') throw new TypeError('v must be a number');\n\t    for (var i = 0, l = arr.length; i < l; i++) {\n\t        if (v <= arr[i]) {\n\t            while (i < l && v === arr[i]) i++;\n\t            if (i === 0) return 0;\n\t            if (v !== arr[i-1]) {\n\t                i += (v - arr[i-1]) \/ (arr[i] - arr[i-1]);\n\t            }\n\t            return i \/ l;\n\t        }\n\t    }\n\t    return 1;\n\t}\n\n\tfunction average(array) {\n\t    return array.reduce((x,y) => x+y)\/array.length\n\t}\n\n\tfunction sendEmailMessage(subject, msg){\n\t\tvar data = {\n\t        'name': \"Quarto Crescente - Site\",\n\t        'email': \"info@quartocrescente.org\",\n\t        'subject': subject,\n\t        'message' : msg\n\t    };\n\n\t    $.ajax({ \n\t        url: 'https:\/\/quartocrescente.org\/wp-content\/themes\/quartocrescente\/assets\/php\/smtp.php', \n\t        data: data,\n\t        type: 'POST',\n\t        success: function (data) {\n\t            console.log(\"DEBUG: E-mail sent successfully!\");\n\t            console.log(data);\n\t        }\n\t    });\n\t}\n<\/script>\n\n<div class=\"outlearn-floating-infobox hidden\">\n\t<div class='loader'><div><\/div><div><\/div><div><\/div><div><\/div><\/div>\n\t<p>A processar...<\/p>\n<\/div>\n\n<label class=\"alignwide\">A <b>Pontua\u00e7\u00e3o OutLearn<\/b> \u00e9 um indicador dos recursos dos agregados familiares para proporcionar oportunidades de aprendizagem informal \u00e0s suas crian\u00e7as. Considera quatro subpontua\u00e7\u00f5es que correspondem a quatro tipos de potencial - <b>Geogr\u00e1fico<\/b>, <b>Humano<\/b>, <b>Espacial<\/b> e <b>Material<\/b>. Utiliza uma escala de 5 pontos, desde <b>E<\/b> (grau mais baixo) a <b>A<\/b> (grau mais alto).<\/label>\n\n\n<div class=\"outlearn-section-wrapper alignwide geographic\">\n\t<div class=\"outlearn-section-header\">\n\t\t<div class=\"title-group\">\n\t\t\t<h2>Potencial Geogr\u00e1fico<\/h2>\n\t\t\t<p>Considera a \u00e1rea alcan\u00e7\u00e1vel em 15 minutos a partir da habita\u00e7\u00e3o, a p\u00e9 (<i class='fa-solid fa-person-walking'><\/i>), por transporte p\u00fablico (<i class='fa-solid fa-bus'><\/i>) e de carro<sup>*<\/sup> (<i class='fa-solid fa-car'><\/i>), considerando a sa\u00edda \u00e0s 17 horas locais da \u00faltima quarta-feira (<span class=\"datestring\"><\/span>). Contabiliza a dimens\u00e3o desta \u00e1rea e a quantidade e diversidade de espa\u00e7os que oferecem oportunidades de aprendizagem informal dentro dela.<\/p>\n\t\t<\/div>\n\t\t<div class=\"outlearn-section-score\">\n\t\t\t<span>-<\/span>\n\t\t<\/div>\n\t<\/div>\n\n\t<form class=\"outlearn-form end-align alignwide\" action=\"\">\n\t\t<div class=\"form-inputs\">\n\t\t\t<h4 class=\"element-group-title\">Local da Habita\u00e7\u00e3o<\/h4>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"country_select\">Pa\u00eds:<\/label>\n\t\t\t\t\t<select class=\"country_select\" id=\"country_select\" name=\"household_country\" oninput=\"onAddressChange(this)\">\n\t\t\t\t\t<\/select>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"postal_input\">C\u00f3digo Postal:<\/label>\n\t\t\t\t\t<input type=\"text\" class=\"postal_input\" id=\"postal_input\" name=\"household_zip\" oninput=\"onAddressChange(this)\">\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<label><sup>*<\/sup>Algum dos cuidadores do agregado familiar tem carta de condu\u00e7\u00e3o e acesso a autom\u00f3vel para uso pessoal?<\/label>\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"car_ownership_true\">Sim<\/label>\n\t\t\t\t\t<input type=\"radio\" id=\"car_ownership_true\" name=\"household_car\" value='yes'>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"car_ownership_false\">N\u00e3o<\/label>\n\t\t\t\t\t<input type=\"radio\" id=\"car_ownership_false\" name=\"household_car\" value='no'>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<button type=\"button\" class=\"submit\" onclick=\"onGeoScoreCalcClick()\">Calcular<\/button>\n\t<input type=\"hidden\" name=\"trp-form-language\" value=\"pt\"\/><\/form>\n\n\t<div class=\"outlearn-map-wrapper geo-map-wrapper alignwide\">\n\t\t<div class=\"lds-ellipsis loader hidden\"><div><\/div><div><\/div><div><\/div><div><\/div><\/div>\n\t\t<div class=\"outlearn-map outlearn-geo-map\"><\/div>\n\t<\/div>\n\n\t<div class=\"outlearn-section-results hidden\">\n\t\t<div class=\"outlearn-section-results-header\">\n\t\t\t<h4 class=\"area-title\" onclick=\"toggleResultsSection(this.nextElementSibling)\"> Resultados<\/h4>\n\t\t\t<button class=\"outlearn-section-results-toggle\" onclick=\"toggleResultsSection(this)\"><i class=\"fa-solid fa-chevron-down\"><\/i><\/button>\n\t\t<\/div>\n\n\t\t<div class=\"outlearn-section-results-body hidden\">\n\t\t\t<div>\n\t\t\t\t<span><i class=\"fa-solid fa-circle-info\"><\/i> <b>Duplo click<\/b> qualquer ponto dentro da \u00e1rea alcan\u00e7\u00e1vel (sombreado) no mapa para adicionar um local \u00e0 lista.<\/span>\n\t\t\t<\/div>\n\n\t\t\t<div class=\"outlearn-geoview-filter\">\n\t\t\t\t<i class=\"fa-solid fa-eye\"><\/i>\n\t\t\t\t<h4>Visualizar<\/h4>\n\t\t\t\t<form onchange=\"onGeoViewChange(this)\" action=\"\">\n\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t<input type=\"radio\" id=\"outlearn-geoview-union\" name=\"outlearn-geoview\" value='union' checked>\n\t\t\t\t\t\t<label for=\"outlearn-geoview-full\"><i class=\"fa-solid fa-object-group\"><\/i><\/label>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<span>|<\/span>\n\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t<input type=\"radio\" id=\"outlearn-geoview-walking\" name=\"outlearn-geoview\" value='walking'>\n\t\t\t\t\t\t<label for=\"outlearn-geoview-walking\"><i class=\"fa-solid fa-person-walking\"><\/i><\/label>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t<input type=\"radio\" id=\"outlearn-geoview-public-transport\" name=\"outlearn-geoview\" value='public-transport'>\n\t\t\t\t\t\t<label for=\"outlearn-geoview-public-transport\"><i class=\"fa-solid fa-bus\"><\/i><\/label>\n\t\t\t\t\t<\/div>\n\t\t\t\t<input type=\"hidden\" name=\"trp-form-language\" value=\"pt\"\/><\/form>\n\t\t\t<\/div>\n\n\t\t\t<div class=\"outlearn-map-overall-data-wrapper\">\n\t\t\t\t<h5><i class=\"fa-solid fa-ruler-combined\"><\/i> \u00c1rea Coberta: <b><span class=\"area-span\"><\/span><\/b><\/h5>\n\t\t\t\t<h5><i class=\"fa-solid fa-location-dot\"><\/i> Lugares: <b><span class=\"n-span\">0<\/span><\/b><\/h5>\n\t\t\t<\/div>\n\n\t\t\t<div class=\"outlearn-places-wrapper\">\n\t\t\t\t<div class=\"outlearn-placestype-wrapper cultural_center recreative_center\" n=\"0\">\n\t\t\t\t\t<h4>centros culturais <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper library\" n=\"0\">\n\t\t\t\t\t<h4>bibliotecas <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper museum\" n=\"0\">\n\t\t\t\t\t<h4>museus <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper park garden\" n=\"0\">\n\t\t\t\t\t<h4>Parques\/Jardins <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper playground\" n=\"0\">\n\t\t\t\t\t<h4>Playgrounds <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper after_school study_center\" n=\"0\">\n\t\t\t\t\t<h4>Centros p\u00f3s-escolares <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper music_school\" n=\"0\">\n\t\t\t\t\t<h4>Escolas de m\u00fasica\/auto-express\u00e3o <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper sports_field sports_club sports_facility\" n=\"0\">\n\t\t\t\t\t<h4>Clubes Desportivos\/Infra-estruturas <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper auditorium concert_hall theater\" n=\"0\">\n\t\t\t\t\t<h4>Audit\u00f3rios <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-placestype-wrapper university college\" n=\"0\">\n\t\t\t\t\t<h4>universidades <span>(0)<\/span><\/h4>\n\t\t\t\t\t<ul class=\"outlearn-placestype-list\"><\/ul>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t<\/div>\n\n\t<div class=\"footer-credits\">\n\t\t<span>Potenciado por: <\/span>\n\t\t<a href=\"https:\/\/traveltime.com\/\" target=\"_blank\">\n\t\t\t<img decoding=\"async\" src=\"https:\/\/quartocrescente.org\/wp-content\/uploads\/2022\/11\/traveltime_logo.svg\"\/>\n\t\t<\/a>\n\t\t<a href=\"https:\/\/developers.google.com\/maps\" target=\"_blank\">\n\t\t\t<img decoding=\"async\" src=\"https:\/\/quartocrescente.org\/wp-content\/uploads\/2022\/11\/googlemaps_logo.svg\"\/>\n\t\t<\/a>\n\t<\/div>\n<\/div>\n\n<div class=\"outlearn-section-wrapper alignwide human\">\n\t<div class=\"outlearn-section-header\">\n\t\t<div class=\"title-group\">\n\t\t\t<h2>Potencial Humano<\/h2>\n\t\t\t<p>Contabiliza o tempo \u00fatil de cuidado dos cuidadores do agregado familiar por crian\u00e7a tutelada, e a extens\u00e3o e proximidade f\u00edsica da rede de cuidadores.<\/p>\n\t\t<\/div>\n\t\t<div class=\"outlearn-section-score\">\n\t\t\t<span>-<\/span>\n\t\t<\/div>\n\t<\/div>\n\n\t<form class=\"outlearn-form start-align alignwide\" action=\"\">\n\t\t<div class=\"form-inputs\">\n\t\t\t<h4 class=\"element-group-title\">Local da Habita\u00e7\u00e3o<\/h4>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"country_select\">Pa\u00eds:<\/label>\n\t\t\t\t\t<select class=\"country_select\" id=\"country_select\" name=\"household_country\" onchange=\"onAddressChange(this)\">\n\t\t\t\t\t<\/select>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"postal_input\">C\u00f3digo Postal:<\/label>\n\t\t\t\t\t<input type=\"text\" class=\"postal_input\" id=\"postal_input\" name=\"household_zip\" oninput=\"onAddressChange(this)\">\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<h4 class=\"element-group-title\">Cuidadores do Agregado<\/h4>\n\t\t\t<div class=\"form-row human-row\">\n\t\t\t\t<div class=\"input-wrapper fullwidth\">\n\t\t\t\t\t<label for=\"caregivers_num_input\">N\u00famero de Cuidadores:<\/label>\n\t\t\t\t\t<input type=\"number\" min=\"1\" id=\"caregivers_num_input\" name=\"caregivers_num_input\" oninput=\"onHumanNumInput(this, 'caregivers')\">\n\t\t\t\t<\/div>\n\t\t\t\t<ul class=\"caregivers-list\">\n\t\t\t\t<\/ul>\n\t\t\t\t\n\t\t\t\t<h4 class=\"element-group-title\">Crian\u00e7as Tuteladas<\/h4>\n\t\t\t\t<p><i class=\"fa-solid fa-circle-exclamation\"><\/i> Considere o <b>n\u00famero total de crian\u00e7as sob cust\u00f3dia (integral ou partilhada) dos cuidadores do agregado<\/b>.<\/p>\n\t\t\t\t<div class=\"input-wrapper fullwidth\">\n\t\t\t\t\t<label for=\"children_num_input\">N\u00famero de Crian\u00e7as:<\/label>\n\t\t\t\t\t<input type=\"number\" min=\"1\" id=\"children_num_input\" name=\"children_num_input\" oninput=\"onHumanNumInput(this, 'children')\">\n\t\t\t\t<\/div>\n\t\t\t\t<ul class=\"children-list\">\n\t\t\t\t<\/ul>\n\t\t\t<\/div>\n\n\t\t\t<h4 class=\"element-group-title\">Cuidadores de Apoio<\/h4>\n\t\t\t<div class=\"form-row human-row\">\n\t\t\t\t<div class=\"input-wrapper fullwidth\">\n\t\t\t\t\t<label for=\"support_num_input\">N\u00famero de Cuidadores de Apoio:<\/label>\n\t\t\t\t\t<input type=\"number\" min=\"0\" id=\"support_num_input\" name=\"support_num_input\" oninput=\"onHumanNumInput(this, 'support')\">\n\t\t\t\t<\/div>\n\t\t\t\t<ul class=\"support-list\">\n\t\t\t\t<\/ul>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<button type=\"button\" class=\"submit\" onclick=\"onHumanScoreCalcClick()\">Calcular<\/button>\n\t<input type=\"hidden\" name=\"trp-form-language\" value=\"pt\"\/><\/form>\n<\/div>\n\n<div class=\"outlearn-section-wrapper alignwide spatial\">\n\t<div class=\"outlearn-section-header\">\n\t\t<div class=\"title-group\">\n\t\t\t<h2>Potencial Espacial<\/h2>\n\t\t\t<p>Considera a tipologia da habita\u00e7\u00e3o e os espa\u00e7os que oferece para atividades de aprendizagem informal.<\/p>\n\t\t<\/div>\n\t\t<div class=\"outlearn-section-score\">\n\t\t\t<span>-<\/span>\n\t\t<\/div>\n\t<\/div>\n\n\t<form class=\"outlearn-form alignwide\" action=\"\">\n\t\t<div class=\"form-inputs\">\n\t\t\t<h4 class=\"element-group-title\">Condi\u00e7\u00f5es de Habita\u00e7\u00e3o<\/h4>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"spatial_home_type\">Tipo:<\/label>\n\t\t\t\t\t<select id=\"spatial_home_type\" name=\"spatial_home_type\"><option value=\"unselected\">(Selecione)<\/option><option value=\"apartment\">Apartamento<\/option><option value=\"single-family\">Moradia Unifamiliar<\/option><option value=\"multi-family\">Moradia Multifamiliar<\/option><option value=\"mobile\">Casa M\u00f3vel<\/option><option value=\"camp\">Acampamento<\/option><\/select>\n\t\t\t\t<\/div>\n\t\t\t\t<!--\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"spatial_home_typology\">Typology:<\/label>\n\t\t\t\t\t<select id=\"spatial_home_typology\" name=\"spatial_home_typology\"><option value=\"unselected\">(Select)<\/option><option value=\"t0\">T0<\/option><option value=\"t1\">T1<\/option><option value=\"t2\">T2<\/option><option value=\"t3\">T3<\/option><option value=\"t4\">T4<\/option><option value=\"t5\">T5<\/option><option value=\"t6\">T6<\/option><option value=\"t7\">T7<\/option><option value=\"t8\">T8<\/option><option value=\"t9\">T9<\/option><option value=\">t9\">>T9<\/option><\/select>\n\t\t\t\t<\/div>\n\t\t\t\t-->\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"spatial_home_area\">\u00c1rea Bruta Interna:<\/label>\n\t\t\t\t\t<input type=\"number\" id=\"spatial_home_area\" name=\"spatial_home_area\">\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<select id=\"spatial_home_area_unit\" name=\"spatial_home_area_unit\"><option value=\"m2\">m\u00b2<\/option><option value=\"ft2\">ft\u00b2<\/option><\/select>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"spatial_residents_num\">N\u00famero de Residentes:<\/label>\n\t\t\t\t\t<input type=\"number\" min=\"1\" id=\"spatial_residents_num\" name=\"spatial_residents_num\"\/>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<ul class=\"dot-leader-list\">\n\t\t\t\t<div class=\"dot-leader-list-header\">\n\t\t\t\t\t<div class=\"header-labels\">\n\t\t\t\t\t\t<label>Sim<\/label>\n\t\t\t\t\t\t<label>N\u00e3o<\/label>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<li>\n\t\t\t\t\t<div class=\"dot-leader-entry\">\n\t\t\t\t\t\t<div class=\"dot-leader-lead\"><h5>Tem um quarto individual n\u00e3o partilhado para cada crian\u00e7a.<\/h5><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader__dots\"><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader-form\">\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_childrooms_true\" name=\"spatial_childrooms\" value='true'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_childrooms_false\" name=\"spatial_childrooms\" value='false'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/li>\n\t\t\t\t<li>\n\t\t\t\t\t<div class=\"dot-leader-entry\">\n\t\t\t\t\t\t<div class=\"dot-leader-lead\"><h5>Tem uma esta\u00e7\u00e3o de escrit\u00f3rio fixa para cada crian\u00e7a.<\/h5><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader__dots\"><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader-form\">\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_officestation_true\" name=\"spatial_officestation\" value='true'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_officestation_false\" name=\"spatial_officestation\" value='false'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/li>\n\t\t\t\t<li>\n\t\t\t\t\t<div class=\"dot-leader-entry\">\n\t\t\t\t\t\t<div class=\"dot-leader-lead\"><h5>Tem logradouro\/terra\u00e7o pavimentado (privado ou comunit\u00e1rio).<\/h5><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader__dots\"><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader-form\">\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_patio_true\" name=\"spatial_patio\" value='true'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_patio_false\" name=\"spatial_patio\" value='false'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/li>\n\t\t\t\t<li>\n\t\t\t\t\t<div class=\"dot-leader-entry\">\n\t\t\t\t\t\t<div class=\"dot-leader-lead\"><h5>Tem quintal (particular ou comunit\u00e1rio).<\/h5><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader__dots\"><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader-form\">\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_backyard_true\" name=\"spatial_backyard\" value='true'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_backyard_false\" name=\"spatial_backyard\" value='false'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/li>\n\t\t\t\t<li>\n\t\t\t\t\t<div class=\"dot-leader-entry\">\n\t\t\t\t\t\t<div class=\"dot-leader-lead\"><h5>Tem um terreno natural de \u00e1rea &gt; 1ha (privado ou comunit\u00e1rio).<\/h5><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader__dots\"><\/div>\n\t\t\t\t\t\t<div class=\"dot-leader-form\">\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_terrain_true\" name=\"spatial_terrain\" value='true'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"spatial_terrain_false\" name=\"spatial_terrain\" value='false'>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/li>\n\t\t\t<\/ul>\n\t\t<\/div>\n\t\t<button type=\"button\" class=\"submit\" onclick=\"onSpatialScoreCalcClick()\">Calcular<\/button>\n\t<input type=\"hidden\" name=\"trp-form-language\" value=\"pt\"\/><\/form>\n<\/div>\n\n<div class=\"outlearn-section-wrapper alignwide material\">\n\t<div class=\"outlearn-section-header\">\n\t\t<div class=\"title-group\">\n\t\t\t<h2>Potencial Material<\/h2>\n\t\t\t<p>Recorre a uma m\u00e9trica do custo de vida do pa\u00eds de resid\u00eancia (Living Wage) para avaliar o conforto financeiro da fam\u00edlia e o consequente acesso a materiais facilitadores de atividades de aprendizagem informal.<\/p>\n\t\t<\/div>\n\t\t<div class=\"outlearn-section-score\">\n\t\t\t<span>-<\/span>\n\t\t<\/div>\n\t<\/div>\n\n\t<form class=\"outlearn-form alignwide\" action=\"\">\n\t\t<div class=\"form-inputs\">\n\t\t\t<h4 class=\"element-group-title\">Local da Habita\u00e7\u00e3o<\/h4>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"country_select\">Pa\u00eds:<\/label>\n\t\t\t\t\t<select class=\"country_select\" id=\"country_select\" name=\"household_country\" onchange=\"onAddressChange(this)\">\n\t\t\t\t\t<\/select>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<h4 class=\"element-group-title\">Rendimento Familiar<\/h4>\n\t\t\t<div class=\"form-row human-row\">\n\t\t\t\t<div class=\"form-row fullwidth\">\n\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t<label for=\"provider_num_input\">N\u00famero de Provedores de Rendimento:<\/label>\n\t\t\t\t\t\t<input type=\"number\" min=\"1\" id=\"provider_num_input\" name=\"provider_num_input\" oninput=\"onHumanNumInput(this, 'provider')\">\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t<label for=\"dependant_num_input\">N\u00famero de Dependentes:<\/label>\n\t\t\t\t\t\t<input type=\"number\" min=\"1\" id=\"dependant_num_input\" name=\"dependant_num_input\">\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<ul class=\"provider-list\">\n\t\t\t\t<\/ul>\n\t\t\t\t<!--\n\t\t\t\t<div class=\"form-row\">\n\t\t\t\t\t<div class='input-wrapper'>\n\t\t\t\t\t\t<label for='providers_discretionary_income'>Aprox. Monthly Discretionary Income:<\/label>\n\t\t\t\t\t\t<select id='providers_discretionary_income' class='providers_discretionary_select' name='providers_discretionary_income'>\n\t\t\t\t\t\t\t<option value='unselected'>(Select)<\/option>\n\t\t\t\t\t\t\t<option min='0' max='10' value='0-10'>Less than 10%<\/option>\n\t\t\t\t\t\t\t<option min='10' max='30' value='10-30'>10% < 30%<\/option>\n\t\t\t\t\t\t\t<option min='30' max='50' value='30-50'>30% < 50%<\/option>\n\t\t\t\t\t\t\t<option min='50' max='70' value='50-70'>50% < 70%<\/option>\n\t\t\t\t\t\t\t<option min='70' max='100' value='70-100'>More than 70%<\/option>\n\t\t\t\t\t\t<\/select>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t\t<select id=\"providers_discretionary_currency\" class=\"providers_discretionary_currency_select currency_select\" name=\"providers_discretionary_currency\" onchange=\"onCurrencySelectChange(this)\"><option selected=\"selected\" value=\"DEFAULT\">%<\/option><\/select>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\n\t\t\t\t<p>(<i class=\"fa-solid fa-circle-exclamation\"><\/i> <b>Discretionary Income<\/b> as the remainig after the deduction of taxes and social security charges but also the basic necessities' shopping and contracted monthly charges, such as the home rent and bills. It should reflect the income portion that can be saved or used to fulfill nonessential personal wishes)<\/p>\n\t\t\t\t-->\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<button type=\"button\" class=\"submit\" onclick=\"onMaterialScoreCalcClick()\">Calcular<\/button>\n\t<input type=\"hidden\" name=\"trp-form-language\" value=\"pt\"\/><\/form>\n<\/div>\n<div class=\"outlearn-section-wrapper alignwide overall\">\n\t<div class=\"outlearn-section-header\">\n\t\t<div class=\"title-group\">\n\t\t\t<h2>Geral<\/h2>\n\t\t\t<p><\/p>\n\t\t<\/div>\n\t\t<div class=\"outlearn-section-score\">\n\t\t\t<span>-<\/span>\n\t\t<\/div>\n\t<\/div>\n\n\t<form class=\"outlearn-form end-align alignwide hidden\" action=\"\">\n\t\t<div class=\"form-inputs\">\n\t\t\t<h4 class=\"element-group-title\">Subpontua\u00e7\u00f5es<\/h4>\n\t\t\t<div class=\"form-row tile-row\">\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Geogr\u00e1fico<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile geographic\">\n\t\t\t\t\t\t<span>-<\/span>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Humano<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile human\">\n\t\t\t\t\t\t<span>-<\/span>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Espacial<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile spatial\">\n\t\t\t\t\t\t<span>-<\/span>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Material<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile material\">\n\t\t\t\t\t\t<span>-<\/span>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<h4 class=\"element-group-title\">Auto-avalia\u00e7\u00e3o<\/h4>\n\t\t\t<div class=\"form-row tile-row\">\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Geogr\u00e1fico<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile self-assessment geographic\">\n\t\t\t\t\t\t<select class=\"self_assessment_select\" id=\"geographic_self_assessment_select\" name=\"geographic_self_assessment_select\" onchange=\"onSelfAssessmentChange(this)\">\n\t\t\t\t\t\t\t<option value=\"unselected\">-<\/option>\n\t\t\t\t\t\t\t<option value=\"5\">A<\/option>\n\t\t\t\t\t\t\t<option value=\"4\">B<\/option>\n\t\t\t\t\t\t\t<option value=\"3\">C<\/option>\n\t\t\t\t\t\t\t<option value=\"2\">D<\/option>\n\t\t\t\t\t\t\t<option value=\"1\">E<\/option>\n\t\t\t\t\t\t<\/select>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Humano<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile self-assessment human\">\n\t\t\t\t\t\t<select class=\"self_assessment_select\" id=\"human_self_assessment_select\" name=\"human_self_assessment_select\" onchange=\"onSelfAssessmentChange(this)\">\n\t\t\t\t\t\t\t<option value=\"unselected\">-<\/option>\n\t\t\t\t\t\t\t<option value=\"5\">A<\/option>\n\t\t\t\t\t\t\t<option value=\"4\">B<\/option>\n\t\t\t\t\t\t\t<option value=\"3\">C<\/option>\n\t\t\t\t\t\t\t<option value=\"2\">D<\/option>\n\t\t\t\t\t\t\t<option value=\"1\">E<\/option>\n\t\t\t\t\t\t<\/select>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Espacial<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile self-assessment spatial\">\n\t\t\t\t\t\t<select class=\"self_assessment_select\" id=\"spatial_self_assessment_select\" name=\"spatial_self_assessment_select\" onchange=\"onSelfAssessmentChange(this)\">\n\t\t\t\t\t\t\t<option value=\"unselected\">-<\/option>\n\t\t\t\t\t\t\t<option value=\"5\">A<\/option>\n\t\t\t\t\t\t\t<option value=\"4\">B<\/option>\n\t\t\t\t\t\t\t<option value=\"3\">C<\/option>\n\t\t\t\t\t\t\t<option value=\"2\">D<\/option>\n\t\t\t\t\t\t\t<option value=\"1\">E<\/option>\n\t\t\t\t\t\t<\/select>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"outlearn-subscore-tile-wrapper\">\n\t\t\t\t\t<label>Material<\/label>\n\t\t\t\t\t<div class=\"outlearn-subscore-tile self-assessment material\">\n\t\t\t\t\t\t<select class=\"self_assessment_select\" id=\"material_self_assessment_select\" name=\"material_self_assessment_select\" onchange=\"onSelfAssessmentChange(this)\">\n\t\t\t\t\t\t\t<option value=\"unselected\">-<\/option>\n\t\t\t\t\t\t\t<option value=\"5\">A<\/option>\n\t\t\t\t\t\t\t<option value=\"4\">B<\/option>\n\t\t\t\t\t\t\t<option value=\"3\">C<\/option>\n\t\t\t\t\t\t\t<option value=\"2\">D<\/option>\n\t\t\t\t\t\t\t<option value=\"1\">E<\/option>\n\t\t\t\t\t\t<\/select>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<div class=\"input-wrapper fullwidth\">\n\t\t\t\t\t<textarea class=\"commentary_textarea\" id=\"commentary_textarea\" name=\"commentary\" rows=\"4\" placeholder=\"Coment\u00e1rio (opcional)\"><\/textarea>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<h4 class=\"element-group-title\">Submiss\u00e3o<\/h4>\n\t\t\t<p><i class=\"fa-solid fa-circle-exclamation\"><\/i> Caso esteja disposto a partilhar estes resultados e os dados do formul\u00e1rio com o investigador por favor preencha os campos adicionais abaixo e clique no bot\u00e3o Submeter.<\/br>Obrigado pela sua participa\u00e7\u00e3o!<\/p>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"firstname_input\">Nome:<\/label>\n\t\t\t\t\t<input type=\"text\" class=\"firstname_input\" id=\"firstname_input\" name=\"first_name\">\n\t\t\t\t\t<\/select>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper\">\n\t\t\t\t\t<label for=\"lastname_input\">Apelido:<\/label>\n\t\t\t\t\t<input type=\"text\" class=\"lastname_input\" id=\"lastname_input\" name=\"last_name\">\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<div class=\"form-row\">\n\t\t\t\t<div class=\"input-wrapper fullwidth\">\n\t\t\t\t\t<label for=\"email_input\">E-mail:<\/label>\n\t\t\t\t\t<input type=\"email\" class=\"email_input\" id=\"email_input\" name=\"respondant_email\">\n\t\t\t\t\t<\/select>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper fullwidth\">\n\t\t\t\t\t<label for=\"postal_input\">Escola da(s) crian\u00e7a(s):<\/label>\n\t\t\t\t\t<input type=\"text\" class=\"school_input\" id=\"school_input\" name=\"children_school\">\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"input-wrapper row\">\n\t\t\t\t\t<input type='checkbox' class='consent_checkbox' id='consent_checkbox' name='consent_checkbox'>\n\t\t\t\t\t<label for=\"consent_checkbox\">Estou dispon\u00edvel para contribuir adicionalmente para este projeto e para este efeito dou o meu consentimento para o contacto por e-mail.<\/label>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\n\t\t<button type=\"button\" class=\"save inverted\" onclick=\"onOverallSubmitClick()\">Submeter<\/button>\n\t<input type=\"hidden\" name=\"trp-form-language\" value=\"pt\"\/><\/form>\n\n\t<button type=\"button\" class=\"submit\" onclick=\"onOverallScoreCalcClick()\">Calcular<\/button>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"class_list":["post-4305","page","type-page","status-publish","hentry","entry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"trp-custom-language-flag":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pedro Silva Ferreira","author_link":"https:\/\/quartocrescente.org\/pt\/journal\/author\/quartocr_manager\/"},"uagb_comment_info":0,"uagb_excerpt":null,"_links":{"self":[{"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/pages\/4305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/comments?post=4305"}],"version-history":[{"count":2,"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/pages\/4305\/revisions"}],"predecessor-version":[{"id":4337,"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/pages\/4305\/revisions\/4337"}],"wp:attachment":[{"href":"https:\/\/quartocrescente.org\/pt\/wp-json\/wp\/v2\/media?parent=4305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}