$(document).ready(function() {
	$('#menu ul .li').hover(
		function(){
			$(this).find('.a').css('color', '#ff7a02');
			$(this).find('.menu_sub').fadeIn('500');
		},
		function(){
			$(this).find('.a').css('color', '#040404');
			$(this).find('.menu_sub').fadeOut('500');
		}
	);

	$('.slider_all').cycle({
		fx:     'cover',
		next:   '#button_next',
		speed:   1000,
		timeout: 10000,
		before:  hide_txt,
		after:   show_txt
	});

    $('.slider_all div').click(function(){
        window.location.href = $(this).attr('rev');
    });

	function hide_txt(x,y){
        $('#info_' + $(x).attr('rel')).hide();
        $('#info_' + $(y).attr('rel')).fadeIn(1000);
//		$(this).find('p').hide();
	}
	function show_txt(){
//		$(this).find('p').fadeIn('fast');
	}



	$('.pop_up_slider').cycle({
		prev:   '.arrow_left',
		next:   '.arrow_right',
		speed:   600,
		timeout: 0
	});


	$('.item a.img').hover(
		function(){
			$(this).css('background', '#65ad28');
			$(this).parent().find('div span.title a').css('textDecoration', 'none');
		},
		function(){
			$(this).css('background', '#ffffff');
			$(this).parent().find('div span.title a').css('textDecoration', 'underline');
		}
	);

	$('.item div span.title a').hover(
		function(){
			$(this).parent().parent().parent().find('a.img').css('background', '#65ad28');
			$(this).css('textDecoration', 'none');
		},
		function(){
			$(this).parent().parent().parent().find('a.img').css('background', '#ffffff');
			$(this).css('textDecoration', 'underline');
		}
	);

	$('div.img_material div').hover(
		function(){
			$(this).find('a').css('display', 'block');
		},
		function(){
			$(this).find('a').css('display', 'none');
		}
	);


	$('#gallery .img').click(function(){
		$('.overlay').css('display', 'block');
		$('#pop_up').css('display', 'block');
		$('#pop_up').css('top', ((document.documentElement.scrollTop || document.body.scrollTop) + 150) + "px");
		$('select').css('visibility', 'hidden');
		return false;
	});
/*
	$('.scheme a').click(function(){
		$('.overlay').css('display', 'block');
		$('#pop_up').css('display', 'block');
		$('#pop_up').css('top', ((document.documentElement.scrollTop || document.body.scrollTop) + 50) + "px");
		$('select').css('visibility', 'hidden');
		return false;
	});
*/
	$('.overlay, .button_close').click(function(){
		$('#pop_up').css('display', 'none');
		$('.overlay').css('display', 'none');
		$('select').css('visibility', 'visible');
		return false;
	});

	$('div.gallery a.img').hover(
		function(){
			$(this).css('background', '#65ad28');
			$(this).parent().find('a.a').css('textDecoration', 'none');
		},
		function(){
			$(this).css('background', '#ffffff');
			$(this).parent().find('a.a').css('textDecoration', 'underline');
		}
	);

	$('div.gallery a.a').hover(
		function(){
			$(this).parent().find('a.img').css('background', '#65ad28');
			$(this).css('textDecoration', 'none');
		},
		function(){
			$(this).parent().find('a.img').css('background', '#ffffff');
			$(this).css('textDecoration', 'underline');
		}
	);


	$('#other_materials').hover(
		function(){
			$(this).find('.other_materials').css('display', 'block');
			$(this).find('.button_other_materials').css('backgroundPosition', '-86px top');
		},
		function(){
			$(this).find('.other_materials').css('display', 'none');
			$(this).find('.button_other_materials').css('backgroundPosition', 'left top');
		}
	);

/*
	$('a.a_select').click(function(){
		if($(this).parent().find('ul').css('display') == ('none')){
			$(this).parent().find('ul').css('display', 'block');
		} else {
			$(this).parent().find('ul').css('display', 'none');
		}
		return false;
	});
*/

	$('i.i_select').mouseover(function(){
		$('a.a_select').parent().find('ul').css('display', 'block');
	});


	$('i.i_select').mouseout(function(){
		$('a.a_select').parent().find('ul').css('display', 'none');
	});

});

