$(document).ready(function() {
	$('.top ul li:last').css('margin-right','0');
	$('.foot ul li:last').css('margin-right','0');
	$('#menu li:last').css('padding-right','0');
	$('.foot table td:first').css('padding-right','10px');
	$('.data1 td:nth-child(3n)').css('padding-right','0');
	$('.data1 tr:last td').css('border','none');
	$('.data5 td:first-child').css('text-align','left').width('263px');
	$('.data5 td:last-child').css('text-align','left');
	$('.pager table td:last-child').css('background','none');
	$('.qList td:first').width('230px');
	$('.catname:last').css('border','none');
	$('<li style="clear:both"></li>').insertAfter('li:has("input.w202")');
	$('#menu ul li ul li:first-child img').addClass('t10');
	$('.qTabsBlock:first, .fieldBlock:first').css('display','block');	
	$('.tabHolder1:first').css('display','block');	
	$('.tabHolder2:first').css('display','block');
	$('.tabs1:first, .content:first').css('display','block');
	$('#menu ul li:first-child ul').css('left','0');
	$('#menu ul li:last-child ul').css('left','-48px').css('padding-right','0');
	
	
	$('.tl').hover(function() {
	    $('ul',this).css('visibility','visible');
	}, function() {
	    $('ul',this).css('visibility','hidden');
	});
	
	$('.queryBt1').hover(function() {
		$(this).attr({'src':'/bitrix/templates/wt-tophifi/img/bt226-on.jpg'});
	}, function() {
		$(this).attr({'src':'/bitrix/templates/wt-tophifi/img/bt226.jpg'});
	});
	
	$('.tabs1 li:not(.act1)').each(function(index) {
		$(this).hover(function() {
			$(this).css('background','url(/bitrix/templates/wt-tophifi/img/glow.jpg) no-repeat center top');
		}, function() {
			$(this).css('background','none');
		});
	});
	
	$('.tabs2 li:not(.act3), .tabs3 li:not(.act4)').each(function(index) {
		$(this).hover(function() {
			$(this).css('background','url(/bitrix/templates/wt-tophifi/img/glow.jpg) no-repeat center top');
		}, function() {
			$(this).css('background','none');
		});
	});
	
	$('.tabs3:first li').hover(function() {
		$(this).css('background-position','left -2px');									
	}, function() {
		$(this).css('background-position','left -2px');	
	});
	
	
	$('.tabs4 li:not(.act5)').each(function(index) {
		$(this).hover(function() {
			$(this).css('background','url(/bitrix/templates/wt-tophifi/img/glow2.jpg) no-repeat center 64px');
		}, function() {
			$(this).css('background','none');
		});
	});
	
	$('.tabSelector li').each(function(index) {
		$('a',this).bind('click',function() {
			$('.tabs1').css('display','none');	
			$('.tabs1:eq('+(index%3)+')').css('display','block');
			$('.content').css('display','none');	
			$('.content:eq('+index%3+')').css('display','block');

			$('.tabSelector').css('background','url(/bitrix/templates/wt-tophifi/img/bg100-'+index%3+'.jpg) no-repeat bottom')
		});
   });
	
	$('.tabs2 li').each(function(index) {
		$('a',this).bind('click',function() {
			$('.qTabsBlock, .fieldBlock').css('display','none');	
			$('.qTabsBlock').toggleClass('v1');
			$('.qTabsBlock:eq('+(index%2)+'), .fieldBlock:eq('+(index%2)+')').css('display','block');
			var src = $('.qTabsBlock').hasClass('v1') ? '/bitrix/templates/wt-tophifi/img/pic194k.jpg' : '/bitrix/templates/wt-tophifi/img/pic194j.jpg';
			$('.banner2').attr({'src':src});
			return false;
		});
	});
	
	
	$('.tabs3 li').each(function(index) {
		$('a',this).bind('click',function() {
			$('.tabHolder1').css('display','none');	
			$('.tabHolder1:eq('+(index%3)+')').css('display','block');

			$('.tabHolder2').css('display','none');	
			$('.tabHolder2:eq('+(index%3)+')').css('display','block');
			
			$('.block26').css('display','none');	
			$('.block26:eq('+(index%3)+')').css('display','block');
			
			return false;
		});
	});
	
	$('.tabs4 li').each(function(index) {
		$('a',this).bind('click',function() {
			$('.tabHolder2').css('display','none');	
			$('.tabHolder2:eq('+(index%3)+')').css('display','block');
			$('.tabHolder1').css('display','none');	
			$('.tabHolder1:eq('+(index%3)+')').css('display','block');
			
			$('.block26').css('display','none');	
			$('.block26:eq('+(index%3)+')').css('display','block');
			
			//return false;
		});
	});

	
    
	
	$('.top ul li, .foot ul li, .submenu1 li').hover(function() {
		$('<img src="/bitrix/templates/wt-tophifi/img/pic59.png" class="png" alt="" />').prependTo(this);
	}, function() {
		$('img',this).css('display','none');
	});
	
	$('.mainTblBlock h2 a, .triple td h5 a').hover(function() {
		$('img',this).css('visibility','visible');
	}, function() {
		$('img',this).css('visibility','hidden');
	});
	
	
	$('.triple td h5').each(function(index) {
		$(this).addClass('trh'+(index+1));
	});
	
	$('.catlist li h4 img').click(function() {
		if( $(this).parent().prev().attr('checked')==false ) {
			$(this).parent().prev().attr('checked','checked');
			$(this).attr('src','/bitrix/templates/wt-tophifi/img/pic16-on.gif');
		}
		
		else {
			$(this).parent().prev().removeAttr('checked');
			$(this).attr('src','/bitrix/templates/wt-tophifi/img/pic16.gif');
		}
		
		if ( $(this).parent().next().hasClass('vis') ) {
			$(this).parent().next().removeClass('vis');					
		}
		
		else {
			$(this).parent().next().addClass('vis');		
		}
	});
	
	
	$('.further1 img').hover(function() {
		$(this).attr({'src':'/bitrix/templates/wt-tophifi/img/bt185-on.gif'});
	}, function() {
		$(this).attr({'src':'/bitrix/templates/wt-tophifi/img/bt185.gif'});
	});
	
	$('.sbm img').hover(function() {
		$(this).attr({'src':'/bitrix/templates/wt-tophifi/img/bt184-on.gif'});
	}, function() {
		$(this).attr({'src':'/bitrix/templates/wt-tophifi/img/bt184.gif'});
	});
	
	
	$('.catname ul img').click(function() {
		
		if( $(this).prev().attr('checked')==false ) {
			$(this).prev().attr('checked','checked');
			$(this).attr('src','/bitrix/templates/wt-tophifi/img/pic16-on.gif');
		}
		
		else {
			$(this).prev().removeAttr('checked');
			$(this).attr('src','/bitrix/templates/wt-tophifi/img/pic16.gif');
		}
		
	});
	
	
	
	$('#menu ul li ul li').hover(function() {
		$('<img src="/bitrix/templates/wt-tophifi/img/pic59.png" alt="" class="png" />').appendTo(this);
		$('img',this).css('display','block');
		$('#menu ul li ul li:first-child img').addClass('t10');
	}, function() {
		$('img',this).remove();
		$('img',this).css('display','none');
	});
	
	if(navigator.appVersion.indexOf('MSIE 6.0')!=-1) {
	
	$('img').each(function() {
		var picSource = $(this).attr('src');
		if(picSource.indexOf('.png')!= -1 ) {
			$(this).addClass('png');			
			}
		});
	}
});


