jQuery.easing['easeInOutQuad'] = function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t + b;
    return -c/2 * ((--t)*(t-2) - 1) + b;
};

$(document).ready(function()
{
	$('.open-player').click(function(){window.open('/online/','new','width=500,height=300,toolbar=1');return false;});
	function loadImg(str)
	 {
		$('#spotlight-img').attr('src', '/img/empty.gif');
		var id = parseInt(str.substr(str.indexOf('_') + 1));
		var ext = str.substr(0, str.indexOf('_'));
		if(id)
		 {
			var img = new Image();
			img.onload = function(){$('#spotlight-img').attr('src', img.src);};
			img.src = '/fc/w290/h154/spotlight/image/image_' + id + '.' + ext;
		 }
		else $('#spotlight-img').attr('src', '/img/empty.gif');
	 }
	$('#spotlight-links .current').removeClass('current');
	var spotlight_first = $('#spotlight-links a:eq(0)');
	$(spotlight_first).addClass('current');
	loadImg($(spotlight_first).attr('class'));
	$('#spotlight-links a').mouseover(function(){if(!$(this).hasClass('current')){$('#spotlight-links .current').removeClass('current');loadImg($(this).attr('class'));$(this).addClass('current');}});
	$('#programs').html('');
	function carousel_itemVisibleInCallback(carousel, item, i, state, evt){var idx = carousel.index(i, programs_list.length);carousel.add(i, programs_list[idx - 1]);};
	function carousel_itemVisibleOutCallback(carousel, item, i, state, evt){carousel.remove(i);};
	$('#programs').jcarousel({scroll:1,size:programs_list.length,animation:600,easing:'easeInOutQuad',visible:2,wrap:'circular',itemVisibleInCallback:{onBeforeAnimation:carousel_itemVisibleInCallback},itemVisibleOutCallback:{onAfterAnimation:carousel_itemVisibleOutCallback}});
	var form = document.getElementById('poll_form');
	if(form)
	 {
		form.btn_submit.disabled = true;
		var inputs = form.getElementsByTagName('input');
		var onchange = function(){this.form.btn_submit.disabled = false;};
		for(var i = 0; i < inputs.length; ++i) if('radio' == inputs[i].type) inputs[i].onchange = onchange;
	 }
	swfobject.embedSWF("/swf/top" + (document.getElementById('logo').getAttribute('href') ? "" : "_without_link") + ".swf", "logo", "199", "158", "10", null, null, {wmode: "transparent", menu: "false", quality: "best"});
});
