/*current = 0;
box = 0;
links = 0;
length = 0;
before = 0;
after = 0;
event = 0;
maxlength = 10;

function nextItems() {
	if (current+maxlength < length) {
		$(links).eq(current).hide();
		$(links).eq(current+maxlength).show();
		current++;
		$('#arrowbefore').css("visibility","visible");
	} 
	if (current+maxlength >= length) {
		window.clearInterval(event);
		$('#arrowafter').css("visibility","hidden");
	}
}
function prevItems() {
	if (current>0) {
		current--;
		$(links).eq(current+maxlength).hide();
		$(links).eq(current).show();
		$('#arrowafter').css("visibility","visible");
	}
	if (current <= 0) {
		window.clearInterval(event);
		$('#arrowbefore').css("visibility","hidden");
	}
}*/
$(document).ready(function() {
	links = $('#jscrollbox').children('a');
	length = $(links).length;
	if (length > 12) {
		$('#jscrollbox').css({'height': 200, 'overflow':'hidden', 'margin-right': 10});
		var $pane = $('#jscrollbox');
		$pane.jScrollPane({scrollbarWidth: 15, showArrows:true, arrowSize: 15});
		/*if ($(links).filter('.activecity').length > 0) {
			var top = $(links).filter('.activecity').eq(0).offset().top-$('#jscrollbox').offset().top;
			alert(top);
		}*/
		$pane[0].scrollTo('.activecity');
	}
	//$('#jscrollbox').jScrollPane();
	/*box = $('#suche-st').children('dd').eq(0);
	links = $(box).children('a');
	length = $(links).length;
	
	if (length > maxlength) {
		var activeindex = -1;
		for (var i = maxlength; i < length; i++) {
			$(links).eq(i).hide();
			if ($(links).eq(i).hasClass('activecity')) {
				activeindex = i;
			}
		}
		
		before = document.createElement('dd');
		$(before).attr("id","arrowbefore");
		//$(before).bind('mouseenter',function() { event = window.setInterval("prevItems();",100); });
		$(before).mousedown(function() { event = window.setInterval("prevItems();",100); });
		$(before).mouseup(function() { window.clearInterval(event); });
		$(before).bind('mouseleave',function() { window.clearInterval(event); });
		$(before).html('<img src="images/3arrowsup.gif" alt="ZUR&Uuml;CK" />');
		$(before).insertBefore(box);
		$('#arrowbefore').css("visibility","hidden");
		
		after = document.createElement('dd');
		$(after).attr("id","arrowafter");
		//$(after).bind('mouseenter',function() { event = window.setInterval("nextItems();",100); });
		$(after).mousedown(function() { event = window.setInterval("nextItems();",100); });
		$(after).mouseup(function() { window.clearInterval(event); });
		$(after).bind('mouseleave',function() { window.clearInterval(event); });
		$(after).html('<img src="images/3arrowsdown.gif" alt="WEITER" />');
		$(after).insertAfter(box);
		
		if (activeindex > -1) {
			while (current < activeindex && current+maxlength < length) {
				nextItems();
			}
		}
		
	}*/
});





