$(function () {
	var clearSearchBox = true;
	
	$('#query-sb').click(function() {
		if(clearSearchBox) {
			$(this).attr('value', '');
			clearSearchBox = false;
		}
	});
	
	
        $('#slides').nivoSlider({ animSpeed: 2000, pauseTime: 6000});
	
	$('#our-partners a img').mouseenter(function() {
		var src = $(this).attr('src');
		$(this).attr('src', '/images/layout/color/' + src.substr(20, 100));
	});
	$('#our-partners a img').mouseout(function() {
		var src = $(this).attr('src');
		$(this).attr('src', '/images/layout/gray/' + src.substr(21, 100));
	});
	
	$('.mini').load(function() {
	var float = $(this).css('float');
		$(this).wrap('<div class="mini-container" style="float:' + float + ';"></div>').parent().append('<span class="mini-sign">Powiększ</span>');
	});
	$('.mini').mouseenter(function() {
		$(this).next().fadeIn();
	});
	$('.mini').mouseout(function() {
		$(this).next().fadeOut();
	});
	$('.mini').click(function() {
		var src = $(this).attr('src');
		var image = $('<div id="image-zoom"><img src="/images/upload/' + src.substr(13, 100) + '" /></div>');
		$('#page').prepend(image);
		$('#image-zoom').click(function() {
			$(this).css('display', 'none');
		});
	});
	$('.download-button').click(function() {
		var type = $(this).attr('name');
		if(type == 'redirect') {
			var url = $(this).attr('href');
			$('#filetype').attr('value', url);
			$('#filetype2').attr('value', url);
		} else {
			$('#filetype').attr('value', type);
			$('#filetype2').attr('value', type);
		}
		$('#files-access').fadeIn();
		
		return false;
	});
	$('#files-access #close').click(function() {
		
		$('#files-access').fadeOut();
		return false;
	});
	
		
	
});

