  $(document).ready(function() {
    
    /*
    $(".table_finall thead tr.row_1 td.test_3 ").mouseover(function() {
      
        tds = $( this ).parent().find("td"),
        index = $.inArray( this, tds ),
        
        tds2 = $(".table_finall tr td.part").index(),
        
        
        sel_tds = $(".table_finall tbody td:nth-child("+( index + 1 )+")");
        
        $( this ).toggleClass("hover_color");
        sel_tds.toggleClass("hover_color");
    }).mouseout(function() {
        sel_tds.toggleClass("hover_color");
        $( this ).toggleClass("hover_color");
    });    
    
    $(".table_finall thead tr.row_2 td.test_3 ").mouseover(function() {
      
        tds = $( this ).index(),

        count = 36 + tds;
        
        sel_tds = $(".table_finall tbody td:nth-child(" + count +")");
        
         $( this ).toggleClass("hover_color");
        sel_tds.toggleClass("hover_color");
    }).mouseout(function() {
        $( this ).toggleClass("hover_color");
        sel_tds.toggleClass("hover_color");
    });    
    
    $(".table_finall thead tr td.test_4").mouseover(function() {
      
        tds = $( this ).index(),

        count = 4 + tds;
        
        
        sel_tds = $(".table_finall tbody td:nth-child(" + count +")");
        
        $( this ).toggleClass("hover_color");
        sel_tds.toggleClass("hover_color");
    }).mouseout(function() {
      $( this ).toggleClass("hover_color");
      sel_tds.toggleClass("hover_color");
    });*/
    
    
    /*$(".month_2 a").click(function(){
      $(".month_2 a").removeClass("curent");
      $(this).addClass("curent");
      return false;
    });*/
	
	// Листалка месяцев
	
	i = 0;
	cell = 63;
	elements = Array();
	
	$("#months-list").children().each(function() {

		if($(this).hasClass('curent')) {
			elements[i] = 'current';
			if(i > 6)
				$("#months-list").css('left', '-'+ (i-6)*cell +'px'); 
		} else {
			elements[i] = 'normal';
		}
		i++;
	});
	
	if(elements.length < 8) {
		$("#month-left").remove();
		$("#month-right").remove();
	}

	cw = parseInt($("#months-list").css('left'), 10);
	
	$("#month-left").click(function() {
		if(cw < 0 && elements.length > 7) {
			cw = cw + cell;
			$("#months-list").animate({ left: "+="+cell+"px" }, "slow");
		}
    });
	
	$("#month-right").click(function() {
		if(cw >= -(elements.length - 8)*cell  && elements.length > 7) {
			cw = cw - cell;
			$("#months-list").animate({ left: "-="+cell+"px" }, "slow");
		}
    });
	
	// Листалка дней уроков
	
    var shedulesDW = {};
    
    $('.daycall').each(function(){
        
        var sid = $(this).attr('data-id');
        shedulesDW[ sid ] = parseInt($(this).css('left'), 10);
    });
    
    
    dw = parseInt($("#daycall").css('left'), 10);
	cell2 = 175;
	
	$(".day-left").click(function() {
		
        var sid = $(this).attr('data-id');
        
        dw = shedulesDW[ sid ];
        
        if(dw < 0) {
			dw = dw + cell2;
			$(".daycall[data-id="+sid+"]").animate({ left: "+="+cell2+"px" }, "fast"); 
		}
        
        shedulesDW[ sid ] = dw;
    });
	
	$(".day-right").click(function() {
		
        var sid = $(this).attr('data-id');
        
        dw = shedulesDW[ sid ];
        
        if(dw > -1*($(".daycall[data-id="+sid+"]").children().length-1)*cell2) {
			dw = dw - cell2;
			$(".daycall[data-id="+sid+"]").animate({ left: "-="+cell2+"px" }, "fast");
		}
        
        shedulesDW[ sid ] = dw;
    });
	
	
    $('span[title]').poshytip({
      className: 'tip-yellowsimple',
      showTimeout: 1,
      alignTo: 'target',
      alignX: 'right',
      alignY: 'center',
      offsetY: 0,
      offsetX: 10,
      allowTipHover: false
    });
    
    $('.task font[title]').poshytip({
      className: 'tip-yellowsimple',
      showTimeout: 1,
      alignTo: 'target',
      alignX: 'right',
      alignY: 'center',
      offsetY: 0,
      allowTipHover: false
    });
	
    $('.mark_big[title]').poshytip({
      className: 'tip-yellowsimple',
      showTimeout: 1,
      alignTo: 'target',
      alignX: 'right',
      alignY: 'center',
      offsetY: 0,
      offsetX: 10,
      allowTipHover: false
    });
    
    
 });