/* -------------------------------------------------- *
 * Project scripts
 * -------------------------------------------------- *
 * Author: Morozov Igor
 * URL: http://www.morozoff.info/
 * Copyright: 2009 Morozov Igor
** -------------------------------------------------- */

$(document).ready(function() {
	$('div.hot-block .hide').click(function() {
		$(this).parent().next().toggle();
		$(this).toggleClass('plus-hide');
		return false;
	});
	$('div.b-box .hide').click(function() {
		var $t = $(this)
		$t.parent().parent().toggleClass('hidden-block');
//		$t.toggleClass('plus-hide');
		return false;
	});
	$('div.hot-block .del').click(function() {
		$('div.hot-block').remove();
		return false;
	});
	$('.navigation ul').superfish({
		delay: 800,
		animation: {height:'show'},
		speed: 'fast',
		autoArrows:false,
		dropShadows:false
	});
	$(".b-events ul").tabs("div.b-events-i > div.tab", {tabs:'li'});
	$(".b-tournirs dl").tabs("div.table-tournirs > div.tab",{effect:'slide',initialIndex:'null'});
	$(".b-all-tabs").tabs("div.b-all-cont-i > div.tab", {initialIndex: null});
	$(".sub-tab-i div").tabs("#info-read .panes > div.pane", {initialIndex: null});
	$(".b-all-tabs a").click(function() {
		$t = $(this);
		attrhref = $t.attr('href')
		$('.b-all-cont-i .tab').addClass('ns-scroll');
		$(attrhref).removeClass('ns-scroll');
	});
	$(".sub-tab-i a").click(function() {
		$t = $(this);
		var index = $('.sub-tab-i a').index(this)
		$('#info-read .panes .pane').addClass('ns-scroll');
		$('#info-read .panes .pane').eq(index).removeClass('ns-scroll');
	});
	$(".sub-tab-i a").click(function() {
		$t = $(this);
		var index = $('.sub-tab-i a').index(this)
		$('#info-read .panes .pane').addClass('ns-scroll');
		$('#info-read .panes .pane').eq(index).removeClass('ns-scroll');
	});
	$('.b-matchcase .show-all').click(function() {
		$t = $(this)
		$t.hide()
		$t.parent().parent().find('.tbody-hide').css('display','')
		$t.parent().parent().find('.hide-all').css('display','inline')
		return false;
	});
	$('.b-matchcase .hide-all').click(function() {
		$t = $(this)
		$t.hide()
		$t.parent().parent().find('.tbody-hide').css('display','none')
		$t.parent().parent().find('.show-all').css('display','inline')
		return false;
	});
	rebuildcycle()
	simple_tooltip(".qtip","tooltip");

});

function rebuildcycle() {
	$('#actions-scroll .items').cycle({ 
		prev:   '#actions-scroll .ar-l', 
		next:   '#actions-scroll .ar-r', 
		speed:  'slow',
		timeout: 0,
		sync:1,
		fx: 'blindY'
	});
	$('#we-recommend-scroll .items').cycle({ 
		prev:   '#we-recommend-scroll .ar-l', 
		next:   '#we-recommend-scroll .ar-r', 
		speed:  'slow',
		timeout: 0,
		sync:1,
		fx: 'blindY'
	});
	$('#prizes-scroll .items').cycle({ 
		prev:   '#prizes-scroll .ar-l', 
		next:   '#prizes-scroll .ar-r', 
		speed:  'slow',
		timeout: 0,
		sync:1,
		fx: 'blindY'
	});
}