$(document).ready(function(){
	$("#tourtb .tab .hlink").click(function(){
		$("#tourtb .scores").toggle();
		$(this).blur();
		return false;
	});
	$("#match .hlink").click(function(){
		$link = $(this);
		hd = $link.text();
		id = $link.attr("href");
		$link.siblings(".current").text(hd);
		$link.hide().siblings(".hlink").show();
		$(id).show().siblings(".matchbox").hide();
        $('.wrap_countdown').toggle();  
		return false;
	});
	$("#newsitems .itemline").bind("mouseenter", function(){
		$line = $(this);
		$arrow = $("#newsarrow");
		curT = $line.offset().top;
		zeroT = $("#newsitems .itemline:first").offset().top
		//console.log(zeroT+", "+$line.index()+", "+t);
		T = curT - zeroT;
		$arrow.css("top", T);
		i = $line.index();
		$(".newsmainitem:eq("+i+")").show().siblings(".newsmainitem:visible").hide();
	});
});
// vitaliy
$(document).ready(function() {
    var nxtDate = $('.nextMatches').text();
    var arrDate = nxtDate.split(',');
    var year = parseInt(arrDate[0]);
    var month = parseInt(arrDate[1]) -1;
    var day = parseInt(arrDate[2]);
    var hour = parseInt(arrDate[3]);
    var min = parseInt(arrDate[4]);
    curDate = new Date(year, month, day, hour, min);
    $('#defaultCountdown').countdown({until: curDate, 
                                      comact: true, 
                                      layout: '<b> {dn}{dl} {hnn}{hl} {sep} {mnn}{ml} {sep} {snn}{sl} </b>'}); 
    
    var now = new Date();
    var today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes());
    var liveMatch = new Date(year, month, day, hour, min);
    if(today.valueOf() >= liveMatch.valueOf()) {
        $('.wrap_countdown, #defaultCountdown').remove();
    }    
});
// vitaliy

$(window).resize(function(){
});
