$(document).ready(function () {
	scroll();
	var bw = new browserSort();
	bw.init('.csapat');
});

var browserSort = function(){
	this.selector = null;
	this.init = function(selector){
		this.selector = selector;
		var ez = this;
		$('a.selected', selector).each(function(){
			$(this).click(function(){
				ez.closeAllSelector();
				$(this).parent().addClass('ddActive');
				$(this).next().css('display', 'block');
				$(this).next().css('top', ($(this).next().height())*-1 );
				return false;
			});
		});
		$('div.dropdown li a', selector).each(function(){
			$(this).click(function(){
				$('a.selected', $(this).parent().parent().parent()).html($(this).html());
				$('a.selected', $(this).parent().parent().parent()).attr('rel', $('a.selected', $(this).parent().parent().parent()).attr('id')+'='+$(this).attr('rel'));
				ez.closeAllSelector();
				inBrowser();
				return false;
			});
		});
	};
	this.closeAllSelector = function(){
		$('a.selected',this.selector).parent().removeClass('ddActive');
		$('a.selected',this.selector).next().css('display', 'none');
	};
}

function scroll(){
	if($('.textContainer').length > 0 && $('.textContent2').height()>$('.textContainer').height()){
		$('.textContainer:first').jScrollPane();
	}
}
