
var konverzni_kurz_euro_skk=30.126;var ek_focus_item_id="input#ek_eur";$(document).ready(function(){controls_set_functionality();$.ajaxSetup({complete:function(XMLHttpRequest,textStatus){controls_set_functionality();}});try{var pageTracker=_gat._getTracker("UA-6976808-1");pageTracker._trackPageview();}catch(err){}$("a.t_out").live("click",function(){open($(this).attr("href"));return false;});$('div.showbox').hide();$("a.showbox").live("click",function(){var href=$(this).attr("href");var box_id=href.substring(href.indexOf('#'));if($(this).hasClass('show_only')){$(box_id).show("fast");}else{$(box_id).toggle("fast");}if(!$(this).hasClass('jump_enabled')){return false;}});$("a.hidebox").live("click",function(){var href=$(this).attr("href");var box_id=href.substring(href.indexOf('#'));$(box_id).hide("fast");return false;});$("input.numbersonly").live("keypress",function(e){return numbersonly(e,false);});$("input.numbersonly_dec").live("keypress",function(e){return numbersonly(e,true);});$("input.psconly").live("keypress",function(e){return psconly(e);});$("input.static").live("keydown",function(e){return false;});$("input#ek_eur").keyup(function(e){ek_refresh("input#ek_eur","input#ek_skk");ek_focus_item_id="input#ek_eur";});$("input#ek_skk").keyup(function(e){ek_refresh("input#ek_skk","input#ek_eur");ek_focus_item_id="input#ek_skk";});$("input#ek_eur").click(function(){ek_focus_item_id="input#ek_eur";});$("input#ek_skk").click(function(){ek_focus_item_id="input#ek_skk";});$("input#ek_skk").keyup(function(e){ek_refresh("input#ek_skk","input#ek_eur");ek_focus_item_id="input#ek_skk";});$("button.ek_button").click(function(){var value=$(this).html();$(ek_focus_item_id).val($(ek_focus_item_id).val()+value);if(ek_focus_item_id=="input#ek_eur"){ek_refresh("input#ek_eur","input#ek_skk");}else if(ek_focus_item_id=="input#ek_skk"){ek_refresh("input#ek_skk","input#ek_eur");}return false;});$("button.ek_clear").click(function(){$("input#ek_eur").val('');$("input#ek_skk").val('');return false;});$("button#ek_SKK-EUR").click(function(){ek_refresh("input#ek_skk","input#ek_eur");return false;});$("button#ek_EUR-SKK").click(function(){ek_refresh("input#ek_eur","input#ek_skk");return false;});});function controls_set_functionality(){$("#right_col *:first").css("margin-top","0");$("table.zoznam").children("tbody").each(function(){var skip_rows=0;var fold_rows=0;var tr_order=0;$(this).children("tr").each(function(){if(skip_rows>0){skip_rows--;}else if(fold_rows>0){$(this).addClass('even');fold_rows--;}else{tr_order++;var even=(tr_order%2)?false:true;var rowspan_max=0;$(this).children("th,td").each(function(){if($(this).attr('rowspan')&&parseInt($(this).attr('rowspan'))>rowspan_max){rowspan_max=parseInt($(this).attr('rowspan'));}});if(even){$(this).addClass('even');fold_rows=rowspan_max-1;}else{skip_rows=rowspan_max-1;}}});});$("table.zoznam").children("thead").each(function(){$(this).children("tr:last").addClass('last');});$("table.zoznam thead th.vertical_stripe").each(function(){var th_pos=0;var rowspans=new Array();$(this).prevAll().each(function(){th_pos+=($(this).attr('colspan'))?parseInt($(this).attr('colspan')):1;if($(this).attr('rowspan')&&parseInt($(this).attr('rowspan'))>1){rowspans.push(parseInt($(this).attr('rowspan')));}});var tr_parent=$(this).parents("tr")[0];var tr_idx=2;$(tr_parent).nextAll().each(function(){var position=0;for(i=0;i<rowspans.length;i++){if(tr_idx<=rowspans[i]){position++;}}$(this).children().each(function(){if(position++==th_pos){$(this).addClass('vertical_stripe');}});tr_idx++;});var table_parent=$(this).parents("table")[0];$(table_parent).children("tbody").children("tr").each(function(){var tds=$(this).children()[th_pos];$(tds).addClass('vertical_stripe');});});$("input.ddv").focus(function(){if(!$(this).attr('default_value')||$(this).attr('default_value')==$(this).val()){$(this).attr('default_value',$(this).val());$(this).val('');}});$("input.ddv").blur(function(){var value=$(this).val();var default_value=$(this).attr('default_value');if(value.length==0&&default_value&&default_value.length>0){$(this).val(default_value);}});$(".fields_box_opt, .fields_box_obl").each(function(){var block_position=$(this).css('position');if(block_position=='static'){$(this).css('position','relative');}if($.browser.msie&&parseInt($.browser.version)<=6&&$(this).css('float')=='none'){var height=$(this).height();$(this).css('height',height+'px');}$(this).append('<div class="corner lt"></div><div class="corner lb"></div><div class="corner rt"></div><div class="corner rb"></div>');});$("button.tisk").click(function(){window.print();return false;});$('div.js_alert_msg').each(function(){if(!$(this).attr('showed')){var content=$(this).html();var js_content=content.replace(/\\n/,'\n');alert(js_content);$(this).attr('showed','1');}});}function ek_refresh(source_id,target_id){var cislo=$(source_id).val();cislo=cislo.replace(/^0+(\d)/g,'$1').replace(/^[,\.]+/g,'').replace(/,/g,'.').replace(/ /g,'');if(is_float(cislo)){var numberparts=cislo.split('.',2);var formated_str=add_thousand_sep(numberparts[0],' ');if(numberparts.length==2){formated_str+=","+numberparts[1];}$(source_id).val(formated_str);var result=(source_id=="input#ek_eur")?round(cislo*konverzni_kurz_euro_skk,2):round(cislo/konverzni_kurz_euro_skk,2);$(target_id).val(number_format(result,2,',',' '));}else if(cislo.length==0){$(target_id).val('');}}function number_format(number,decimals,dec_point,thousand_sep){number=parseFloat(number);if(!decimals){decimals=0;}if(!dec_point){dec_point=',';}if(!thousand_sep){thousand_sep='';}var multi=Math.pow(10,decimals);var rounded=Math.round(number*multi)/multi;var rounded_str=rounded+"";var numberparts=rounded_str.split('.',2);var intpart_str=numberparts[0];var decpart_str='';if(numberparts[1]){decpart_str=numberparts[1];}else{for(var i=1;i<=decimals;i++){decpart_str+='0';}}if(thousand_sep.length){intpart_str=add_thousand_sep(intpart_str,thousand_sep);}var formated=intpart_str;if(decimals){formated+=dec_point+decpart_str;}return formated;}function add_thousand_sep(number,thousand_sep){var number_str=parseInt(number)+"";if(!thousand_sep){thousand_sep='';}if(thousand_sep.length){var number_str_new="";var tmp=number_str;var last_trio="";while(tmp.length>3){last_trio=tmp.substring(tmp.length-3);number_str_new=(number_str_new.length)?last_trio+" "+number_str_new:last_trio;tmp=tmp.substring(0,tmp.length-3);}number_str=(number_str_new.length)?tmp+" "+number_str_new:tmp;}return number_str;}function numbersonly(e,dec){var key;var keychar;if(window.event)key=window.event.keyCode;else if(e)key=e.which;else
return true;keychar=String.fromCharCode(key);if((key==null)||(key==0)||(key==8)||(key==9)||(key==13)||(key==27))return true;else if(("0123456789").indexOf(keychar)>-1)return true;else if(dec&&((".,").indexOf(keychar)>-1)){return true;}else
return false;}function is_int(tested_value){var tmp;tmp=parseInt(tested_value)+"";if(tested_value.length==0){return false;}else if(tmp.length!=tested_value.length||isNaN(tmp)){return false;}else{return true;}}function is_float(tested_value){var tmp;tmp=parseFloat(tested_value)+"";if(tested_value.length==0){return false;}else if(tmp.length!=tested_value.length||isNaN(tmp)){return false;}else{return true;}}function round(number,decimals){number=parseFloat(number);var multi=Math.pow(10,decimals);return Math.round(number*multi)/multi;}function psconly(myfield,e){var key;var keychar;if(window.event)key=window.event.keyCode;else if(e)key=e.which;else
return true;keychar=String.fromCharCode(key);if((key==null)||(key==0)||(key==8)||(key==9)||(key==13)||(key==27))return true;else if(((' 0123456789').indexOf(keychar)>-1))return true;else
return false;}
