/* * Funkcia na odpocitavanie po sekundach * - pouzitie pri loade obrazovky * source - id hiddenu s nastavenymi pociatocnymi sekundami * target - id spanu kde sa sekundy vypisuju vo formate hodina:minuta:sekunda * nová verze pro odpočet času do dalšího zápasu */ function runSecondsNew(source, target_1, target_2, target_3, hide_obj, show_obj) { seconds_left = parseInt(document.getElementById(source).value); //seconds_left = parseInt(0.25 * seconds_left); hours = parseInt(seconds_left/3600); if (hours < 0) { hours = 0; } if (hours < 10) { hours = '0' + hours; } pom = seconds_left%3600; minutes = parseInt(pom/60); if (minutes < 0) { minutes = 0; } if (minutes < 10) { minutes = '0' + minutes; } seconds = pom%60; if (seconds < 0) { seconds = 0; } if (seconds < 10) { seconds = '0' + seconds; } if (hours > 99) { seconds = '--'; } if (hours > 99) { minutes = '--'; } if (hours > 99) { hours = '--'; } document.getElementById(target_1).innerHTML = hours; document.getElementById(target_2).innerHTML = minutes; document.getElementById(target_3).innerHTML = seconds; document.getElementById(source).value = parseInt(document.getElementById(source).value) - 1; if (document.getElementById(source).value > 0) { timerID = setTimeout("runSecondsNew('" + source + "', '" + target_1 + "', '" + target_2 + "', '" + target_3 + "', '" + hide_obj + "', '" + show_obj + "')", 1000); } else { document.getElementById(hide_obj).style.display = 'none'; document.getElementById(show_obj).style.display = 'block'; } } /* * Funkcia na odpocitavanie po sekundach * - pouzitie pri loade obrazovky * source - id hiddenu s nastavenymi pociatocnymi sekundami * target - id spanu kde sa sekundy vypisuju vo formate hodina:minuta:sekunda * původní verze */ function runSeconds(source, target, message) { seconds_left = parseInt(document.getElementById(source).value); //seconds_left = parseInt(0.25 * seconds_left); hours = parseInt(seconds_left/3600); if (hours < 0) { hours = 0; } if (hours < 10) { hours = '0' + hours; } pom = seconds_left%3600; minutes = parseInt(pom/60); if (minutes < 0) { minutes = 0; } if (minutes < 10) { minutes = '0' + minutes; } seconds = pom%60; if (seconds < 0) { seconds = 0; } if (seconds < 10) { seconds = '0' + seconds; } document.getElementById(target).innerHTML = hours + ":" + minutes + ":" + seconds; document.getElementById(source).value = parseInt(document.getElementById(source).value) - 1; if (document.getElementById(source).value > 0) { timerID = setTimeout("runSeconds('" + source + "', '" + target + "', '" + message + "')", 1000); } else { document.getElementById(target).innerHTML = message; } } /* * Funkcia na odpocitavanie po sekundach * - pouzitie pri loade obrazovky * source - id hiddenu s nastavenymi pociatocnymi sekundami * target - id spanu kde sa sekundy vypisuju vo formate hodina:minuta:sekunda */ function runTimeSeconds(source, target) { hours = parseInt(document.getElementById(source).value/3600); if (hours < 10) { hours = '0' + hours; } pom = document.getElementById(source).value%3600; minutes = parseInt(pom/60); if (minutes < 10) { minutes = '0' + minutes; } seconds = pom%60; if (seconds < 10) { seconds = '0' + seconds; } document.getElementById(target).innerHTML = hours + ":" + minutes + ":" + seconds; document.getElementById(source).value = parseInt(document.getElementById(source).value) + 1; if (document.getElementById(source).value >= (24*60*60)) { document.getElementById(source).value = document.getElementById(source).value - (24*60*60); } timerID = setTimeout("runTimeSeconds('" + source + "', '" + target + "')", 1000); } /* * Funkcia na zmenu obrazka v IMG tagu * - pouzitie pri onMouseover a onMouseout */ function changeImg(file, obj) { obj.src = file; } function runMinutes(source, target) { seconds_left = parseInt(document.getElementById(source).value); hours = parseInt(seconds_left/3600); if (hours < 0) { hours = 0; } if (hours < 10) { hours = '0' + hours; } pom = seconds_left%3600; seconds = parseInt(seconds_left%60); if (seconds < 0) { seconds = 0; } if (seconds < 10) { seconds = '0' + seconds; } minutes = parseInt(pom/60); if (minutes < 0) { minutes = 0; } if (minutes < 10) { minutes = '0' + minutes; } if (hours >= 0) { target = 'end_action_secs'; document.getElementById(target).innerHTML = seconds; target = 'end_action_mins'; document.getElementById(target).innerHTML = minutes; target = 'end_action_hours'; document.getElementById(target).innerHTML = hours; } document.getElementById(source).value = parseInt(document.getElementById(source).value) - 1; if (document.getElementById(source).value > 0) { timerID = setTimeout("runMinutes('" + source + "', '" + target + "')", 1000); } else { target = 'end_action_hours'; document.getElementById(target).innerHTML = "  -"; target = 'end_action_mins'; document.getElementById(target).innerHTML = "   -"; target = 'end_action_secs'; document.getElementById(target).innerHTML = "   -"; } } function addText(insert, textAreaId){ //Get the textarea area = document.getElementById(textAreaId); //Get the selection bounds var start = area.selectionStart; var end = area.selectionEnd; //Break up the text by selection var text = area.value; var pre = text.substring(0, start); var sel = text.substring(start, end); var post = text.substring(end); //Insert the text at the beginning of the selection text = pre + insert + sel + post; //Put the text in the textarea area.value = text; //Re-establish the selection, adjusted for the added characters. area.selectionStart = start+insert.length; area.selectionEnd = end+insert.length; } function countTextareaLines(obj) { var hard_lines = 0; var soft_lines = 0; var last = -1; while ( true ) { last_before = last; last = obj.value.indexOf("\n", last+1); if (last == (last_before + 1) || (last_before + 1) == obj.value.length) { hard_lines ++; } else { if (last > 0) { soft_lines = soft_lines + Math.ceil(obj.value.substring(last_before, last).length / (obj.cols-1)); } else { soft_lines = soft_lines + Math.ceil(obj.value.substring(last_before).length / (obj.cols-1)); } } if ( last == -1 ) break; } return soft_lines + hard_lines; } function resizeTextarea(obj, numberlines) { num = countTextareaLines(obj) + 1; if (num > numberlines) { obj.rows = num; } else { obj.rows = numberlines; } } function checkPasswords() { pass = document.getElementById('password').value; pass_confirm = document.getElementById('confirmpassword').value; if(pass != pass_confirm){ document.getElementById('password_confirm_info').innerHTML = " " + password_problem; } else { document.getElementById('password_confirm_info').innerHTML = " "; } } function ajax_send_to_server(page, data) { // definovanie objektu XMLHttpRequest aby pracoval korektne aj v IE var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false)); xmlhttp.open('GET', page); xmlhttp.onreadystatechange = function() { }; xmlhttp.send(data); } // end function load element $(document).ready(function() { // zvýrazní block pokud je takové IDčko na stránce $("#zvyraznit_box").effect("highlight", {color:"#FFFF66"}, 4000); $("#toogle_com_menu").click(function(e) { $("#top_communication_menu").toggle(); e.stopPropagation(); }); $("body").click(function() { $("#top_communication_menu").hide(); $("#top_submenu_user").hide(); $("#lng_menu").hide(); }); $("#toogle_lng_menu").click(function(e) { $("#lng_menu").toggle(); e.stopPropagation(); }); $("#lng_menu").click(function(e){ e.stopPropagation(); }); $("#top_communication_menu").click(function(e){ e.stopPropagation(); }); $("#toogle_user_menu").click(function(e) { $("#top_submenu_user").toggle(); e.stopPropagation(); }); $("#top_submenu_user").click(function(e){ e.stopPropagation(); }); $('#jersey_home').width(180); $('#jersey_home').mouseenter(function(e) { $(this).stop().animate({width: "254px", height: "124px", left: "-=40"}, 'fast'); //$(this).animate({width: "254px", height: "124px"}, 'fast'); $("#jersey_box").css("height","170px"); e.stopPropagation(); }); $('#jersey_home').mouseleave(function(e) { $(this).stop().animate({width: "180px", height: "87px", left: "0"}, 'fast'); $("#jersey_box").css("height","140px"); e.stopPropagation(); }); $('#jersey_away').width(180); $('#jersey_away').mouseenter(function(e) { $(this).stop().animate({width: "254px", height: "124px", left: "-=40"}, 'fast'); $("#jersey_box").css("height","170px"); e.stopPropagation(); }); $('#jersey_away').mouseleave(function(e) { $(this).stop().animate({width: "180px", height: "87px", left: "0"}, 'fast'); $("#jersey_box").css("height","140px"); e.stopPropagation(); }); });