// JavaScript Document
function setHeight() {
	var height = $(this).height();
	$('#sliderBig').css({ 'height':height });
}
$(document).ready(function(){
	if ($('#slider').length) {
		$('#slider').after('<div id="nav">').cycle({ fx: 'fade', speed: 'slow', timeout: 5000, pager: '#nav' });
	}
	if ($('#sliderBig').length) {
		$('#sliderBig').cycle({ fx: 'none', timeout: 0, pager: '.pager span', prev: '.pager a.bt-prev', next: '.pager a.bt-next', after: setHeight });
	}
	if ($('#carousel').length) {
		$(function(){
			$('#carousel').jCarouselLite({ visible: 3, btnNext: '#carousel a.next', btnPrev: '#carousel a.prev' });
		});
	}
	$('#menuMain a.big').each(function(){
		var index = $('#menuMain a.big').index(this);
		$(this).css({'z-index':6-index});
	});
	$('#menuMain a.big').hover(function(){
			if ($(this).next('div.menuPopup').length) {	$(this).css({'z-index':'9'}); }
			else { $(this).css({'z-index':'7'}); }
		},function(){
			var index = $('#menuMain a.big').index(this);
			$(this).css({'z-index':6-index});
		});
	$('#menuMain a.big').mouseover(function(){
		var index = $('#menuMain a.big').index(this);
		var width = $(this).width() - 5;
		if ($(this).next('div.menuPopup').length) {
			$(this).css({'background-position':'left center','color':'#000'});
		}
		$('div.menuPopup:visible').slideUp('fast',function(){
			$(this).prev('a.big').css({'background-position':'left top','color':'#fff'});
		});
		$(this).next('div.menuPopup').css({'left':(index*width)+'px'});
		$(this).next('div.menuPopup').stop(true,true).slideDown('fast',function(){
			if ( $.browser.msie && $.browser.version=='6.0' ) {
  			} else { $(this).prev('a.big').unbind('mouseleave'); }
		});
	});
	$('div.menuPopup').mouseleave(function(){
		$(this).stop(true,true).slideUp('fast',function(){
			var index = $('#menuMain a.big').index($(this).prev('a.big'));
			$(this).prev('a.big').css({'background-position':'left top','color':'#fff'});
			$(this).prev('a.big').css({'z-index':6-index});
		});
	});
	$('div.menuPopup a').mouseover(function(){
		$(this).parent('div').stop(true,true);
	});
	$('#tabs a.tabTitle').click(function(){
		$(this).next('div.tab').slideDown('fast');
		$(this).siblings().next('div.tab').slideUp('fast');
		return false;
	});
	$('#blockSide .inpHolder input').focus(function(){
		$(this).css({'color':'#454545'});
	});
	$('#carousel div').hover(function(){
		$(this).css({ 'background-color':'#f3fcff' });
	},function(){
		$(this).css({ 'background-color':'#fff' });
	});
});
