$(document).ready(function(){
	$(document).pngFix();

	$('.scroll-text').jScrollPane({
			showArrows:true,
			scrollbarWidth:19,
			dragMaxHeight:43
			});
	$('.SectionElements').jScrollPane({
		showArrows:true,
		scrollbarWidth:19,
		dragMaxHeight:43
	});
	$("a.img").fancybox({
			'overlayShow'					: true,
			'overlayOpacity'			: 0.6,
			'overlayColor'	:'#333',
			'padding'							: '6',
			'zoomSpeedIn'					: 1000,
			'zoomSpeedOut'				: 500,
			'imageScale'					:	true,
			'hideOnContentClick'	: false
	});
	
	$("#main_page_img2").oneTime(5000, function() {
		$("#main_page_img2").fadeIn(1400);
	})


	var index=0;
	$("#SlideCatalog").everyTime(5000, function() {
		if (index<=-($('#SlideCatalog div').length-1)*150) {
			index=0;
		} else {
			index-=150;
		}
		$('#SlideCatalog div:first').css('margin-top',index+'px');
	});
	

	var type = $('#form_dropdown_type');

	type.change(function(e) {
		if ($('#form_dropdown_type option:selected').html()=='Деревянные') {
			location.href = location.toString().substring(0,location.toString().indexOf('?type=')+6)+105;
		} 
												
		if ($('#form_dropdown_type option:selected').html()=='Металлические') {
			location.href = location.toString().substring(0,location.toString().indexOf('?type=')+6)+106;
		}
		if ($('#form_dropdown_type option:selected').html()=='Винтовые') {
			location.href = location.toString().substring(0,location.toString().indexOf('?type=')+6)+107;
		} 
		if ($('#form_dropdown_type option:selected').html()=='На бетонной основе') {
			location.href = location.toString().substring(0,location.toString().indexOf('?type=')+6)+108;
		} 
	});

	$('#form img').hover(function () { 
		$(this).css('border-color','#F58220');}, function () {
			$(this).css('border-color','#999999');} ).click(function () {
				$(this).next().children().attr('checked',1); } );

})
