PageSourceSearch

https://d5kizks5bscsw.ok.kimi.link/main.js

js d5kizks5bscsw.ok.kimi.link collected 2026-10-03 05:06:15 UTC 45,961 bytes, 1,065 lines download raw bytes

1// Crisis Management Website - Main JavaScript
2// Handles all interactive functionality across pages
3
4// Global variables
5let currentKit = {};
6let contacts = JSON.parse(localStorage.getItem('emergencyContacts') || '[]');
7let meetingPoints = JSON.parse(localStorage.getItem('meetingPoints') || '[]');
8let supplies = JSON.parse(localStorage.getItem('emergencySupplies') || '[]');
9
10// Initialize page when DOM is loaded
11document.addEventListener('DOMContentLoaded', function() {
12    initializePage();
13    setupEventListeners();
14    loadStoredData();
15});
16
17// Initialize page-specific functionality
18function initializePage() {
19    const currentPage = window.location.pathname.split('/').pop() || 'index.html';
20    
21    switch(currentPage) {
22        case 'index.html':
23        case '':
24            initializeHomePage();
25            break;
26        case 'survival-kit.html':
27            initializeSurvivalKitPage();
28            break;
29        case 'instructions.html':
30            initializeInstructionsPage();
31            break;
32        case 'resources.html':
33            initializeResourcesPage();
34            break;
35    }
36}
37
38// Home page initialization
39function initializeHomePage() {
40    // Initialize typewriter effect
41    if (document.getElementById('typed-text')) {
42        new Typed('#typed-text', {
43            strings: ['Διαχείριση Κρίσεων', 'Κιτ Επιβίωσης', 'Έκτακτη Ανάγκη'],
44            typeSpeed: 80,
45            backSpeed: 50,
46            backDelay: 2000,
47            loop: true,
48            showCursor: true,
49            cursorChar: '|'
50        });
51    }
52    
53    // Initialize charts
54    initializeRiskChart();
55    initializePreparednessChart();
56    
57    // Setup scenario buttons
58    setupScenarioButtons();
59}
60
61// Initialize risk distribution chart
62function initializeRiskChart() {
63    const chartElement = document.getElementById('risk-chart');
64    if (!chartElement) return;
65    
66    const chart = echarts.init(chartElement);
67    const option = {
68        tooltip: {
69            trigger: 'item',
70            formatter: '{a} <br/>{b}: {c}% ({d}%)'
71        },
72        legend: {
73            orient: 'vertical',
74            left: 10,
75            data: ['Πλημμύρες', 'Πυρκαγιές', 'Σεισμοί', 'Κακοκαιρία', 'Άλλα']
76        },
77        series: [
78            {
79                name: 'Κίνδυνοι',
80                type: 'pie',
81                radius: ['50%', '70%'],
82                avoidLabelOverlap: false,
83                label: {
84                    show: false,
85                    position: 'center'
86                },
87                emphasis: {
88                    label: {
89                        show: true,
90                        fontSize: '18',
91                        fontWeight: 'bold'
92                    }
93                },
94                labelLine: {
95                    show: false
96                },
97                data: [
98                    {value: 35, name: 'Πλημμύρες', itemStyle: {color: '#3b82f6'}},
99                    {value: 25, name: 'Πυρκαγιές', itemStyle: {color: '#ef4444'}},
100                    {value: 20, name: 'Σεισμοί', itemStyle: {color: '#10b981'}},
101                    {value: 15, name: 'Κακοκαιρία', itemStyle: {color: '#f59e0b'}},
102                    {value: 5, name: 'Άλλα', itemStyle: {color: '#8b5cf6'}}
103                ]
104            }
105        ]
106    };
107    chart.setOption(option);
108}
109
110// Initialize preparedness chart
111function initializePreparednessChart() {
112    const chartElement = document.getElementById('preparedness-chart');
113    if (!chartElement) return;
114    
115    const chart = echarts.init(chartElement);
116    const option = {
117        tooltip: {
118            trigger: 'axis',
119            axisPointer: {
120                type: 'shadow'
121            }
122        },
123        legend: {
124            data: ['Έχουν Κιτ', 'Δεν Έχουν Κιτ']
125        },
126        grid: {
127            left: '3%',
128            right: '4%',
129            bottom: '3%',
130            containLabel: true
131        },
132        xAxis: {
133            type: 'value',
134            boundaryGap: [0, 0.01]
135        },
136        yAxis: {
137            type: 'category',
138            data: ['Αθήνα', 'Θεσσαλονίκη', 'Πάτρα', 'Ηράκλειο', 'Λάρισα']
139        },
140        series: [
141            {
142                name: 'Έχουν Κιτ',
143                type: 'bar',
144                data: [23, 18, 15, 12, 10],
145                itemStyle: {color: '#10b981'}
146            },
147            {
148                name: 'Δεν Έχουν Κιτ',
149                type: 'bar',
150                data: [77, 82, 85, 88, 90],
151                itemStyle: {color: '#ef4444'}
152            }
153        ]
154    };
155    chart.setOption(option);
156}
157
158// Setup scenario buttons
159function setupScenarioButtons() {
160    const scenarioButtons = document.querySelectorAll('.scenario-btn');
161    scenarioButtons.forEach(button => {
162        button.addEventListener('click', function() {
163            const scenario = this.dataset.scenario;
164            showScenarioInfo(scenario);
165        });
166    });
167}
168
169// Show scenario information
170function showScenarioInfo(scenario) {
171    const scenarioInfo = {
172        flood: {
173            title: 'Πλημμύρα',
174            content: 'Σε περίπτωση πλημμύρας: 1. Απομακρυνθείτε από χαμηλά σημεία, 2. Μην διασχίζετε πλημμυρισμένους δρόμους, 3. Ακολουθήστε διαδρομές εκκένωσης'
175        },
176        fire: {
177            title: 'Πυρκαγιά',
178            content: 'Σε περίπτωση πυρκαγιάς: 1. Καλέστε αμέσως 199, 2. Εκκενώστε το κτίριο, 3. Μείνετε χαμηλά στον καπνό, 4. Μην χρησιμοποιείτε ανελκυστήρα'
179        },
180        power: {
181            title: 'Διακοπή Ρεύματος',
182            content: 'Σε διακοπή ρεύματος: 1. Χρησιμοποιήστε φακούς, 2. Απενεργοποιήστε ηλεκτρικές συσκευές, 3. Κρατήστε ψυγεία/καταψύκτες κλειστά, 4. Έχετε μπαταρίες διαθέσιμες'
183        },
184        home: {
185            title: 'Ασφάλεια Κατοικίας',
186            content: 'Για ασφάλεια στο σπίτι: 1. Έχετε κιτ επιβίωσης διαθέσιμο, 2. Γνωρίζετε τη θέση διακοπτών, 3. Έχετε σχέδιο εκκένωσης, 4. Ελέγχετε συναγερμούς'
187        },
188        vehicle: {
189            title: 'Κιτ Αυτοκινήτου',
190            content: 'Για ασφαλή μετακίνηση: 1. Έχετε κιτ αυτοκινήτου, 2. Γνωρίζετε εναλλακτικές διαδρομές, 3. Έχετε χάρτες offline, 4. Φουλάρετε το ντεπόζιτο'
191        },
192        medical: {
193            title: 'Πρώτες Βοήθειες',
194            content: 'Για ιατρικά περιστατικά: 1. Καλέστε 166, 2. Παρέχετε βασικές πρώτες βοήθειες, 3. Μην μετακινείτε σοβαρά τραυματίες, 4. Έχετε φάρμακα διαθέσιμα'
195        }
196    };
197    
198    const info = scenarioInfo[scenario];
199    if (info) {
200        alert(`${info.title}\n\n${info.content}`);
201    }
202}
203
204// Survival Kit page initialization
205function initializeSurvivalKitPage() {
206    setupKitForm();
207    setupCategoryButtons();
208    setupModalHandlers();
209    updateProgress();
210}
211
212// Setup kit form
213function setupKitForm() {
214    const form = document.getElementById('kit-form');
215    if (!form) return;
216    
217    form.addEventListener('submit', function(e) {
218        e.preventDefault();
219        generateKit();
220    });
221}
222
223// Generate personalized kit
224function generateKit() {
225    const familySize = parseInt(document.getElementById('family-size').value);
226    const homeType = document.getElementById('home-type').value;
227    const pets = document.getElementById('pets').value;
228    const specialNeeds = document.getElementById('special-needs').value;
229    
230    currentKit = {
231        familySize,
232        homeType,
233        pets,
234        specialNeeds,
235        categories: generateKitCategories(familySize, pets, specialNeeds)
236    };
237    
238    // Show progress section and categories
239    document.getElementById('progress-section').style.display = 'block';
240    document.getElementById('kit-categories').style.display = 'block';
241    
242    // Scroll to categories
243    document.getElementById('kit-categories').scrollIntoView({ behavior: 'smooth' });
244    
245    updateProgress();
246}
247
248// Generate kit categories based on user input
249function generateKitCategories(familySize, pets, specialNeeds) {
250    const baseCategories = {
251        basic: [
252            { item: 'Νερό (1 γαλόνι ανά άτομο/ημέρα)', quantity: familySize * 3, essential: true },
253            { item: 'Μη μαγειρευτά τρόφιμα (3 μέρες)', quantity: familySize * 3, essential: true },
254            { item: 'Χειροκίνητο ανοιχτήρι κονσερβών', quantity: 1, essential: true },
255            { item: 'Φακός με επιπλέον μπαταρίες', quantity: 2, essential: true },
256            { item: 'Ραδιόφωνο με μπαταρίες', quantity: 1, essential: true },
257            { item: 'Σφυρίχτρα', quantity: 1, essential: true },
258            { item: 'Μάσκες σκόνης', quantity: familySize * 2, essential: false },
259            { item: 'Πλαστική μεμβράνη και αυτοκόλλητη ταινία', quantity: 1, essential: false }
260        ],
261        medical: [
262            { item: 'Κιτ πρώτων βοηθειών', quantity: 1, essential: true },
263            { item: 'Αντισηπτικό', quantity: 2, essential: true },
264            { item: 'Παυσίπονα (παρακεταμόλη/ιβουπροφαίνη)', quantity: 2, essential: true },
265            { item: 'Επίδεσμοι και γάζες', quantity: 3, essential: true },
266            { item: 'Αντιβιοτική αλοιφή', quantity: 1, essential: true },
267            { item: 'Ψαλίδι', quantity: 1, essential: true },
268            { item: 'Πενσέτα', quantity: 1, essential: true },
269            { item: 'Θερμόμετρο', quantity: 1, essential: false },
270            { item: 'Αντιδιαρροϊκά φάρμακα', quantity: 1, essential: false },
271            { item: 'Αντιισταμινικά', quantity: 1, essential: false },
272            { item: 'Γάντια μιας χρήσης', quantity: 10, essential: false },
273            { item: 'Μάσκες προσώπου', quantity: 5, essential: false }
274        ],
275        tools: [
276            { item: 'Πολυεργαλείο', quantity: 1, essential: true },
277            { item: 'Κλειδί για διακοπές (νερό, αέριο)', quantity: 1, essential: true },
278            { item: 'Φακός κεφαλής', quantity: 1, essential: true },
279            { item: 'Μπαταρίες εφεδρικές', quantity: 8, essential: true },
280            { item: 'Αδιάβροχοι σπίρτοι', quantity: 2, essential: false },
281            { item: 'Κουβέρτα επιβίωσης', quantity: familySize, essential: true },
282            { item: 'Σχοινί (15 μέτρα)', quantity: 1, essential: false },
283            { item: 'Σακούλες απορριμμάτων', quantity: 10, essential: false },
284            { item: 'Χαρτί και μολύβι', quantity: 2, essential: false },
285            { item: 'Χάρτες περιοχής', quantity: 2, essential: true }
286        ],
287        personal: [
288            { item: 'Ρούχα αλλαγής', quantity: familySize * 2, essential: true },
289            { item: 'Υγιεινή προσωπική (οδοντόβουρτσα, οδοντόκρεμα)', quantity: familySize, essential: true },
290            { item: 'Σαμπουάν και σαπούνι', quantity: 2, essential: true },
291            { item: 'Πετσέτες', quantity: familySize, essential: true },
292            { item: 'Γυαλιά ηλίου', quantity: familySize, essential: false },
293            { item: 'Αντηλιακό', quantity: 1, essential: false },
294            { item: 'Επιπλέον γυαλιά οράσεως/φακοί επαφής', quantity: 1, essential: false },
295            { item: 'Καπέλο', quantity: familySize, essential: false },
296            { item: 'Γάντια εργασίας', quantity: 2, essential: false },
297            { item: 'Καλλυντικά γυναικείας υγιεινής', quantity: 1, essential: true }
298        ],
299        communication: [
300            { item: 'Κινητό τηλέφωνο με φορτιστή', quantity: 1, essential: true },
301            { item: 'Power bank', quantity: 2, essential: true },
302            { item: 'Ραδιόφωνο με μπαταρίες', quantity: 1, essential: true },
303            { item: 'Επαφές έκτακτης ανάγκης (εκτυπωμένες)', quantity: 1, essential: true },
304            { item: 'Χρήματα μετρητά (μικρά χαρτονομίσματα)', quantity: 1, essential: true },
305            { item: 'Κάρτες πίστωσης/χρεωστικές', quantity: 2, essential: true },
306            { item: 'Έγγραφα ταυτοποίησης (αντίγραφα)', quantity: 1, essential: true },
307            { item: 'Λίστα φαρμάκων και δοσολογιών', quantity: 1, essential: true }
308        ]
309    };
310    
311    // Add special needs items
312    if (specialNeeds !== 'none') {
313        baseCategories.special = [];
314        
315        if (specialNeeds === 'medical') {
316            baseCategories.special.push(
317                { item: 'Επιπλέον φάρμακα (7 μέρες)', quantity: 1, essential: true },
318                { item: 'Συσκευές ιατρικής παρακολούθησης', quantity: 1, essential: true },
319                { item: 'Ιατρικές οδηγίες (εκτυπωμένες)', quantity: 1, essential: true }
320            );
321        }
322        
323        if (specialNeeds === 'elderly') {
324            baseCategories.special.push(
325                { item: 'Βοηθητικά σκεύη κινητικότητας', quantity: 1, essential: true },
326                { item: 'Φάρμακα ηλικιωμένων', quantity: 1, essential: true },
327                { item: 'Ειδικά τρόφιμα διατροφής', quantity: 1, essential: false }
328            );
329        }
330        
331        if (specialNeeds === 'infant') {
332            baseCategories.special.push(
333                { item: 'Γάλα σκόνη βρέφους', quantity: 3, essential: true },
334                { item: 'Πάνες βρέφους', quantity: 20, essential: true },
335                { item: 'Βρεφικά τρόφιμα', quantity: 10, essential: true },
336                { item: 'Παιχνίδια ηρεμίας', quantity: 3, essential: false }
337            );
338        }
339    }
340    
341    // Add pet supplies
342    if (pets !== 'none') {
343        if (!baseCategories.special) baseCategories.special = [];
344        
345        baseCategories.special.push(
346            { item: 'Τρόφιμα κατοικιδίων (3 μέρες)', quantity: 1, essential: true },
347            { item: 'Νερό για κατοικίδια', quantity: 3, essential: true },
348            { item: 'Λουρί και ταυτότητα κατοικιδίου', quantity: 1, essential: true },
349            { item: 'Φάρμακα κατοικιδίων', quantity: 1, essential: false }
350        );
351    }
352    
353    return baseCategories;
354}
355
356// Setup category buttons
357function setupCategoryButtons() {
358    const categoryButtons = document.querySelectorAll('.category-btn');
359    categoryButtons.forEach(button => {
360        button.addEventListener('click', function() {
361            const category = this.dataset.category;
362            showCategoryChecklist(category);
363        });
364    });
365}
366
367// Show category checklist modal
368function showCategoryChecklist(category) {
369    const modal = document.getElementById('checklist-modal');
370    const title = document.getElementById('modal-title');
371    const content = document.getElementById('checklist-content');
372    
373    const categoryNames = {
374        basic: 'Βασικά Απαραίτητα',
375        medical: 'Πρώτες Βοήθειες',
376        tools: 'Εργαλεία & Εξοπλισμός',
377        personal: 'Προσωπικά Αντικείμενα',
378        special: 'Ειδικές Ανάγκες',
379        communication: 'Επικοινωνία'
380    };
381    
382    title.textContent = categoryNames[category] || 'Λίστα Ελέγχου';
383    
384    if (currentKit.categories && currentKit.categories[category]) {
385        const items = currentKit.categories[category];
386        let html = `<div class="space-y-3">`;
387        
388        items.forEach((item, index) => {
389            const itemId = `${category}-${index}`;
390            const checked = localStorage.getItem(itemId) === 'true';
391            html += `
392                <div class="checklist-item ${checked ? 'completed' : ''} flex items-center p-3 bg-gray-50 rounded-lg">
393                    <input type="checkbox" id="${itemId}" class="mr-3 w-5 h-5 text-blue-600" ${checked ? 'checked' : ''} onchange="toggleChecklistItem('${itemId}')">
394                    <div class="flex-1">
395                        <span class="item-text font-medium ${checked ? 'line-through text-gray-500' : 'text-gray-900'}">${item.item}</span>
396                        <span class="text-sm text-gray-600 ml-2">(Ποσότητα: ${item.quantity})</span>
397                        ${item.essential ? '<span class="ml-2 px-2 py-1 bg-red-100 text-red-800 text-xs rounded">Απαραίτητο</span>' : ''}
398                    </div>
399                </div>
400            `;
401        });
402        
403        html += `</div>`;
404        content.innerHTML = html;
405    } else {
406        content.innerHTML = '<p class="text-gray-600">Δεν υπάρχουν στοιχεία για αυτή την κατηγορία.</p>';
407    }
408    
409    modal.classList.remove('hidden');
410}
411
412// Toggle checklist item
413function toggleChecklistItem(itemId) {
414    const checkbox = document.getElementById(itemId);
415    const item = checkbox.closest('.checklist-item');
416    const text = item.querySelector('.item-text');
417    
418    if (checkbox.checked) {
419        localStorage.setItem(itemId, 'true');
420        item.classList.add('completed');
421        text.classList.add('line-through', 'text-gray-500');
422    } else {
423        localStorage.removeItem(itemId);
424        item.classList.remove('completed');
425        text.classList.remove('line-through', 'text-gray-500');
426    }
427    
428    updateProgress();
429}
430
431// Update progress
432function updateProgress() {
433    if (!currentKit.categories) return;
434    
435    let totalItems = 0;
436    let completedItems = 0;
437    
438    Object.keys(currentKit.categories).forEach(category => {
439        const items = currentKit.categories[category];
440        totalItems += items.length;
441        
442        items.forEach((item, index) => {
443            const itemId = `${category}-${index}`;
444            if (localStorage.getItem(itemId) === 'true') {
445                completedItems++;
446            }
447        });
448        
449        // Update category progress
450        const categoryProgress = document.querySelector(`[data-category="${category}"] .category-progress`);
451        const categoryProgressBar = document.querySelector(`[data-category="${category}"] .category-progress-bar`);
452        
453        if (categoryProgress && categoryProgressBar) {
454            const categoryCompleted = items.filter((_, index) => 
455                localStorage.getItem(`${category}-${index}`) === 'true'
456            ).length;
457            
458            categoryProgress.textContent = `${categoryCompleted}/${items.length}`;
459            categoryProgressBar.style.width = `${(categoryCompleted / items.length) * 100}%`;
460        }
461    });
462    
463    const percentage = Math.round((completedItems / totalItems) * 100);
464    
465    const progressBar = document.getElementById('progress-bar');
466    const progressPercentage = document.getElementById('progress-percentage');
467    
468    if (progressBar && progressPercentage) {
469        progressBar.style.width = `${percentage}%`;
470        progressPercentage.textContent = `${percentage}%`;
471    }
472}
473
474// Setup modal handlers
475function setupModalHandlers() {
476    const modal = document.getElementById('checklist-modal');
477    const closeBtn = document.getElementById('close-modal');
478    const exportBtn = document.getElementById('export-checklist');
479    const printBtn = document.getElementById('print-checklist');
480    
481    if (closeBtn) {
482        closeBtn.addEventListener('click', () => {
483            modal.classList.add('hidden');
484        });
485    }
486    
487    if (exportBtn) {
488        exportBtn.addEventListener('click', exportChecklist);
489    }
490    
491    if (printBtn) {
492        printBtn.addEventListener('click', printChecklist);
493    }
494    
495    // Close modal when clicking outside
496    modal?.addEventListener('click', function(e) {
497        if (e.target === modal) {
498            modal.classList.add('hidden');
499        }
500    });
501}
502
503// Export checklist
504function exportChecklist() {
505    if (!currentKit.categories) return;
506    
507    let content = 'ΚΙΤ ΕΠΙΒΙΩΣΗΣ - ΛΙΣΤΑ ΕΛΕΓΧΟΥ\n';
508    content += '=' * 50 + '\n\n';
509    
510    Object.keys(currentKit.categories).forEach(category => {
511        const categoryNames = {
512            basic: 'ΒΑΣΙΚΑ ΑΠΑΡΑΙΤΗΤΑ',
513            medical: 'ΠΡΩΤΕΣ ΒΟΗΘΕΙΕΣ',
514            tools: 'ΕΡΓΑΛΕΙΑ & ΕΞΟΠΛΙΣΜΟΣ',
515            personal: 'ΠΡΟΣΩΠΙΚΑ ΑΝΤΙΚΕΙΜΕΝΑ',
516            special: 'ΕΙΔΙΚΕΣ ΑΝΑΓΚΕΣ',
517            communication: 'ΕΠΙΚΟΙΝΩΝΙΑ'
518        };
519        
520        content += `${categoryNames[category]}\n`;
521        content += '-' * 30 + '\n';
522        
523        const items = currentKit.categories[category];
524        items.forEach((item, index) => {
525            const itemId = `${category}-${index}`;
526            const checked = localStorage.getItem(itemId) === 'true';
527            const status = checked ? '✓' : '☐';
528            content += `${status} ${item.item} (x${item.quantity})${item.essential ? ' [ΑΠΑΡΑΙΤΗΤΟ]' : ''}\n`;
529        });
530        content += '\n';
531    });
532    
533    const blob = new Blob([content], { type: 'text/plain' });
534    const url = URL.createObjectURL(blob);
535    const a = document.createElement('a');
536    a.href = url;
537    a.download = 'kit-epiviosis.txt';
538    a.click();
539    URL.revokeObjectURL(url);
540}
541
542// Print checklist
543function printChecklist() {
544    window.print();
545}
546
547// Instructions page initialization
548function initializeInstructionsPage() {
549    setupDisasterTypeButtons();
550    setupPrintCardButtons();
551}
552
553// Setup disaster type buttons
554function setupDisasterTypeButtons() {
555    const buttons = document.querySelectorAll('.disaster-type-btn');
556    buttons.forEach(button => {
557        button.addEventListener('click', function() {
558            const type = this.dataset.type;
559            showInstructions(type);
560            
561            // Update active state
562            buttons.forEach(btn => btn.classList.remove('border-blue-500'));
563            this.classList.add('border-blue-500');
564        });
565    });
566}
567
568// Show instructions for disaster type
569function showInstructions(type) {
570    const container = document.getElementById('instructions-container');
571    const instructions = getInstructionsForType(type);
572    
573    let html = `
574        <div class="mb-6">
575            <h2 class="text-3xl font-bold text-gray-900 mb-4">${instructions.title}</h2>
576            <p class="text-lg text-gray-600 mb-8">${instructions.description}</p>
577        </div>
578    `;
579    
580    html += '<div class="space-y-6">';
581    instructions.steps.forEach((step, index) => {
582        html += `
583            <div class="instruction-step flex items-start p-4 bg-gray-50 rounded-lg">
584                <div class="step-number mr-4 flex-shrink-0">${index + 1}</div>
585                <div>
586                    <h3 class="text-lg font-semibold text-gray-900 mb-2">${step.title}</h3>
587                    <p class="text-gray-700">${step.description}</p>
588                    ${step.tips ? `<div class="mt-3 p-3 bg-blue-50 border-l-4 border-blue-400 rounded"><p class="text-sm text-blue-800"><strong>Συμβουλή:</strong> ${step.tips}</p></div>` : ''}
589                </div>
590            </div>
591        `;
592    });
593    html += '</div>';
594    
595    html += `
596        <div class="mt-8 p-6 bg-red-50 border border-red-200 rounded-lg">
597            <h3 class="text-lg font-semibold text-red-800 mb-3">🚨 Σημαντικές Επαφές</h3>
598            <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
599                <div class="flex justify-between">
600                    <span>Γενική Έκτακτη Ανάγκη:</span>
601                    <span class="font-bold text-red-600">112</span>
602                </div>
603                <div class="flex justify-between">
604                    <span>Πυροσβεστική:</span>
605                    <span class="font-bold text-red-600">199</span>
606                </div>
607                <div class="flex justify-between">
608                    <span>Αστυνομία:</span>
609                    <span class="font-bold text-red-600">100</span>
610                </div>
611                <div class="flex justify-between">
612                    <span>ΕΚΑΒ:</span>
613                    <span class="font-bold text-red-600">166</span>
614                </div>
615            </div>
616        </div>
617    `;
618    
619    container.innerHTML = html;
620}
621
622// Get instructions for disaster type
623function getInstructionsForType(type) {
624    const instructions = {
625        flood: {
626            title: 'Οδηγίες για Πλημμύρα',
627            description: 'Ακολουθήστε αυτές τις οδηγίες για ασφαλή αντιμετώπιση πλημμυρικών φαινομένων',
628            steps: [
629                {
630                    title: 'Ακούστε τις προειδοποιήσεις',
631                    description: 'Παρακολουθείστε τα μέσα ενημέρωσης και τις επίσημες ανακοινώσεις για εντολές εκκένωσης.',
632                    tips: 'Κατεβάστε εφαρμογές έκτακτης ανάγκης για έγκαιρη ειδοποίηση'
633                },
634                {
635                    title: 'Απομακρυνθείτε από επικίνδυνες περιοχές',
636                    description: 'Εγκαταλείψτε αμέσως υπόγεια, ημιυπόγεια και ισόγεια χώρους. Ανεβείτε σε ψηλότερα σημεία.',
637                    tips: 'Μην περιμένετε να δείτε το νερό - η πλημμύρα μπορεί να έρθει γρήγορα'
638                },
639                {
640                    title: 'Αποφύγετε διασταυρώσεις με νερό',
641                    description: 'Μην προσπαθήσετε να διασχίσετε πλημμυρισμένους δρόμους ή χείμαρρους. Το νερό μπορεί να είναι βαθύτερο και πιο γρήγορο από ότι φαίνεται.',
642                    tips: '15 εκατοστά κινούμενου νερού μπορούν να ρίξουν έναν ενήλικα'
643                },
644                {
645                    title: 'Απενεργοποιήστε το ηλεκτρικό ρεύμα',
646                    description: 'Αν έχει νερό μέσα στο σπίτι, κλείστε τον κεντρικό διακόπτη. Μην αγγίζετε ηλεκτρικές συσκευές με βρεγμένα χέρια.',
647                    tips: 'Το ηλεκτρικό ρεύμα και το νερό δεν συνδυάζονται'
648                },
649                {
650                    title: 'Μην πίνετε μολυσμένο νερό',
651                    description: 'Χρησιμοποιείτε μόνο εμφιαλωμένο ή βρασμένο νερό. Αποφύγετε πηγές που μπορεί να έχουν μολυνθεί.',
652                    tips: 'Βράστε το νερό για τουλάχιστον 1 λεπτό για απολύμανση'
653                }
654            ]
655        },
656        fire: {
657            title: 'Οδηγίες για Πυρκαγιά',
658            description: 'Ακολουθήστε αυτές τις οδηγίες για ασφαλή εκκένωση και αντιμετώπιση πυρκαγιάς',
659            steps: [
660                {
661                    title: 'Καλέστε αμέσως την Πυροσβεστική',
662                    description: 'Καλέστε 199 και δώστε ακριβή διεύθυνση. Μην υποθέσετε ότι κάποιος άλλος το έχει ήδη κάνει.',
663                    tips: 'Μείνετε ήρεμοι και μιλήστε καθαρά με τον χειριστή'
664                },
665                {
666                    title: 'Εκκενώστε αμέσως το κτίριο',
667                    description: 'Βγείτε έξω γρήγορα και με ασφάλεια. Μην σταματήσετε για προσωπικά αντικείμενα.',
668                    tips: 'Τα υλικά αντικείμενα μπορούν να αντικατασταθούν - η ζωή σας όχι'
669                },
670                {
671                    title: 'Μείνετε χαμηλά στον καπνό',
672                    description: 'Σέρνεστε κάτω από τον καπνό όπου ο αέρας είναι καθαρότερος. Καλύψτε τη μύτη και το στόμα με υγρό πανί.',
673                    tips: 'Ο καπνός είναι ο κύριος λόγος θανάτων σε πυρκαγιές'
674                },
675                {
676                    title: 'Μην χρησιμοποιείτε ανελκυστήρα',
677                    description: 'Χρησιμοποιείτε πάντα τις σκάλες. Οι ανελκυστήρες μπορεί να σταματήσουν να λειτουργούν ή να ανοίξουν σε φλεγόμενο όροφο.',
678                    tips: 'Οι σκάλες είναι ο πιο ασφαλής τρόπος διαÏ
678†Ï…γής'
679                },
680                {
681                    title: 'Συναντηθείτε στο προκαθορισμένο σημείο',
682                    description: 'Μόλις βγείτε έξω, πηγαίνετε στο προκαθορισμένο σημείο συνάντησης. Μην επιστρέψετε μέσα για κανένα λόγο.',
683                    tips: 'Κάντε καταμέτρηση για να βεβαιωθείτε ότι όλοι είναι ασφαλείς'
684                }
685            ]
686        },
687        earthquake: {
688            title: 'Οδηγίες για Σεισμό',
689            description: 'Ακολουθήστε αυτές τις οδηγίες για προστασία κατά τη διάρκεια σεισμού',
690            steps: [
691                {
692                    title: 'Πέστε, καλυφθείτε, κρατηθείτε',
693                    description: 'Πέστε κάτω στα γόνατα, καλυφθείτε κάτω από ένα γερό τραπέζι ή γραφείο, και κρατηθείτε μέχρι να σταματήσει ο σεισμός.',
694                    tips: 'Αυτή είναι η πιο αποτελεσματική μέθοδος προστασίας'
695                },
696                {
697                    title: 'Μείνετε μακριά από παράθυρα',
698                    description: 'Τα παράθυρα μπορεί να σπάσουν και να προκαλέσουν σοβαρούς τραυματισμούς. Απομακρυνθείτε από εξωτερικούς τοίχους.',
699                    tips: 'Το γυαλί μπορεί να ταξιδέψει αρκετά μέτρα'
700                },
701                {
702                    title: 'Μην βγείτε έξω κατά τη διάρκεια',
703                    description: 'Μείνετε μέσα μέχρι να σταματήσει ο σεισμός. Το εξωτερικό μπορεί να είναι πιο επικίνδυνο με πτώσεις αντικειμένων.',
704                    tips: 'Οι περισσότεροι τραυματισμοί συμβαίνουν όταν οι άνθρωποι προσπαθούν να βγουν έξω'
705                },
706                {
707                    title: 'Χρησιμοποιείτε σκάλες, όχι ανελκυστήρες',
708                    description: 'Μετά το σεισμό, χρησιμοποιείτε σκάλες για να βγείτε έξω. Οι ανελκυστήρες μπορεί να μην λειτουργούν ή να είναι επικίνδυνοι.',
709                    tips: 'Οι ανελκυστήρες μπορεί να παγιδεύσουν ή να πέσουν'
710                },
711                {
712                    title: 'Ελέγξτε για τραυματισμούς και ζημιές',
713                    description: 'Αφού σταματήσει ο σεισμός, ελέγξτε τον εαυτό σας και τους άλλους για τραυματισμούς. Ελέγξτε για ζημιές στο κτίριο.',
714                    tips: 'Μην ανάψετε αναπτήρες ή κεριά - μπορεί να υπάρχουν διαρροές αερίων'
715                }
716            ]
717        }
718    };
719    
720    return instructions[type] || instructions.flood;
721}
722
723// Setup print card buttons
724function setupPrintCardButtons() {
725    const buttons = document.querySelectorAll('.print-card-btn');
726    buttons.forEach(button => {
727        button.addEventListener('click', function() {
728            const card = this.dataset.card;
729            printEmergencyCard(card);
730        });
731    });
732}
733
734// Print emergency card
735function printEmergencyCard(cardType) {
736    const cardContent = getEmergencyCardContent(cardType);
737    const printWindow = window.open('', '_blank');
738    printWindow.document.write(`
739        <html>
740            <head>
741                <title>Κάρτα Έκτακτης Ανάγκης</title>
742                <style>
743                    body { font-family: Arial, sans-serif; margin: 20px; }
744                    .card { border: 2px solid #ccc; padding: 20px; border-radius: 10px; max-width: 400px; }
745                    h2 { color: #dc2626; margin-bottom: 15px; }
746                    ul { list-style: none; padding: 0; }
747                    li { margin: 8px 0; padding: 5px; background: #f3f4f6; border-radius: 5px; }
748                </style>
749            </head>
750            <body>
751                <div class="card">
752                    ${cardContent}
753                </div>
754            </body>
755        </html>
756    `);
757    printWindow.document.close();
758    printWindow.print();
759}
760
761// Get emergency card content
762function getEmergencyCardContent(cardType) {
763    const cards = {
764        fire: `
765            <h2>🔥 Πυρκαγιά</h2>
766            <ul>
767                <li>🚨 Καλέστε αμέσως 199</li>
768                <li>🏃 Εκκενώστε το κτίριο</li>
769                <li>😷 Μείνετε χαμηλά στον καπνό</li>
770                <li>🚫 Μην χρησιμοποιείτε ανελκυστήρα</li>
771                <li>📍 Συναντηθείτε στο σημείο συνάντησης</li>
772            </ul>
773        `,
774        flood: `
775            <h2>🌊 Πλημμύρα</h2>
776            <ul>
777                <li>⬆️ Απομακρυνθείτε από χαμηλά σημεία</li>
778                <li>🚫 Μην διασχίζετε πλημμυρισμένους δρόμους</li>
779                <li>🛣️ Ακολουθήστε διαδρομές εκκένωσης</li>
780                <li>⚡ Αποφύγετε ηλεκτρικές συσκευές</li>
781                <li>🏠 Παραμείνετε σε ασφαλές σημείο</li>
782            </ul>
783        `,
784        earthquake: `
785            <h2>🏠 Σεισμός</h2>
786            <ul>
787                <li>🙇 Πέστε, καλυφθείτε, κρατηθείτε</li>
788                <li>🪟 Μείνετε μακριά από παράθυρα</li>
789                <li>🏠 Μην βγείτε έξω κατά τη διάρκεια</li>
790                <li>🪜 Χρησιμοποιείτε σκάλες, όχι ανελκυστήρα</li>
791                <li>🔍 Ελέγξτε για τραυματισμούς</li>
792            </ul>
793        `
794    };
795    
796    return cards[cardType] || cards.fire;
797}
798
799// Resources page initialization
800function initializeResourcesPage() {
801    setupContactForm();
802    setupCallButtons();
803    setupQRCodeGenerator();
804    loadContacts();
805    setupExportButtons();
806}
807
808// Setup contact form
809function setupContactForm() {
810    const form = document.getElementById('contact-form');
811    if (!form) return;
812    
813    form.addEventListener('submit', function(e) {
814        e.preventDefault();
815        addContact();
816    });
817}
818
819// Add contact
820function addContact() {
821    const name = document.getElementById('contact-name').value;
822    const phone = document.getElementById('contact-phone').value;
823    const relation = document.getElementById('contact-relation').value;
824    const type = document.getElementById('contact-type').value;
825    
826    if (!name || !phone) {
827        alert('Παρακαλώ συμπληρώστε όλα τα υποχρεωτικά πεδία.');
828        return;
829    }
830    
831    const contact = {
832        id: Date.now(),
833        name,
834        phone,
835        relation,
836        type
837    };
838    
839    contacts.push(contact);
840    localStorage.setItem('emergencyContacts', JSON.stringify(contacts));
841    
842    // Clear form
843    document.getElementById('contact-form').reset();
844    
845    // Reload contacts list
846    loadContacts();
847}
848
849// Load contacts
850function loadContacts() {
851    const container = document.getElementById('contacts-list');
852    if (!container) return;
853    
854    if (contacts.length === 0) {
855        container.innerHTML = '<p class="text-gray-500 text-center py-4">Δεν υπάρχουν αποθηκευμένες επαφές.</p>';
856        return;
857    }
858    
859    let html = '';
860    contacts.forEach(contact => {
861        html += `
862            <div class="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
863                <div class="flex-1">
864                    <div class="flex items-center">
865                        <span class="font-medium text-gray-900">${contact.name}</span>
866                        <span class="ml-2 px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded">${contact.type}</span>
867                    </div>
868                    <div class="text-sm text-gray-600">${contact.phone} • ${contact.relation}</div>
869                </div>
870                <div class="flex gap-2">
871                    <button class="bg-green-600 text-white px-3 py-1 rounded text-sm hover:bg-green-700" onclick="callContact('${contact.phone}')">📞</button>
872                    <button class="bg-red-600 text-white px-3 py-1 rounded text-sm hover:bg-red-700" onclick="deleteContact(${contact.id})">🗑️</button>
873                </div>
874            </div>
875        `;
876    });
877    
878    container.innerHTML = html;
879}
880
881// Delete contact
882function deleteContact(id) {
883    if (confirm('Είστε σίγουροι ότι θέλετε να διαγράψετε αυτή την επαφή;')) {
884        contacts = contacts.filter(contact => contact.id !== id);
885        localStorage.setItem('emergencyContacts', JSON.stringify(contacts));
886        loadContacts();
887    }
888}
889
890// Call contact
891function callContact(phone) {
892    window.location.href = `tel:${phone}`;
893}
894
895// Setup call buttons
896function setupCallButtons() {
897    const buttons = document.querySelectorAll('.call-btn');
898    buttons.forEach(button => {
899        button.addEventListener('click', function() {
900            const number = this.dataset.number;
901            window.location.href = `tel:${number}`;
902        });
903    });
904}
905
906// Setup QR code generator
907function setupQRCodeGenerator() {
908    const generateBtn = document.getElementById('generate-qr');
909    const modal = document.getElementById('qr-modal');
910    const closeBtn = document.getElementById('close-qr-modal');
911    
912    if (generateBtn) {
913        generateBtn.addEventListener('click', function() {
914            generateQRCode();
915            modal.classList.remove('hidden');
916        });
917    }
918    
919    if (closeBtn) {
920        closeBtn.addEventListener('click', () => {
921            modal.classList.add('hidden');
922        });
923    }
924}
925
926// Generate QR code
927function generateQRCode() {
928    const qrContainer = document.querySelector('.qr-code');
929    
930    if (contacts.length === 0) {
931        qrContainer.innerHTML = '<div class="text-gray-500"><div class="text-2xl mb-2">⚠️</div><p>Δεν υπάρχουν επαφές για δημιουργία QR code</p></div>';
932        return;
933    }
934    
935    // Create vCard data
936    let vcardData = 'BEGIN:VCARD\nVERSION:3.0\n';
937    contacts.forEach(contact => {
938        vcardData += `FN:${contact.name}\nTEL:${contact.phone}\nNOTE:${contact.relation}\n`;
939    });
940    vcardData += 'END:VCARD';
941    
942    // In a real implementation, you would use a QR code library
943    // For this demo, we'll show a placeholder
944    qrContainer.innerHTML = `
945        <div class="text-center">
946            <div class="text-6xl mb-4">📱</div>
947            <p class="text-sm text-gray-600">QR Code για ${contacts.length} επαφές</p>
948            <p class="text-xs text-gray-500 mt-2">Σαρώστε για αποθήκευση επαφών</p>
949        </div>
950    `;
951}
952
953// Setup export buttons
954function setupExportButtons() {
955    const exportBtn = document.getElementById('export-contacts');
956    const printBtn = document.getElementById('print-contacts');
957    
958    if (exportBtn) {
959        exportBtn.addEventListener('click', exportContacts);
960    }
961    
962    if (printBtn) {
963        printBtn.addEventListener('click', printContacts);
964    }
965}
966
967// Export contacts
968function exportContacts() {
969    if (contacts.length === 0) {
970        alert('Δεν υπάρχουν επαφές για εξαγωγή.');
971        return;
972    }
973    
974    let content = 'ΕΠΑΦΕΣ ΕΚΤΑΚΤΗΣ ΑΝΑΓΚΗΣ\n';
975    content += '=' * 30 + '\n\n';
976    
977    contacts.forEach(contact => {
978        content += `Όνομα: ${contact.name}\n`;
979        content += `Τηλέφωνο: ${contact.phone}\n`;
980        content += `Σχέση: ${contact.relation}\n`;
981        content += `Τύπος: ${contact.type}\n`;
982        content += '-'.repeat(20) + '\n';
983    });
984    
985    const blob = new Blob([content], { type: 'text/plain' });
986    const url = URL.createObjectURL(blob);
987    const a = document.createElement('a');
988    a.href = url;
989    a.download = 'epafes-anagkis.txt';
990    a.click();
991    URL.revokeObjectURL(url);
992}
993
994// Print contacts
995function printContacts() {
996    window.print();
997}
998
999// Load stored data
1000function loadStoredData() {
1001    // Data is already loaded in global variables
1002    // This function can be used for additional data loading if needed
1003}
1004
1005// Setup global event listeners
1006function setupEventListeners() {
1007    // Handle emergency alert button clicks
1008    const emergencyButtons = document.querySelectorAll('button[class*="emergency"]');
1009    emergencyButtons.forEach(button => {
1010        if (button.textContent.includes('112')) {
1011            button.addEventListener('click', function() {
1012                if (confirm('Θέλετε να καλέσετε το 112;')) {
1013                    window.location.href = 'tel:112';
1014                }
1015            });
1016        }
1017    });
1018    
1019    // Handle animations on scroll
1020    const observerOptions = {
1021        threshold: 0.1,
1022        rootMargin: '0px 0px -50px 0px'
1023    };
1024    
1025    const observer = new IntersectionObserver((entries) => {
1026        entries.forEach(entry => {
1027            if (entry.isIntersecting) {
1028                entry.target.style.opacity = '1';
1029                entry.target.style.transform = 'translateY(0)';
1030            }
1031        });
1032    }, observerOptions);
1033    
1034    // Observe elements for animation
1035    const animatedElements = document.querySelectorAll('.crisis-card, .kit-category, .resource-card, .instruction-step');
1036    animatedElements.forEach(el => {
1037        el.style.opacity = '0';
1038        el.style.transform = 'translateY(20px)';
1039        el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
1040        observer.observe(el);
1041    });
1042}
1043
1044// Utility functions
1045function showNotification(message, type = 'info') {
1046    // Simple notification system
1047    const notification = document.createElement('div');
1048    notification.className = `fixed top-20 right-4 z-50 p-4 rounded-lg shadow-lg ${
1049        type === 'success' ? 'bg-green-500 text-white' : 
1050        type === 'error' ? 'bg-red-500 text-white' : 
1051        'bg-blue-500 text-white'
1052    }`;
1053    notification.textContent = message;
1054    
1055    document.body.appendChild(notification);
1056    
1057    setTimeout(() => {
1058        notification.remove();
1059    }, 3000);
1060}
1061
1062// Export functions for global access
1063window.toggleChecklistItem = toggleChecklistItem;
1064window.deleteContact = deleteContact;
1065window.callContact = callContact;

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