$(function() { $('.popupDatepicker_1').datepick({dateFormat: 'yy-mm-dd'}); $('.popupDatepicker_2').datepick({dateFormat: 'yy-mm-dd'}); $('.popupDatepicker_3').datepick({dateFormat: 'dd.mm.yy'}); window.onload=startList; $('.groupsList tr').each(function () { var check=$(this).find("td").eq(1).attr("class").indexOf("checked"); if (check==-1) $(this).find("td").eq(2).find("img").css("display","none"); }); $('.groupsList tr').hover( function() {$(this).find("td").eq(2).find("img").css("display","inline");}, function() {var check=$(this).find("td").eq(1).attr("class").indexOf("checked");if (check==-1)$(this).find("td").eq(2).find("img").css("display","none");} ); //$(".trHide").css("display","none"); $('.trHide').hover( function() {$(this).find(".classHide").css("display","inline");}, function() {$(this).find(".classHide").css("display","none");} ); $(".classHide").css("display","none"); $('.classHide').parent().hover( function() {$(this).find(".classHide").css("display","inline");}, function() {$(this).find(".classHide").css("display","none");} ); var t= $('#journalTable').attr('id'); //alert(t); if (t=='journalTable') { //alert('test'); tableNavigation2(); } /*$('.clickme').live('click', function() { tableNavigation() });*/ tableSchedule(); }); function tableSchedule() { var period=$('#period:checked').val(); if (period=="2") { var date=$('#per_2').val(); var pos=0; var find=0; $('#leftSchedule tbody tr').each(function() { var id=$(this).attr('id'); if (id=='tr_'+date) find=pos; pos++; } ); //var h= $('#leftSchedule tbody').find('tr[id=tr_'+date+']').css('display','block'); $('#leftSchedule tbody tr:lt('+find+')').hide(); $('#leftSchedule tbody tr:gt('+(find+14)+')').hide(); //var h= $('#leftSchedule tbody').find('tr[id=tr_'+date+']').css('display','block'); //alert(h.html()); } } function keyArrow(elem) { var code=e.keyCode; if (code=='40') { var tr=$(this).parent().parent().next(); tr.find('input').eq(curCol).focus(); //alert((index+1)+' % '+cols+'-1 = '+curCol) } if (code=='38') { var tr=$(this).parent().parent().prev(); tr.find('input').eq(curCol).focus(); } if (code=='37') { $('#journalTable input').eq(index-1).focus(); } if (code=='39') { $('#journalTable input').eq(index+1).focus(); } } function tableNavigation() { var rows=$('#journalTable tr').size()-2; var cols=$('#journalTable input').size()/rows; //alert(rows+'-'+cols) $('#journalTable input').each(function() { var index = $("'#journalTable input").index(this); var curCol=index%cols; $(this).keydown(function(e){ var code=e.keyCode; if (code=='40') { var tr=$(this).parent().parent().next(); tr.find('input').eq(curCol).focus(); //alert((index+1)+' % '+cols+'-1 = '+curCol) } if (code=='38') { var tr=$(this).parent().parent().prev(); tr.find('input').eq(curCol).focus(); } if (code=='37') { $('#journalTable input').eq(index-1).focus(); } if (code=='39') { $('#journalTable input').eq(index+1).focus(); } }); } ); } function tableNavigation2() { //var t= $('#journalTable').html(); //alert(t); var rows=$('#journalTable tr').size()-2; var cols=$('#journalTable input').size()/rows; var newElem; //alert(rows+'-'+cols) $('#journalTable input').live('keydown',function(e){ var code=e.keyCode; //alert(code); var index = $("'#journalTable input").index(this); var curCol=index%cols; if (code=='40') { var tr=$(this).parent().parent().next(); newElem=tr.find('input').eq(curCol); while (newElem.attr('disabled')) { newElem=newElem.parent().parent().next().find('input').eq(curCol); } //newElem.focus(); //alert((index+1)+' % '+cols+'-1 = '+curCol) } else if (code=='38') { var tr=$(this).parent().parent().prev(); newElem=tr.find('input').eq(curCol); while (newElem.attr('disabled')) { newElem=newElem.parent().parent().prev().find('input').eq(curCol); } //newElem.focus(); } else if (code=='37') { newElem=$('#journalTable input').eq(index-1); var i=1; // alert(newElem.attr('disabled')); while (newElem.attr('disabled')) { i++; newElem=$('#journalTable input').eq(index-i); //alert(i+newElem.attr('disabled')); } //newElem.focus(); } else if (code=='39') { newElem=$('#journalTable input').eq(index+1) var i=1; while (newElem.attr('disabled')) { i++; newElem=$('#journalTable input').eq(index+i); } } newElem.focus(); }); } function showDate(date) { alert('The date chosen is ' + date); } function copyShedule() { alert('Идет разработка'); //=========================================== var file = "./sheduleCopy.php"; $.get(file,{ type: "application/x-www-form-urlencoded" }, function(responseText){ var q=responseText; alert(q); }); } startList = function() { var text='Извините за неудобства. Ведутся работы'; //alert(); navRoot = document.getElementById('TOP_MENU'); for (i=0; i