$(document).ready(function(){
						   

	$('.color a:first').addClass('inactive');
	$('.color').each(function(){
		$(this).children('a:first').addClass('inactive');					  
	})
	
	$('a.swap').each(function(){
		$(this).children('img:eq(1)').hide();						  
	})

	if ($.browser.msie) { 
		if ($.browser.version < 7) {
			
		}
		$('.color a').click(function(){
				if ($(this).hasClass('inactive')) {}
				else {
					$(this).parent().children('a').removeClass('inactive');
					//$('.color a').removeClass('inactive');
					color = $(this).attr('class');
					src  =  $('.imgswap img').attr('src');
					src =  src.substring(0,(src.length - 10)) + '_' + color + '.jpg';
					$('.imgswap img').fadeOut(500);
					setTimeout ("$('.imgswap img').attr('src', src)", 500);
					$('.imgswap img').fadeIn(500);
				}
				$(this).addClass('inactive');
				return false;
		});
		
		$('a.swap').toggle(function(){
			$('a.swap img:first').fadeOut(500);	
			setTimeout ("$('a.swap img:eq(1)').fadeIn(500)", 500);
							
									
		}, function(){
			$('a.swap img:eq(1)').fadeOut(500);	
			setTimeout ("$('a.swap img:first').fadeIn(500)", 500);
	
		});
	
	
	}
	
	else {
			$('.color a').click(function(){
			if ($(this).hasClass('inactive')) {}
			else {
				$('.color a').removeClass('inactive');
				color = $(this).attr('class');
				src  =  $('.imgswap img').attr('src');
				src =  src.substring(0,(src.length - 10)) + '_' + color + '.jpg';
				$('.imgswap img').hide("scale", {}, 500);
				setTimeout ("$('.imgswap img').attr('src', src)", 500);
				$('.imgswap img').show("scale", {}, 500);
				
			}
			$(this).addClass('inactive');
			return false;
		});
		
		$('a.swap').toggle(function(){
			$('a.swap img:first').hide("scale", {}, 500);	
			setTimeout ("$('a.swap img:eq(1)').show('scale', {}, 500)", 500);
							
									
			}, function(){
				$('a.swap img:eq(1)').hide("scale", {}, 500);	
				setTimeout ("$('a.swap img:first').show('scale', {}, 500)", 500);
		
		});
	}
	
	
	
	/*$('.color a').click(function(){

		if ($(this).hasClass('inactive')) {}
		else {
			$('.color a').removeClass('inactive');
			color = $(this).attr('class');
			src  =  $('.imgswap img').attr('src');
			src =  src.substring(0,(src.length - 10)) + '_' + color + '.jpg';
			$('.imgswap img').hide("scale", {}, 500);
			setTimeout ("$('.imgswap img').attr('src', src)", 500);
			$('.imgswap img').show("scale", {}, 500);
			
		}
		$(this).addClass('inactive');
		return false;
	});*/
	
	
	
	
	$('#menu li:not(.active) a.f_menu').hover(function(){
		src = $(this).children('img').attr('src');
		src_h = src.substring(0,(src.length - 4)) + '_h.gif';
		$(this).children('img').attr('src', src_h);
	}, function(){
		src = $(this).children('img').attr('src');
		src_h = src.substring(0,(src.length - 6)) + '.gif';
		$(this).children('img').attr('src', src_h);
	
	});
	
	if ($('#accordion').attr('id') == 'accordion' ) {
		
		$('#accordion').accordion({
			active: 'li.active',
			header: 'a.acc',
			alwaysOpen: false,
			autoheight: false
		});
	}
	
	$('#accordion a.acc').click(function(){
			$(this).parent().children('.submenu').children('ul').css('background-position','0% ' + 
																
			($(this).parent().children('.submenu').height()-16) + 'px');									  
	});
	
	if ($('a.facebox').hasClass('facebox')) $('a.facebox').facebox();
	
	$('a.print').click(function(){
		$('#menu, #konkurs, #copy, #cetis, .leftcol a, h1').hide();
		$('.imgswap a').show();
		$('.content, #footer').css('float','left');
		$('#right').css('margin-left','20px').css('clear','both');
		$('.leftcol').append('<a href="'+ window.location +'"><img src="/i/buttons/back.png" alt="Назад" /></a>');
		setTimeout("window.print();", 700);
	
	    return false;
	});
	
	
	
});