function css() {
	
	$.extend($.Autocompleter.defaults, {		
		width: 160,
		selectFirst: false
	});
	autocomplateURL = '/pliki/jquery-autocomplete/demo/search.php';
	
	$('#innerfade-set_nowosc').innerfade({ timeout: 2500 , containerheight: '290px' , speed: 'slow'  });
	$('#innerfade-set_polecamy').innerfade({ timeout: 2500 , containerheight: '320px' , speed: 'slow'  });
	
	$('.list-grow').growRow({	
		i: 1,
		l_add: 'dodaj nowy produkt',
		l_remove: 'usuń'
		
	});

		$('.tab-2>a, .price-question').unbind('click').bind('click',function(e){
			e.preventDefault();
			
			$('#side-tabs form').toggle(1000);
			
		});

			var fjb =  {
				root	: $('#side-tabs'),
				offset : $('#side-tabs').offset(),
				h : $('#top').outerHeight()
			}
				
			fjb.root.css('top', fjb.h);
			
			$(window).scroll(function(e){
				fjb.scroll = $(window).scrollTop();
				
				if(fjb.scroll+fjb.h > fjb.h)
					fjb.root.css('top', (fjb.scroll + fjb.h) );
				else
					fjb.root.css('top', fjb.h );
			
			});		
			
}

$(document).ready(css);

jQuery.fn.clear = function() {
	$(this).focus(function(){ 
		if(!$(this).is('.blur')){
			$(this).addClass('blur');
	
			if($(this).is('textarea'))
				$(this).text(''); 
			else
				$(this).val(''); 
		}
	}); // focus
} // clear
jQuery.fn.growRow = function(option) {
	option = jQuery.extend({
		i: 1, // dodawaj po n wierszy
		l_add: 'dodaj nowy rodzaj pokoju', // etykieta
		l_remove: 'usuń' // etykieta
	}, option);	
	
	
		var list = {
			root : $(this),
			proto: $(this).children('li').eq(0)
		}
		
		list.root.wrap('<div class="mod-grow"></div>');
		list.root.after('<a class="row-add">'+option.l_add+'</a><input type="hidden" name="list_size" id="list_size" value="0" />').find('li').append('<a class="row-remove">'+option.l_remove+'</a>');


		$('.row-add').bind('click',function(){
		
			list.item = list.root.children('li');
			list.size = list.item.size();
			
			list.copy = list.size == 0 ? list.proto : list.item.eq(list.size-1).clone();
			
			list.copy.find('input').each(function(n){
				list.input = $(this);
				list.input.ID = updateAttr(list.input.attr('id'),option.i);
				list.input.Name = updateAttr(list.input.attr('name'),option.i);
				
				
				list.input.val('').attr('name',list.input.Name).attr('id',list.input.ID);
						
				list.copy.appendTo(list.root);
				
				$('#list_size').val(list.size+1);
			});
			remove_row();
		}); // bind add
		
		function updateAttr(attr,i){			
			n = attr.match(/\d+/g); 
			n = parseInt(n);
			n = n+ i;
			return attr.replace(/\d+/g,n);
		}		
		function remove_row(){
			$('.row-remove').unbind().bind('click',function(){	
				$(this).parents('li').remove();
				$('#list_size').val(list.root.children('li').size());
					
			}); // bind remove	
			$('.list-grow').find('input.product').autocomplete(autocomplateURL);
			$('input[type=text], textarea').clear();
		}		
		remove_row();

}
